cdp-driver 0.3.0

Chrome DevTools Protocol client for AI agent browser control
Documentation
// @generated by `just generate-methods` from protocol/*.json.
// Do not edit by hand; edit xtask/ and regenerate.

//! This domain exposes CSS read/write operations. All CSS objects
//! (stylesheets, rules, and styles) have an associated `id` used in
//! subsequent operations on the related object. Each object type has a
//! specific `id` structure, and those are not interchangeable between objects
//! of different kinds. CSS objects can be loaded using the `get*ForNode()`
//! calls (which accept a DOM node id). A client can also keep track of
//! stylesheets via the `styleSheetAdded`/`styleSheetRemoved` events and
//! subsequently load the required stylesheet contents using the
//! `getStyleSheet\[Text\]()` methods.
//!
//! Method names for the `CSS` domain, for use with
//! [`CdpClient::call`](crate::CdpClient::call).
//!
//! This domain is experimental and may change without notice.

/// Inserts a new rule with the given `ruleText` in a stylesheet with given
/// `styleSheetId`, at the position specified by `location`.
///
/// Parameters:
/// - `styleSheetId`: DOM.StyleSheetId
/// - `ruleText`: string
/// - `location`: SourceRange
/// - `nodeForPropertySyntaxValidation`: DOM.NodeId (optional)
///
/// Returns: `rule`
pub const ADD_RULE: &str = "CSS.addRule";

/// Returns all class names from specified stylesheet.
///
/// Parameters:
/// - `styleSheetId`: DOM.StyleSheetId
///
/// Returns: `classNames`
pub const COLLECT_CLASS_NAMES: &str = "CSS.collectClassNames";

/// Creates a new special "via-inspector" stylesheet in the frame with given
/// `frameId`.
///
/// Parameters:
/// - `frameId`: Page.FrameId
/// - `force`: boolean (optional)
///
/// Returns: `styleSheetId`
pub const CREATE_STYLE_SHEET: &str = "CSS.createStyleSheet";

/// Disables the CSS agent for the given page.
pub const DISABLE: &str = "CSS.disable";

/// 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.
pub const ENABLE: &str = "CSS.enable";

/// Ensures that the given node will have specified pseudo-classes whenever
/// its style is computed by the browser.
///
/// Parameters:
/// - `nodeId`: DOM.NodeId
/// - `forcedPseudoClasses`: array
pub const FORCE_PSEUDO_STATE: &str = "CSS.forcePseudoState";

/// Ensures that the given node is in its starting-style state.
///
/// Parameters:
/// - `nodeId`: DOM.NodeId
/// - `forced`: boolean
pub const FORCE_STARTING_STYLE: &str = "CSS.forceStartingStyle";

/// `CSS.getBackgroundColors`
///
/// Parameters:
/// - `nodeId`: DOM.NodeId
///
/// Returns: `backgroundColors`, `computedFontSize`, `computedFontWeight`
pub const GET_BACKGROUND_COLORS: &str = "CSS.getBackgroundColors";

/// Returns the computed style for a DOM node identified by `nodeId`.
///
/// Parameters:
/// - `nodeId`: DOM.NodeId
///
/// Returns: `computedStyle`, `extraFields`
pub const GET_COMPUTED_STYLE_FOR_NODE: &str = "CSS.getComputedStyleForNode";

/// 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. Note: this
/// function currently does not resolve CSS random() function, it returns
/// unmodified random() function parts.`
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `values`: array
/// - `nodeId`: DOM.NodeId
/// - `propertyName`: string (optional)
/// - `pseudoType`: DOM.PseudoType (optional)
/// - `pseudoIdentifier`: string (optional)
///
/// Returns: `results`
pub const RESOLVE_VALUES: &str = "CSS.resolveValues";

/// `CSS.getLonghandProperties`
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `shorthandName`: string
/// - `value`: string
///
/// Returns: `longhandProperties`
pub const GET_LONGHAND_PROPERTIES: &str = "CSS.getLonghandProperties";

/// Returns the styles defined inline (explicitly in the "style" attribute and
/// implicitly, using DOM attributes) for a DOM node identified by `nodeId`.
///
/// Parameters:
/// - `nodeId`: DOM.NodeId
///
/// Returns: `inlineStyle`, `attributesStyle`
pub const GET_INLINE_STYLES_FOR_NODE: &str = "CSS.getInlineStylesForNode";

/// Returns the styles coming from animations & transitions including the
/// animation & transition styles coming from inheritance chain.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `nodeId`: DOM.NodeId
///
/// Returns: `animationStyles`, `transitionsStyle`, `inherited`
pub const GET_ANIMATED_STYLES_FOR_NODE: &str = "CSS.getAnimatedStylesForNode";

/// Returns requested styles for a DOM node identified by `nodeId`.
///
/// Parameters:
/// - `nodeId`: DOM.NodeId
///
/// Returns: `inlineStyle`, `attributesStyle`, `matchedCSSRules`, `pseudoElements`, `inherited`, `inheritedPseudoElements`, `cssKeyframesRules`, `cssPositionTryRules`, `activePositionFallbackIndex`, `cssPropertyRules`, `cssPropertyRegistrations`, `cssAtRules`, `parentLayoutNodeId`, `cssFunctionRules`
pub const GET_MATCHED_STYLES_FOR_NODE: &str = "CSS.getMatchedStylesForNode";

/// Returns the values of the default UA-defined environment variables used in
/// env()
///
/// Experimental: may change without notice.
///
/// Returns: `environmentVariables`
pub const GET_ENVIRONMENT_VARIABLES: &str = "CSS.getEnvironmentVariables";

/// Returns all media queries parsed by the rendering engine.
///
/// Returns: `medias`
pub const GET_MEDIA_QUERIES: &str = "CSS.getMediaQueries";

/// Requests information about platform fonts which we used to render child
/// TextNodes in the given node.
///
/// Parameters:
/// - `nodeId`: DOM.NodeId
///
/// Returns: `fonts`
pub const GET_PLATFORM_FONTS_FOR_NODE: &str = "CSS.getPlatformFontsForNode";

/// Returns the current textual content for a stylesheet.
///
/// Parameters:
/// - `styleSheetId`: DOM.StyleSheetId
///
/// Returns: `text`
pub const GET_STYLE_SHEET_TEXT: &str = "CSS.getStyleSheetText";

/// 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.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `nodeId`: DOM.NodeId
///
/// Returns: `rootLayer`
pub const GET_LAYERS_FOR_NODE: &str = "CSS.getLayersForNode";

/// Given a CSS selector text and a style sheet ID, getLocationForSelector
/// returns an array of locations of the CSS selector in the style sheet.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `styleSheetId`: DOM.StyleSheetId
/// - `selectorText`: string
///
/// Returns: `ranges`
pub const GET_LOCATION_FOR_SELECTOR: &str = "CSS.getLocationForSelector";

/// 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.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `nodeId`: DOM.NodeId (optional)
pub const TRACK_COMPUTED_STYLE_UPDATES_FOR_NODE: &str = "CSS.trackComputedStyleUpdatesForNode";

/// 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.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `propertiesToTrack`: array
pub const TRACK_COMPUTED_STYLE_UPDATES: &str = "CSS.trackComputedStyleUpdates";

/// Polls the next batch of computed style updates.
///
/// Experimental: may change without notice.
///
/// Returns: `nodeIds`
pub const TAKE_COMPUTED_STYLE_UPDATES: &str = "CSS.takeComputedStyleUpdates";

/// Find a rule with the given active property for the given node and set the
/// new value for this property
///
/// Parameters:
/// - `nodeId`: DOM.NodeId
/// - `propertyName`: string
/// - `value`: string
pub const SET_EFFECTIVE_PROPERTY_VALUE_FOR_NODE: &str = "CSS.setEffectivePropertyValueForNode";

/// Modifies the property rule property name.
///
/// Parameters:
/// - `styleSheetId`: DOM.StyleSheetId
/// - `range`: SourceRange
/// - `propertyName`: string
///
/// Returns: `propertyName`
pub const SET_PROPERTY_RULE_PROPERTY_NAME: &str = "CSS.setPropertyRulePropertyName";

/// Modifies the keyframe rule key text.
///
/// Parameters:
/// - `styleSheetId`: DOM.StyleSheetId
/// - `range`: SourceRange
/// - `keyText`: string
///
/// Returns: `keyText`
pub const SET_KEYFRAME_KEY: &str = "CSS.setKeyframeKey";

/// Modifies the rule selector.
///
/// Parameters:
/// - `styleSheetId`: DOM.StyleSheetId
/// - `range`: SourceRange
/// - `text`: string
///
/// Returns: `media`
pub const SET_MEDIA_TEXT: &str = "CSS.setMediaText";

/// Modifies the expression of a container query. Deprecated. Use
/// setContainerQueryConditionText instead.
///
/// Deprecated in the protocol.
/// Experimental: may change without notice.
///
/// Parameters:
/// - `styleSheetId`: DOM.StyleSheetId
/// - `range`: SourceRange
/// - `text`: string
///
/// Returns: `containerQuery`
pub const SET_CONTAINER_QUERY_TEXT: &str = "CSS.setContainerQueryText";

/// `CSS.setContainerQueryConditionText`
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `styleSheetId`: DOM.StyleSheetId
/// - `range`: SourceRange
/// - `text`: string
///
/// Returns: `containerQuery`
pub const SET_CONTAINER_QUERY_CONDITION_TEXT: &str = "CSS.setContainerQueryConditionText";

/// Modifies the expression of a supports at-rule.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `styleSheetId`: DOM.StyleSheetId
/// - `range`: SourceRange
/// - `text`: string
///
/// Returns: `supports`
pub const SET_SUPPORTS_TEXT: &str = "CSS.setSupportsText";

/// Modifies the expression of a navigation at-rule.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `styleSheetId`: DOM.StyleSheetId
/// - `range`: SourceRange
/// - `text`: string
///
/// Returns: `navigation`
pub const SET_NAVIGATION_TEXT: &str = "CSS.setNavigationText";

/// Modifies the expression of a scope at-rule.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `styleSheetId`: DOM.StyleSheetId
/// - `range`: SourceRange
/// - `text`: string
///
/// Returns: `scope`
pub const SET_SCOPE_TEXT: &str = "CSS.setScopeText";

/// Modifies the rule selector.
///
/// Parameters:
/// - `styleSheetId`: DOM.StyleSheetId
/// - `range`: SourceRange
/// - `selector`: string
///
/// Returns: `selectorList`
pub const SET_RULE_SELECTOR: &str = "CSS.setRuleSelector";

/// Sets the new stylesheet text.
///
/// Parameters:
/// - `styleSheetId`: DOM.StyleSheetId
/// - `text`: string
///
/// Returns: `sourceMapURL`
pub const SET_STYLE_SHEET_TEXT: &str = "CSS.setStyleSheetText";

/// Applies specified style edits one after another in the given order.
///
/// Parameters:
/// - `edits`: array
/// - `nodeForPropertySyntaxValidation`: DOM.NodeId (optional)
///
/// Returns: `styles`
pub const SET_STYLE_TEXTS: &str = "CSS.setStyleTexts";

/// Enables the selector recording.
pub const START_RULE_USAGE_TRACKING: &str = "CSS.startRuleUsageTracking";

/// Stop tracking rule usage and return the list of rules that were used since
/// last call to `takeCoverageDelta` (or since start of coverage
/// instrumentation).
///
/// Returns: `ruleUsage`
pub const STOP_RULE_USAGE_TRACKING: &str = "CSS.stopRuleUsageTracking";

/// Obtain list of rules that became used since last call to this method (or
/// since start of coverage instrumentation).
///
/// Returns: `coverage`, `timestamp`
pub const TAKE_COVERAGE_DELTA: &str = "CSS.takeCoverageDelta";

/// Enables/disables rendering of local CSS fonts (enabled by default).
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `enabled`: boolean
pub const SET_LOCAL_FONTS_ENABLED: &str = "CSS.setLocalFontsEnabled";