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