Skip to main content

cdp_driver/methods/
css.rs

1// @generated by `just generate-methods` from protocol/*.json.
2// Do not edit by hand; edit xtask/ and regenerate.
3
4//! This domain exposes CSS read/write operations. All CSS objects
5//! (stylesheets, rules, and styles) have an associated `id` used in
6//! subsequent operations on the related object. Each object type has a
7//! specific `id` structure, and those are not interchangeable between objects
8//! of different kinds. CSS objects can be loaded using the `get*ForNode()`
9//! calls (which accept a DOM node id). A client can also keep track of
10//! stylesheets via the `styleSheetAdded`/`styleSheetRemoved` events and
11//! subsequently load the required stylesheet contents using the
12//! `getStyleSheet\[Text\]()` methods.
13//!
14//! Method names for the `CSS` domain, for use with
15//! [`CdpClient::call`](crate::CdpClient::call).
16//!
17//! This domain is experimental and may change without notice.
18
19/// Inserts a new rule with the given `ruleText` in a stylesheet with given
20/// `styleSheetId`, at the position specified by `location`.
21///
22/// Parameters:
23/// - `styleSheetId`: DOM.StyleSheetId
24/// - `ruleText`: string
25/// - `location`: SourceRange
26/// - `nodeForPropertySyntaxValidation`: DOM.NodeId (optional)
27///
28/// Returns: `rule`
29pub const ADD_RULE: &str = "CSS.addRule";
30
31/// Returns all class names from specified stylesheet.
32///
33/// Parameters:
34/// - `styleSheetId`: DOM.StyleSheetId
35///
36/// Returns: `classNames`
37pub const COLLECT_CLASS_NAMES: &str = "CSS.collectClassNames";
38
39/// Creates a new special "via-inspector" stylesheet in the frame with given
40/// `frameId`.
41///
42/// Parameters:
43/// - `frameId`: Page.FrameId
44/// - `force`: boolean (optional)
45///
46/// Returns: `styleSheetId`
47pub const CREATE_STYLE_SHEET: &str = "CSS.createStyleSheet";
48
49/// Disables the CSS agent for the given page.
50pub const DISABLE: &str = "CSS.disable";
51
52/// Enables the CSS agent for the given page. Clients should not assume that
53/// the CSS agent has been enabled until the result of this command is
54/// received.
55pub const ENABLE: &str = "CSS.enable";
56
57/// Ensures that the given node will have specified pseudo-classes whenever
58/// its style is computed by the browser.
59///
60/// Parameters:
61/// - `nodeId`: DOM.NodeId
62/// - `forcedPseudoClasses`: array
63pub const FORCE_PSEUDO_STATE: &str = "CSS.forcePseudoState";
64
65/// Ensures that the given node is in its starting-style state.
66///
67/// Parameters:
68/// - `nodeId`: DOM.NodeId
69/// - `forced`: boolean
70pub const FORCE_STARTING_STYLE: &str = "CSS.forceStartingStyle";
71
72/// Forces a position-try option for the given node.
73///
74/// Parameters:
75/// - `nodeId`: DOM.NodeId
76/// - `index`: integer (optional)
77pub const FORCE_POSITION_TRY_OPTION: &str = "CSS.forcePositionTryOption";
78
79/// `CSS.getBackgroundColors`
80///
81/// Parameters:
82/// - `nodeId`: DOM.NodeId
83///
84/// Returns: `backgroundColors`, `computedFontSize`, `computedFontWeight`
85pub const GET_BACKGROUND_COLORS: &str = "CSS.getBackgroundColors";
86
87/// Returns the computed style for a DOM node identified by `nodeId`.
88///
89/// Parameters:
90/// - `nodeId`: DOM.NodeId
91///
92/// Returns: `computedStyle`, `extraFields`
93pub const GET_COMPUTED_STYLE_FOR_NODE: &str = "CSS.getComputedStyleForNode";
94
95/// Resolve the specified values in the context of the provided element. For
96/// example, a value of '1em' is evaluated according to the computed
97/// 'font-size' of the element and a value 'calc(1px + 2px)' will be resolved
98/// to '3px'. If the `propertyName` was specified the `values` are resolved as
99/// if they were property's declaration. If a value cannot be parsed according
100/// to the provided property syntax, the value is parsed using combined syntax
101/// as if null `propertyName` was provided. If the value cannot be resolved
102/// even then, return the provided value without any changes. Note: this
103/// function currently does not resolve CSS random() function, it returns
104/// unmodified random() function parts.`
105///
106/// Experimental: may change without notice.
107///
108/// Parameters:
109/// - `values`: array
110/// - `nodeId`: DOM.NodeId
111/// - `propertyName`: string (optional)
112/// - `pseudoType`: DOM.PseudoType (optional)
113/// - `pseudoIdentifier`: string (optional)
114///
115/// Returns: `results`
116pub const RESOLVE_VALUES: &str = "CSS.resolveValues";
117
118/// `CSS.getLonghandProperties`
119///
120/// Experimental: may change without notice.
121///
122/// Parameters:
123/// - `shorthandName`: string
124/// - `value`: string
125///
126/// Returns: `longhandProperties`
127pub const GET_LONGHAND_PROPERTIES: &str = "CSS.getLonghandProperties";
128
129/// Returns the styles defined inline (explicitly in the "style" attribute and
130/// implicitly, using DOM attributes) for a DOM node identified by `nodeId`.
131///
132/// Parameters:
133/// - `nodeId`: DOM.NodeId
134///
135/// Returns: `inlineStyle`, `attributesStyle`
136pub const GET_INLINE_STYLES_FOR_NODE: &str = "CSS.getInlineStylesForNode";
137
138/// Returns the styles coming from animations & transitions including the
139/// animation & transition styles coming from inheritance chain.
140///
141/// Experimental: may change without notice.
142///
143/// Parameters:
144/// - `nodeId`: DOM.NodeId
145///
146/// Returns: `animationStyles`, `transitionsStyle`, `inherited`
147pub const GET_ANIMATED_STYLES_FOR_NODE: &str = "CSS.getAnimatedStylesForNode";
148
149/// Returns requested styles for a DOM node identified by `nodeId`.
150///
151/// Parameters:
152/// - `nodeId`: DOM.NodeId
153///
154/// Returns: `inlineStyle`, `attributesStyle`, `matchedCSSRules`, `pseudoElements`, `inherited`, `inheritedPseudoElements`, `cssKeyframesRules`, `cssPositionTryRules`, `activePositionFallbackIndex`, `cssPropertyRules`, `cssPropertyRegistrations`, `cssAtRules`, `parentLayoutNodeId`, `cssFunctionRules`
155pub const GET_MATCHED_STYLES_FOR_NODE: &str = "CSS.getMatchedStylesForNode";
156
157/// Returns the values of the default UA-defined environment variables used in
158/// env()
159///
160/// Experimental: may change without notice.
161///
162/// Returns: `environmentVariables`
163pub const GET_ENVIRONMENT_VARIABLES: &str = "CSS.getEnvironmentVariables";
164
165/// Returns all media queries parsed by the rendering engine.
166///
167/// Returns: `medias`
168pub const GET_MEDIA_QUERIES: &str = "CSS.getMediaQueries";
169
170/// Requests information about platform fonts which we used to render child
171/// TextNodes in the given node.
172///
173/// Parameters:
174/// - `nodeId`: DOM.NodeId
175///
176/// Returns: `fonts`
177pub const GET_PLATFORM_FONTS_FOR_NODE: &str = "CSS.getPlatformFontsForNode";
178
179/// Returns the current textual content for a stylesheet.
180///
181/// Parameters:
182/// - `styleSheetId`: DOM.StyleSheetId
183///
184/// Returns: `text`
185pub const GET_STYLE_SHEET_TEXT: &str = "CSS.getStyleSheetText";
186
187/// Returns all layers parsed by the rendering engine for the tree scope of a
188/// node. Given a DOM element identified by nodeId, getLayersForNode returns
189/// the root layer for the nearest ancestor document or shadow root. The layer
190/// root contains the full layer tree for the tree scope and their ordering.
191///
192/// Experimental: may change without notice.
193///
194/// Parameters:
195/// - `nodeId`: DOM.NodeId
196///
197/// Returns: `rootLayer`
198pub const GET_LAYERS_FOR_NODE: &str = "CSS.getLayersForNode";
199
200/// Given a CSS selector text and a style sheet ID, getLocationForSelector
201/// returns an array of locations of the CSS selector in the style sheet.
202///
203/// Experimental: may change without notice.
204///
205/// Parameters:
206/// - `styleSheetId`: DOM.StyleSheetId
207/// - `selectorText`: string
208///
209/// Returns: `ranges`
210pub const GET_LOCATION_FOR_SELECTOR: &str = "CSS.getLocationForSelector";
211
212/// Starts tracking the given node for the computed style updates and whenever
213/// the computed style is updated for node, it queues a `computedStyleUpdated`
214/// event with throttling. There can only be 1 node tracked for computed style
215/// updates so passing a new node id removes tracking from the previous node.
216/// Pass `undefined` to disable tracking.
217///
218/// Experimental: may change without notice.
219///
220/// Parameters:
221/// - `nodeId`: DOM.NodeId (optional)
222pub const TRACK_COMPUTED_STYLE_UPDATES_FOR_NODE: &str = "CSS.trackComputedStyleUpdatesForNode";
223
224/// Starts tracking the given computed styles for updates. The specified array
225/// of properties replaces the one previously specified. Pass empty array to
226/// disable tracking. Use takeComputedStyleUpdates to retrieve the list of
227/// nodes that had properties modified. The changes to computed style
228/// properties are only tracked for nodes pushed to the front-end by the DOM
229/// agent. If no changes to the tracked properties occur after the node has
230/// been pushed to the front-end, no updates will be issued for the node.
231///
232/// Experimental: may change without notice.
233///
234/// Parameters:
235/// - `propertiesToTrack`: array
236pub const TRACK_COMPUTED_STYLE_UPDATES: &str = "CSS.trackComputedStyleUpdates";
237
238/// Polls the next batch of computed style updates.
239///
240/// Experimental: may change without notice.
241///
242/// Returns: `nodeIds`
243pub const TAKE_COMPUTED_STYLE_UPDATES: &str = "CSS.takeComputedStyleUpdates";
244
245/// Find a rule with the given active property for the given node and set the
246/// new value for this property
247///
248/// Parameters:
249/// - `nodeId`: DOM.NodeId
250/// - `propertyName`: string
251/// - `value`: string
252pub const SET_EFFECTIVE_PROPERTY_VALUE_FOR_NODE: &str = "CSS.setEffectivePropertyValueForNode";
253
254/// Modifies the property rule property name.
255///
256/// Parameters:
257/// - `styleSheetId`: DOM.StyleSheetId
258/// - `range`: SourceRange
259/// - `propertyName`: string
260///
261/// Returns: `propertyName`
262pub const SET_PROPERTY_RULE_PROPERTY_NAME: &str = "CSS.setPropertyRulePropertyName";
263
264/// Modifies the keyframe rule key text.
265///
266/// Parameters:
267/// - `styleSheetId`: DOM.StyleSheetId
268/// - `range`: SourceRange
269/// - `keyText`: string
270///
271/// Returns: `keyText`
272pub const SET_KEYFRAME_KEY: &str = "CSS.setKeyframeKey";
273
274/// Modifies the rule selector.
275///
276/// Parameters:
277/// - `styleSheetId`: DOM.StyleSheetId
278/// - `range`: SourceRange
279/// - `text`: string
280///
281/// Returns: `media`
282pub const SET_MEDIA_TEXT: &str = "CSS.setMediaText";
283
284/// Modifies the expression of a container query. Deprecated. Use
285/// setContainerQueryConditionText instead.
286///
287/// Deprecated in the protocol.
288/// Experimental: may change without notice.
289///
290/// Parameters:
291/// - `styleSheetId`: DOM.StyleSheetId
292/// - `range`: SourceRange
293/// - `text`: string
294///
295/// Returns: `containerQuery`
296pub const SET_CONTAINER_QUERY_TEXT: &str = "CSS.setContainerQueryText";
297
298/// `CSS.setContainerQueryConditionText`
299///
300/// Experimental: may change without notice.
301///
302/// Parameters:
303/// - `styleSheetId`: DOM.StyleSheetId
304/// - `range`: SourceRange
305/// - `text`: string
306///
307/// Returns: `containerQuery`
308pub const SET_CONTAINER_QUERY_CONDITION_TEXT: &str = "CSS.setContainerQueryConditionText";
309
310/// Modifies the expression of a supports at-rule.
311///
312/// Experimental: may change without notice.
313///
314/// Parameters:
315/// - `styleSheetId`: DOM.StyleSheetId
316/// - `range`: SourceRange
317/// - `text`: string
318///
319/// Returns: `supports`
320pub const SET_SUPPORTS_TEXT: &str = "CSS.setSupportsText";
321
322/// Modifies the expression of a navigation at-rule.
323///
324/// Experimental: may change without notice.
325///
326/// Parameters:
327/// - `styleSheetId`: DOM.StyleSheetId
328/// - `range`: SourceRange
329/// - `text`: string
330///
331/// Returns: `navigation`
332pub const SET_NAVIGATION_TEXT: &str = "CSS.setNavigationText";
333
334/// Modifies the expression of a scope at-rule.
335///
336/// Experimental: may change without notice.
337///
338/// Parameters:
339/// - `styleSheetId`: DOM.StyleSheetId
340/// - `range`: SourceRange
341/// - `text`: string
342///
343/// Returns: `scope`
344pub const SET_SCOPE_TEXT: &str = "CSS.setScopeText";
345
346/// Modifies the rule selector.
347///
348/// Parameters:
349/// - `styleSheetId`: DOM.StyleSheetId
350/// - `range`: SourceRange
351/// - `selector`: string
352///
353/// Returns: `selectorList`
354pub const SET_RULE_SELECTOR: &str = "CSS.setRuleSelector";
355
356/// Sets the new stylesheet text.
357///
358/// Parameters:
359/// - `styleSheetId`: DOM.StyleSheetId
360/// - `text`: string
361///
362/// Returns: `sourceMapURL`
363pub const SET_STYLE_SHEET_TEXT: &str = "CSS.setStyleSheetText";
364
365/// Applies specified style edits one after another in the given order.
366///
367/// Parameters:
368/// - `edits`: array
369/// - `nodeForPropertySyntaxValidation`: DOM.NodeId (optional)
370///
371/// Returns: `styles`
372pub const SET_STYLE_TEXTS: &str = "CSS.setStyleTexts";
373
374/// Enables the selector recording.
375pub const START_RULE_USAGE_TRACKING: &str = "CSS.startRuleUsageTracking";
376
377/// Stop tracking rule usage and return the list of rules that were used since
378/// last call to `takeCoverageDelta` (or since start of coverage
379/// instrumentation).
380///
381/// Returns: `ruleUsage`
382pub const STOP_RULE_USAGE_TRACKING: &str = "CSS.stopRuleUsageTracking";
383
384/// Obtain list of rules that became used since last call to this method (or
385/// since start of coverage instrumentation).
386///
387/// Returns: `coverage`, `timestamp`
388pub const TAKE_COVERAGE_DELTA: &str = "CSS.takeCoverageDelta";
389
390/// Enables/disables rendering of local CSS fonts (enabled by default).
391///
392/// Experimental: may change without notice.
393///
394/// Parameters:
395/// - `enabled`: boolean
396pub const SET_LOCAL_FONTS_ENABLED: &str = "CSS.setLocalFontsEnabled";