Skip to main content

browser_protocol/css/
mod.rs

1//! This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles)
2//! have an associated 'id' used in subsequent operations on the related object. Each object type has
3//! a specific 'id' structure, and those are not interchangeable between objects of different kinds.
4//! CSS objects can be loaded using the 'get*ForNode()' calls (which accept a DOM node id). A client
5//! can also keep track of stylesheets via the 'styleSheetAdded'/'styleSheetRemoved' events and
6//! subsequently load the required stylesheet contents using the 'getStyleSheet[Text]()' methods.
7use serde::{Serialize, Deserialize};
8use serde_json::Value as JsonValue;
9
10/// Stylesheet type: "injected" for stylesheets injected via extension, "user-agent" for user-agent
11/// stylesheets, "inspector" for stylesheets created by the inspector (i.e. those holding the "via
12/// inspector" rules), "regular" for regular stylesheets.
13
14#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
15pub enum StyleSheetOrigin {
16    #[default]
17    Injected,
18    UserAgent,
19    Inspector,
20    Regular,
21}
22
23/// CSS rule collection for a single pseudo style.
24
25#[derive(Debug, Clone, Serialize, Deserialize, Default)]
26#[serde(rename_all = "camelCase")]
27pub struct PseudoElementMatches {
28    /// Pseudo element type.
29
30    pub pseudoType: crate::dom::PseudoType,
31    /// Pseudo element custom ident.
32
33    #[serde(skip_serializing_if = "Option::is_none")]
34    pub pseudoIdentifier: Option<String>,
35    /// Matches of CSS rules applicable to the pseudo style.
36
37    pub matches: Vec<RuleMatch>,
38}
39
40/// CSS style coming from animations with the name of the animation.
41
42#[derive(Debug, Clone, Serialize, Deserialize, Default)]
43#[serde(rename_all = "camelCase")]
44pub struct CSSAnimationStyle {
45    /// The name of the animation.
46
47    #[serde(skip_serializing_if = "Option::is_none")]
48    pub name: Option<String>,
49    /// The style coming from the animation.
50
51    pub style: CSSStyle,
52}
53
54/// Inherited CSS rule collection from ancestor node.
55
56#[derive(Debug, Clone, Serialize, Deserialize, Default)]
57#[serde(rename_all = "camelCase")]
58pub struct InheritedStyleEntry {
59    /// The ancestor node's inline style, if any, in the style inheritance chain.
60
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub inlineStyle: Option<CSSStyle>,
63    /// Matches of CSS rules matching the ancestor node in the style inheritance chain.
64
65    pub matchedCSSRules: Vec<RuleMatch>,
66}
67
68/// Inherited CSS style collection for animated styles from ancestor node.
69
70#[derive(Debug, Clone, Serialize, Deserialize, Default)]
71#[serde(rename_all = "camelCase")]
72pub struct InheritedAnimatedStyleEntry {
73    /// Styles coming from the animations of the ancestor, if any, in the style inheritance chain.
74
75    #[serde(skip_serializing_if = "Option::is_none")]
76    pub animationStyles: Option<Vec<CSSAnimationStyle>>,
77    /// The style coming from the transitions of the ancestor, if any, in the style inheritance chain.
78
79    #[serde(skip_serializing_if = "Option::is_none")]
80    pub transitionsStyle: Option<CSSStyle>,
81}
82
83/// Inherited pseudo element matches from pseudos of an ancestor node.
84
85#[derive(Debug, Clone, Serialize, Deserialize, Default)]
86#[serde(rename_all = "camelCase")]
87pub struct InheritedPseudoElementMatches {
88    /// Matches of pseudo styles from the pseudos of an ancestor node.
89
90    pub pseudoElements: Vec<PseudoElementMatches>,
91}
92
93/// Match data for a CSS rule.
94
95#[derive(Debug, Clone, Serialize, Deserialize, Default)]
96#[serde(rename_all = "camelCase")]
97pub struct RuleMatch {
98    /// CSS rule in the match.
99
100    pub rule: CSSRule,
101    /// Matching selector indices in the rule's selectorList selectors (0-based).
102
103    pub matchingSelectors: Vec<i64>,
104}
105
106/// Data for a simple selector (these are delimited by commas in a selector list).
107
108#[derive(Debug, Clone, Serialize, Deserialize, Default)]
109#[serde(rename_all = "camelCase")]
110pub struct ProtocolValue {
111    /// Value text.
112
113    pub text: String,
114    /// Value range in the underlying resource (if available).
115
116    #[serde(skip_serializing_if = "Option::is_none")]
117    pub range: Option<SourceRange>,
118    /// Specificity of the selector.
119
120    #[serde(skip_serializing_if = "Option::is_none")]
121    pub specificity: Option<Specificity>,
122}
123
124/// Specificity:
125/// https://drafts.csswg.org/selectors/#specificity-rules
126
127#[derive(Debug, Clone, Serialize, Deserialize, Default)]
128#[serde(rename_all = "camelCase")]
129pub struct Specificity {
130    /// The a component, which represents the number of ID selectors.
131
132    pub a: i64,
133    /// The b component, which represents the number of class selectors, attributes selectors, and
134    /// pseudo-classes.
135
136    pub b: i64,
137    /// The c component, which represents the number of type selectors and pseudo-elements.
138
139    pub c: i64,
140}
141
142/// Selector list data.
143
144#[derive(Debug, Clone, Serialize, Deserialize, Default)]
145#[serde(rename_all = "camelCase")]
146pub struct SelectorList {
147    /// Selectors in the list.
148
149    pub selectors: Vec<ProtocolValue>,
150    /// Rule selector text.
151
152    pub text: String,
153}
154
155/// CSS stylesheet metainformation.
156
157#[derive(Debug, Clone, Serialize, Deserialize, Default)]
158#[serde(rename_all = "camelCase")]
159pub struct CSSStyleSheetHeader {
160    /// The stylesheet identifier.
161
162    pub styleSheetId: crate::dom::StyleSheetId,
163    /// Owner frame identifier.
164
165    pub frameId: crate::page::FrameId,
166    /// Stylesheet resource URL. Empty if this is a constructed stylesheet created using
167    /// new CSSStyleSheet() (but non-empty if this is a constructed stylesheet imported
168    /// as a CSS module script).
169
170    pub sourceURL: String,
171    /// URL of source map associated with the stylesheet (if any).
172
173    #[serde(skip_serializing_if = "Option::is_none")]
174    pub sourceMapURL: Option<String>,
175    /// Stylesheet origin.
176
177    pub origin: StyleSheetOrigin,
178    /// Stylesheet title.
179
180    pub title: String,
181    /// The backend id for the owner node of the stylesheet.
182
183    #[serde(skip_serializing_if = "Option::is_none")]
184    pub ownerNode: Option<crate::dom::BackendNodeId>,
185    /// Denotes whether the stylesheet is disabled.
186
187    pub disabled: bool,
188    /// Whether the sourceURL field value comes from the sourceURL comment.
189
190    #[serde(skip_serializing_if = "Option::is_none")]
191    pub hasSourceURL: Option<bool>,
192    /// Whether this stylesheet is created for STYLE tag by parser. This flag is not set for
193    /// document.written STYLE tags.
194
195    pub isInline: bool,
196    /// Whether this stylesheet is mutable. Inline stylesheets become mutable
197    /// after they have been modified via CSSOM API.
198    /// '<link>' element's stylesheets become mutable only if DevTools modifies them.
199    /// Constructed stylesheets (new CSSStyleSheet()) are mutable immediately after creation.
200
201    pub isMutable: bool,
202    /// True if this stylesheet is created through new CSSStyleSheet() or imported as a
203    /// CSS module script.
204
205    pub isConstructed: bool,
206    /// Line offset of the stylesheet within the resource (zero based).
207
208    pub startLine: f64,
209    /// Column offset of the stylesheet within the resource (zero based).
210
211    pub startColumn: f64,
212    /// Size of the content (in characters).
213
214    pub length: f64,
215    /// Line offset of the end of the stylesheet within the resource (zero based).
216
217    pub endLine: f64,
218    /// Column offset of the end of the stylesheet within the resource (zero based).
219
220    pub endColumn: f64,
221    /// If the style sheet was loaded from a network resource, this indicates when the resource failed to load
222
223    #[serde(skip_serializing_if = "Option::is_none")]
224    pub loadingFailed: Option<bool>,
225}
226
227/// CSS rule representation.
228
229#[derive(Debug, Clone, Serialize, Deserialize, Default)]
230#[serde(rename_all = "camelCase")]
231pub struct CSSRule {
232    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
233    /// stylesheet rules) this rule came from.
234
235    #[serde(skip_serializing_if = "Option::is_none")]
236    pub styleSheetId: Option<crate::dom::StyleSheetId>,
237    /// Rule selector data.
238
239    pub selectorList: SelectorList,
240    /// Array of selectors from ancestor style rules, sorted by distance from the current rule.
241
242    #[serde(skip_serializing_if = "Option::is_none")]
243    pub nestingSelectors: Option<Vec<String>>,
244    /// Parent stylesheet's origin.
245
246    pub origin: StyleSheetOrigin,
247    /// Associated style declaration.
248
249    pub style: CSSStyle,
250    /// The BackendNodeId of the DOM node that constitutes the origin tree scope of this rule.
251
252    #[serde(skip_serializing_if = "Option::is_none")]
253    pub originTreeScopeNodeId: Option<crate::dom::BackendNodeId>,
254    /// Media list array (for rules involving media queries). The array enumerates media queries
255    /// starting with the innermost one, going outwards.
256
257    #[serde(skip_serializing_if = "Option::is_none")]
258    pub media: Option<Vec<CSSMedia>>,
259    /// Container query list array (for rules involving container queries).
260    /// The array enumerates container queries starting with the innermost one, going outwards.
261
262    #[serde(skip_serializing_if = "Option::is_none")]
263    pub containerQueries: Option<Vec<CSSContainerQuery>>,
264    /// @supports CSS at-rule array.
265    /// The array enumerates @supports at-rules starting with the innermost one, going outwards.
266
267    #[serde(skip_serializing_if = "Option::is_none")]
268    pub supports: Option<Vec<CSSSupports>>,
269    /// Cascade layer array. Contains the layer hierarchy that this rule belongs to starting
270    /// with the innermost layer and going outwards.
271
272    #[serde(skip_serializing_if = "Option::is_none")]
273    pub layers: Option<Vec<CSSLayer>>,
274    /// @scope CSS at-rule array.
275    /// The array enumerates @scope at-rules starting with the innermost one, going outwards.
276
277    #[serde(skip_serializing_if = "Option::is_none")]
278    pub scopes: Option<Vec<CSSScope>>,
279    /// The array keeps the types of ancestor CSSRules from the innermost going outwards.
280
281    #[serde(skip_serializing_if = "Option::is_none")]
282    pub ruleTypes: Option<Vec<CSSRuleType>>,
283    /// @starting-style CSS at-rule array.
284    /// The array enumerates @starting-style at-rules starting with the innermost one, going outwards.
285
286    #[serde(skip_serializing_if = "Option::is_none")]
287    pub startingStyles: Option<Vec<CSSStartingStyle>>,
288    /// @navigation CSS at-rule array.
289    /// The array enumerates @navigation at-rules starting with the innermost one, going outwards.
290
291    #[serde(skip_serializing_if = "Option::is_none")]
292    pub navigations: Option<Vec<CSSNavigation>>,
293}
294
295/// Enum indicating the type of a CSS rule, used to represent the order of a style rule's ancestors.
296/// This list only contains rule types that are collected during the ancestor rule collection.
297
298#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
299pub enum CSSRuleType {
300    #[default]
301    MediaRule,
302    SupportsRule,
303    ContainerRule,
304    LayerRule,
305    ScopeRule,
306    StyleRule,
307    StartingStyleRule,
308    NavigationRule,
309}
310
311/// CSS coverage information.
312
313#[derive(Debug, Clone, Serialize, Deserialize, Default)]
314#[serde(rename_all = "camelCase")]
315pub struct RuleUsage {
316    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
317    /// stylesheet rules) this rule came from.
318
319    pub styleSheetId: crate::dom::StyleSheetId,
320    /// Offset of the start of the rule (including selector) from the beginning of the stylesheet.
321
322    pub startOffset: f64,
323    /// Offset of the end of the rule body from the beginning of the stylesheet.
324
325    pub endOffset: f64,
326    /// Indicates whether the rule was actually used by some element in the page.
327
328    pub used: bool,
329}
330
331/// Text range within a resource. All numbers are zero-based.
332
333#[derive(Debug, Clone, Serialize, Deserialize, Default)]
334#[serde(rename_all = "camelCase")]
335pub struct SourceRange {
336    /// Start line of range.
337
338    pub startLine: i64,
339    /// Start column of range (inclusive).
340
341    pub startColumn: i64,
342    /// End line of range
343
344    pub endLine: i64,
345    /// End column of range (exclusive).
346
347    pub endColumn: i64,
348}
349
350
351#[derive(Debug, Clone, Serialize, Deserialize, Default)]
352#[serde(rename_all = "camelCase")]
353pub struct ShorthandEntry {
354    /// Shorthand name.
355
356    pub name: String,
357    /// Shorthand value.
358
359    pub value: String,
360    /// Whether the property has "!important" annotation (implies 'false' if absent).
361
362    #[serde(skip_serializing_if = "Option::is_none")]
363    pub important: Option<bool>,
364}
365
366
367#[derive(Debug, Clone, Serialize, Deserialize, Default)]
368#[serde(rename_all = "camelCase")]
369pub struct CSSComputedStyleProperty {
370    /// Computed style property name.
371
372    pub name: String,
373    /// Computed style property value.
374
375    pub value: String,
376}
377
378
379#[derive(Debug, Clone, Serialize, Deserialize, Default)]
380#[serde(rename_all = "camelCase")]
381pub struct ComputedStyleExtraFields {
382    /// Returns whether or not this node is being rendered with base appearance,
383    /// which happens when it has its appearance property set to base/base-select
384    /// or it is in the subtree of an element being rendered with base appearance.
385
386    pub isAppearanceBase: bool,
387}
388
389/// CSS style representation.
390
391#[derive(Debug, Clone, Serialize, Deserialize, Default)]
392#[serde(rename_all = "camelCase")]
393pub struct CSSStyle {
394    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
395    /// stylesheet rules) this rule came from.
396
397    #[serde(skip_serializing_if = "Option::is_none")]
398    pub styleSheetId: Option<crate::dom::StyleSheetId>,
399    /// CSS properties in the style.
400
401    pub cssProperties: Vec<CSSProperty>,
402    /// Computed values for all shorthands found in the style.
403
404    pub shorthandEntries: Vec<ShorthandEntry>,
405    /// Style declaration text (if available).
406
407    #[serde(skip_serializing_if = "Option::is_none")]
408    pub cssText: Option<String>,
409    /// Style declaration range in the enclosing stylesheet (if available).
410
411    #[serde(skip_serializing_if = "Option::is_none")]
412    pub range: Option<SourceRange>,
413}
414
415/// CSS property declaration data.
416
417#[derive(Debug, Clone, Serialize, Deserialize, Default)]
418#[serde(rename_all = "camelCase")]
419pub struct CSSProperty {
420    /// The property name.
421
422    pub name: String,
423    /// The property value.
424
425    pub value: String,
426    /// Whether the property has "!important" annotation (implies 'false' if absent).
427
428    #[serde(skip_serializing_if = "Option::is_none")]
429    pub important: Option<bool>,
430    /// Whether the property is implicit (implies 'false' if absent).
431
432    #[serde(skip_serializing_if = "Option::is_none")]
433    pub implicit: Option<bool>,
434    /// The full property text as specified in the style.
435
436    #[serde(skip_serializing_if = "Option::is_none")]
437    pub text: Option<String>,
438    /// Whether the property is understood by the browser (implies 'true' if absent).
439
440    #[serde(skip_serializing_if = "Option::is_none")]
441    pub parsedOk: Option<bool>,
442    /// Whether the property is disabled by the user (present for source-based properties only).
443
444    #[serde(skip_serializing_if = "Option::is_none")]
445    pub disabled: Option<bool>,
446    /// The entire property range in the enclosing style declaration (if available).
447
448    #[serde(skip_serializing_if = "Option::is_none")]
449    pub range: Option<SourceRange>,
450    /// Parsed longhand components of this property if it is a shorthand.
451    /// This field will be empty if the given property is not a shorthand.
452
453    #[serde(skip_serializing_if = "Option::is_none")]
454    pub longhandProperties: Option<Vec<CSSProperty>>,
455}
456
457/// CSS media rule descriptor.
458
459#[derive(Debug, Clone, Serialize, Deserialize, Default)]
460#[serde(rename_all = "camelCase")]
461pub struct CSSMedia {
462    /// Media query text.
463
464    pub text: String,
465    /// Source of the media query: "mediaRule" if specified by a @media rule, "importRule" if
466    /// specified by an @import rule, "linkedSheet" if specified by a "media" attribute in a linked
467    /// stylesheet's LINK tag, "inlineSheet" if specified by a "media" attribute in an inline
468    /// stylesheet's STYLE tag.
469
470    pub source: String,
471    /// URL of the document containing the media query description.
472
473    #[serde(skip_serializing_if = "Option::is_none")]
474    pub sourceURL: Option<String>,
475    /// The associated rule (@media or @import) header range in the enclosing stylesheet (if
476    /// available).
477
478    #[serde(skip_serializing_if = "Option::is_none")]
479    pub range: Option<SourceRange>,
480    /// Identifier of the stylesheet containing this object (if exists).
481
482    #[serde(skip_serializing_if = "Option::is_none")]
483    pub styleSheetId: Option<crate::dom::StyleSheetId>,
484    /// Array of media queries.
485
486    #[serde(skip_serializing_if = "Option::is_none")]
487    pub mediaList: Option<Vec<MediaQuery>>,
488}
489
490/// Media query descriptor.
491
492#[derive(Debug, Clone, Serialize, Deserialize, Default)]
493#[serde(rename_all = "camelCase")]
494pub struct MediaQuery {
495    /// Array of media query expressions.
496
497    pub expressions: Vec<MediaQueryExpression>,
498    /// Whether the media query condition is satisfied.
499
500    pub active: bool,
501}
502
503/// Media query expression descriptor.
504
505#[derive(Debug, Clone, Serialize, Deserialize, Default)]
506#[serde(rename_all = "camelCase")]
507pub struct MediaQueryExpression {
508    /// Media query expression value.
509
510    pub value: f64,
511    /// Media query expression units.
512
513    pub unit: String,
514    /// Media query expression feature.
515
516    pub feature: String,
517    /// The associated range of the value text in the enclosing stylesheet (if available).
518
519    #[serde(skip_serializing_if = "Option::is_none")]
520    pub valueRange: Option<SourceRange>,
521    /// Computed length of media query expression (if applicable).
522
523    #[serde(skip_serializing_if = "Option::is_none")]
524    pub computedLength: Option<f64>,
525}
526
527/// CSS container query rule descriptor.
528
529#[derive(Debug, Clone, Serialize, Deserialize, Default)]
530#[serde(rename_all = "camelCase")]
531pub struct CSSContainerQuery {
532    /// Container query text.
533
534    pub text: String,
535    /// The associated rule header range in the enclosing stylesheet (if
536    /// available).
537
538    #[serde(skip_serializing_if = "Option::is_none")]
539    pub range: Option<SourceRange>,
540    /// Identifier of the stylesheet containing this object (if exists).
541
542    #[serde(skip_serializing_if = "Option::is_none")]
543    pub styleSheetId: Option<crate::dom::StyleSheetId>,
544    /// Optional name for the container.
545
546    #[serde(skip_serializing_if = "Option::is_none")]
547    pub name: Option<String>,
548    /// Optional physical axes queried for the container.
549
550    #[serde(skip_serializing_if = "Option::is_none")]
551    pub physicalAxes: Option<crate::dom::PhysicalAxes>,
552    /// Optional logical axes queried for the container.
553
554    #[serde(skip_serializing_if = "Option::is_none")]
555    pub logicalAxes: Option<crate::dom::LogicalAxes>,
556    /// true if the query contains scroll-state() queries.
557
558    #[serde(skip_serializing_if = "Option::is_none")]
559    pub queriesScrollState: Option<bool>,
560    /// true if the query contains anchored() queries.
561
562    #[serde(skip_serializing_if = "Option::is_none")]
563    pub queriesAnchored: Option<bool>,
564}
565
566/// CSS Supports at-rule descriptor.
567
568#[derive(Debug, Clone, Serialize, Deserialize, Default)]
569#[serde(rename_all = "camelCase")]
570pub struct CSSSupports {
571    /// Supports rule text.
572
573    pub text: String,
574    /// Whether the supports condition is satisfied.
575
576    pub active: bool,
577    /// The associated rule header range in the enclosing stylesheet (if
578    /// available).
579
580    #[serde(skip_serializing_if = "Option::is_none")]
581    pub range: Option<SourceRange>,
582    /// Identifier of the stylesheet containing this object (if exists).
583
584    #[serde(skip_serializing_if = "Option::is_none")]
585    pub styleSheetId: Option<crate::dom::StyleSheetId>,
586}
587
588/// CSS Navigation at-rule descriptor.
589
590#[derive(Debug, Clone, Serialize, Deserialize, Default)]
591#[serde(rename_all = "camelCase")]
592pub struct CSSNavigation {
593    /// Navigation rule text.
594
595    pub text: String,
596    /// Whether the navigation condition is satisfied.
597
598    #[serde(skip_serializing_if = "Option::is_none")]
599    pub active: Option<bool>,
600    /// The associated rule header range in the enclosing stylesheet (if
601    /// available).
602
603    #[serde(skip_serializing_if = "Option::is_none")]
604    pub range: Option<SourceRange>,
605    /// Identifier of the stylesheet containing this object (if exists).
606
607    #[serde(skip_serializing_if = "Option::is_none")]
608    pub styleSheetId: Option<crate::dom::StyleSheetId>,
609}
610
611/// CSS Scope at-rule descriptor.
612
613#[derive(Debug, Clone, Serialize, Deserialize, Default)]
614#[serde(rename_all = "camelCase")]
615pub struct CSSScope {
616    /// Scope rule text.
617
618    pub text: String,
619    /// The associated rule header range in the enclosing stylesheet (if
620    /// available).
621
622    #[serde(skip_serializing_if = "Option::is_none")]
623    pub range: Option<SourceRange>,
624    /// Identifier of the stylesheet containing this object (if exists).
625
626    #[serde(skip_serializing_if = "Option::is_none")]
627    pub styleSheetId: Option<crate::dom::StyleSheetId>,
628}
629
630/// CSS Layer at-rule descriptor.
631
632#[derive(Debug, Clone, Serialize, Deserialize, Default)]
633#[serde(rename_all = "camelCase")]
634pub struct CSSLayer {
635    /// Layer name.
636
637    pub text: String,
638    /// The associated rule header range in the enclosing stylesheet (if
639    /// available).
640
641    #[serde(skip_serializing_if = "Option::is_none")]
642    pub range: Option<SourceRange>,
643    /// Identifier of the stylesheet containing this object (if exists).
644
645    #[serde(skip_serializing_if = "Option::is_none")]
646    pub styleSheetId: Option<crate::dom::StyleSheetId>,
647}
648
649/// CSS Starting Style at-rule descriptor.
650
651#[derive(Debug, Clone, Serialize, Deserialize, Default)]
652#[serde(rename_all = "camelCase")]
653pub struct CSSStartingStyle {
654    /// The associated rule header range in the enclosing stylesheet (if
655    /// available).
656
657    #[serde(skip_serializing_if = "Option::is_none")]
658    pub range: Option<SourceRange>,
659    /// Identifier of the stylesheet containing this object (if exists).
660
661    #[serde(skip_serializing_if = "Option::is_none")]
662    pub styleSheetId: Option<crate::dom::StyleSheetId>,
663}
664
665/// CSS Layer data.
666
667#[derive(Debug, Clone, Serialize, Deserialize, Default)]
668#[serde(rename_all = "camelCase")]
669pub struct CSSLayerData {
670    /// Layer name.
671
672    pub name: String,
673    /// Direct sub-layers
674
675    #[serde(skip_serializing_if = "Option::is_none")]
676    pub subLayers: Option<Vec<CSSLayerData>>,
677    /// Layer order. The order determines the order of the layer in the cascade order.
678    /// A higher number has higher priority in the cascade order.
679
680    pub order: f64,
681}
682
683/// Information about amount of glyphs that were rendered with given font.
684
685#[derive(Debug, Clone, Serialize, Deserialize, Default)]
686#[serde(rename_all = "camelCase")]
687pub struct PlatformFontUsage {
688    /// Font's family name reported by platform.
689
690    pub familyName: String,
691    /// Font's PostScript name reported by platform.
692
693    pub postScriptName: String,
694    /// Indicates if the font was downloaded or resolved locally.
695
696    pub isCustomFont: bool,
697    /// Amount of glyphs that were rendered with this font.
698
699    pub glyphCount: f64,
700}
701
702/// Information about font variation axes for variable fonts
703
704#[derive(Debug, Clone, Serialize, Deserialize, Default)]
705#[serde(rename_all = "camelCase")]
706pub struct FontVariationAxis {
707    /// The font-variation-setting tag (a.k.a. "axis tag").
708
709    pub tag: String,
710    /// Human-readable variation name in the default language (normally, "en").
711
712    pub name: String,
713    /// The minimum value (inclusive) the font supports for this tag.
714
715    pub minValue: f64,
716    /// The maximum value (inclusive) the font supports for this tag.
717
718    pub maxValue: f64,
719    /// The default value.
720
721    pub defaultValue: f64,
722}
723
724/// Properties of a web font: https://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#font-descriptions
725/// and additional information such as platformFontFamily and fontVariationAxes.
726
727#[derive(Debug, Clone, Serialize, Deserialize, Default)]
728#[serde(rename_all = "camelCase")]
729pub struct FontFace {
730    /// The font-family.
731
732    pub fontFamily: String,
733    /// The font-style.
734
735    pub fontStyle: String,
736    /// The font-variant.
737
738    pub fontVariant: String,
739    /// The font-weight.
740
741    pub fontWeight: String,
742    /// The font-stretch.
743
744    pub fontStretch: String,
745    /// The font-display.
746
747    pub fontDisplay: String,
748    /// The unicode-range.
749
750    pub unicodeRange: String,
751    /// The src.
752
753    pub src: String,
754    /// The resolved platform font family
755
756    pub platformFontFamily: String,
757    /// Available variation settings (a.k.a. "axes").
758
759    #[serde(skip_serializing_if = "Option::is_none")]
760    pub fontVariationAxes: Option<Vec<FontVariationAxis>>,
761}
762
763/// CSS try rule representation.
764
765#[derive(Debug, Clone, Serialize, Deserialize, Default)]
766#[serde(rename_all = "camelCase")]
767pub struct CSSTryRule {
768    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
769    /// stylesheet rules) this rule came from.
770
771    #[serde(skip_serializing_if = "Option::is_none")]
772    pub styleSheetId: Option<crate::dom::StyleSheetId>,
773    /// Parent stylesheet's origin.
774
775    pub origin: StyleSheetOrigin,
776    /// Associated style declaration.
777
778    pub style: CSSStyle,
779}
780
781/// CSS @position-try rule representation.
782
783#[derive(Debug, Clone, Serialize, Deserialize, Default)]
784#[serde(rename_all = "camelCase")]
785pub struct CSSPositionTryRule {
786    /// The prelude dashed-ident name
787
788    pub name: ProtocolValue,
789    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
790    /// stylesheet rules) this rule came from.
791
792    #[serde(skip_serializing_if = "Option::is_none")]
793    pub styleSheetId: Option<crate::dom::StyleSheetId>,
794    /// Parent stylesheet's origin.
795
796    pub origin: StyleSheetOrigin,
797    /// Associated style declaration.
798
799    pub style: CSSStyle,
800
801    pub active: bool,
802}
803
804/// CSS keyframes rule representation.
805
806#[derive(Debug, Clone, Serialize, Deserialize, Default)]
807#[serde(rename_all = "camelCase")]
808pub struct CSSKeyframesRule {
809    /// Animation name.
810
811    pub animationName: ProtocolValue,
812    /// List of keyframes.
813
814    pub keyframes: Vec<CSSKeyframeRule>,
815}
816
817/// Representation of a custom property registration through CSS.registerProperty
818
819#[derive(Debug, Clone, Serialize, Deserialize, Default)]
820#[serde(rename_all = "camelCase")]
821pub struct CSSPropertyRegistration {
822
823    pub propertyName: String,
824
825    #[serde(skip_serializing_if = "Option::is_none")]
826    pub initialValue: Option<ProtocolValue>,
827
828    pub inherits: bool,
829
830    pub syntax: String,
831}
832
833/// CSS generic @rule representation.
834
835#[derive(Debug, Clone, Serialize, Deserialize, Default)]
836#[serde(rename_all = "camelCase")]
837pub struct CSSAtRule {
838    /// Type of at-rule.
839
840    #[serde(rename = "type")]
841    pub type_: String,
842    /// Subsection of font-feature-values, if this is a subsection.
843
844    #[serde(skip_serializing_if = "Option::is_none")]
845    pub subsection: Option<String>,
846    /// LINT.ThenChange(//third_party/blink/renderer/core/inspector/inspector_style_sheet.cc:FontVariantAlternatesFeatureType,//third_party/blink/renderer/core/inspector/inspector_css_agent.cc:FontVariantAlternatesFeatureType)
847    /// Associated name, if applicable.
848
849    #[serde(skip_serializing_if = "Option::is_none")]
850    pub name: Option<ProtocolValue>,
851    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
852    /// stylesheet rules) this rule came from.
853
854    #[serde(skip_serializing_if = "Option::is_none")]
855    pub styleSheetId: Option<crate::dom::StyleSheetId>,
856    /// Parent stylesheet's origin.
857
858    pub origin: StyleSheetOrigin,
859    /// Associated style declaration.
860
861    pub style: CSSStyle,
862}
863
864/// CSS property at-rule representation.
865
866#[derive(Debug, Clone, Serialize, Deserialize, Default)]
867#[serde(rename_all = "camelCase")]
868pub struct CSSPropertyRule {
869    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
870    /// stylesheet rules) this rule came from.
871
872    #[serde(skip_serializing_if = "Option::is_none")]
873    pub styleSheetId: Option<crate::dom::StyleSheetId>,
874    /// Parent stylesheet's origin.
875
876    pub origin: StyleSheetOrigin,
877    /// Associated property name.
878
879    pub propertyName: ProtocolValue,
880    /// Associated style declaration.
881
882    pub style: CSSStyle,
883}
884
885/// CSS function argument representation.
886
887#[derive(Debug, Clone, Serialize, Deserialize, Default)]
888#[serde(rename_all = "camelCase")]
889pub struct CSSFunctionParameter {
890    /// The parameter name.
891
892    pub name: String,
893    /// The parameter type.
894
895    #[serde(rename = "type")]
896    pub type_: String,
897}
898
899/// CSS function conditional block representation.
900
901#[derive(Debug, Clone, Serialize, Deserialize, Default)]
902#[serde(rename_all = "camelCase")]
903pub struct CSSFunctionConditionNode {
904    /// Media query for this conditional block. Only one type of condition should be set.
905
906    #[serde(skip_serializing_if = "Option::is_none")]
907    pub media: Option<CSSMedia>,
908    /// Container query for this conditional block. Only one type of condition should be set.
909
910    #[serde(skip_serializing_if = "Option::is_none")]
911    pub containerQueries: Option<CSSContainerQuery>,
912    /// @supports CSS at-rule condition. Only one type of condition should be set.
913
914    #[serde(skip_serializing_if = "Option::is_none")]
915    pub supports: Option<CSSSupports>,
916    /// @navigation condition. Only one type of condition should be set.
917
918    #[serde(skip_serializing_if = "Option::is_none")]
919    pub navigation: Option<CSSNavigation>,
920    /// Block body.
921
922    pub children: Vec<CSSFunctionNode>,
923    /// The condition text.
924
925    pub conditionText: String,
926}
927
928/// Section of the body of a CSS function rule.
929
930#[derive(Debug, Clone, Serialize, Deserialize, Default)]
931#[serde(rename_all = "camelCase")]
932pub struct CSSFunctionNode {
933    /// A conditional block. If set, style should not be set.
934
935    #[serde(skip_serializing_if = "Option::is_none")]
936    pub condition: Option<CSSFunctionConditionNode>,
937    /// Values set by this node. If set, condition should not be set.
938
939    #[serde(skip_serializing_if = "Option::is_none")]
940    pub style: Option<CSSStyle>,
941}
942
943/// CSS function at-rule representation.
944
945#[derive(Debug, Clone, Serialize, Deserialize, Default)]
946#[serde(rename_all = "camelCase")]
947pub struct CSSFunctionRule {
948    /// Name of the function.
949
950    pub name: ProtocolValue,
951    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
952    /// stylesheet rules) this rule came from.
953
954    #[serde(skip_serializing_if = "Option::is_none")]
955    pub styleSheetId: Option<crate::dom::StyleSheetId>,
956    /// Parent stylesheet's origin.
957
958    pub origin: StyleSheetOrigin,
959    /// List of parameters.
960
961    pub parameters: Vec<CSSFunctionParameter>,
962    /// Function body.
963
964    pub children: Vec<CSSFunctionNode>,
965    /// The BackendNodeId of the DOM node that constitutes the origin tree scope of this rule.
966
967    #[serde(skip_serializing_if = "Option::is_none")]
968    pub originTreeScopeNodeId: Option<crate::dom::BackendNodeId>,
969}
970
971/// CSS keyframe rule representation.
972
973#[derive(Debug, Clone, Serialize, Deserialize, Default)]
974#[serde(rename_all = "camelCase")]
975pub struct CSSKeyframeRule {
976    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
977    /// stylesheet rules) this rule came from.
978
979    #[serde(skip_serializing_if = "Option::is_none")]
980    pub styleSheetId: Option<crate::dom::StyleSheetId>,
981    /// Parent stylesheet's origin.
982
983    pub origin: StyleSheetOrigin,
984    /// Associated key text.
985
986    pub keyText: ProtocolValue,
987    /// Associated style declaration.
988
989    pub style: CSSStyle,
990}
991
992/// A descriptor of operation to mutate style declaration text.
993
994#[derive(Debug, Clone, Serialize, Deserialize, Default)]
995#[serde(rename_all = "camelCase")]
996pub struct StyleDeclarationEdit {
997    /// The css style sheet identifier.
998
999    pub styleSheetId: crate::dom::StyleSheetId,
1000    /// The range of the style text in the enclosing stylesheet.
1001
1002    pub range: SourceRange,
1003    /// New style text.
1004
1005    pub text: String,
1006}
1007
1008/// Inserts a new rule with the given 'ruleText' in a stylesheet with given 'styleSheetId', at the
1009/// position specified by 'location'.
1010
1011#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1012#[serde(rename_all = "camelCase")]
1013pub struct AddRuleParams {
1014    /// The css style sheet identifier where a new rule should be inserted.
1015
1016    pub styleSheetId: crate::dom::StyleSheetId,
1017    /// The text of a new rule.
1018
1019    pub ruleText: String,
1020    /// Text position of a new rule in the target style sheet.
1021
1022    pub location: SourceRange,
1023    /// NodeId for the DOM node in whose context custom property declarations for registered properties should be
1024    /// validated. If omitted, declarations in the new rule text can only be validated statically, which may produce
1025    /// incorrect results if the declaration contains a var() for example.
1026
1027    #[serde(skip_serializing_if = "Option::is_none")]
1028    pub nodeForPropertySyntaxValidation: Option<crate::dom::NodeId>,
1029}
1030
1031/// Inserts a new rule with the given 'ruleText' in a stylesheet with given 'styleSheetId', at the
1032/// position specified by 'location'.
1033
1034#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1035#[serde(rename_all = "camelCase")]
1036pub struct AddRuleReturns {
1037    /// The newly created rule.
1038
1039    pub rule: CSSRule,
1040}
1041
1042impl AddRuleParams { pub const METHOD: &'static str = "CSS.addRule"; }
1043
1044impl crate::CdpCommand for AddRuleParams {
1045    const METHOD: &'static str = "CSS.addRule";
1046    type Response = AddRuleReturns;
1047}
1048
1049/// Returns all class names from specified stylesheet.
1050
1051#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1052#[serde(rename_all = "camelCase")]
1053pub struct CollectClassNamesParams {
1054
1055    pub styleSheetId: crate::dom::StyleSheetId,
1056}
1057
1058/// Returns all class names from specified stylesheet.
1059
1060#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1061#[serde(rename_all = "camelCase")]
1062pub struct CollectClassNamesReturns {
1063    /// Class name list.
1064
1065    pub classNames: Vec<String>,
1066}
1067
1068impl CollectClassNamesParams { pub const METHOD: &'static str = "CSS.collectClassNames"; }
1069
1070impl crate::CdpCommand for CollectClassNamesParams {
1071    const METHOD: &'static str = "CSS.collectClassNames";
1072    type Response = CollectClassNamesReturns;
1073}
1074
1075/// Creates a new special "via-inspector" stylesheet in the frame with given 'frameId'.
1076
1077#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1078#[serde(rename_all = "camelCase")]
1079pub struct CreateStyleSheetParams {
1080    /// Identifier of the frame where "via-inspector" stylesheet should be created.
1081
1082    pub frameId: crate::page::FrameId,
1083    /// If true, creates a new stylesheet for every call. If false,
1084    /// returns a stylesheet previously created by a call with force=false
1085    /// for the frame's document if it exists or creates a new stylesheet
1086    /// (default: false).
1087
1088    #[serde(skip_serializing_if = "Option::is_none")]
1089    pub force: Option<bool>,
1090}
1091
1092/// Creates a new special "via-inspector" stylesheet in the frame with given 'frameId'.
1093
1094#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1095#[serde(rename_all = "camelCase")]
1096pub struct CreateStyleSheetReturns {
1097    /// Identifier of the created "via-inspector" stylesheet.
1098
1099    pub styleSheetId: crate::dom::StyleSheetId,
1100}
1101
1102impl CreateStyleSheetParams { pub const METHOD: &'static str = "CSS.createStyleSheet"; }
1103
1104impl crate::CdpCommand for CreateStyleSheetParams {
1105    const METHOD: &'static str = "CSS.createStyleSheet";
1106    type Response = CreateStyleSheetReturns;
1107}
1108
1109#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1110pub struct DisableParams {}
1111
1112impl DisableParams { pub const METHOD: &'static str = "CSS.disable"; }
1113
1114impl crate::CdpCommand for DisableParams {
1115    const METHOD: &'static str = "CSS.disable";
1116    type Response = crate::EmptyReturns;
1117}
1118
1119#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1120pub struct EnableParams {}
1121
1122impl EnableParams { pub const METHOD: &'static str = "CSS.enable"; }
1123
1124impl crate::CdpCommand for EnableParams {
1125    const METHOD: &'static str = "CSS.enable";
1126    type Response = crate::EmptyReturns;
1127}
1128
1129/// Ensures that the given node will have specified pseudo-classes whenever its style is computed by
1130/// the browser.
1131
1132#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1133#[serde(rename_all = "camelCase")]
1134pub struct ForcePseudoStateParams {
1135    /// The element id for which to force the pseudo state.
1136
1137    pub nodeId: crate::dom::NodeId,
1138    /// Element pseudo classes to force when computing the element's style.
1139
1140    pub forcedPseudoClasses: Vec<String>,
1141}
1142
1143impl ForcePseudoStateParams { pub const METHOD: &'static str = "CSS.forcePseudoState"; }
1144
1145impl crate::CdpCommand for ForcePseudoStateParams {
1146    const METHOD: &'static str = "CSS.forcePseudoState";
1147    type Response = crate::EmptyReturns;
1148}
1149
1150/// Ensures that the given node is in its starting-style state.
1151
1152#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1153#[serde(rename_all = "camelCase")]
1154pub struct ForceStartingStyleParams {
1155    /// The element id for which to force the starting-style state.
1156
1157    pub nodeId: crate::dom::NodeId,
1158    /// Boolean indicating if this is on or off.
1159
1160    pub forced: bool,
1161}
1162
1163impl ForceStartingStyleParams { pub const METHOD: &'static str = "CSS.forceStartingStyle"; }
1164
1165impl crate::CdpCommand for ForceStartingStyleParams {
1166    const METHOD: &'static str = "CSS.forceStartingStyle";
1167    type Response = crate::EmptyReturns;
1168}
1169
1170
1171#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1172#[serde(rename_all = "camelCase")]
1173pub struct GetBackgroundColorsParams {
1174    /// Id of the node to get background colors for.
1175
1176    pub nodeId: crate::dom::NodeId,
1177}
1178
1179
1180#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1181#[serde(rename_all = "camelCase")]
1182pub struct GetBackgroundColorsReturns {
1183    /// The range of background colors behind this element, if it contains any visible text. If no
1184    /// visible text is present, this will be undefined. In the case of a flat background color,
1185    /// this will consist of simply that color. In the case of a gradient, this will consist of each
1186    /// of the color stops. For anything more complicated, this will be an empty array. Images will
1187    /// be ignored (as if the image had failed to load).
1188
1189    #[serde(skip_serializing_if = "Option::is_none")]
1190    pub backgroundColors: Option<Vec<String>>,
1191    /// The computed font size for this node, as a CSS computed value string (e.g. '12px').
1192
1193    #[serde(skip_serializing_if = "Option::is_none")]
1194    pub computedFontSize: Option<String>,
1195    /// The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or
1196    /// '100').
1197
1198    #[serde(skip_serializing_if = "Option::is_none")]
1199    pub computedFontWeight: Option<String>,
1200}
1201
1202impl GetBackgroundColorsParams { pub const METHOD: &'static str = "CSS.getBackgroundColors"; }
1203
1204impl crate::CdpCommand for GetBackgroundColorsParams {
1205    const METHOD: &'static str = "CSS.getBackgroundColors";
1206    type Response = GetBackgroundColorsReturns;
1207}
1208
1209/// Returns the computed style for a DOM node identified by 'nodeId'.
1210
1211#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1212#[serde(rename_all = "camelCase")]
1213pub struct GetComputedStyleForNodeParams {
1214
1215    pub nodeId: crate::dom::NodeId,
1216}
1217
1218/// Returns the computed style for a DOM node identified by 'nodeId'.
1219
1220#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1221#[serde(rename_all = "camelCase")]
1222pub struct GetComputedStyleForNodeReturns {
1223    /// Computed style for the specified DOM node.
1224
1225    pub computedStyle: Vec<CSSComputedStyleProperty>,
1226    /// A list of non-standard "extra fields" which blink stores alongside each
1227    /// computed style.
1228
1229    pub extraFields: ComputedStyleExtraFields,
1230}
1231
1232impl GetComputedStyleForNodeParams { pub const METHOD: &'static str = "CSS.getComputedStyleForNode"; }
1233
1234impl crate::CdpCommand for GetComputedStyleForNodeParams {
1235    const METHOD: &'static str = "CSS.getComputedStyleForNode";
1236    type Response = GetComputedStyleForNodeReturns;
1237}
1238
1239/// Resolve the specified values in the context of the provided element.
1240/// For example, a value of '1em' is evaluated according to the computed
1241/// 'font-size' of the element and a value 'calc(1px + 2px)' will be
1242/// resolved to '3px'.
1243/// If the 'propertyName' was specified the 'values' are resolved as if
1244/// they were property's declaration. If a value cannot be parsed according
1245/// to the provided property syntax, the value is parsed using combined
1246/// syntax as if null 'propertyName' was provided. If the value cannot be
1247/// resolved even then, return the provided value without any changes.
1248/// Note: this function currently does not resolve CSS random() function,
1249/// it returns unmodified random() function parts.'
1250
1251#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1252#[serde(rename_all = "camelCase")]
1253pub struct ResolveValuesParams {
1254    /// Cascade-dependent keywords (revert/revert-layer) do not work.
1255
1256    pub values: Vec<String>,
1257    /// Id of the node in whose context the expression is evaluated
1258
1259    pub nodeId: crate::dom::NodeId,
1260    /// Only longhands and custom property names are accepted.
1261
1262    #[serde(skip_serializing_if = "Option::is_none")]
1263    pub propertyName: Option<String>,
1264    /// Pseudo element type, only works for pseudo elements that generate
1265    /// elements in the tree, such as ::before and ::after.
1266
1267    #[serde(skip_serializing_if = "Option::is_none")]
1268    pub pseudoType: Option<crate::dom::PseudoType>,
1269    /// Pseudo element custom ident.
1270
1271    #[serde(skip_serializing_if = "Option::is_none")]
1272    pub pseudoIdentifier: Option<String>,
1273}
1274
1275/// Resolve the specified values in the context of the provided element.
1276/// For example, a value of '1em' is evaluated according to the computed
1277/// 'font-size' of the element and a value 'calc(1px + 2px)' will be
1278/// resolved to '3px'.
1279/// If the 'propertyName' was specified the 'values' are resolved as if
1280/// they were property's declaration. If a value cannot be parsed according
1281/// to the provided property syntax, the value is parsed using combined
1282/// syntax as if null 'propertyName' was provided. If the value cannot be
1283/// resolved even then, return the provided value without any changes.
1284/// Note: this function currently does not resolve CSS random() function,
1285/// it returns unmodified random() function parts.'
1286
1287#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1288#[serde(rename_all = "camelCase")]
1289pub struct ResolveValuesReturns {
1290
1291    pub results: Vec<String>,
1292}
1293
1294impl ResolveValuesParams { pub const METHOD: &'static str = "CSS.resolveValues"; }
1295
1296impl crate::CdpCommand for ResolveValuesParams {
1297    const METHOD: &'static str = "CSS.resolveValues";
1298    type Response = ResolveValuesReturns;
1299}
1300
1301
1302#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1303#[serde(rename_all = "camelCase")]
1304pub struct GetLonghandPropertiesParams {
1305
1306    pub shorthandName: String,
1307
1308    pub value: String,
1309}
1310
1311
1312#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1313#[serde(rename_all = "camelCase")]
1314pub struct GetLonghandPropertiesReturns {
1315
1316    pub longhandProperties: Vec<CSSProperty>,
1317}
1318
1319impl GetLonghandPropertiesParams { pub const METHOD: &'static str = "CSS.getLonghandProperties"; }
1320
1321impl crate::CdpCommand for GetLonghandPropertiesParams {
1322    const METHOD: &'static str = "CSS.getLonghandProperties";
1323    type Response = GetLonghandPropertiesReturns;
1324}
1325
1326/// Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM
1327/// attributes) for a DOM node identified by 'nodeId'.
1328
1329#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1330#[serde(rename_all = "camelCase")]
1331pub struct GetInlineStylesForNodeParams {
1332
1333    pub nodeId: crate::dom::NodeId,
1334}
1335
1336/// Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM
1337/// attributes) for a DOM node identified by 'nodeId'.
1338
1339#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1340#[serde(rename_all = "camelCase")]
1341pub struct GetInlineStylesForNodeReturns {
1342    /// Inline style for the specified DOM node.
1343
1344    #[serde(skip_serializing_if = "Option::is_none")]
1345    pub inlineStyle: Option<CSSStyle>,
1346    /// Attribute-defined element style (e.g. resulting from "width=20 height=100%").
1347
1348    #[serde(skip_serializing_if = "Option::is_none")]
1349    pub attributesStyle: Option<CSSStyle>,
1350}
1351
1352impl GetInlineStylesForNodeParams { pub const METHOD: &'static str = "CSS.getInlineStylesForNode"; }
1353
1354impl crate::CdpCommand for GetInlineStylesForNodeParams {
1355    const METHOD: &'static str = "CSS.getInlineStylesForNode";
1356    type Response = GetInlineStylesForNodeReturns;
1357}
1358
1359/// Returns the styles coming from animations & transitions
1360/// including the animation & transition styles coming from inheritance chain.
1361
1362#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1363#[serde(rename_all = "camelCase")]
1364pub struct GetAnimatedStylesForNodeParams {
1365
1366    pub nodeId: crate::dom::NodeId,
1367}
1368
1369/// Returns the styles coming from animations & transitions
1370/// including the animation & transition styles coming from inheritance chain.
1371
1372#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1373#[serde(rename_all = "camelCase")]
1374pub struct GetAnimatedStylesForNodeReturns {
1375    /// Styles coming from animations.
1376
1377    #[serde(skip_serializing_if = "Option::is_none")]
1378    pub animationStyles: Option<Vec<CSSAnimationStyle>>,
1379    /// Style coming from transitions.
1380
1381    #[serde(skip_serializing_if = "Option::is_none")]
1382    pub transitionsStyle: Option<CSSStyle>,
1383    /// Inherited style entries for animationsStyle and transitionsStyle from
1384    /// the inheritance chain of the element.
1385
1386    #[serde(skip_serializing_if = "Option::is_none")]
1387    pub inherited: Option<Vec<InheritedAnimatedStyleEntry>>,
1388}
1389
1390impl GetAnimatedStylesForNodeParams { pub const METHOD: &'static str = "CSS.getAnimatedStylesForNode"; }
1391
1392impl crate::CdpCommand for GetAnimatedStylesForNodeParams {
1393    const METHOD: &'static str = "CSS.getAnimatedStylesForNode";
1394    type Response = GetAnimatedStylesForNodeReturns;
1395}
1396
1397/// Returns requested styles for a DOM node identified by 'nodeId'.
1398
1399#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1400#[serde(rename_all = "camelCase")]
1401pub struct GetMatchedStylesForNodeParams {
1402
1403    pub nodeId: crate::dom::NodeId,
1404}
1405
1406/// Returns requested styles for a DOM node identified by 'nodeId'.
1407
1408#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1409#[serde(rename_all = "camelCase")]
1410pub struct GetMatchedStylesForNodeReturns {
1411    /// Inline style for the specified DOM node.
1412
1413    #[serde(skip_serializing_if = "Option::is_none")]
1414    pub inlineStyle: Option<CSSStyle>,
1415    /// Attribute-defined element style (e.g. resulting from "width=20 height=100%").
1416
1417    #[serde(skip_serializing_if = "Option::is_none")]
1418    pub attributesStyle: Option<CSSStyle>,
1419    /// CSS rules matching this node, from all applicable stylesheets.
1420
1421    #[serde(skip_serializing_if = "Option::is_none")]
1422    pub matchedCSSRules: Option<Vec<RuleMatch>>,
1423    /// Pseudo style matches for this node.
1424
1425    #[serde(skip_serializing_if = "Option::is_none")]
1426    pub pseudoElements: Option<Vec<PseudoElementMatches>>,
1427    /// A chain of inherited styles (from the immediate node parent up to the DOM tree root).
1428
1429    #[serde(skip_serializing_if = "Option::is_none")]
1430    pub inherited: Option<Vec<InheritedStyleEntry>>,
1431    /// A chain of inherited pseudo element styles (from the immediate node parent up to the DOM tree root).
1432
1433    #[serde(skip_serializing_if = "Option::is_none")]
1434    pub inheritedPseudoElements: Option<Vec<InheritedPseudoElementMatches>>,
1435    /// A list of CSS keyframed animations matching this node.
1436
1437    #[serde(skip_serializing_if = "Option::is_none")]
1438    pub cssKeyframesRules: Option<Vec<CSSKeyframesRule>>,
1439    /// A list of CSS @position-try rules matching this node, based on the position-try-fallbacks property.
1440
1441    #[serde(skip_serializing_if = "Option::is_none")]
1442    pub cssPositionTryRules: Option<Vec<CSSPositionTryRule>>,
1443    /// Index of the active fallback in the applied position-try-fallback property,
1444    /// will not be set if there is no active position-try fallback.
1445
1446    #[serde(skip_serializing_if = "Option::is_none")]
1447    pub activePositionFallbackIndex: Option<u64>,
1448    /// A list of CSS at-property rules matching this node.
1449
1450    #[serde(skip_serializing_if = "Option::is_none")]
1451    pub cssPropertyRules: Option<Vec<CSSPropertyRule>>,
1452    /// A list of CSS property registrations matching this node.
1453
1454    #[serde(skip_serializing_if = "Option::is_none")]
1455    pub cssPropertyRegistrations: Option<Vec<CSSPropertyRegistration>>,
1456    /// A list of simple @rules matching this node or its pseudo-elements.
1457
1458    #[serde(skip_serializing_if = "Option::is_none")]
1459    pub cssAtRules: Option<Vec<CSSAtRule>>,
1460    /// Id of the first parent element that does not have display: contents.
1461
1462    #[serde(skip_serializing_if = "Option::is_none")]
1463    pub parentLayoutNodeId: Option<crate::dom::NodeId>,
1464    /// A list of CSS at-function rules referenced by styles of this node.
1465
1466    #[serde(skip_serializing_if = "Option::is_none")]
1467    pub cssFunctionRules: Option<Vec<CSSFunctionRule>>,
1468}
1469
1470impl GetMatchedStylesForNodeParams { pub const METHOD: &'static str = "CSS.getMatchedStylesForNode"; }
1471
1472impl crate::CdpCommand for GetMatchedStylesForNodeParams {
1473    const METHOD: &'static str = "CSS.getMatchedStylesForNode";
1474    type Response = GetMatchedStylesForNodeReturns;
1475}
1476
1477/// Returns the values of the default UA-defined environment variables used in env()
1478
1479#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1480#[serde(rename_all = "camelCase")]
1481pub struct GetEnvironmentVariablesReturns {
1482
1483    pub environmentVariables: serde_json::Map<String, JsonValue>,
1484}
1485
1486#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1487pub struct GetEnvironmentVariablesParams {}
1488
1489impl GetEnvironmentVariablesParams { pub const METHOD: &'static str = "CSS.getEnvironmentVariables"; }
1490
1491impl crate::CdpCommand for GetEnvironmentVariablesParams {
1492    const METHOD: &'static str = "CSS.getEnvironmentVariables";
1493    type Response = GetEnvironmentVariablesReturns;
1494}
1495
1496/// Returns all media queries parsed by the rendering engine.
1497
1498#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1499#[serde(rename_all = "camelCase")]
1500pub struct GetMediaQueriesReturns {
1501
1502    pub medias: Vec<CSSMedia>,
1503}
1504
1505#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1506pub struct GetMediaQueriesParams {}
1507
1508impl GetMediaQueriesParams { pub const METHOD: &'static str = "CSS.getMediaQueries"; }
1509
1510impl crate::CdpCommand for GetMediaQueriesParams {
1511    const METHOD: &'static str = "CSS.getMediaQueries";
1512    type Response = GetMediaQueriesReturns;
1513}
1514
1515/// Requests information about platform fonts which we used to render child TextNodes in the given
1516/// node.
1517
1518#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1519#[serde(rename_all = "camelCase")]
1520pub struct GetPlatformFontsForNodeParams {
1521
1522    pub nodeId: crate::dom::NodeId,
1523}
1524
1525/// Requests information about platform fonts which we used to render child TextNodes in the given
1526/// node.
1527
1528#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1529#[serde(rename_all = "camelCase")]
1530pub struct GetPlatformFontsForNodeReturns {
1531    /// Usage statistics for every employed platform font.
1532
1533    pub fonts: Vec<PlatformFontUsage>,
1534}
1535
1536impl GetPlatformFontsForNodeParams { pub const METHOD: &'static str = "CSS.getPlatformFontsForNode"; }
1537
1538impl crate::CdpCommand for GetPlatformFontsForNodeParams {
1539    const METHOD: &'static str = "CSS.getPlatformFontsForNode";
1540    type Response = GetPlatformFontsForNodeReturns;
1541}
1542
1543/// Returns the current textual content for a stylesheet.
1544
1545#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1546#[serde(rename_all = "camelCase")]
1547pub struct GetStyleSheetTextParams {
1548
1549    pub styleSheetId: crate::dom::StyleSheetId,
1550}
1551
1552/// Returns the current textual content for a stylesheet.
1553
1554#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1555#[serde(rename_all = "camelCase")]
1556pub struct GetStyleSheetTextReturns {
1557    /// The stylesheet text.
1558
1559    pub text: String,
1560}
1561
1562impl GetStyleSheetTextParams { pub const METHOD: &'static str = "CSS.getStyleSheetText"; }
1563
1564impl crate::CdpCommand for GetStyleSheetTextParams {
1565    const METHOD: &'static str = "CSS.getStyleSheetText";
1566    type Response = GetStyleSheetTextReturns;
1567}
1568
1569/// Returns all layers parsed by the rendering engine for the tree scope of a node.
1570/// Given a DOM element identified by nodeId, getLayersForNode returns the root
1571/// layer for the nearest ancestor document or shadow root. The layer root contains
1572/// the full layer tree for the tree scope and their ordering.
1573
1574#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1575#[serde(rename_all = "camelCase")]
1576pub struct GetLayersForNodeParams {
1577
1578    pub nodeId: crate::dom::NodeId,
1579}
1580
1581/// Returns all layers parsed by the rendering engine for the tree scope of a node.
1582/// Given a DOM element identified by nodeId, getLayersForNode returns the root
1583/// layer for the nearest ancestor document or shadow root. The layer root contains
1584/// the full layer tree for the tree scope and their ordering.
1585
1586#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1587#[serde(rename_all = "camelCase")]
1588pub struct GetLayersForNodeReturns {
1589
1590    pub rootLayer: CSSLayerData,
1591}
1592
1593impl GetLayersForNodeParams { pub const METHOD: &'static str = "CSS.getLayersForNode"; }
1594
1595impl crate::CdpCommand for GetLayersForNodeParams {
1596    const METHOD: &'static str = "CSS.getLayersForNode";
1597    type Response = GetLayersForNodeReturns;
1598}
1599
1600/// Given a CSS selector text and a style sheet ID, getLocationForSelector
1601/// returns an array of locations of the CSS selector in the style sheet.
1602
1603#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1604#[serde(rename_all = "camelCase")]
1605pub struct GetLocationForSelectorParams {
1606
1607    pub styleSheetId: crate::dom::StyleSheetId,
1608
1609    pub selectorText: String,
1610}
1611
1612/// Given a CSS selector text and a style sheet ID, getLocationForSelector
1613/// returns an array of locations of the CSS selector in the style sheet.
1614
1615#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1616#[serde(rename_all = "camelCase")]
1617pub struct GetLocationForSelectorReturns {
1618
1619    pub ranges: Vec<SourceRange>,
1620}
1621
1622impl GetLocationForSelectorParams { pub const METHOD: &'static str = "CSS.getLocationForSelector"; }
1623
1624impl crate::CdpCommand for GetLocationForSelectorParams {
1625    const METHOD: &'static str = "CSS.getLocationForSelector";
1626    type Response = GetLocationForSelectorReturns;
1627}
1628
1629/// Starts tracking the given node for the computed style updates
1630/// and whenever the computed style is updated for node, it queues
1631/// a 'computedStyleUpdated' event with throttling.
1632/// There can only be 1 node tracked for computed style updates
1633/// so passing a new node id removes tracking from the previous node.
1634/// Pass 'undefined' to disable tracking.
1635
1636#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1637#[serde(rename_all = "camelCase")]
1638pub struct TrackComputedStyleUpdatesForNodeParams {
1639
1640    #[serde(skip_serializing_if = "Option::is_none")]
1641    pub nodeId: Option<crate::dom::NodeId>,
1642}
1643
1644impl TrackComputedStyleUpdatesForNodeParams { pub const METHOD: &'static str = "CSS.trackComputedStyleUpdatesForNode"; }
1645
1646impl crate::CdpCommand for TrackComputedStyleUpdatesForNodeParams {
1647    const METHOD: &'static str = "CSS.trackComputedStyleUpdatesForNode";
1648    type Response = crate::EmptyReturns;
1649}
1650
1651/// Starts tracking the given computed styles for updates. The specified array of properties
1652/// replaces the one previously specified. Pass empty array to disable tracking.
1653/// Use takeComputedStyleUpdates to retrieve the list of nodes that had properties modified.
1654/// The changes to computed style properties are only tracked for nodes pushed to the front-end
1655/// by the DOM agent. If no changes to the tracked properties occur after the node has been pushed
1656/// to the front-end, no updates will be issued for the node.
1657
1658#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1659#[serde(rename_all = "camelCase")]
1660pub struct TrackComputedStyleUpdatesParams {
1661
1662    pub propertiesToTrack: Vec<CSSComputedStyleProperty>,
1663}
1664
1665impl TrackComputedStyleUpdatesParams { pub const METHOD: &'static str = "CSS.trackComputedStyleUpdates"; }
1666
1667impl crate::CdpCommand for TrackComputedStyleUpdatesParams {
1668    const METHOD: &'static str = "CSS.trackComputedStyleUpdates";
1669    type Response = crate::EmptyReturns;
1670}
1671
1672/// Polls the next batch of computed style updates.
1673
1674#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1675#[serde(rename_all = "camelCase")]
1676pub struct TakeComputedStyleUpdatesReturns {
1677    /// The list of node Ids that have their tracked computed styles updated.
1678
1679    pub nodeIds: Vec<crate::dom::NodeId>,
1680}
1681
1682#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1683pub struct TakeComputedStyleUpdatesParams {}
1684
1685impl TakeComputedStyleUpdatesParams { pub const METHOD: &'static str = "CSS.takeComputedStyleUpdates"; }
1686
1687impl crate::CdpCommand for TakeComputedStyleUpdatesParams {
1688    const METHOD: &'static str = "CSS.takeComputedStyleUpdates";
1689    type Response = TakeComputedStyleUpdatesReturns;
1690}
1691
1692/// Find a rule with the given active property for the given node and set the new value for this
1693/// property
1694
1695#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1696#[serde(rename_all = "camelCase")]
1697pub struct SetEffectivePropertyValueForNodeParams {
1698    /// The element id for which to set property.
1699
1700    pub nodeId: crate::dom::NodeId,
1701
1702    pub propertyName: String,
1703
1704    pub value: String,
1705}
1706
1707impl SetEffectivePropertyValueForNodeParams { pub const METHOD: &'static str = "CSS.setEffectivePropertyValueForNode"; }
1708
1709impl crate::CdpCommand for SetEffectivePropertyValueForNodeParams {
1710    const METHOD: &'static str = "CSS.setEffectivePropertyValueForNode";
1711    type Response = crate::EmptyReturns;
1712}
1713
1714/// Modifies the property rule property name.
1715
1716#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1717#[serde(rename_all = "camelCase")]
1718pub struct SetPropertyRulePropertyNameParams {
1719
1720    pub styleSheetId: crate::dom::StyleSheetId,
1721
1722    pub range: SourceRange,
1723
1724    pub propertyName: String,
1725}
1726
1727/// Modifies the property rule property name.
1728
1729#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1730#[serde(rename_all = "camelCase")]
1731pub struct SetPropertyRulePropertyNameReturns {
1732    /// The resulting key text after modification.
1733
1734    pub propertyName: ProtocolValue,
1735}
1736
1737impl SetPropertyRulePropertyNameParams { pub const METHOD: &'static str = "CSS.setPropertyRulePropertyName"; }
1738
1739impl crate::CdpCommand for SetPropertyRulePropertyNameParams {
1740    const METHOD: &'static str = "CSS.setPropertyRulePropertyName";
1741    type Response = SetPropertyRulePropertyNameReturns;
1742}
1743
1744/// Modifies the keyframe rule key text.
1745
1746#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1747#[serde(rename_all = "camelCase")]
1748pub struct SetKeyframeKeyParams {
1749
1750    pub styleSheetId: crate::dom::StyleSheetId,
1751
1752    pub range: SourceRange,
1753
1754    pub keyText: String,
1755}
1756
1757/// Modifies the keyframe rule key text.
1758
1759#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1760#[serde(rename_all = "camelCase")]
1761pub struct SetKeyframeKeyReturns {
1762    /// The resulting key text after modification.
1763
1764    pub keyText: ProtocolValue,
1765}
1766
1767impl SetKeyframeKeyParams { pub const METHOD: &'static str = "CSS.setKeyframeKey"; }
1768
1769impl crate::CdpCommand for SetKeyframeKeyParams {
1770    const METHOD: &'static str = "CSS.setKeyframeKey";
1771    type Response = SetKeyframeKeyReturns;
1772}
1773
1774/// Modifies the rule selector.
1775
1776#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1777#[serde(rename_all = "camelCase")]
1778pub struct SetMediaTextParams {
1779
1780    pub styleSheetId: crate::dom::StyleSheetId,
1781
1782    pub range: SourceRange,
1783
1784    pub text: String,
1785}
1786
1787/// Modifies the rule selector.
1788
1789#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1790#[serde(rename_all = "camelCase")]
1791pub struct SetMediaTextReturns {
1792    /// The resulting CSS media rule after modification.
1793
1794    pub media: CSSMedia,
1795}
1796
1797impl SetMediaTextParams { pub const METHOD: &'static str = "CSS.setMediaText"; }
1798
1799impl crate::CdpCommand for SetMediaTextParams {
1800    const METHOD: &'static str = "CSS.setMediaText";
1801    type Response = SetMediaTextReturns;
1802}
1803
1804/// Modifies the expression of a container query.
1805
1806#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1807#[serde(rename_all = "camelCase")]
1808pub struct SetContainerQueryTextParams {
1809
1810    pub styleSheetId: crate::dom::StyleSheetId,
1811
1812    pub range: SourceRange,
1813
1814    pub text: String,
1815}
1816
1817/// Modifies the expression of a container query.
1818
1819#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1820#[serde(rename_all = "camelCase")]
1821pub struct SetContainerQueryTextReturns {
1822    /// The resulting CSS container query rule after modification.
1823
1824    pub containerQuery: CSSContainerQuery,
1825}
1826
1827impl SetContainerQueryTextParams { pub const METHOD: &'static str = "CSS.setContainerQueryText"; }
1828
1829impl crate::CdpCommand for SetContainerQueryTextParams {
1830    const METHOD: &'static str = "CSS.setContainerQueryText";
1831    type Response = SetContainerQueryTextReturns;
1832}
1833
1834/// Modifies the expression of a supports at-rule.
1835
1836#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1837#[serde(rename_all = "camelCase")]
1838pub struct SetSupportsTextParams {
1839
1840    pub styleSheetId: crate::dom::StyleSheetId,
1841
1842    pub range: SourceRange,
1843
1844    pub text: String,
1845}
1846
1847/// Modifies the expression of a supports at-rule.
1848
1849#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1850#[serde(rename_all = "camelCase")]
1851pub struct SetSupportsTextReturns {
1852    /// The resulting CSS Supports rule after modification.
1853
1854    pub supports: CSSSupports,
1855}
1856
1857impl SetSupportsTextParams { pub const METHOD: &'static str = "CSS.setSupportsText"; }
1858
1859impl crate::CdpCommand for SetSupportsTextParams {
1860    const METHOD: &'static str = "CSS.setSupportsText";
1861    type Response = SetSupportsTextReturns;
1862}
1863
1864/// Modifies the expression of a navigation at-rule.
1865
1866#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1867#[serde(rename_all = "camelCase")]
1868pub struct SetNavigationTextParams {
1869
1870    pub styleSheetId: crate::dom::StyleSheetId,
1871
1872    pub range: SourceRange,
1873
1874    pub text: String,
1875}
1876
1877/// Modifies the expression of a navigation at-rule.
1878
1879#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1880#[serde(rename_all = "camelCase")]
1881pub struct SetNavigationTextReturns {
1882    /// The resulting CSS Navigation rule after modification.
1883
1884    pub navigation: CSSNavigation,
1885}
1886
1887impl SetNavigationTextParams { pub const METHOD: &'static str = "CSS.setNavigationText"; }
1888
1889impl crate::CdpCommand for SetNavigationTextParams {
1890    const METHOD: &'static str = "CSS.setNavigationText";
1891    type Response = SetNavigationTextReturns;
1892}
1893
1894/// Modifies the expression of a scope at-rule.
1895
1896#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1897#[serde(rename_all = "camelCase")]
1898pub struct SetScopeTextParams {
1899
1900    pub styleSheetId: crate::dom::StyleSheetId,
1901
1902    pub range: SourceRange,
1903
1904    pub text: String,
1905}
1906
1907/// Modifies the expression of a scope at-rule.
1908
1909#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1910#[serde(rename_all = "camelCase")]
1911pub struct SetScopeTextReturns {
1912    /// The resulting CSS Scope rule after modification.
1913
1914    pub scope: CSSScope,
1915}
1916
1917impl SetScopeTextParams { pub const METHOD: &'static str = "CSS.setScopeText"; }
1918
1919impl crate::CdpCommand for SetScopeTextParams {
1920    const METHOD: &'static str = "CSS.setScopeText";
1921    type Response = SetScopeTextReturns;
1922}
1923
1924/// Modifies the rule selector.
1925
1926#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1927#[serde(rename_all = "camelCase")]
1928pub struct SetRuleSelectorParams {
1929
1930    pub styleSheetId: crate::dom::StyleSheetId,
1931
1932    pub range: SourceRange,
1933
1934    pub selector: String,
1935}
1936
1937/// Modifies the rule selector.
1938
1939#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1940#[serde(rename_all = "camelCase")]
1941pub struct SetRuleSelectorReturns {
1942    /// The resulting selector list after modification.
1943
1944    pub selectorList: SelectorList,
1945}
1946
1947impl SetRuleSelectorParams { pub const METHOD: &'static str = "CSS.setRuleSelector"; }
1948
1949impl crate::CdpCommand for SetRuleSelectorParams {
1950    const METHOD: &'static str = "CSS.setRuleSelector";
1951    type Response = SetRuleSelectorReturns;
1952}
1953
1954/// Sets the new stylesheet text.
1955
1956#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1957#[serde(rename_all = "camelCase")]
1958pub struct SetStyleSheetTextParams {
1959
1960    pub styleSheetId: crate::dom::StyleSheetId,
1961
1962    pub text: String,
1963}
1964
1965/// Sets the new stylesheet text.
1966
1967#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1968#[serde(rename_all = "camelCase")]
1969pub struct SetStyleSheetTextReturns {
1970    /// URL of source map associated with script (if any).
1971
1972    #[serde(skip_serializing_if = "Option::is_none")]
1973    pub sourceMapURL: Option<String>,
1974}
1975
1976impl SetStyleSheetTextParams { pub const METHOD: &'static str = "CSS.setStyleSheetText"; }
1977
1978impl crate::CdpCommand for SetStyleSheetTextParams {
1979    const METHOD: &'static str = "CSS.setStyleSheetText";
1980    type Response = SetStyleSheetTextReturns;
1981}
1982
1983/// Applies specified style edits one after another in the given order.
1984
1985#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1986#[serde(rename_all = "camelCase")]
1987pub struct SetStyleTextsParams {
1988
1989    pub edits: Vec<StyleDeclarationEdit>,
1990    /// NodeId for the DOM node in whose context custom property declarations for registered properties should be
1991    /// validated. If omitted, declarations in the new rule text can only be validated statically, which may produce
1992    /// incorrect results if the declaration contains a var() for example.
1993
1994    #[serde(skip_serializing_if = "Option::is_none")]
1995    pub nodeForPropertySyntaxValidation: Option<crate::dom::NodeId>,
1996}
1997
1998/// Applies specified style edits one after another in the given order.
1999
2000#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2001#[serde(rename_all = "camelCase")]
2002pub struct SetStyleTextsReturns {
2003    /// The resulting styles after modification.
2004
2005    pub styles: Vec<CSSStyle>,
2006}
2007
2008impl SetStyleTextsParams { pub const METHOD: &'static str = "CSS.setStyleTexts"; }
2009
2010impl crate::CdpCommand for SetStyleTextsParams {
2011    const METHOD: &'static str = "CSS.setStyleTexts";
2012    type Response = SetStyleTextsReturns;
2013}
2014
2015#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2016pub struct StartRuleUsageTrackingParams {}
2017
2018impl StartRuleUsageTrackingParams { pub const METHOD: &'static str = "CSS.startRuleUsageTracking"; }
2019
2020impl crate::CdpCommand for StartRuleUsageTrackingParams {
2021    const METHOD: &'static str = "CSS.startRuleUsageTracking";
2022    type Response = crate::EmptyReturns;
2023}
2024
2025/// Stop tracking rule usage and return the list of rules that were used since last call to
2026/// 'takeCoverageDelta' (or since start of coverage instrumentation).
2027
2028#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2029#[serde(rename_all = "camelCase")]
2030pub struct StopRuleUsageTrackingReturns {
2031
2032    pub ruleUsage: Vec<RuleUsage>,
2033}
2034
2035#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2036pub struct StopRuleUsageTrackingParams {}
2037
2038impl StopRuleUsageTrackingParams { pub const METHOD: &'static str = "CSS.stopRuleUsageTracking"; }
2039
2040impl crate::CdpCommand for StopRuleUsageTrackingParams {
2041    const METHOD: &'static str = "CSS.stopRuleUsageTracking";
2042    type Response = StopRuleUsageTrackingReturns;
2043}
2044
2045/// Obtain list of rules that became used since last call to this method (or since start of coverage
2046/// instrumentation).
2047
2048#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2049#[serde(rename_all = "camelCase")]
2050pub struct TakeCoverageDeltaReturns {
2051
2052    pub coverage: Vec<RuleUsage>,
2053    /// Monotonically increasing time, in seconds.
2054
2055    pub timestamp: f64,
2056}
2057
2058#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2059pub struct TakeCoverageDeltaParams {}
2060
2061impl TakeCoverageDeltaParams { pub const METHOD: &'static str = "CSS.takeCoverageDelta"; }
2062
2063impl crate::CdpCommand for TakeCoverageDeltaParams {
2064    const METHOD: &'static str = "CSS.takeCoverageDelta";
2065    type Response = TakeCoverageDeltaReturns;
2066}
2067
2068/// Enables/disables rendering of local CSS fonts (enabled by default).
2069
2070#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2071#[serde(rename_all = "camelCase")]
2072pub struct SetLocalFontsEnabledParams {
2073    /// Whether rendering of local fonts is enabled.
2074
2075    pub enabled: bool,
2076}
2077
2078impl SetLocalFontsEnabledParams { pub const METHOD: &'static str = "CSS.setLocalFontsEnabled"; }
2079
2080impl crate::CdpCommand for SetLocalFontsEnabledParams {
2081    const METHOD: &'static str = "CSS.setLocalFontsEnabled";
2082    type Response = crate::EmptyReturns;
2083}