Skip to main content

CSSClient

Struct CSSClient 

Source
pub struct CSSClient { /* private fields */ }
Expand description

Client for CSS domain commands.

Implementations§

Source§

impl CSSClient

Source

pub async fn add_rule( &self, params: AddRuleParams, session_id: Option<&str>, ) -> Result<AddRuleReturns, CdpError>

Inserts a new rule with the given ruleText in a stylesheet with given styleSheetId, at the position specified by location.

Source

pub async fn collect_class_names( &self, params: CollectClassNamesParams, session_id: Option<&str>, ) -> Result<CollectClassNamesReturns, CdpError>

Returns all class names from specified stylesheet.

Source

pub async fn create_style_sheet( &self, params: CreateStyleSheetParams, session_id: Option<&str>, ) -> Result<CreateStyleSheetReturns, CdpError>

Creates a new special “via-inspector” stylesheet in the frame with given frameId.

Source

pub async fn disable(&self, session_id: Option<&str>) -> Result<Value, CdpError>

Disables the CSS agent for the given page.

Source

pub async fn enable(&self, session_id: Option<&str>) -> Result<Value, CdpError>

Enables the CSS agent for the given page. Clients should not assume that the CSS agent has been enabled until the result of this command is received.

Source

pub async fn force_pseudo_state( &self, params: ForcePseudoStateParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser.

Source

pub async fn force_starting_style( &self, params: ForceStartingStyleParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

Ensures that the given node is in its starting-style state.

Source

pub async fn get_background_colors( &self, params: GetBackgroundColorsParams, session_id: Option<&str>, ) -> Result<GetBackgroundColorsReturns, CdpError>

Source

pub async fn get_computed_style_for_node( &self, params: GetComputedStyleForNodeParams, session_id: Option<&str>, ) -> Result<GetComputedStyleForNodeReturns, CdpError>

Returns the computed style for a DOM node identified by nodeId.

Source

pub async fn resolve_values( &self, params: ResolveValuesParams, session_id: Option<&str>, ) -> Result<ResolveValuesReturns, CdpError>

Resolve the specified values in the context of the provided element. For example, a value of ‘1em’ is evaluated according to the computed ‘font-size’ of the element and a value ‘calc(1px + 2px)’ will be resolved to ‘3px’. If the propertyName was specified the values are resolved as if they were property’s declaration. If a value cannot be parsed according to the provided property syntax, the value is parsed using combined syntax as if null propertyName was provided. If the value cannot be resolved even then, return the provided value without any changes.

Source

pub async fn get_longhand_properties( &self, params: GetLonghandPropertiesParams, session_id: Option<&str>, ) -> Result<GetLonghandPropertiesReturns, CdpError>

Source

pub async fn get_inline_styles_for_node( &self, params: GetInlineStylesForNodeParams, session_id: Option<&str>, ) -> Result<GetInlineStylesForNodeReturns, CdpError>

Returns the styles defined inline (explicitly in the “style” attribute and implicitly, using DOM attributes) for a DOM node identified by nodeId.

Source

pub async fn get_animated_styles_for_node( &self, params: GetAnimatedStylesForNodeParams, session_id: Option<&str>, ) -> Result<GetAnimatedStylesForNodeReturns, CdpError>

Returns the styles coming from animations & transitions including the animation & transition styles coming from inheritance chain.

Source

pub async fn get_matched_styles_for_node( &self, params: GetMatchedStylesForNodeParams, session_id: Option<&str>, ) -> Result<GetMatchedStylesForNodeReturns, CdpError>

Returns requested styles for a DOM node identified by nodeId.

Source

pub async fn get_environment_variables( &self, session_id: Option<&str>, ) -> Result<GetEnvironmentVariablesReturns, CdpError>

Returns the values of the default UA-defined environment variables used in env()

Source

pub async fn get_media_queries( &self, session_id: Option<&str>, ) -> Result<GetMediaQueriesReturns, CdpError>

Returns all media queries parsed by the rendering engine.

Source

pub async fn get_platform_fonts_for_node( &self, params: GetPlatformFontsForNodeParams, session_id: Option<&str>, ) -> Result<GetPlatformFontsForNodeReturns, CdpError>

Requests information about platform fonts which we used to render child TextNodes in the given node.

Source

pub async fn get_style_sheet_text( &self, params: GetStyleSheetTextParams, session_id: Option<&str>, ) -> Result<GetStyleSheetTextReturns, CdpError>

Returns the current textual content for a stylesheet.

Source

pub async fn get_layers_for_node( &self, params: GetLayersForNodeParams, session_id: Option<&str>, ) -> Result<GetLayersForNodeReturns, CdpError>

Returns all layers parsed by the rendering engine for the tree scope of a node. Given a DOM element identified by nodeId, getLayersForNode returns the root layer for the nearest ancestor document or shadow root. The layer root contains the full layer tree for the tree scope and their ordering.

Source

pub async fn get_location_for_selector( &self, params: GetLocationForSelectorParams, session_id: Option<&str>, ) -> Result<GetLocationForSelectorReturns, CdpError>

Given a CSS selector text and a style sheet ID, getLocationForSelector returns an array of locations of the CSS selector in the style sheet.

Source

pub async fn track_computed_style_updates_for_node( &self, params: TrackComputedStyleUpdatesForNodeParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

Starts tracking the given node for the computed style updates and whenever the computed style is updated for node, it queues a computedStyleUpdated event with throttling. There can only be 1 node tracked for computed style updates so passing a new node id removes tracking from the previous node. Pass undefined to disable tracking.

Source

pub async fn track_computed_style_updates( &self, params: TrackComputedStyleUpdatesParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

Starts tracking the given computed styles for updates. The specified array of properties replaces the one previously specified. Pass empty array to disable tracking. Use takeComputedStyleUpdates to retrieve the list of nodes that had properties modified. The changes to computed style properties are only tracked for nodes pushed to the front-end by the DOM agent. If no changes to the tracked properties occur after the node has been pushed to the front-end, no updates will be issued for the node.

Source

pub async fn take_computed_style_updates( &self, session_id: Option<&str>, ) -> Result<TakeComputedStyleUpdatesReturns, CdpError>

Polls the next batch of computed style updates.

Source

pub async fn set_effective_property_value_for_node( &self, params: SetEffectivePropertyValueForNodeParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

Find a rule with the given active property for the given node and set the new value for this property

Source

pub async fn set_property_rule_property_name( &self, params: SetPropertyRulePropertyNameParams, session_id: Option<&str>, ) -> Result<SetPropertyRulePropertyNameReturns, CdpError>

Modifies the property rule property name.

Source

pub async fn set_keyframe_key( &self, params: SetKeyframeKeyParams, session_id: Option<&str>, ) -> Result<SetKeyframeKeyReturns, CdpError>

Modifies the keyframe rule key text.

Source

pub async fn set_media_text( &self, params: SetMediaTextParams, session_id: Option<&str>, ) -> Result<SetMediaTextReturns, CdpError>

Modifies the rule selector.

Source

pub async fn set_container_query_text( &self, params: SetContainerQueryTextParams, session_id: Option<&str>, ) -> Result<SetContainerQueryTextReturns, CdpError>

Modifies the expression of a container query.

Source

pub async fn set_supports_text( &self, params: SetSupportsTextParams, session_id: Option<&str>, ) -> Result<SetSupportsTextReturns, CdpError>

Modifies the expression of a supports at-rule.

Source

pub async fn set_scope_text( &self, params: SetScopeTextParams, session_id: Option<&str>, ) -> Result<SetScopeTextReturns, CdpError>

Modifies the expression of a scope at-rule.

Source

pub async fn set_rule_selector( &self, params: SetRuleSelectorParams, session_id: Option<&str>, ) -> Result<SetRuleSelectorReturns, CdpError>

Modifies the rule selector.

Source

pub async fn set_style_sheet_text( &self, params: SetStyleSheetTextParams, session_id: Option<&str>, ) -> Result<SetStyleSheetTextReturns, CdpError>

Sets the new stylesheet text.

Source

pub async fn set_style_texts( &self, params: SetStyleTextsParams, session_id: Option<&str>, ) -> Result<SetStyleTextsReturns, CdpError>

Applies specified style edits one after another in the given order.

Source

pub async fn start_rule_usage_tracking( &self, session_id: Option<&str>, ) -> Result<Value, CdpError>

Enables the selector recording.

Source

pub async fn stop_rule_usage_tracking( &self, session_id: Option<&str>, ) -> Result<StopRuleUsageTrackingReturns, CdpError>

Stop tracking rule usage and return the list of rules that were used since last call to takeCoverageDelta (or since start of coverage instrumentation).

Source

pub async fn take_coverage_delta( &self, session_id: Option<&str>, ) -> Result<TakeCoverageDeltaReturns, CdpError>

Obtain list of rules that became used since last call to this method (or since start of coverage instrumentation).

Source

pub async fn set_local_fonts_enabled( &self, params: SetLocalFontsEnabledParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

Enables/disables rendering of local CSS fonts (enabled by default).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more