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
8
9use serde::{Serialize, Deserialize};
10use serde_json::Value as JsonValue;
11use std::borrow::Cow;
12
13/// Stylesheet type: "injected" for stylesheets injected via extension, "user-agent" for user-agent
14/// stylesheets, "inspector" for stylesheets created by the inspector (i.e. those holding the "via
15/// inspector" rules), "regular" for regular stylesheets.
16
17#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
18pub enum StyleSheetOrigin {
19    #[default]
20    #[serde(rename = "injected")]
21    Injected,
22    #[serde(rename = "user-agent")]
23    UserAgent,
24    #[serde(rename = "inspector")]
25    Inspector,
26    #[serde(rename = "regular")]
27    Regular,
28}
29
30/// CSS rule collection for a single pseudo style.
31
32#[derive(Debug, Clone, Serialize, Deserialize, Default)]
33#[serde(rename_all = "camelCase")]
34pub struct PseudoElementMatches<'a> {
35    /// Pseudo element type.
36    pseudoType: crate::dom::PseudoType,
37    /// Pseudo element custom ident.
38    #[serde(skip_serializing_if = "Option::is_none")]
39    pseudoIdentifier: Option<Cow<'a, str>>,
40    /// Matches of CSS rules applicable to the pseudo style.
41    matches: Vec<RuleMatch<'a>>,
42}
43
44impl<'a> PseudoElementMatches<'a> {
45    pub fn builder(pseudoType: crate::dom::PseudoType, matches: Vec<RuleMatch<'a>>) -> PseudoElementMatchesBuilder<'a> {
46        PseudoElementMatchesBuilder {
47            pseudoType: pseudoType,
48            pseudoIdentifier: None,
49            matches: matches,
50        }
51    }
52    pub fn pseudoType(&self) -> &crate::dom::PseudoType { &self.pseudoType }
53    pub fn pseudoIdentifier(&self) -> Option<&str> { self.pseudoIdentifier.as_deref() }
54    pub fn matches(&self) -> &[RuleMatch<'a>] { &self.matches }
55}
56
57
58pub struct PseudoElementMatchesBuilder<'a> {
59    pseudoType: crate::dom::PseudoType,
60    pseudoIdentifier: Option<Cow<'a, str>>,
61    matches: Vec<RuleMatch<'a>>,
62}
63
64impl<'a> PseudoElementMatchesBuilder<'a> {
65    /// Pseudo element custom ident.
66    pub fn pseudoIdentifier(mut self, pseudoIdentifier: impl Into<Cow<'a, str>>) -> Self { self.pseudoIdentifier = Some(pseudoIdentifier.into()); self }
67    pub fn build(self) -> PseudoElementMatches<'a> {
68        PseudoElementMatches {
69            pseudoType: self.pseudoType,
70            pseudoIdentifier: self.pseudoIdentifier,
71            matches: self.matches,
72        }
73    }
74}
75
76/// CSS style coming from animations with the name of the animation.
77
78#[derive(Debug, Clone, Serialize, Deserialize, Default)]
79#[serde(rename_all = "camelCase")]
80pub struct CSSAnimationStyle<'a> {
81    /// The name of the animation.
82    #[serde(skip_serializing_if = "Option::is_none")]
83    name: Option<Cow<'a, str>>,
84    /// The style coming from the animation.
85    style: CSSStyle<'a>,
86}
87
88impl<'a> CSSAnimationStyle<'a> {
89    pub fn builder(style: CSSStyle<'a>) -> CSSAnimationStyleBuilder<'a> {
90        CSSAnimationStyleBuilder {
91            name: None,
92            style: style,
93        }
94    }
95    pub fn name(&self) -> Option<&str> { self.name.as_deref() }
96    pub fn style(&self) -> &CSSStyle<'a> { &self.style }
97}
98
99
100pub struct CSSAnimationStyleBuilder<'a> {
101    name: Option<Cow<'a, str>>,
102    style: CSSStyle<'a>,
103}
104
105impl<'a> CSSAnimationStyleBuilder<'a> {
106    /// The name of the animation.
107    pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self { self.name = Some(name.into()); self }
108    pub fn build(self) -> CSSAnimationStyle<'a> {
109        CSSAnimationStyle {
110            name: self.name,
111            style: self.style,
112        }
113    }
114}
115
116/// Inherited CSS rule collection from ancestor node.
117
118#[derive(Debug, Clone, Serialize, Deserialize, Default)]
119#[serde(rename_all = "camelCase")]
120pub struct InheritedStyleEntry<'a> {
121    /// The ancestor node's inline style, if any, in the style inheritance chain.
122    #[serde(skip_serializing_if = "Option::is_none")]
123    inlineStyle: Option<CSSStyle<'a>>,
124    /// Matches of CSS rules matching the ancestor node in the style inheritance chain.
125    matchedCSSRules: Vec<RuleMatch<'a>>,
126}
127
128impl<'a> InheritedStyleEntry<'a> {
129    pub fn builder(matchedCSSRules: Vec<RuleMatch<'a>>) -> InheritedStyleEntryBuilder<'a> {
130        InheritedStyleEntryBuilder {
131            inlineStyle: None,
132            matchedCSSRules: matchedCSSRules,
133        }
134    }
135    pub fn inlineStyle(&self) -> Option<&CSSStyle<'a>> { self.inlineStyle.as_ref() }
136    pub fn matchedCSSRules(&self) -> &[RuleMatch<'a>] { &self.matchedCSSRules }
137}
138
139
140pub struct InheritedStyleEntryBuilder<'a> {
141    inlineStyle: Option<CSSStyle<'a>>,
142    matchedCSSRules: Vec<RuleMatch<'a>>,
143}
144
145impl<'a> InheritedStyleEntryBuilder<'a> {
146    /// The ancestor node's inline style, if any, in the style inheritance chain.
147    pub fn inlineStyle(mut self, inlineStyle: CSSStyle<'a>) -> Self { self.inlineStyle = Some(inlineStyle); self }
148    pub fn build(self) -> InheritedStyleEntry<'a> {
149        InheritedStyleEntry {
150            inlineStyle: self.inlineStyle,
151            matchedCSSRules: self.matchedCSSRules,
152        }
153    }
154}
155
156/// Inherited CSS style collection for animated styles from ancestor node.
157
158#[derive(Debug, Clone, Serialize, Deserialize, Default)]
159#[serde(rename_all = "camelCase")]
160pub struct InheritedAnimatedStyleEntry<'a> {
161    /// Styles coming from the animations of the ancestor, if any, in the style inheritance chain.
162    #[serde(skip_serializing_if = "Option::is_none")]
163    animationStyles: Option<Vec<CSSAnimationStyle<'a>>>,
164    /// The style coming from the transitions of the ancestor, if any, in the style inheritance chain.
165    #[serde(skip_serializing_if = "Option::is_none")]
166    transitionsStyle: Option<CSSStyle<'a>>,
167}
168
169impl<'a> InheritedAnimatedStyleEntry<'a> {
170    pub fn builder() -> InheritedAnimatedStyleEntryBuilder<'a> {
171        InheritedAnimatedStyleEntryBuilder {
172            animationStyles: None,
173            transitionsStyle: None,
174        }
175    }
176    pub fn animationStyles(&self) -> Option<&[CSSAnimationStyle<'a>]> { self.animationStyles.as_deref() }
177    pub fn transitionsStyle(&self) -> Option<&CSSStyle<'a>> { self.transitionsStyle.as_ref() }
178}
179
180#[derive(Default)]
181pub struct InheritedAnimatedStyleEntryBuilder<'a> {
182    animationStyles: Option<Vec<CSSAnimationStyle<'a>>>,
183    transitionsStyle: Option<CSSStyle<'a>>,
184}
185
186impl<'a> InheritedAnimatedStyleEntryBuilder<'a> {
187    /// Styles coming from the animations of the ancestor, if any, in the style inheritance chain.
188    pub fn animationStyles(mut self, animationStyles: Vec<CSSAnimationStyle<'a>>) -> Self { self.animationStyles = Some(animationStyles); self }
189    /// The style coming from the transitions of the ancestor, if any, in the style inheritance chain.
190    pub fn transitionsStyle(mut self, transitionsStyle: CSSStyle<'a>) -> Self { self.transitionsStyle = Some(transitionsStyle); self }
191    pub fn build(self) -> InheritedAnimatedStyleEntry<'a> {
192        InheritedAnimatedStyleEntry {
193            animationStyles: self.animationStyles,
194            transitionsStyle: self.transitionsStyle,
195        }
196    }
197}
198
199/// Inherited pseudo element matches from pseudos of an ancestor node.
200
201#[derive(Debug, Clone, Serialize, Deserialize, Default)]
202#[serde(rename_all = "camelCase")]
203pub struct InheritedPseudoElementMatches<'a> {
204    /// Matches of pseudo styles from the pseudos of an ancestor node.
205    pseudoElements: Vec<PseudoElementMatches<'a>>,
206}
207
208impl<'a> InheritedPseudoElementMatches<'a> {
209    pub fn builder(pseudoElements: Vec<PseudoElementMatches<'a>>) -> InheritedPseudoElementMatchesBuilder<'a> {
210        InheritedPseudoElementMatchesBuilder {
211            pseudoElements: pseudoElements,
212        }
213    }
214    pub fn pseudoElements(&self) -> &[PseudoElementMatches<'a>] { &self.pseudoElements }
215}
216
217
218pub struct InheritedPseudoElementMatchesBuilder<'a> {
219    pseudoElements: Vec<PseudoElementMatches<'a>>,
220}
221
222impl<'a> InheritedPseudoElementMatchesBuilder<'a> {
223    pub fn build(self) -> InheritedPseudoElementMatches<'a> {
224        InheritedPseudoElementMatches {
225            pseudoElements: self.pseudoElements,
226        }
227    }
228}
229
230/// Match data for a CSS rule.
231
232#[derive(Debug, Clone, Serialize, Deserialize, Default)]
233#[serde(rename_all = "camelCase")]
234pub struct RuleMatch<'a> {
235    /// CSS rule in the match.
236    rule: CSSRule<'a>,
237    /// Matching selector indices in the rule's selectorList selectors (0-based).
238    matchingSelectors: Vec<i64>,
239}
240
241impl<'a> RuleMatch<'a> {
242    pub fn builder(rule: CSSRule<'a>, matchingSelectors: Vec<i64>) -> RuleMatchBuilder<'a> {
243        RuleMatchBuilder {
244            rule: rule,
245            matchingSelectors: matchingSelectors,
246        }
247    }
248    pub fn rule(&self) -> &CSSRule<'a> { &self.rule }
249    pub fn matchingSelectors(&self) -> &[i64] { &self.matchingSelectors }
250}
251
252
253pub struct RuleMatchBuilder<'a> {
254    rule: CSSRule<'a>,
255    matchingSelectors: Vec<i64>,
256}
257
258impl<'a> RuleMatchBuilder<'a> {
259    pub fn build(self) -> RuleMatch<'a> {
260        RuleMatch {
261            rule: self.rule,
262            matchingSelectors: self.matchingSelectors,
263        }
264    }
265}
266
267/// Data for a simple selector (these are delimited by commas in a selector list).
268
269#[derive(Debug, Clone, Serialize, Deserialize, Default)]
270#[serde(rename_all = "camelCase")]
271pub struct ProtocolValue<'a> {
272    /// Value text.
273    text: Cow<'a, str>,
274    /// Value range in the underlying resource (if available).
275    #[serde(skip_serializing_if = "Option::is_none")]
276    range: Option<SourceRange>,
277    /// Specificity of the selector.
278    #[serde(skip_serializing_if = "Option::is_none")]
279    specificity: Option<Specificity>,
280}
281
282impl<'a> ProtocolValue<'a> {
283    pub fn builder(text: impl Into<Cow<'a, str>>) -> ProtocolValueBuilder<'a> {
284        ProtocolValueBuilder {
285            text: text.into(),
286            range: None,
287            specificity: None,
288        }
289    }
290    pub fn text(&self) -> &str { self.text.as_ref() }
291    pub fn range(&self) -> Option<&SourceRange> { self.range.as_ref() }
292    pub fn specificity(&self) -> Option<&Specificity> { self.specificity.as_ref() }
293}
294
295
296pub struct ProtocolValueBuilder<'a> {
297    text: Cow<'a, str>,
298    range: Option<SourceRange>,
299    specificity: Option<Specificity>,
300}
301
302impl<'a> ProtocolValueBuilder<'a> {
303    /// Value range in the underlying resource (if available).
304    pub fn range(mut self, range: SourceRange) -> Self { self.range = Some(range); self }
305    /// Specificity of the selector.
306    pub fn specificity(mut self, specificity: Specificity) -> Self { self.specificity = Some(specificity); self }
307    pub fn build(self) -> ProtocolValue<'a> {
308        ProtocolValue {
309            text: self.text,
310            range: self.range,
311            specificity: self.specificity,
312        }
313    }
314}
315
316/// Specificity:
317/// https://drafts.csswg.org/selectors/#specificity-rules
318
319#[derive(Debug, Clone, Serialize, Deserialize, Default)]
320#[serde(rename_all = "camelCase")]
321pub struct Specificity {
322    /// The a component, which represents the number of ID selectors.
323    a: i64,
324    /// The b component, which represents the number of class selectors, attributes selectors, and
325    /// pseudo-classes.
326    b: i64,
327    /// The c component, which represents the number of type selectors and pseudo-elements.
328    c: i64,
329}
330
331impl Specificity {
332    pub fn builder(a: i64, b: i64, c: i64) -> SpecificityBuilder {
333        SpecificityBuilder {
334            a: a,
335            b: b,
336            c: c,
337        }
338    }
339    pub fn a(&self) -> i64 { self.a }
340    pub fn b(&self) -> i64 { self.b }
341    pub fn c(&self) -> i64 { self.c }
342}
343
344
345pub struct SpecificityBuilder {
346    a: i64,
347    b: i64,
348    c: i64,
349}
350
351impl SpecificityBuilder {
352    pub fn build(self) -> Specificity {
353        Specificity {
354            a: self.a,
355            b: self.b,
356            c: self.c,
357        }
358    }
359}
360
361/// Selector list data.
362
363#[derive(Debug, Clone, Serialize, Deserialize, Default)]
364#[serde(rename_all = "camelCase")]
365pub struct SelectorList<'a> {
366    /// Selectors in the list.
367    selectors: Vec<ProtocolValue<'a>>,
368    /// Rule selector text.
369    text: Cow<'a, str>,
370}
371
372impl<'a> SelectorList<'a> {
373    pub fn builder(selectors: Vec<ProtocolValue<'a>>, text: impl Into<Cow<'a, str>>) -> SelectorListBuilder<'a> {
374        SelectorListBuilder {
375            selectors: selectors,
376            text: text.into(),
377        }
378    }
379    pub fn selectors(&self) -> &[ProtocolValue<'a>] { &self.selectors }
380    pub fn text(&self) -> &str { self.text.as_ref() }
381}
382
383
384pub struct SelectorListBuilder<'a> {
385    selectors: Vec<ProtocolValue<'a>>,
386    text: Cow<'a, str>,
387}
388
389impl<'a> SelectorListBuilder<'a> {
390    pub fn build(self) -> SelectorList<'a> {
391        SelectorList {
392            selectors: self.selectors,
393            text: self.text,
394        }
395    }
396}
397
398/// CSS stylesheet metainformation.
399
400#[derive(Debug, Clone, Serialize, Deserialize, Default)]
401#[serde(rename_all = "camelCase")]
402pub struct CSSStyleSheetHeader<'a> {
403    /// The stylesheet identifier.
404    styleSheetId: crate::dom::StyleSheetId<'a>,
405    /// Owner frame identifier.
406    frameId: crate::page::FrameId<'a>,
407    /// Stylesheet resource URL. Empty if this is a constructed stylesheet created using
408    /// new CSSStyleSheet() (but non-empty if this is a constructed stylesheet imported
409    /// as a CSS module script).
410    sourceURL: Cow<'a, str>,
411    /// URL of source map associated with the stylesheet (if any).
412    #[serde(skip_serializing_if = "Option::is_none")]
413    sourceMapURL: Option<Cow<'a, str>>,
414    /// Stylesheet origin.
415    origin: StyleSheetOrigin,
416    /// Stylesheet title.
417    title: Cow<'a, str>,
418    /// The backend id for the owner node of the stylesheet.
419    #[serde(skip_serializing_if = "Option::is_none")]
420    ownerNode: Option<crate::dom::BackendNodeId>,
421    /// Denotes whether the stylesheet is disabled.
422    disabled: bool,
423    /// Whether the sourceURL field value comes from the sourceURL comment.
424    #[serde(skip_serializing_if = "Option::is_none")]
425    hasSourceURL: Option<bool>,
426    /// Whether this stylesheet is created for STYLE tag by parser. This flag is not set for
427    /// document.written STYLE tags.
428    isInline: bool,
429    /// Whether this stylesheet is mutable. Inline stylesheets become mutable
430    /// after they have been modified via CSSOM API.
431    /// '<link>' element's stylesheets become mutable only if DevTools modifies them.
432    /// Constructed stylesheets (new CSSStyleSheet()) are mutable immediately after creation.
433    isMutable: bool,
434    /// True if this stylesheet is created through new CSSStyleSheet() or imported as a
435    /// CSS module script.
436    isConstructed: bool,
437    /// Line offset of the stylesheet within the resource (zero based).
438    startLine: f64,
439    /// Column offset of the stylesheet within the resource (zero based).
440    startColumn: f64,
441    /// Size of the content (in characters).
442    length: f64,
443    /// Line offset of the end of the stylesheet within the resource (zero based).
444    endLine: f64,
445    /// Column offset of the end of the stylesheet within the resource (zero based).
446    endColumn: f64,
447    /// If the style sheet was loaded from a network resource, this indicates when the resource failed to load
448    #[serde(skip_serializing_if = "Option::is_none")]
449    loadingFailed: Option<bool>,
450}
451
452impl<'a> CSSStyleSheetHeader<'a> {
453    pub fn builder(styleSheetId: crate::dom::StyleSheetId<'a>, frameId: crate::page::FrameId<'a>, sourceURL: impl Into<Cow<'a, str>>, origin: StyleSheetOrigin, title: impl Into<Cow<'a, str>>, disabled: bool, isInline: bool, isMutable: bool, isConstructed: bool, startLine: f64, startColumn: f64, length: f64, endLine: f64, endColumn: f64) -> CSSStyleSheetHeaderBuilder<'a> {
454        CSSStyleSheetHeaderBuilder {
455            styleSheetId: styleSheetId,
456            frameId: frameId,
457            sourceURL: sourceURL.into(),
458            sourceMapURL: None,
459            origin: origin,
460            title: title.into(),
461            ownerNode: None,
462            disabled: disabled,
463            hasSourceURL: None,
464            isInline: isInline,
465            isMutable: isMutable,
466            isConstructed: isConstructed,
467            startLine: startLine,
468            startColumn: startColumn,
469            length: length,
470            endLine: endLine,
471            endColumn: endColumn,
472            loadingFailed: None,
473        }
474    }
475    pub fn styleSheetId(&self) -> &crate::dom::StyleSheetId<'a> { &self.styleSheetId }
476    pub fn frameId(&self) -> &crate::page::FrameId<'a> { &self.frameId }
477    pub fn sourceURL(&self) -> &str { self.sourceURL.as_ref() }
478    pub fn sourceMapURL(&self) -> Option<&str> { self.sourceMapURL.as_deref() }
479    pub fn origin(&self) -> &StyleSheetOrigin { &self.origin }
480    pub fn title(&self) -> &str { self.title.as_ref() }
481    pub fn ownerNode(&self) -> Option<&crate::dom::BackendNodeId> { self.ownerNode.as_ref() }
482    pub fn disabled(&self) -> bool { self.disabled }
483    pub fn hasSourceURL(&self) -> Option<bool> { self.hasSourceURL }
484    pub fn isInline(&self) -> bool { self.isInline }
485    pub fn isMutable(&self) -> bool { self.isMutable }
486    pub fn isConstructed(&self) -> bool { self.isConstructed }
487    pub fn startLine(&self) -> f64 { self.startLine }
488    pub fn startColumn(&self) -> f64 { self.startColumn }
489    pub fn length(&self) -> f64 { self.length }
490    pub fn endLine(&self) -> f64 { self.endLine }
491    pub fn endColumn(&self) -> f64 { self.endColumn }
492    pub fn loadingFailed(&self) -> Option<bool> { self.loadingFailed }
493}
494
495
496pub struct CSSStyleSheetHeaderBuilder<'a> {
497    styleSheetId: crate::dom::StyleSheetId<'a>,
498    frameId: crate::page::FrameId<'a>,
499    sourceURL: Cow<'a, str>,
500    sourceMapURL: Option<Cow<'a, str>>,
501    origin: StyleSheetOrigin,
502    title: Cow<'a, str>,
503    ownerNode: Option<crate::dom::BackendNodeId>,
504    disabled: bool,
505    hasSourceURL: Option<bool>,
506    isInline: bool,
507    isMutable: bool,
508    isConstructed: bool,
509    startLine: f64,
510    startColumn: f64,
511    length: f64,
512    endLine: f64,
513    endColumn: f64,
514    loadingFailed: Option<bool>,
515}
516
517impl<'a> CSSStyleSheetHeaderBuilder<'a> {
518    /// URL of source map associated with the stylesheet (if any).
519    pub fn sourceMapURL(mut self, sourceMapURL: impl Into<Cow<'a, str>>) -> Self { self.sourceMapURL = Some(sourceMapURL.into()); self }
520    /// The backend id for the owner node of the stylesheet.
521    pub fn ownerNode(mut self, ownerNode: crate::dom::BackendNodeId) -> Self { self.ownerNode = Some(ownerNode); self }
522    /// Whether the sourceURL field value comes from the sourceURL comment.
523    pub fn hasSourceURL(mut self, hasSourceURL: bool) -> Self { self.hasSourceURL = Some(hasSourceURL); self }
524    /// If the style sheet was loaded from a network resource, this indicates when the resource failed to load
525    pub fn loadingFailed(mut self, loadingFailed: bool) -> Self { self.loadingFailed = Some(loadingFailed); self }
526    pub fn build(self) -> CSSStyleSheetHeader<'a> {
527        CSSStyleSheetHeader {
528            styleSheetId: self.styleSheetId,
529            frameId: self.frameId,
530            sourceURL: self.sourceURL,
531            sourceMapURL: self.sourceMapURL,
532            origin: self.origin,
533            title: self.title,
534            ownerNode: self.ownerNode,
535            disabled: self.disabled,
536            hasSourceURL: self.hasSourceURL,
537            isInline: self.isInline,
538            isMutable: self.isMutable,
539            isConstructed: self.isConstructed,
540            startLine: self.startLine,
541            startColumn: self.startColumn,
542            length: self.length,
543            endLine: self.endLine,
544            endColumn: self.endColumn,
545            loadingFailed: self.loadingFailed,
546        }
547    }
548}
549
550/// CSS rule representation.
551
552#[derive(Debug, Clone, Serialize, Deserialize, Default)]
553#[serde(rename_all = "camelCase")]
554pub struct CSSRule<'a> {
555    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
556    /// stylesheet rules) this rule came from.
557    #[serde(skip_serializing_if = "Option::is_none")]
558    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
559    /// Rule selector data.
560    selectorList: SelectorList<'a>,
561    /// Array of selectors from ancestor style rules, sorted by distance from the current rule.
562    #[serde(skip_serializing_if = "Option::is_none")]
563    nestingSelectors: Option<Vec<Cow<'a, str>>>,
564    /// Parent stylesheet's origin.
565    origin: StyleSheetOrigin,
566    /// Associated style declaration.
567    style: CSSStyle<'a>,
568    /// The BackendNodeId of the DOM node that constitutes the origin tree scope of this rule.
569    #[serde(skip_serializing_if = "Option::is_none")]
570    originTreeScopeNodeId: Option<crate::dom::BackendNodeId>,
571    /// Media list array (for rules involving media queries). The array enumerates media queries
572    /// starting with the innermost one, going outwards.
573    #[serde(skip_serializing_if = "Option::is_none")]
574    media: Option<Vec<CSSMedia<'a>>>,
575    /// Container query list array (for rules involving container queries).
576    /// The array enumerates container queries starting with the innermost one, going outwards.
577    #[serde(skip_serializing_if = "Option::is_none")]
578    containerQueries: Option<Vec<CSSContainerQuery<'a>>>,
579    /// @supports CSS at-rule array.
580    /// The array enumerates @supports at-rules starting with the innermost one, going outwards.
581    #[serde(skip_serializing_if = "Option::is_none")]
582    supports: Option<Vec<CSSSupports<'a>>>,
583    /// Cascade layer array. Contains the layer hierarchy that this rule belongs to starting
584    /// with the innermost layer and going outwards.
585    #[serde(skip_serializing_if = "Option::is_none")]
586    layers: Option<Vec<CSSLayer<'a>>>,
587    /// @scope CSS at-rule array.
588    /// The array enumerates @scope at-rules starting with the innermost one, going outwards.
589    #[serde(skip_serializing_if = "Option::is_none")]
590    scopes: Option<Vec<CSSScope<'a>>>,
591    /// The array keeps the types of ancestor CSSRules from the innermost going outwards.
592    #[serde(skip_serializing_if = "Option::is_none")]
593    ruleTypes: Option<Vec<CSSRuleType>>,
594    /// @starting-style CSS at-rule array.
595    /// The array enumerates @starting-style at-rules starting with the innermost one, going outwards.
596    #[serde(skip_serializing_if = "Option::is_none")]
597    startingStyles: Option<Vec<CSSStartingStyle<'a>>>,
598    /// @navigation CSS at-rule array.
599    /// The array enumerates @navigation at-rules starting with the innermost one, going outwards.
600    #[serde(skip_serializing_if = "Option::is_none")]
601    navigations: Option<Vec<CSSNavigation<'a>>>,
602}
603
604impl<'a> CSSRule<'a> {
605    pub fn builder(selectorList: SelectorList<'a>, origin: StyleSheetOrigin, style: CSSStyle<'a>) -> CSSRuleBuilder<'a> {
606        CSSRuleBuilder {
607            styleSheetId: None,
608            selectorList: selectorList,
609            nestingSelectors: None,
610            origin: origin,
611            style: style,
612            originTreeScopeNodeId: None,
613            media: None,
614            containerQueries: None,
615            supports: None,
616            layers: None,
617            scopes: None,
618            ruleTypes: None,
619            startingStyles: None,
620            navigations: None,
621        }
622    }
623    pub fn styleSheetId(&self) -> Option<&crate::dom::StyleSheetId<'a>> { self.styleSheetId.as_ref() }
624    pub fn selectorList(&self) -> &SelectorList<'a> { &self.selectorList }
625    pub fn nestingSelectors(&self) -> Option<&[Cow<'a, str>]> { self.nestingSelectors.as_deref() }
626    pub fn origin(&self) -> &StyleSheetOrigin { &self.origin }
627    pub fn style(&self) -> &CSSStyle<'a> { &self.style }
628    pub fn originTreeScopeNodeId(&self) -> Option<&crate::dom::BackendNodeId> { self.originTreeScopeNodeId.as_ref() }
629    pub fn media(&self) -> Option<&[CSSMedia<'a>]> { self.media.as_deref() }
630    pub fn containerQueries(&self) -> Option<&[CSSContainerQuery<'a>]> { self.containerQueries.as_deref() }
631    pub fn supports(&self) -> Option<&[CSSSupports<'a>]> { self.supports.as_deref() }
632    pub fn layers(&self) -> Option<&[CSSLayer<'a>]> { self.layers.as_deref() }
633    pub fn scopes(&self) -> Option<&[CSSScope<'a>]> { self.scopes.as_deref() }
634    pub fn ruleTypes(&self) -> Option<&[CSSRuleType]> { self.ruleTypes.as_deref() }
635    pub fn startingStyles(&self) -> Option<&[CSSStartingStyle<'a>]> { self.startingStyles.as_deref() }
636    pub fn navigations(&self) -> Option<&[CSSNavigation<'a>]> { self.navigations.as_deref() }
637}
638
639
640pub struct CSSRuleBuilder<'a> {
641    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
642    selectorList: SelectorList<'a>,
643    nestingSelectors: Option<Vec<Cow<'a, str>>>,
644    origin: StyleSheetOrigin,
645    style: CSSStyle<'a>,
646    originTreeScopeNodeId: Option<crate::dom::BackendNodeId>,
647    media: Option<Vec<CSSMedia<'a>>>,
648    containerQueries: Option<Vec<CSSContainerQuery<'a>>>,
649    supports: Option<Vec<CSSSupports<'a>>>,
650    layers: Option<Vec<CSSLayer<'a>>>,
651    scopes: Option<Vec<CSSScope<'a>>>,
652    ruleTypes: Option<Vec<CSSRuleType>>,
653    startingStyles: Option<Vec<CSSStartingStyle<'a>>>,
654    navigations: Option<Vec<CSSNavigation<'a>>>,
655}
656
657impl<'a> CSSRuleBuilder<'a> {
658    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
659    /// stylesheet rules) this rule came from.
660    pub fn styleSheetId(mut self, styleSheetId: crate::dom::StyleSheetId<'a>) -> Self { self.styleSheetId = Some(styleSheetId); self }
661    /// Array of selectors from ancestor style rules, sorted by distance from the current rule.
662    pub fn nestingSelectors(mut self, nestingSelectors: Vec<Cow<'a, str>>) -> Self { self.nestingSelectors = Some(nestingSelectors); self }
663    /// The BackendNodeId of the DOM node that constitutes the origin tree scope of this rule.
664    pub fn originTreeScopeNodeId(mut self, originTreeScopeNodeId: crate::dom::BackendNodeId) -> Self { self.originTreeScopeNodeId = Some(originTreeScopeNodeId); self }
665    /// Media list array (for rules involving media queries). The array enumerates media queries
666    /// starting with the innermost one, going outwards.
667    pub fn media(mut self, media: Vec<CSSMedia<'a>>) -> Self { self.media = Some(media); self }
668    /// Container query list array (for rules involving container queries).
669    /// The array enumerates container queries starting with the innermost one, going outwards.
670    pub fn containerQueries(mut self, containerQueries: Vec<CSSContainerQuery<'a>>) -> Self { self.containerQueries = Some(containerQueries); self }
671    /// @supports CSS at-rule array.
672    /// The array enumerates @supports at-rules starting with the innermost one, going outwards.
673    pub fn supports(mut self, supports: Vec<CSSSupports<'a>>) -> Self { self.supports = Some(supports); self }
674    /// Cascade layer array. Contains the layer hierarchy that this rule belongs to starting
675    /// with the innermost layer and going outwards.
676    pub fn layers(mut self, layers: Vec<CSSLayer<'a>>) -> Self { self.layers = Some(layers); self }
677    /// @scope CSS at-rule array.
678    /// The array enumerates @scope at-rules starting with the innermost one, going outwards.
679    pub fn scopes(mut self, scopes: Vec<CSSScope<'a>>) -> Self { self.scopes = Some(scopes); self }
680    /// The array keeps the types of ancestor CSSRules from the innermost going outwards.
681    pub fn ruleTypes(mut self, ruleTypes: Vec<CSSRuleType>) -> Self { self.ruleTypes = Some(ruleTypes); self }
682    /// @starting-style CSS at-rule array.
683    /// The array enumerates @starting-style at-rules starting with the innermost one, going outwards.
684    pub fn startingStyles(mut self, startingStyles: Vec<CSSStartingStyle<'a>>) -> Self { self.startingStyles = Some(startingStyles); self }
685    /// @navigation CSS at-rule array.
686    /// The array enumerates @navigation at-rules starting with the innermost one, going outwards.
687    pub fn navigations(mut self, navigations: Vec<CSSNavigation<'a>>) -> Self { self.navigations = Some(navigations); self }
688    pub fn build(self) -> CSSRule<'a> {
689        CSSRule {
690            styleSheetId: self.styleSheetId,
691            selectorList: self.selectorList,
692            nestingSelectors: self.nestingSelectors,
693            origin: self.origin,
694            style: self.style,
695            originTreeScopeNodeId: self.originTreeScopeNodeId,
696            media: self.media,
697            containerQueries: self.containerQueries,
698            supports: self.supports,
699            layers: self.layers,
700            scopes: self.scopes,
701            ruleTypes: self.ruleTypes,
702            startingStyles: self.startingStyles,
703            navigations: self.navigations,
704        }
705    }
706}
707
708/// Enum indicating the type of a CSS rule, used to represent the order of a style rule's ancestors.
709/// This list only contains rule types that are collected during the ancestor rule collection.
710
711#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
712pub enum CSSRuleType {
713    #[default]
714    #[serde(rename = "MediaRule")]
715    MediaRule,
716    #[serde(rename = "SupportsRule")]
717    SupportsRule,
718    #[serde(rename = "ContainerRule")]
719    ContainerRule,
720    #[serde(rename = "LayerRule")]
721    LayerRule,
722    #[serde(rename = "ScopeRule")]
723    ScopeRule,
724    #[serde(rename = "StyleRule")]
725    StyleRule,
726    #[serde(rename = "StartingStyleRule")]
727    StartingStyleRule,
728    #[serde(rename = "NavigationRule")]
729    NavigationRule,
730}
731
732/// CSS coverage information.
733
734#[derive(Debug, Clone, Serialize, Deserialize, Default)]
735#[serde(rename_all = "camelCase")]
736pub struct RuleUsage<'a> {
737    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
738    /// stylesheet rules) this rule came from.
739    styleSheetId: crate::dom::StyleSheetId<'a>,
740    /// Offset of the start of the rule (including selector) from the beginning of the stylesheet.
741    startOffset: f64,
742    /// Offset of the end of the rule body from the beginning of the stylesheet.
743    endOffset: f64,
744    /// Indicates whether the rule was actually used by some element in the page.
745    used: bool,
746}
747
748impl<'a> RuleUsage<'a> {
749    pub fn builder(styleSheetId: crate::dom::StyleSheetId<'a>, startOffset: f64, endOffset: f64, used: bool) -> RuleUsageBuilder<'a> {
750        RuleUsageBuilder {
751            styleSheetId: styleSheetId,
752            startOffset: startOffset,
753            endOffset: endOffset,
754            used: used,
755        }
756    }
757    pub fn styleSheetId(&self) -> &crate::dom::StyleSheetId<'a> { &self.styleSheetId }
758    pub fn startOffset(&self) -> f64 { self.startOffset }
759    pub fn endOffset(&self) -> f64 { self.endOffset }
760    pub fn used(&self) -> bool { self.used }
761}
762
763
764pub struct RuleUsageBuilder<'a> {
765    styleSheetId: crate::dom::StyleSheetId<'a>,
766    startOffset: f64,
767    endOffset: f64,
768    used: bool,
769}
770
771impl<'a> RuleUsageBuilder<'a> {
772    pub fn build(self) -> RuleUsage<'a> {
773        RuleUsage {
774            styleSheetId: self.styleSheetId,
775            startOffset: self.startOffset,
776            endOffset: self.endOffset,
777            used: self.used,
778        }
779    }
780}
781
782/// Text range within a resource. All numbers are zero-based.
783
784#[derive(Debug, Clone, Serialize, Deserialize, Default)]
785#[serde(rename_all = "camelCase")]
786pub struct SourceRange {
787    /// Start line of range.
788    startLine: i64,
789    /// Start column of range (inclusive).
790    startColumn: i64,
791    /// End line of range
792    endLine: i64,
793    /// End column of range (exclusive).
794    endColumn: i64,
795}
796
797impl SourceRange {
798    pub fn builder(startLine: i64, startColumn: i64, endLine: i64, endColumn: i64) -> SourceRangeBuilder {
799        SourceRangeBuilder {
800            startLine: startLine,
801            startColumn: startColumn,
802            endLine: endLine,
803            endColumn: endColumn,
804        }
805    }
806    pub fn startLine(&self) -> i64 { self.startLine }
807    pub fn startColumn(&self) -> i64 { self.startColumn }
808    pub fn endLine(&self) -> i64 { self.endLine }
809    pub fn endColumn(&self) -> i64 { self.endColumn }
810}
811
812
813pub struct SourceRangeBuilder {
814    startLine: i64,
815    startColumn: i64,
816    endLine: i64,
817    endColumn: i64,
818}
819
820impl SourceRangeBuilder {
821    pub fn build(self) -> SourceRange {
822        SourceRange {
823            startLine: self.startLine,
824            startColumn: self.startColumn,
825            endLine: self.endLine,
826            endColumn: self.endColumn,
827        }
828    }
829}
830
831
832#[derive(Debug, Clone, Serialize, Deserialize, Default)]
833#[serde(rename_all = "camelCase")]
834pub struct ShorthandEntry<'a> {
835    /// Shorthand name.
836    name: Cow<'a, str>,
837    /// Shorthand value.
838    value: Cow<'a, str>,
839    /// Whether the property has "!important" annotation (implies 'false' if absent).
840    #[serde(skip_serializing_if = "Option::is_none")]
841    important: Option<bool>,
842}
843
844impl<'a> ShorthandEntry<'a> {
845    pub fn builder(name: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>) -> ShorthandEntryBuilder<'a> {
846        ShorthandEntryBuilder {
847            name: name.into(),
848            value: value.into(),
849            important: None,
850        }
851    }
852    pub fn name(&self) -> &str { self.name.as_ref() }
853    pub fn value(&self) -> &str { self.value.as_ref() }
854    pub fn important(&self) -> Option<bool> { self.important }
855}
856
857
858pub struct ShorthandEntryBuilder<'a> {
859    name: Cow<'a, str>,
860    value: Cow<'a, str>,
861    important: Option<bool>,
862}
863
864impl<'a> ShorthandEntryBuilder<'a> {
865    /// Whether the property has "!important" annotation (implies 'false' if absent).
866    pub fn important(mut self, important: bool) -> Self { self.important = Some(important); self }
867    pub fn build(self) -> ShorthandEntry<'a> {
868        ShorthandEntry {
869            name: self.name,
870            value: self.value,
871            important: self.important,
872        }
873    }
874}
875
876
877#[derive(Debug, Clone, Serialize, Deserialize, Default)]
878#[serde(rename_all = "camelCase")]
879pub struct CSSComputedStyleProperty<'a> {
880    /// Computed style property name.
881    name: Cow<'a, str>,
882    /// Computed style property value.
883    value: Cow<'a, str>,
884}
885
886impl<'a> CSSComputedStyleProperty<'a> {
887    pub fn builder(name: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>) -> CSSComputedStylePropertyBuilder<'a> {
888        CSSComputedStylePropertyBuilder {
889            name: name.into(),
890            value: value.into(),
891        }
892    }
893    pub fn name(&self) -> &str { self.name.as_ref() }
894    pub fn value(&self) -> &str { self.value.as_ref() }
895}
896
897
898pub struct CSSComputedStylePropertyBuilder<'a> {
899    name: Cow<'a, str>,
900    value: Cow<'a, str>,
901}
902
903impl<'a> CSSComputedStylePropertyBuilder<'a> {
904    pub fn build(self) -> CSSComputedStyleProperty<'a> {
905        CSSComputedStyleProperty {
906            name: self.name,
907            value: self.value,
908        }
909    }
910}
911
912
913#[derive(Debug, Clone, Serialize, Deserialize, Default)]
914#[serde(rename_all = "camelCase")]
915pub struct ComputedStyleExtraFields {
916    /// Returns whether or not this node is being rendered with base appearance,
917    /// which happens when it has its appearance property set to base/base-select
918    /// or it is in the subtree of an element being rendered with base appearance.
919    isAppearanceBase: bool,
920}
921
922impl ComputedStyleExtraFields {
923    pub fn builder(isAppearanceBase: bool) -> ComputedStyleExtraFieldsBuilder {
924        ComputedStyleExtraFieldsBuilder {
925            isAppearanceBase: isAppearanceBase,
926        }
927    }
928    pub fn isAppearanceBase(&self) -> bool { self.isAppearanceBase }
929}
930
931
932pub struct ComputedStyleExtraFieldsBuilder {
933    isAppearanceBase: bool,
934}
935
936impl ComputedStyleExtraFieldsBuilder {
937    pub fn build(self) -> ComputedStyleExtraFields {
938        ComputedStyleExtraFields {
939            isAppearanceBase: self.isAppearanceBase,
940        }
941    }
942}
943
944/// CSS style representation.
945
946#[derive(Debug, Clone, Serialize, Deserialize, Default)]
947#[serde(rename_all = "camelCase")]
948pub struct CSSStyle<'a> {
949    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
950    /// stylesheet rules) this rule came from.
951    #[serde(skip_serializing_if = "Option::is_none")]
952    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
953    /// CSS properties in the style.
954    cssProperties: Vec<CSSProperty<'a>>,
955    /// Computed values for all shorthands found in the style.
956    shorthandEntries: Vec<ShorthandEntry<'a>>,
957    /// Style declaration text (if available).
958    #[serde(skip_serializing_if = "Option::is_none")]
959    cssText: Option<Cow<'a, str>>,
960    /// Style declaration range in the enclosing stylesheet (if available).
961    #[serde(skip_serializing_if = "Option::is_none")]
962    range: Option<SourceRange>,
963}
964
965impl<'a> CSSStyle<'a> {
966    pub fn builder(cssProperties: Vec<CSSProperty<'a>>, shorthandEntries: Vec<ShorthandEntry<'a>>) -> CSSStyleBuilder<'a> {
967        CSSStyleBuilder {
968            styleSheetId: None,
969            cssProperties: cssProperties,
970            shorthandEntries: shorthandEntries,
971            cssText: None,
972            range: None,
973        }
974    }
975    pub fn styleSheetId(&self) -> Option<&crate::dom::StyleSheetId<'a>> { self.styleSheetId.as_ref() }
976    pub fn cssProperties(&self) -> &[CSSProperty<'a>] { &self.cssProperties }
977    pub fn shorthandEntries(&self) -> &[ShorthandEntry<'a>] { &self.shorthandEntries }
978    pub fn cssText(&self) -> Option<&str> { self.cssText.as_deref() }
979    pub fn range(&self) -> Option<&SourceRange> { self.range.as_ref() }
980}
981
982
983pub struct CSSStyleBuilder<'a> {
984    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
985    cssProperties: Vec<CSSProperty<'a>>,
986    shorthandEntries: Vec<ShorthandEntry<'a>>,
987    cssText: Option<Cow<'a, str>>,
988    range: Option<SourceRange>,
989}
990
991impl<'a> CSSStyleBuilder<'a> {
992    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
993    /// stylesheet rules) this rule came from.
994    pub fn styleSheetId(mut self, styleSheetId: crate::dom::StyleSheetId<'a>) -> Self { self.styleSheetId = Some(styleSheetId); self }
995    /// Style declaration text (if available).
996    pub fn cssText(mut self, cssText: impl Into<Cow<'a, str>>) -> Self { self.cssText = Some(cssText.into()); self }
997    /// Style declaration range in the enclosing stylesheet (if available).
998    pub fn range(mut self, range: SourceRange) -> Self { self.range = Some(range); self }
999    pub fn build(self) -> CSSStyle<'a> {
1000        CSSStyle {
1001            styleSheetId: self.styleSheetId,
1002            cssProperties: self.cssProperties,
1003            shorthandEntries: self.shorthandEntries,
1004            cssText: self.cssText,
1005            range: self.range,
1006        }
1007    }
1008}
1009
1010/// CSS property declaration data.
1011
1012#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1013#[serde(rename_all = "camelCase")]
1014pub struct CSSProperty<'a> {
1015    /// The property name.
1016    name: Cow<'a, str>,
1017    /// The property value.
1018    value: Cow<'a, str>,
1019    /// Whether the property has "!important" annotation (implies 'false' if absent).
1020    #[serde(skip_serializing_if = "Option::is_none")]
1021    important: Option<bool>,
1022    /// Whether the property is implicit (implies 'false' if absent).
1023    #[serde(skip_serializing_if = "Option::is_none")]
1024    implicit: Option<bool>,
1025    /// The full property text as specified in the style.
1026    #[serde(skip_serializing_if = "Option::is_none")]
1027    text: Option<Cow<'a, str>>,
1028    /// Whether the property is understood by the browser (implies 'true' if absent).
1029    #[serde(skip_serializing_if = "Option::is_none")]
1030    parsedOk: Option<bool>,
1031    /// Whether the property is disabled by the user (present for source-based properties only).
1032    #[serde(skip_serializing_if = "Option::is_none")]
1033    disabled: Option<bool>,
1034    /// The entire property range in the enclosing style declaration (if available).
1035    #[serde(skip_serializing_if = "Option::is_none")]
1036    range: Option<SourceRange>,
1037    /// Parsed longhand components of this property if it is a shorthand.
1038    /// This field will be empty if the given property is not a shorthand.
1039    #[serde(skip_serializing_if = "Option::is_none")]
1040    longhandProperties: Option<Vec<Box<CSSProperty<'a>>>>,
1041}
1042
1043impl<'a> CSSProperty<'a> {
1044    pub fn builder(name: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>) -> CSSPropertyBuilder<'a> {
1045        CSSPropertyBuilder {
1046            name: name.into(),
1047            value: value.into(),
1048            important: None,
1049            implicit: None,
1050            text: None,
1051            parsedOk: None,
1052            disabled: None,
1053            range: None,
1054            longhandProperties: None,
1055        }
1056    }
1057    pub fn name(&self) -> &str { self.name.as_ref() }
1058    pub fn value(&self) -> &str { self.value.as_ref() }
1059    pub fn important(&self) -> Option<bool> { self.important }
1060    pub fn implicit(&self) -> Option<bool> { self.implicit }
1061    pub fn text(&self) -> Option<&str> { self.text.as_deref() }
1062    pub fn parsedOk(&self) -> Option<bool> { self.parsedOk }
1063    pub fn disabled(&self) -> Option<bool> { self.disabled }
1064    pub fn range(&self) -> Option<&SourceRange> { self.range.as_ref() }
1065    pub fn longhandProperties(&self) -> Option<&[Box<CSSProperty<'a>>]> { self.longhandProperties.as_deref() }
1066}
1067
1068
1069pub struct CSSPropertyBuilder<'a> {
1070    name: Cow<'a, str>,
1071    value: Cow<'a, str>,
1072    important: Option<bool>,
1073    implicit: Option<bool>,
1074    text: Option<Cow<'a, str>>,
1075    parsedOk: Option<bool>,
1076    disabled: Option<bool>,
1077    range: Option<SourceRange>,
1078    longhandProperties: Option<Vec<Box<CSSProperty<'a>>>>,
1079}
1080
1081impl<'a> CSSPropertyBuilder<'a> {
1082    /// Whether the property has "!important" annotation (implies 'false' if absent).
1083    pub fn important(mut self, important: bool) -> Self { self.important = Some(important); self }
1084    /// Whether the property is implicit (implies 'false' if absent).
1085    pub fn implicit(mut self, implicit: bool) -> Self { self.implicit = Some(implicit); self }
1086    /// The full property text as specified in the style.
1087    pub fn text(mut self, text: impl Into<Cow<'a, str>>) -> Self { self.text = Some(text.into()); self }
1088    /// Whether the property is understood by the browser (implies 'true' if absent).
1089    pub fn parsedOk(mut self, parsedOk: bool) -> Self { self.parsedOk = Some(parsedOk); self }
1090    /// Whether the property is disabled by the user (present for source-based properties only).
1091    pub fn disabled(mut self, disabled: bool) -> Self { self.disabled = Some(disabled); self }
1092    /// The entire property range in the enclosing style declaration (if available).
1093    pub fn range(mut self, range: SourceRange) -> Self { self.range = Some(range); self }
1094    /// Parsed longhand components of this property if it is a shorthand.
1095    /// This field will be empty if the given property is not a shorthand.
1096    pub fn longhandProperties(mut self, longhandProperties: Vec<Box<CSSProperty<'a>>>) -> Self { self.longhandProperties = Some(longhandProperties); self }
1097    pub fn build(self) -> CSSProperty<'a> {
1098        CSSProperty {
1099            name: self.name,
1100            value: self.value,
1101            important: self.important,
1102            implicit: self.implicit,
1103            text: self.text,
1104            parsedOk: self.parsedOk,
1105            disabled: self.disabled,
1106            range: self.range,
1107            longhandProperties: self.longhandProperties,
1108        }
1109    }
1110}
1111
1112/// CSS media rule descriptor.
1113
1114#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1115#[serde(rename_all = "camelCase")]
1116pub struct CSSMedia<'a> {
1117    /// Media query text.
1118    text: Cow<'a, str>,
1119    /// Source of the media query: "mediaRule" if specified by a @media rule, "importRule" if
1120    /// specified by an @import rule, "linkedSheet" if specified by a "media" attribute in a linked
1121    /// stylesheet's LINK tag, "inlineSheet" if specified by a "media" attribute in an inline
1122    /// stylesheet's STYLE tag.
1123    source: Cow<'a, str>,
1124    /// URL of the document containing the media query description.
1125    #[serde(skip_serializing_if = "Option::is_none")]
1126    sourceURL: Option<Cow<'a, str>>,
1127    /// The associated rule (@media or @import) header range in the enclosing stylesheet (if
1128    /// available).
1129    #[serde(skip_serializing_if = "Option::is_none")]
1130    range: Option<SourceRange>,
1131    /// Identifier of the stylesheet containing this object (if exists).
1132    #[serde(skip_serializing_if = "Option::is_none")]
1133    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1134    /// Array of media queries.
1135    #[serde(skip_serializing_if = "Option::is_none")]
1136    mediaList: Option<Vec<MediaQuery<'a>>>,
1137}
1138
1139impl<'a> CSSMedia<'a> {
1140    pub fn builder(text: impl Into<Cow<'a, str>>, source: impl Into<Cow<'a, str>>) -> CSSMediaBuilder<'a> {
1141        CSSMediaBuilder {
1142            text: text.into(),
1143            source: source.into(),
1144            sourceURL: None,
1145            range: None,
1146            styleSheetId: None,
1147            mediaList: None,
1148        }
1149    }
1150    pub fn text(&self) -> &str { self.text.as_ref() }
1151    pub fn source(&self) -> &str { self.source.as_ref() }
1152    pub fn sourceURL(&self) -> Option<&str> { self.sourceURL.as_deref() }
1153    pub fn range(&self) -> Option<&SourceRange> { self.range.as_ref() }
1154    pub fn styleSheetId(&self) -> Option<&crate::dom::StyleSheetId<'a>> { self.styleSheetId.as_ref() }
1155    pub fn mediaList(&self) -> Option<&[MediaQuery<'a>]> { self.mediaList.as_deref() }
1156}
1157
1158
1159pub struct CSSMediaBuilder<'a> {
1160    text: Cow<'a, str>,
1161    source: Cow<'a, str>,
1162    sourceURL: Option<Cow<'a, str>>,
1163    range: Option<SourceRange>,
1164    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1165    mediaList: Option<Vec<MediaQuery<'a>>>,
1166}
1167
1168impl<'a> CSSMediaBuilder<'a> {
1169    /// URL of the document containing the media query description.
1170    pub fn sourceURL(mut self, sourceURL: impl Into<Cow<'a, str>>) -> Self { self.sourceURL = Some(sourceURL.into()); self }
1171    /// The associated rule (@media or @import) header range in the enclosing stylesheet (if
1172    /// available).
1173    pub fn range(mut self, range: SourceRange) -> Self { self.range = Some(range); self }
1174    /// Identifier of the stylesheet containing this object (if exists).
1175    pub fn styleSheetId(mut self, styleSheetId: crate::dom::StyleSheetId<'a>) -> Self { self.styleSheetId = Some(styleSheetId); self }
1176    /// Array of media queries.
1177    pub fn mediaList(mut self, mediaList: Vec<MediaQuery<'a>>) -> Self { self.mediaList = Some(mediaList); self }
1178    pub fn build(self) -> CSSMedia<'a> {
1179        CSSMedia {
1180            text: self.text,
1181            source: self.source,
1182            sourceURL: self.sourceURL,
1183            range: self.range,
1184            styleSheetId: self.styleSheetId,
1185            mediaList: self.mediaList,
1186        }
1187    }
1188}
1189
1190/// Media query descriptor.
1191
1192#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1193#[serde(rename_all = "camelCase")]
1194pub struct MediaQuery<'a> {
1195    /// Array of media query expressions.
1196    expressions: Vec<MediaQueryExpression<'a>>,
1197    /// Whether the media query condition is satisfied.
1198    active: bool,
1199}
1200
1201impl<'a> MediaQuery<'a> {
1202    pub fn builder(expressions: Vec<MediaQueryExpression<'a>>, active: bool) -> MediaQueryBuilder<'a> {
1203        MediaQueryBuilder {
1204            expressions: expressions,
1205            active: active,
1206        }
1207    }
1208    pub fn expressions(&self) -> &[MediaQueryExpression<'a>] { &self.expressions }
1209    pub fn active(&self) -> bool { self.active }
1210}
1211
1212
1213pub struct MediaQueryBuilder<'a> {
1214    expressions: Vec<MediaQueryExpression<'a>>,
1215    active: bool,
1216}
1217
1218impl<'a> MediaQueryBuilder<'a> {
1219    pub fn build(self) -> MediaQuery<'a> {
1220        MediaQuery {
1221            expressions: self.expressions,
1222            active: self.active,
1223        }
1224    }
1225}
1226
1227/// Media query expression descriptor.
1228
1229#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1230#[serde(rename_all = "camelCase")]
1231pub struct MediaQueryExpression<'a> {
1232    /// Media query expression value.
1233    value: f64,
1234    /// Media query expression units.
1235    unit: Cow<'a, str>,
1236    /// Media query expression feature.
1237    feature: Cow<'a, str>,
1238    /// The associated range of the value text in the enclosing stylesheet (if available).
1239    #[serde(skip_serializing_if = "Option::is_none")]
1240    valueRange: Option<SourceRange>,
1241    /// Computed length of media query expression (if applicable).
1242    #[serde(skip_serializing_if = "Option::is_none")]
1243    computedLength: Option<f64>,
1244}
1245
1246impl<'a> MediaQueryExpression<'a> {
1247    pub fn builder(value: f64, unit: impl Into<Cow<'a, str>>, feature: impl Into<Cow<'a, str>>) -> MediaQueryExpressionBuilder<'a> {
1248        MediaQueryExpressionBuilder {
1249            value: value,
1250            unit: unit.into(),
1251            feature: feature.into(),
1252            valueRange: None,
1253            computedLength: None,
1254        }
1255    }
1256    pub fn value(&self) -> f64 { self.value }
1257    pub fn unit(&self) -> &str { self.unit.as_ref() }
1258    pub fn feature(&self) -> &str { self.feature.as_ref() }
1259    pub fn valueRange(&self) -> Option<&SourceRange> { self.valueRange.as_ref() }
1260    pub fn computedLength(&self) -> Option<f64> { self.computedLength }
1261}
1262
1263
1264pub struct MediaQueryExpressionBuilder<'a> {
1265    value: f64,
1266    unit: Cow<'a, str>,
1267    feature: Cow<'a, str>,
1268    valueRange: Option<SourceRange>,
1269    computedLength: Option<f64>,
1270}
1271
1272impl<'a> MediaQueryExpressionBuilder<'a> {
1273    /// The associated range of the value text in the enclosing stylesheet (if available).
1274    pub fn valueRange(mut self, valueRange: SourceRange) -> Self { self.valueRange = Some(valueRange); self }
1275    /// Computed length of media query expression (if applicable).
1276    pub fn computedLength(mut self, computedLength: f64) -> Self { self.computedLength = Some(computedLength); self }
1277    pub fn build(self) -> MediaQueryExpression<'a> {
1278        MediaQueryExpression {
1279            value: self.value,
1280            unit: self.unit,
1281            feature: self.feature,
1282            valueRange: self.valueRange,
1283            computedLength: self.computedLength,
1284        }
1285    }
1286}
1287
1288/// CSS container query rule descriptor.
1289
1290#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1291#[serde(rename_all = "camelCase")]
1292pub struct CSSContainerQuery<'a> {
1293    /// Container query text.
1294    text: Cow<'a, str>,
1295    /// The associated rule header range in the enclosing stylesheet (if
1296    /// available).
1297    #[serde(skip_serializing_if = "Option::is_none")]
1298    range: Option<SourceRange>,
1299    /// Identifier of the stylesheet containing this object (if exists).
1300    #[serde(skip_serializing_if = "Option::is_none")]
1301    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1302    /// Optional name for the container.
1303    #[serde(skip_serializing_if = "Option::is_none")]
1304    name: Option<Cow<'a, str>>,
1305    /// Optional physical axes queried for the container.
1306    #[serde(skip_serializing_if = "Option::is_none")]
1307    physicalAxes: Option<crate::dom::PhysicalAxes>,
1308    /// Optional logical axes queried for the container.
1309    #[serde(skip_serializing_if = "Option::is_none")]
1310    logicalAxes: Option<crate::dom::LogicalAxes>,
1311    /// true if the query contains scroll-state() queries.
1312    #[serde(skip_serializing_if = "Option::is_none")]
1313    queriesScrollState: Option<bool>,
1314    /// true if the query contains anchored() queries.
1315    #[serde(skip_serializing_if = "Option::is_none")]
1316    queriesAnchored: Option<bool>,
1317}
1318
1319impl<'a> CSSContainerQuery<'a> {
1320    pub fn builder(text: impl Into<Cow<'a, str>>) -> CSSContainerQueryBuilder<'a> {
1321        CSSContainerQueryBuilder {
1322            text: text.into(),
1323            range: None,
1324            styleSheetId: None,
1325            name: None,
1326            physicalAxes: None,
1327            logicalAxes: None,
1328            queriesScrollState: None,
1329            queriesAnchored: None,
1330        }
1331    }
1332    pub fn text(&self) -> &str { self.text.as_ref() }
1333    pub fn range(&self) -> Option<&SourceRange> { self.range.as_ref() }
1334    pub fn styleSheetId(&self) -> Option<&crate::dom::StyleSheetId<'a>> { self.styleSheetId.as_ref() }
1335    pub fn name(&self) -> Option<&str> { self.name.as_deref() }
1336    pub fn physicalAxes(&self) -> Option<&crate::dom::PhysicalAxes> { self.physicalAxes.as_ref() }
1337    pub fn logicalAxes(&self) -> Option<&crate::dom::LogicalAxes> { self.logicalAxes.as_ref() }
1338    pub fn queriesScrollState(&self) -> Option<bool> { self.queriesScrollState }
1339    pub fn queriesAnchored(&self) -> Option<bool> { self.queriesAnchored }
1340}
1341
1342
1343pub struct CSSContainerQueryBuilder<'a> {
1344    text: Cow<'a, str>,
1345    range: Option<SourceRange>,
1346    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1347    name: Option<Cow<'a, str>>,
1348    physicalAxes: Option<crate::dom::PhysicalAxes>,
1349    logicalAxes: Option<crate::dom::LogicalAxes>,
1350    queriesScrollState: Option<bool>,
1351    queriesAnchored: Option<bool>,
1352}
1353
1354impl<'a> CSSContainerQueryBuilder<'a> {
1355    /// The associated rule header range in the enclosing stylesheet (if
1356    /// available).
1357    pub fn range(mut self, range: SourceRange) -> Self { self.range = Some(range); self }
1358    /// Identifier of the stylesheet containing this object (if exists).
1359    pub fn styleSheetId(mut self, styleSheetId: crate::dom::StyleSheetId<'a>) -> Self { self.styleSheetId = Some(styleSheetId); self }
1360    /// Optional name for the container.
1361    pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self { self.name = Some(name.into()); self }
1362    /// Optional physical axes queried for the container.
1363    pub fn physicalAxes(mut self, physicalAxes: crate::dom::PhysicalAxes) -> Self { self.physicalAxes = Some(physicalAxes); self }
1364    /// Optional logical axes queried for the container.
1365    pub fn logicalAxes(mut self, logicalAxes: crate::dom::LogicalAxes) -> Self { self.logicalAxes = Some(logicalAxes); self }
1366    /// true if the query contains scroll-state() queries.
1367    pub fn queriesScrollState(mut self, queriesScrollState: bool) -> Self { self.queriesScrollState = Some(queriesScrollState); self }
1368    /// true if the query contains anchored() queries.
1369    pub fn queriesAnchored(mut self, queriesAnchored: bool) -> Self { self.queriesAnchored = Some(queriesAnchored); self }
1370    pub fn build(self) -> CSSContainerQuery<'a> {
1371        CSSContainerQuery {
1372            text: self.text,
1373            range: self.range,
1374            styleSheetId: self.styleSheetId,
1375            name: self.name,
1376            physicalAxes: self.physicalAxes,
1377            logicalAxes: self.logicalAxes,
1378            queriesScrollState: self.queriesScrollState,
1379            queriesAnchored: self.queriesAnchored,
1380        }
1381    }
1382}
1383
1384/// CSS Supports at-rule descriptor.
1385
1386#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1387#[serde(rename_all = "camelCase")]
1388pub struct CSSSupports<'a> {
1389    /// Supports rule text.
1390    text: Cow<'a, str>,
1391    /// Whether the supports condition is satisfied.
1392    active: bool,
1393    /// The associated rule header range in the enclosing stylesheet (if
1394    /// available).
1395    #[serde(skip_serializing_if = "Option::is_none")]
1396    range: Option<SourceRange>,
1397    /// Identifier of the stylesheet containing this object (if exists).
1398    #[serde(skip_serializing_if = "Option::is_none")]
1399    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1400}
1401
1402impl<'a> CSSSupports<'a> {
1403    pub fn builder(text: impl Into<Cow<'a, str>>, active: bool) -> CSSSupportsBuilder<'a> {
1404        CSSSupportsBuilder {
1405            text: text.into(),
1406            active: active,
1407            range: None,
1408            styleSheetId: None,
1409        }
1410    }
1411    pub fn text(&self) -> &str { self.text.as_ref() }
1412    pub fn active(&self) -> bool { self.active }
1413    pub fn range(&self) -> Option<&SourceRange> { self.range.as_ref() }
1414    pub fn styleSheetId(&self) -> Option<&crate::dom::StyleSheetId<'a>> { self.styleSheetId.as_ref() }
1415}
1416
1417
1418pub struct CSSSupportsBuilder<'a> {
1419    text: Cow<'a, str>,
1420    active: bool,
1421    range: Option<SourceRange>,
1422    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1423}
1424
1425impl<'a> CSSSupportsBuilder<'a> {
1426    /// The associated rule header range in the enclosing stylesheet (if
1427    /// available).
1428    pub fn range(mut self, range: SourceRange) -> Self { self.range = Some(range); self }
1429    /// Identifier of the stylesheet containing this object (if exists).
1430    pub fn styleSheetId(mut self, styleSheetId: crate::dom::StyleSheetId<'a>) -> Self { self.styleSheetId = Some(styleSheetId); self }
1431    pub fn build(self) -> CSSSupports<'a> {
1432        CSSSupports {
1433            text: self.text,
1434            active: self.active,
1435            range: self.range,
1436            styleSheetId: self.styleSheetId,
1437        }
1438    }
1439}
1440
1441/// CSS Navigation at-rule descriptor.
1442
1443#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1444#[serde(rename_all = "camelCase")]
1445pub struct CSSNavigation<'a> {
1446    /// Navigation rule text.
1447    text: Cow<'a, str>,
1448    /// Whether the navigation condition is satisfied.
1449    #[serde(skip_serializing_if = "Option::is_none")]
1450    active: Option<bool>,
1451    /// The associated rule header range in the enclosing stylesheet (if
1452    /// available).
1453    #[serde(skip_serializing_if = "Option::is_none")]
1454    range: Option<SourceRange>,
1455    /// Identifier of the stylesheet containing this object (if exists).
1456    #[serde(skip_serializing_if = "Option::is_none")]
1457    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1458}
1459
1460impl<'a> CSSNavigation<'a> {
1461    pub fn builder(text: impl Into<Cow<'a, str>>) -> CSSNavigationBuilder<'a> {
1462        CSSNavigationBuilder {
1463            text: text.into(),
1464            active: None,
1465            range: None,
1466            styleSheetId: None,
1467        }
1468    }
1469    pub fn text(&self) -> &str { self.text.as_ref() }
1470    pub fn active(&self) -> Option<bool> { self.active }
1471    pub fn range(&self) -> Option<&SourceRange> { self.range.as_ref() }
1472    pub fn styleSheetId(&self) -> Option<&crate::dom::StyleSheetId<'a>> { self.styleSheetId.as_ref() }
1473}
1474
1475
1476pub struct CSSNavigationBuilder<'a> {
1477    text: Cow<'a, str>,
1478    active: Option<bool>,
1479    range: Option<SourceRange>,
1480    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1481}
1482
1483impl<'a> CSSNavigationBuilder<'a> {
1484    /// Whether the navigation condition is satisfied.
1485    pub fn active(mut self, active: bool) -> Self { self.active = Some(active); self }
1486    /// The associated rule header range in the enclosing stylesheet (if
1487    /// available).
1488    pub fn range(mut self, range: SourceRange) -> Self { self.range = Some(range); self }
1489    /// Identifier of the stylesheet containing this object (if exists).
1490    pub fn styleSheetId(mut self, styleSheetId: crate::dom::StyleSheetId<'a>) -> Self { self.styleSheetId = Some(styleSheetId); self }
1491    pub fn build(self) -> CSSNavigation<'a> {
1492        CSSNavigation {
1493            text: self.text,
1494            active: self.active,
1495            range: self.range,
1496            styleSheetId: self.styleSheetId,
1497        }
1498    }
1499}
1500
1501/// CSS Scope at-rule descriptor.
1502
1503#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1504#[serde(rename_all = "camelCase")]
1505pub struct CSSScope<'a> {
1506    /// Scope rule text.
1507    text: Cow<'a, str>,
1508    /// The associated rule header range in the enclosing stylesheet (if
1509    /// available).
1510    #[serde(skip_serializing_if = "Option::is_none")]
1511    range: Option<SourceRange>,
1512    /// Identifier of the stylesheet containing this object (if exists).
1513    #[serde(skip_serializing_if = "Option::is_none")]
1514    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1515}
1516
1517impl<'a> CSSScope<'a> {
1518    pub fn builder(text: impl Into<Cow<'a, str>>) -> CSSScopeBuilder<'a> {
1519        CSSScopeBuilder {
1520            text: text.into(),
1521            range: None,
1522            styleSheetId: None,
1523        }
1524    }
1525    pub fn text(&self) -> &str { self.text.as_ref() }
1526    pub fn range(&self) -> Option<&SourceRange> { self.range.as_ref() }
1527    pub fn styleSheetId(&self) -> Option<&crate::dom::StyleSheetId<'a>> { self.styleSheetId.as_ref() }
1528}
1529
1530
1531pub struct CSSScopeBuilder<'a> {
1532    text: Cow<'a, str>,
1533    range: Option<SourceRange>,
1534    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1535}
1536
1537impl<'a> CSSScopeBuilder<'a> {
1538    /// The associated rule header range in the enclosing stylesheet (if
1539    /// available).
1540    pub fn range(mut self, range: SourceRange) -> Self { self.range = Some(range); self }
1541    /// Identifier of the stylesheet containing this object (if exists).
1542    pub fn styleSheetId(mut self, styleSheetId: crate::dom::StyleSheetId<'a>) -> Self { self.styleSheetId = Some(styleSheetId); self }
1543    pub fn build(self) -> CSSScope<'a> {
1544        CSSScope {
1545            text: self.text,
1546            range: self.range,
1547            styleSheetId: self.styleSheetId,
1548        }
1549    }
1550}
1551
1552/// CSS Layer at-rule descriptor.
1553
1554#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1555#[serde(rename_all = "camelCase")]
1556pub struct CSSLayer<'a> {
1557    /// Layer name.
1558    text: Cow<'a, str>,
1559    /// The associated rule header range in the enclosing stylesheet (if
1560    /// available).
1561    #[serde(skip_serializing_if = "Option::is_none")]
1562    range: Option<SourceRange>,
1563    /// Identifier of the stylesheet containing this object (if exists).
1564    #[serde(skip_serializing_if = "Option::is_none")]
1565    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1566}
1567
1568impl<'a> CSSLayer<'a> {
1569    pub fn builder(text: impl Into<Cow<'a, str>>) -> CSSLayerBuilder<'a> {
1570        CSSLayerBuilder {
1571            text: text.into(),
1572            range: None,
1573            styleSheetId: None,
1574        }
1575    }
1576    pub fn text(&self) -> &str { self.text.as_ref() }
1577    pub fn range(&self) -> Option<&SourceRange> { self.range.as_ref() }
1578    pub fn styleSheetId(&self) -> Option<&crate::dom::StyleSheetId<'a>> { self.styleSheetId.as_ref() }
1579}
1580
1581
1582pub struct CSSLayerBuilder<'a> {
1583    text: Cow<'a, str>,
1584    range: Option<SourceRange>,
1585    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1586}
1587
1588impl<'a> CSSLayerBuilder<'a> {
1589    /// The associated rule header range in the enclosing stylesheet (if
1590    /// available).
1591    pub fn range(mut self, range: SourceRange) -> Self { self.range = Some(range); self }
1592    /// Identifier of the stylesheet containing this object (if exists).
1593    pub fn styleSheetId(mut self, styleSheetId: crate::dom::StyleSheetId<'a>) -> Self { self.styleSheetId = Some(styleSheetId); self }
1594    pub fn build(self) -> CSSLayer<'a> {
1595        CSSLayer {
1596            text: self.text,
1597            range: self.range,
1598            styleSheetId: self.styleSheetId,
1599        }
1600    }
1601}
1602
1603/// CSS Starting Style at-rule descriptor.
1604
1605#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1606#[serde(rename_all = "camelCase")]
1607pub struct CSSStartingStyle<'a> {
1608    /// The associated rule header range in the enclosing stylesheet (if
1609    /// available).
1610    #[serde(skip_serializing_if = "Option::is_none")]
1611    range: Option<SourceRange>,
1612    /// Identifier of the stylesheet containing this object (if exists).
1613    #[serde(skip_serializing_if = "Option::is_none")]
1614    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1615}
1616
1617impl<'a> CSSStartingStyle<'a> {
1618    pub fn builder() -> CSSStartingStyleBuilder<'a> {
1619        CSSStartingStyleBuilder {
1620            range: None,
1621            styleSheetId: None,
1622        }
1623    }
1624    pub fn range(&self) -> Option<&SourceRange> { self.range.as_ref() }
1625    pub fn styleSheetId(&self) -> Option<&crate::dom::StyleSheetId<'a>> { self.styleSheetId.as_ref() }
1626}
1627
1628#[derive(Default)]
1629pub struct CSSStartingStyleBuilder<'a> {
1630    range: Option<SourceRange>,
1631    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1632}
1633
1634impl<'a> CSSStartingStyleBuilder<'a> {
1635    /// The associated rule header range in the enclosing stylesheet (if
1636    /// available).
1637    pub fn range(mut self, range: SourceRange) -> Self { self.range = Some(range); self }
1638    /// Identifier of the stylesheet containing this object (if exists).
1639    pub fn styleSheetId(mut self, styleSheetId: crate::dom::StyleSheetId<'a>) -> Self { self.styleSheetId = Some(styleSheetId); self }
1640    pub fn build(self) -> CSSStartingStyle<'a> {
1641        CSSStartingStyle {
1642            range: self.range,
1643            styleSheetId: self.styleSheetId,
1644        }
1645    }
1646}
1647
1648/// CSS Layer data.
1649
1650#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1651#[serde(rename_all = "camelCase")]
1652pub struct CSSLayerData<'a> {
1653    /// Layer name.
1654    name: Cow<'a, str>,
1655    /// Direct sub-layers
1656    #[serde(skip_serializing_if = "Option::is_none")]
1657    subLayers: Option<Vec<Box<CSSLayerData<'a>>>>,
1658    /// Layer order. The order determines the order of the layer in the cascade order.
1659    /// A higher number has higher priority in the cascade order.
1660    order: f64,
1661}
1662
1663impl<'a> CSSLayerData<'a> {
1664    pub fn builder(name: impl Into<Cow<'a, str>>, order: f64) -> CSSLayerDataBuilder<'a> {
1665        CSSLayerDataBuilder {
1666            name: name.into(),
1667            subLayers: None,
1668            order: order,
1669        }
1670    }
1671    pub fn name(&self) -> &str { self.name.as_ref() }
1672    pub fn subLayers(&self) -> Option<&[Box<CSSLayerData<'a>>]> { self.subLayers.as_deref() }
1673    pub fn order(&self) -> f64 { self.order }
1674}
1675
1676
1677pub struct CSSLayerDataBuilder<'a> {
1678    name: Cow<'a, str>,
1679    subLayers: Option<Vec<Box<CSSLayerData<'a>>>>,
1680    order: f64,
1681}
1682
1683impl<'a> CSSLayerDataBuilder<'a> {
1684    /// Direct sub-layers
1685    pub fn subLayers(mut self, subLayers: Vec<Box<CSSLayerData<'a>>>) -> Self { self.subLayers = Some(subLayers); self }
1686    pub fn build(self) -> CSSLayerData<'a> {
1687        CSSLayerData {
1688            name: self.name,
1689            subLayers: self.subLayers,
1690            order: self.order,
1691        }
1692    }
1693}
1694
1695/// Information about amount of glyphs that were rendered with given font.
1696
1697#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1698#[serde(rename_all = "camelCase")]
1699pub struct PlatformFontUsage<'a> {
1700    /// Font's family name reported by platform.
1701    familyName: Cow<'a, str>,
1702    /// Font's PostScript name reported by platform.
1703    postScriptName: Cow<'a, str>,
1704    /// Indicates if the font was downloaded or resolved locally.
1705    isCustomFont: bool,
1706    /// Amount of glyphs that were rendered with this font.
1707    glyphCount: f64,
1708}
1709
1710impl<'a> PlatformFontUsage<'a> {
1711    pub fn builder(familyName: impl Into<Cow<'a, str>>, postScriptName: impl Into<Cow<'a, str>>, isCustomFont: bool, glyphCount: f64) -> PlatformFontUsageBuilder<'a> {
1712        PlatformFontUsageBuilder {
1713            familyName: familyName.into(),
1714            postScriptName: postScriptName.into(),
1715            isCustomFont: isCustomFont,
1716            glyphCount: glyphCount,
1717        }
1718    }
1719    pub fn familyName(&self) -> &str { self.familyName.as_ref() }
1720    pub fn postScriptName(&self) -> &str { self.postScriptName.as_ref() }
1721    pub fn isCustomFont(&self) -> bool { self.isCustomFont }
1722    pub fn glyphCount(&self) -> f64 { self.glyphCount }
1723}
1724
1725
1726pub struct PlatformFontUsageBuilder<'a> {
1727    familyName: Cow<'a, str>,
1728    postScriptName: Cow<'a, str>,
1729    isCustomFont: bool,
1730    glyphCount: f64,
1731}
1732
1733impl<'a> PlatformFontUsageBuilder<'a> {
1734    pub fn build(self) -> PlatformFontUsage<'a> {
1735        PlatformFontUsage {
1736            familyName: self.familyName,
1737            postScriptName: self.postScriptName,
1738            isCustomFont: self.isCustomFont,
1739            glyphCount: self.glyphCount,
1740        }
1741    }
1742}
1743
1744/// Information about font variation axes for variable fonts
1745
1746#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1747#[serde(rename_all = "camelCase")]
1748pub struct FontVariationAxis<'a> {
1749    /// The font-variation-setting tag (a.k.a. "axis tag").
1750    tag: Cow<'a, str>,
1751    /// Human-readable variation name in the default language (normally, "en").
1752    name: Cow<'a, str>,
1753    /// The minimum value (inclusive) the font supports for this tag.
1754    minValue: f64,
1755    /// The maximum value (inclusive) the font supports for this tag.
1756    maxValue: f64,
1757    /// The default value.
1758    defaultValue: f64,
1759}
1760
1761impl<'a> FontVariationAxis<'a> {
1762    pub fn builder(tag: impl Into<Cow<'a, str>>, name: impl Into<Cow<'a, str>>, minValue: f64, maxValue: f64, defaultValue: f64) -> FontVariationAxisBuilder<'a> {
1763        FontVariationAxisBuilder {
1764            tag: tag.into(),
1765            name: name.into(),
1766            minValue: minValue,
1767            maxValue: maxValue,
1768            defaultValue: defaultValue,
1769        }
1770    }
1771    pub fn tag(&self) -> &str { self.tag.as_ref() }
1772    pub fn name(&self) -> &str { self.name.as_ref() }
1773    pub fn minValue(&self) -> f64 { self.minValue }
1774    pub fn maxValue(&self) -> f64 { self.maxValue }
1775    pub fn defaultValue(&self) -> f64 { self.defaultValue }
1776}
1777
1778
1779pub struct FontVariationAxisBuilder<'a> {
1780    tag: Cow<'a, str>,
1781    name: Cow<'a, str>,
1782    minValue: f64,
1783    maxValue: f64,
1784    defaultValue: f64,
1785}
1786
1787impl<'a> FontVariationAxisBuilder<'a> {
1788    pub fn build(self) -> FontVariationAxis<'a> {
1789        FontVariationAxis {
1790            tag: self.tag,
1791            name: self.name,
1792            minValue: self.minValue,
1793            maxValue: self.maxValue,
1794            defaultValue: self.defaultValue,
1795        }
1796    }
1797}
1798
1799/// Properties of a web font: https://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#font-descriptions
1800/// and additional information such as platformFontFamily and fontVariationAxes.
1801
1802#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1803#[serde(rename_all = "camelCase")]
1804pub struct FontFace<'a> {
1805    /// The font-family.
1806    fontFamily: Cow<'a, str>,
1807    /// The font-style.
1808    fontStyle: Cow<'a, str>,
1809    /// The font-variant.
1810    fontVariant: Cow<'a, str>,
1811    /// The font-weight.
1812    fontWeight: Cow<'a, str>,
1813    /// The font-stretch.
1814    fontStretch: Cow<'a, str>,
1815    /// The font-display.
1816    fontDisplay: Cow<'a, str>,
1817    /// The unicode-range.
1818    unicodeRange: Cow<'a, str>,
1819    /// The src.
1820    src: Cow<'a, str>,
1821    /// The resolved platform font family
1822    platformFontFamily: Cow<'a, str>,
1823    /// Available variation settings (a.k.a. "axes").
1824    #[serde(skip_serializing_if = "Option::is_none")]
1825    fontVariationAxes: Option<Vec<FontVariationAxis<'a>>>,
1826}
1827
1828impl<'a> FontFace<'a> {
1829    pub fn builder(fontFamily: impl Into<Cow<'a, str>>, fontStyle: impl Into<Cow<'a, str>>, fontVariant: impl Into<Cow<'a, str>>, fontWeight: impl Into<Cow<'a, str>>, fontStretch: impl Into<Cow<'a, str>>, fontDisplay: impl Into<Cow<'a, str>>, unicodeRange: impl Into<Cow<'a, str>>, src: impl Into<Cow<'a, str>>, platformFontFamily: impl Into<Cow<'a, str>>) -> FontFaceBuilder<'a> {
1830        FontFaceBuilder {
1831            fontFamily: fontFamily.into(),
1832            fontStyle: fontStyle.into(),
1833            fontVariant: fontVariant.into(),
1834            fontWeight: fontWeight.into(),
1835            fontStretch: fontStretch.into(),
1836            fontDisplay: fontDisplay.into(),
1837            unicodeRange: unicodeRange.into(),
1838            src: src.into(),
1839            platformFontFamily: platformFontFamily.into(),
1840            fontVariationAxes: None,
1841        }
1842    }
1843    pub fn fontFamily(&self) -> &str { self.fontFamily.as_ref() }
1844    pub fn fontStyle(&self) -> &str { self.fontStyle.as_ref() }
1845    pub fn fontVariant(&self) -> &str { self.fontVariant.as_ref() }
1846    pub fn fontWeight(&self) -> &str { self.fontWeight.as_ref() }
1847    pub fn fontStretch(&self) -> &str { self.fontStretch.as_ref() }
1848    pub fn fontDisplay(&self) -> &str { self.fontDisplay.as_ref() }
1849    pub fn unicodeRange(&self) -> &str { self.unicodeRange.as_ref() }
1850    pub fn src(&self) -> &str { self.src.as_ref() }
1851    pub fn platformFontFamily(&self) -> &str { self.platformFontFamily.as_ref() }
1852    pub fn fontVariationAxes(&self) -> Option<&[FontVariationAxis<'a>]> { self.fontVariationAxes.as_deref() }
1853}
1854
1855
1856pub struct FontFaceBuilder<'a> {
1857    fontFamily: Cow<'a, str>,
1858    fontStyle: Cow<'a, str>,
1859    fontVariant: Cow<'a, str>,
1860    fontWeight: Cow<'a, str>,
1861    fontStretch: Cow<'a, str>,
1862    fontDisplay: Cow<'a, str>,
1863    unicodeRange: Cow<'a, str>,
1864    src: Cow<'a, str>,
1865    platformFontFamily: Cow<'a, str>,
1866    fontVariationAxes: Option<Vec<FontVariationAxis<'a>>>,
1867}
1868
1869impl<'a> FontFaceBuilder<'a> {
1870    /// Available variation settings (a.k.a. "axes").
1871    pub fn fontVariationAxes(mut self, fontVariationAxes: Vec<FontVariationAxis<'a>>) -> Self { self.fontVariationAxes = Some(fontVariationAxes); self }
1872    pub fn build(self) -> FontFace<'a> {
1873        FontFace {
1874            fontFamily: self.fontFamily,
1875            fontStyle: self.fontStyle,
1876            fontVariant: self.fontVariant,
1877            fontWeight: self.fontWeight,
1878            fontStretch: self.fontStretch,
1879            fontDisplay: self.fontDisplay,
1880            unicodeRange: self.unicodeRange,
1881            src: self.src,
1882            platformFontFamily: self.platformFontFamily,
1883            fontVariationAxes: self.fontVariationAxes,
1884        }
1885    }
1886}
1887
1888/// CSS try rule representation.
1889
1890#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1891#[serde(rename_all = "camelCase")]
1892pub struct CSSTryRule<'a> {
1893    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
1894    /// stylesheet rules) this rule came from.
1895    #[serde(skip_serializing_if = "Option::is_none")]
1896    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1897    /// Parent stylesheet's origin.
1898    origin: StyleSheetOrigin,
1899    /// Associated style declaration.
1900    style: CSSStyle<'a>,
1901}
1902
1903impl<'a> CSSTryRule<'a> {
1904    pub fn builder(origin: StyleSheetOrigin, style: CSSStyle<'a>) -> CSSTryRuleBuilder<'a> {
1905        CSSTryRuleBuilder {
1906            styleSheetId: None,
1907            origin: origin,
1908            style: style,
1909        }
1910    }
1911    pub fn styleSheetId(&self) -> Option<&crate::dom::StyleSheetId<'a>> { self.styleSheetId.as_ref() }
1912    pub fn origin(&self) -> &StyleSheetOrigin { &self.origin }
1913    pub fn style(&self) -> &CSSStyle<'a> { &self.style }
1914}
1915
1916
1917pub struct CSSTryRuleBuilder<'a> {
1918    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1919    origin: StyleSheetOrigin,
1920    style: CSSStyle<'a>,
1921}
1922
1923impl<'a> CSSTryRuleBuilder<'a> {
1924    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
1925    /// stylesheet rules) this rule came from.
1926    pub fn styleSheetId(mut self, styleSheetId: crate::dom::StyleSheetId<'a>) -> Self { self.styleSheetId = Some(styleSheetId); self }
1927    pub fn build(self) -> CSSTryRule<'a> {
1928        CSSTryRule {
1929            styleSheetId: self.styleSheetId,
1930            origin: self.origin,
1931            style: self.style,
1932        }
1933    }
1934}
1935
1936/// CSS @position-try rule representation.
1937
1938#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1939#[serde(rename_all = "camelCase")]
1940pub struct CSSPositionTryRule<'a> {
1941    /// The prelude dashed-ident name
1942    name: ProtocolValue<'a>,
1943    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
1944    /// stylesheet rules) this rule came from.
1945    #[serde(skip_serializing_if = "Option::is_none")]
1946    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1947    /// Parent stylesheet's origin.
1948    origin: StyleSheetOrigin,
1949    /// Associated style declaration.
1950    style: CSSStyle<'a>,
1951    active: bool,
1952}
1953
1954impl<'a> CSSPositionTryRule<'a> {
1955    pub fn builder(name: ProtocolValue<'a>, origin: StyleSheetOrigin, style: CSSStyle<'a>, active: bool) -> CSSPositionTryRuleBuilder<'a> {
1956        CSSPositionTryRuleBuilder {
1957            name: name,
1958            styleSheetId: None,
1959            origin: origin,
1960            style: style,
1961            active: active,
1962        }
1963    }
1964    pub fn name(&self) -> &ProtocolValue<'a> { &self.name }
1965    pub fn styleSheetId(&self) -> Option<&crate::dom::StyleSheetId<'a>> { self.styleSheetId.as_ref() }
1966    pub fn origin(&self) -> &StyleSheetOrigin { &self.origin }
1967    pub fn style(&self) -> &CSSStyle<'a> { &self.style }
1968    pub fn active(&self) -> bool { self.active }
1969}
1970
1971
1972pub struct CSSPositionTryRuleBuilder<'a> {
1973    name: ProtocolValue<'a>,
1974    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
1975    origin: StyleSheetOrigin,
1976    style: CSSStyle<'a>,
1977    active: bool,
1978}
1979
1980impl<'a> CSSPositionTryRuleBuilder<'a> {
1981    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
1982    /// stylesheet rules) this rule came from.
1983    pub fn styleSheetId(mut self, styleSheetId: crate::dom::StyleSheetId<'a>) -> Self { self.styleSheetId = Some(styleSheetId); self }
1984    pub fn build(self) -> CSSPositionTryRule<'a> {
1985        CSSPositionTryRule {
1986            name: self.name,
1987            styleSheetId: self.styleSheetId,
1988            origin: self.origin,
1989            style: self.style,
1990            active: self.active,
1991        }
1992    }
1993}
1994
1995/// CSS keyframes rule representation.
1996
1997#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1998#[serde(rename_all = "camelCase")]
1999pub struct CSSKeyframesRule<'a> {
2000    /// Animation name.
2001    animationName: ProtocolValue<'a>,
2002    /// List of keyframes.
2003    keyframes: Vec<CSSKeyframeRule<'a>>,
2004}
2005
2006impl<'a> CSSKeyframesRule<'a> {
2007    pub fn builder(animationName: ProtocolValue<'a>, keyframes: Vec<CSSKeyframeRule<'a>>) -> CSSKeyframesRuleBuilder<'a> {
2008        CSSKeyframesRuleBuilder {
2009            animationName: animationName,
2010            keyframes: keyframes,
2011        }
2012    }
2013    pub fn animationName(&self) -> &ProtocolValue<'a> { &self.animationName }
2014    pub fn keyframes(&self) -> &[CSSKeyframeRule<'a>] { &self.keyframes }
2015}
2016
2017
2018pub struct CSSKeyframesRuleBuilder<'a> {
2019    animationName: ProtocolValue<'a>,
2020    keyframes: Vec<CSSKeyframeRule<'a>>,
2021}
2022
2023impl<'a> CSSKeyframesRuleBuilder<'a> {
2024    pub fn build(self) -> CSSKeyframesRule<'a> {
2025        CSSKeyframesRule {
2026            animationName: self.animationName,
2027            keyframes: self.keyframes,
2028        }
2029    }
2030}
2031
2032/// Representation of a custom property registration through CSS.registerProperty
2033
2034#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2035#[serde(rename_all = "camelCase")]
2036pub struct CSSPropertyRegistration<'a> {
2037    propertyName: Cow<'a, str>,
2038    #[serde(skip_serializing_if = "Option::is_none")]
2039    initialValue: Option<ProtocolValue<'a>>,
2040    inherits: bool,
2041    syntax: Cow<'a, str>,
2042}
2043
2044impl<'a> CSSPropertyRegistration<'a> {
2045    pub fn builder(propertyName: impl Into<Cow<'a, str>>, inherits: bool, syntax: impl Into<Cow<'a, str>>) -> CSSPropertyRegistrationBuilder<'a> {
2046        CSSPropertyRegistrationBuilder {
2047            propertyName: propertyName.into(),
2048            initialValue: None,
2049            inherits: inherits,
2050            syntax: syntax.into(),
2051        }
2052    }
2053    pub fn propertyName(&self) -> &str { self.propertyName.as_ref() }
2054    pub fn initialValue(&self) -> Option<&ProtocolValue<'a>> { self.initialValue.as_ref() }
2055    pub fn inherits(&self) -> bool { self.inherits }
2056    pub fn syntax(&self) -> &str { self.syntax.as_ref() }
2057}
2058
2059
2060pub struct CSSPropertyRegistrationBuilder<'a> {
2061    propertyName: Cow<'a, str>,
2062    initialValue: Option<ProtocolValue<'a>>,
2063    inherits: bool,
2064    syntax: Cow<'a, str>,
2065}
2066
2067impl<'a> CSSPropertyRegistrationBuilder<'a> {
2068    pub fn initialValue(mut self, initialValue: ProtocolValue<'a>) -> Self { self.initialValue = Some(initialValue); self }
2069    pub fn build(self) -> CSSPropertyRegistration<'a> {
2070        CSSPropertyRegistration {
2071            propertyName: self.propertyName,
2072            initialValue: self.initialValue,
2073            inherits: self.inherits,
2074            syntax: self.syntax,
2075        }
2076    }
2077}
2078
2079/// CSS generic @rule representation.
2080
2081#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2082#[serde(rename_all = "camelCase")]
2083pub struct CSSAtRule<'a> {
2084    /// Type of at-rule.
2085    #[serde(rename = "type")]
2086    type_: Cow<'a, str>,
2087    /// Subsection of font-feature-values, if this is a subsection.
2088    #[serde(skip_serializing_if = "Option::is_none")]
2089    subsection: Option<Cow<'a, str>>,
2090    /// LINT.ThenChange(//third_party/blink/renderer/core/inspector/inspector_style_sheet.cc:FontVariantAlternatesFeatureType,//third_party/blink/renderer/core/inspector/inspector_css_agent.cc:FontVariantAlternatesFeatureType)
2091    /// Associated name, if applicable.
2092    #[serde(skip_serializing_if = "Option::is_none")]
2093    name: Option<ProtocolValue<'a>>,
2094    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
2095    /// stylesheet rules) this rule came from.
2096    #[serde(skip_serializing_if = "Option::is_none")]
2097    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
2098    /// Parent stylesheet's origin.
2099    origin: StyleSheetOrigin,
2100    /// Associated style declaration.
2101    style: CSSStyle<'a>,
2102}
2103
2104impl<'a> CSSAtRule<'a> {
2105    pub fn builder(type_: impl Into<Cow<'a, str>>, origin: StyleSheetOrigin, style: CSSStyle<'a>) -> CSSAtRuleBuilder<'a> {
2106        CSSAtRuleBuilder {
2107            type_: type_.into(),
2108            subsection: None,
2109            name: None,
2110            styleSheetId: None,
2111            origin: origin,
2112            style: style,
2113        }
2114    }
2115    pub fn type_(&self) -> &str { self.type_.as_ref() }
2116    pub fn subsection(&self) -> Option<&str> { self.subsection.as_deref() }
2117    pub fn name(&self) -> Option<&ProtocolValue<'a>> { self.name.as_ref() }
2118    pub fn styleSheetId(&self) -> Option<&crate::dom::StyleSheetId<'a>> { self.styleSheetId.as_ref() }
2119    pub fn origin(&self) -> &StyleSheetOrigin { &self.origin }
2120    pub fn style(&self) -> &CSSStyle<'a> { &self.style }
2121}
2122
2123
2124pub struct CSSAtRuleBuilder<'a> {
2125    type_: Cow<'a, str>,
2126    subsection: Option<Cow<'a, str>>,
2127    name: Option<ProtocolValue<'a>>,
2128    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
2129    origin: StyleSheetOrigin,
2130    style: CSSStyle<'a>,
2131}
2132
2133impl<'a> CSSAtRuleBuilder<'a> {
2134    /// Subsection of font-feature-values, if this is a subsection.
2135    pub fn subsection(mut self, subsection: impl Into<Cow<'a, str>>) -> Self { self.subsection = Some(subsection.into()); self }
2136    /// LINT.ThenChange(//third_party/blink/renderer/core/inspector/inspector_style_sheet.cc:FontVariantAlternatesFeatureType,//third_party/blink/renderer/core/inspector/inspector_css_agent.cc:FontVariantAlternatesFeatureType)
2137    /// Associated name, if applicable.
2138    pub fn name(mut self, name: ProtocolValue<'a>) -> Self { self.name = Some(name); self }
2139    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
2140    /// stylesheet rules) this rule came from.
2141    pub fn styleSheetId(mut self, styleSheetId: crate::dom::StyleSheetId<'a>) -> Self { self.styleSheetId = Some(styleSheetId); self }
2142    pub fn build(self) -> CSSAtRule<'a> {
2143        CSSAtRule {
2144            type_: self.type_,
2145            subsection: self.subsection,
2146            name: self.name,
2147            styleSheetId: self.styleSheetId,
2148            origin: self.origin,
2149            style: self.style,
2150        }
2151    }
2152}
2153
2154/// CSS property at-rule representation.
2155
2156#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2157#[serde(rename_all = "camelCase")]
2158pub struct CSSPropertyRule<'a> {
2159    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
2160    /// stylesheet rules) this rule came from.
2161    #[serde(skip_serializing_if = "Option::is_none")]
2162    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
2163    /// Parent stylesheet's origin.
2164    origin: StyleSheetOrigin,
2165    /// Associated property name.
2166    propertyName: ProtocolValue<'a>,
2167    /// Associated style declaration.
2168    style: CSSStyle<'a>,
2169}
2170
2171impl<'a> CSSPropertyRule<'a> {
2172    pub fn builder(origin: StyleSheetOrigin, propertyName: ProtocolValue<'a>, style: CSSStyle<'a>) -> CSSPropertyRuleBuilder<'a> {
2173        CSSPropertyRuleBuilder {
2174            styleSheetId: None,
2175            origin: origin,
2176            propertyName: propertyName,
2177            style: style,
2178        }
2179    }
2180    pub fn styleSheetId(&self) -> Option<&crate::dom::StyleSheetId<'a>> { self.styleSheetId.as_ref() }
2181    pub fn origin(&self) -> &StyleSheetOrigin { &self.origin }
2182    pub fn propertyName(&self) -> &ProtocolValue<'a> { &self.propertyName }
2183    pub fn style(&self) -> &CSSStyle<'a> { &self.style }
2184}
2185
2186
2187pub struct CSSPropertyRuleBuilder<'a> {
2188    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
2189    origin: StyleSheetOrigin,
2190    propertyName: ProtocolValue<'a>,
2191    style: CSSStyle<'a>,
2192}
2193
2194impl<'a> CSSPropertyRuleBuilder<'a> {
2195    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
2196    /// stylesheet rules) this rule came from.
2197    pub fn styleSheetId(mut self, styleSheetId: crate::dom::StyleSheetId<'a>) -> Self { self.styleSheetId = Some(styleSheetId); self }
2198    pub fn build(self) -> CSSPropertyRule<'a> {
2199        CSSPropertyRule {
2200            styleSheetId: self.styleSheetId,
2201            origin: self.origin,
2202            propertyName: self.propertyName,
2203            style: self.style,
2204        }
2205    }
2206}
2207
2208/// CSS function argument representation.
2209
2210#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2211#[serde(rename_all = "camelCase")]
2212pub struct CSSFunctionParameter<'a> {
2213    /// The parameter name.
2214    name: Cow<'a, str>,
2215    /// The parameter type.
2216    #[serde(rename = "type")]
2217    type_: Cow<'a, str>,
2218}
2219
2220impl<'a> CSSFunctionParameter<'a> {
2221    pub fn builder(name: impl Into<Cow<'a, str>>, type_: impl Into<Cow<'a, str>>) -> CSSFunctionParameterBuilder<'a> {
2222        CSSFunctionParameterBuilder {
2223            name: name.into(),
2224            type_: type_.into(),
2225        }
2226    }
2227    pub fn name(&self) -> &str { self.name.as_ref() }
2228    pub fn type_(&self) -> &str { self.type_.as_ref() }
2229}
2230
2231
2232pub struct CSSFunctionParameterBuilder<'a> {
2233    name: Cow<'a, str>,
2234    type_: Cow<'a, str>,
2235}
2236
2237impl<'a> CSSFunctionParameterBuilder<'a> {
2238    pub fn build(self) -> CSSFunctionParameter<'a> {
2239        CSSFunctionParameter {
2240            name: self.name,
2241            type_: self.type_,
2242        }
2243    }
2244}
2245
2246/// CSS function conditional block representation.
2247
2248#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2249#[serde(rename_all = "camelCase")]
2250pub struct CSSFunctionConditionNode<'a> {
2251    /// Media query for this conditional block. Only one type of condition should be set.
2252    #[serde(skip_serializing_if = "Option::is_none")]
2253    media: Option<CSSMedia<'a>>,
2254    /// Container query for this conditional block. Only one type of condition should be set.
2255    #[serde(skip_serializing_if = "Option::is_none")]
2256    containerQueries: Option<CSSContainerQuery<'a>>,
2257    /// @supports CSS at-rule condition. Only one type of condition should be set.
2258    #[serde(skip_serializing_if = "Option::is_none")]
2259    supports: Option<CSSSupports<'a>>,
2260    /// @navigation condition. Only one type of condition should be set.
2261    #[serde(skip_serializing_if = "Option::is_none")]
2262    navigation: Option<CSSNavigation<'a>>,
2263    /// Block body.
2264    children: Vec<CSSFunctionNode<'a>>,
2265    /// The condition text.
2266    conditionText: Cow<'a, str>,
2267}
2268
2269impl<'a> CSSFunctionConditionNode<'a> {
2270    pub fn builder(children: Vec<CSSFunctionNode<'a>>, conditionText: impl Into<Cow<'a, str>>) -> CSSFunctionConditionNodeBuilder<'a> {
2271        CSSFunctionConditionNodeBuilder {
2272            media: None,
2273            containerQueries: None,
2274            supports: None,
2275            navigation: None,
2276            children: children,
2277            conditionText: conditionText.into(),
2278        }
2279    }
2280    pub fn media(&self) -> Option<&CSSMedia<'a>> { self.media.as_ref() }
2281    pub fn containerQueries(&self) -> Option<&CSSContainerQuery<'a>> { self.containerQueries.as_ref() }
2282    pub fn supports(&self) -> Option<&CSSSupports<'a>> { self.supports.as_ref() }
2283    pub fn navigation(&self) -> Option<&CSSNavigation<'a>> { self.navigation.as_ref() }
2284    pub fn children(&self) -> &[CSSFunctionNode<'a>] { &self.children }
2285    pub fn conditionText(&self) -> &str { self.conditionText.as_ref() }
2286}
2287
2288
2289pub struct CSSFunctionConditionNodeBuilder<'a> {
2290    media: Option<CSSMedia<'a>>,
2291    containerQueries: Option<CSSContainerQuery<'a>>,
2292    supports: Option<CSSSupports<'a>>,
2293    navigation: Option<CSSNavigation<'a>>,
2294    children: Vec<CSSFunctionNode<'a>>,
2295    conditionText: Cow<'a, str>,
2296}
2297
2298impl<'a> CSSFunctionConditionNodeBuilder<'a> {
2299    /// Media query for this conditional block. Only one type of condition should be set.
2300    pub fn media(mut self, media: CSSMedia<'a>) -> Self { self.media = Some(media); self }
2301    /// Container query for this conditional block. Only one type of condition should be set.
2302    pub fn containerQueries(mut self, containerQueries: CSSContainerQuery<'a>) -> Self { self.containerQueries = Some(containerQueries); self }
2303    /// @supports CSS at-rule condition. Only one type of condition should be set.
2304    pub fn supports(mut self, supports: CSSSupports<'a>) -> Self { self.supports = Some(supports); self }
2305    /// @navigation condition. Only one type of condition should be set.
2306    pub fn navigation(mut self, navigation: CSSNavigation<'a>) -> Self { self.navigation = Some(navigation); self }
2307    pub fn build(self) -> CSSFunctionConditionNode<'a> {
2308        CSSFunctionConditionNode {
2309            media: self.media,
2310            containerQueries: self.containerQueries,
2311            supports: self.supports,
2312            navigation: self.navigation,
2313            children: self.children,
2314            conditionText: self.conditionText,
2315        }
2316    }
2317}
2318
2319/// Section of the body of a CSS function rule.
2320
2321#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2322#[serde(rename_all = "camelCase")]
2323pub struct CSSFunctionNode<'a> {
2324    /// A conditional block. If set, style should not be set.
2325    #[serde(skip_serializing_if = "Option::is_none")]
2326    condition: Option<CSSFunctionConditionNode<'a>>,
2327    /// Values set by this node. If set, condition should not be set.
2328    #[serde(skip_serializing_if = "Option::is_none")]
2329    style: Option<CSSStyle<'a>>,
2330}
2331
2332impl<'a> CSSFunctionNode<'a> {
2333    pub fn builder() -> CSSFunctionNodeBuilder<'a> {
2334        CSSFunctionNodeBuilder {
2335            condition: None,
2336            style: None,
2337        }
2338    }
2339    pub fn condition(&self) -> Option<&CSSFunctionConditionNode<'a>> { self.condition.as_ref() }
2340    pub fn style(&self) -> Option<&CSSStyle<'a>> { self.style.as_ref() }
2341}
2342
2343#[derive(Default)]
2344pub struct CSSFunctionNodeBuilder<'a> {
2345    condition: Option<CSSFunctionConditionNode<'a>>,
2346    style: Option<CSSStyle<'a>>,
2347}
2348
2349impl<'a> CSSFunctionNodeBuilder<'a> {
2350    /// A conditional block. If set, style should not be set.
2351    pub fn condition(mut self, condition: CSSFunctionConditionNode<'a>) -> Self { self.condition = Some(condition); self }
2352    /// Values set by this node. If set, condition should not be set.
2353    pub fn style(mut self, style: CSSStyle<'a>) -> Self { self.style = Some(style); self }
2354    pub fn build(self) -> CSSFunctionNode<'a> {
2355        CSSFunctionNode {
2356            condition: self.condition,
2357            style: self.style,
2358        }
2359    }
2360}
2361
2362/// CSS function at-rule representation.
2363
2364#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2365#[serde(rename_all = "camelCase")]
2366pub struct CSSFunctionRule<'a> {
2367    /// Name of the function.
2368    name: ProtocolValue<'a>,
2369    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
2370    /// stylesheet rules) this rule came from.
2371    #[serde(skip_serializing_if = "Option::is_none")]
2372    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
2373    /// Parent stylesheet's origin.
2374    origin: StyleSheetOrigin,
2375    /// List of parameters.
2376    parameters: Vec<CSSFunctionParameter<'a>>,
2377    /// Function body.
2378    children: Vec<CSSFunctionNode<'a>>,
2379    /// The BackendNodeId of the DOM node that constitutes the origin tree scope of this rule.
2380    #[serde(skip_serializing_if = "Option::is_none")]
2381    originTreeScopeNodeId: Option<crate::dom::BackendNodeId>,
2382}
2383
2384impl<'a> CSSFunctionRule<'a> {
2385    pub fn builder(name: ProtocolValue<'a>, origin: StyleSheetOrigin, parameters: Vec<CSSFunctionParameter<'a>>, children: Vec<CSSFunctionNode<'a>>) -> CSSFunctionRuleBuilder<'a> {
2386        CSSFunctionRuleBuilder {
2387            name: name,
2388            styleSheetId: None,
2389            origin: origin,
2390            parameters: parameters,
2391            children: children,
2392            originTreeScopeNodeId: None,
2393        }
2394    }
2395    pub fn name(&self) -> &ProtocolValue<'a> { &self.name }
2396    pub fn styleSheetId(&self) -> Option<&crate::dom::StyleSheetId<'a>> { self.styleSheetId.as_ref() }
2397    pub fn origin(&self) -> &StyleSheetOrigin { &self.origin }
2398    pub fn parameters(&self) -> &[CSSFunctionParameter<'a>] { &self.parameters }
2399    pub fn children(&self) -> &[CSSFunctionNode<'a>] { &self.children }
2400    pub fn originTreeScopeNodeId(&self) -> Option<&crate::dom::BackendNodeId> { self.originTreeScopeNodeId.as_ref() }
2401}
2402
2403
2404pub struct CSSFunctionRuleBuilder<'a> {
2405    name: ProtocolValue<'a>,
2406    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
2407    origin: StyleSheetOrigin,
2408    parameters: Vec<CSSFunctionParameter<'a>>,
2409    children: Vec<CSSFunctionNode<'a>>,
2410    originTreeScopeNodeId: Option<crate::dom::BackendNodeId>,
2411}
2412
2413impl<'a> CSSFunctionRuleBuilder<'a> {
2414    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
2415    /// stylesheet rules) this rule came from.
2416    pub fn styleSheetId(mut self, styleSheetId: crate::dom::StyleSheetId<'a>) -> Self { self.styleSheetId = Some(styleSheetId); self }
2417    /// The BackendNodeId of the DOM node that constitutes the origin tree scope of this rule.
2418    pub fn originTreeScopeNodeId(mut self, originTreeScopeNodeId: crate::dom::BackendNodeId) -> Self { self.originTreeScopeNodeId = Some(originTreeScopeNodeId); self }
2419    pub fn build(self) -> CSSFunctionRule<'a> {
2420        CSSFunctionRule {
2421            name: self.name,
2422            styleSheetId: self.styleSheetId,
2423            origin: self.origin,
2424            parameters: self.parameters,
2425            children: self.children,
2426            originTreeScopeNodeId: self.originTreeScopeNodeId,
2427        }
2428    }
2429}
2430
2431/// CSS keyframe rule representation.
2432
2433#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2434#[serde(rename_all = "camelCase")]
2435pub struct CSSKeyframeRule<'a> {
2436    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
2437    /// stylesheet rules) this rule came from.
2438    #[serde(skip_serializing_if = "Option::is_none")]
2439    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
2440    /// Parent stylesheet's origin.
2441    origin: StyleSheetOrigin,
2442    /// Associated key text.
2443    keyText: ProtocolValue<'a>,
2444    /// Associated style declaration.
2445    style: CSSStyle<'a>,
2446}
2447
2448impl<'a> CSSKeyframeRule<'a> {
2449    pub fn builder(origin: StyleSheetOrigin, keyText: ProtocolValue<'a>, style: CSSStyle<'a>) -> CSSKeyframeRuleBuilder<'a> {
2450        CSSKeyframeRuleBuilder {
2451            styleSheetId: None,
2452            origin: origin,
2453            keyText: keyText,
2454            style: style,
2455        }
2456    }
2457    pub fn styleSheetId(&self) -> Option<&crate::dom::StyleSheetId<'a>> { self.styleSheetId.as_ref() }
2458    pub fn origin(&self) -> &StyleSheetOrigin { &self.origin }
2459    pub fn keyText(&self) -> &ProtocolValue<'a> { &self.keyText }
2460    pub fn style(&self) -> &CSSStyle<'a> { &self.style }
2461}
2462
2463
2464pub struct CSSKeyframeRuleBuilder<'a> {
2465    styleSheetId: Option<crate::dom::StyleSheetId<'a>>,
2466    origin: StyleSheetOrigin,
2467    keyText: ProtocolValue<'a>,
2468    style: CSSStyle<'a>,
2469}
2470
2471impl<'a> CSSKeyframeRuleBuilder<'a> {
2472    /// The css style sheet identifier (absent for user agent stylesheet and user-specified
2473    /// stylesheet rules) this rule came from.
2474    pub fn styleSheetId(mut self, styleSheetId: crate::dom::StyleSheetId<'a>) -> Self { self.styleSheetId = Some(styleSheetId); self }
2475    pub fn build(self) -> CSSKeyframeRule<'a> {
2476        CSSKeyframeRule {
2477            styleSheetId: self.styleSheetId,
2478            origin: self.origin,
2479            keyText: self.keyText,
2480            style: self.style,
2481        }
2482    }
2483}
2484
2485/// A descriptor of operation to mutate style declaration text.
2486
2487#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2488#[serde(rename_all = "camelCase")]
2489pub struct StyleDeclarationEdit<'a> {
2490    /// The css style sheet identifier.
2491    styleSheetId: crate::dom::StyleSheetId<'a>,
2492    /// The range of the style text in the enclosing stylesheet.
2493    range: SourceRange,
2494    /// New style text.
2495    text: Cow<'a, str>,
2496}
2497
2498impl<'a> StyleDeclarationEdit<'a> {
2499    pub fn builder(styleSheetId: crate::dom::StyleSheetId<'a>, range: SourceRange, text: impl Into<Cow<'a, str>>) -> StyleDeclarationEditBuilder<'a> {
2500        StyleDeclarationEditBuilder {
2501            styleSheetId: styleSheetId,
2502            range: range,
2503            text: text.into(),
2504        }
2505    }
2506    pub fn styleSheetId(&self) -> &crate::dom::StyleSheetId<'a> { &self.styleSheetId }
2507    pub fn range(&self) -> &SourceRange { &self.range }
2508    pub fn text(&self) -> &str { self.text.as_ref() }
2509}
2510
2511
2512pub struct StyleDeclarationEditBuilder<'a> {
2513    styleSheetId: crate::dom::StyleSheetId<'a>,
2514    range: SourceRange,
2515    text: Cow<'a, str>,
2516}
2517
2518impl<'a> StyleDeclarationEditBuilder<'a> {
2519    pub fn build(self) -> StyleDeclarationEdit<'a> {
2520        StyleDeclarationEdit {
2521            styleSheetId: self.styleSheetId,
2522            range: self.range,
2523            text: self.text,
2524        }
2525    }
2526}
2527
2528/// Inserts a new rule with the given 'ruleText' in a stylesheet with given 'styleSheetId', at the
2529/// position specified by 'location'.
2530
2531#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2532#[serde(rename_all = "camelCase")]
2533pub struct AddRuleParams<'a> {
2534    /// The css style sheet identifier where a new rule should be inserted.
2535    styleSheetId: crate::dom::StyleSheetId<'a>,
2536    /// The text of a new rule.
2537    ruleText: Cow<'a, str>,
2538    /// Text position of a new rule in the target style sheet.
2539    location: SourceRange,
2540    /// NodeId for the DOM node in whose context custom property declarations for registered properties should be
2541    /// validated. If omitted, declarations in the new rule text can only be validated statically, which may produce
2542    /// incorrect results if the declaration contains a var() for example.
2543    #[serde(skip_serializing_if = "Option::is_none")]
2544    nodeForPropertySyntaxValidation: Option<crate::dom::NodeId>,
2545}
2546
2547impl<'a> AddRuleParams<'a> {
2548    pub fn builder(styleSheetId: crate::dom::StyleSheetId<'a>, ruleText: impl Into<Cow<'a, str>>, location: SourceRange) -> AddRuleParamsBuilder<'a> {
2549        AddRuleParamsBuilder {
2550            styleSheetId: styleSheetId,
2551            ruleText: ruleText.into(),
2552            location: location,
2553            nodeForPropertySyntaxValidation: None,
2554        }
2555    }
2556    pub fn styleSheetId(&self) -> &crate::dom::StyleSheetId<'a> { &self.styleSheetId }
2557    pub fn ruleText(&self) -> &str { self.ruleText.as_ref() }
2558    pub fn location(&self) -> &SourceRange { &self.location }
2559    pub fn nodeForPropertySyntaxValidation(&self) -> Option<&crate::dom::NodeId> { self.nodeForPropertySyntaxValidation.as_ref() }
2560}
2561
2562
2563pub struct AddRuleParamsBuilder<'a> {
2564    styleSheetId: crate::dom::StyleSheetId<'a>,
2565    ruleText: Cow<'a, str>,
2566    location: SourceRange,
2567    nodeForPropertySyntaxValidation: Option<crate::dom::NodeId>,
2568}
2569
2570impl<'a> AddRuleParamsBuilder<'a> {
2571    /// NodeId for the DOM node in whose context custom property declarations for registered properties should be
2572    /// validated. If omitted, declarations in the new rule text can only be validated statically, which may produce
2573    /// incorrect results if the declaration contains a var() for example.
2574    pub fn nodeForPropertySyntaxValidation(mut self, nodeForPropertySyntaxValidation: crate::dom::NodeId) -> Self { self.nodeForPropertySyntaxValidation = Some(nodeForPropertySyntaxValidation); self }
2575    pub fn build(self) -> AddRuleParams<'a> {
2576        AddRuleParams {
2577            styleSheetId: self.styleSheetId,
2578            ruleText: self.ruleText,
2579            location: self.location,
2580            nodeForPropertySyntaxValidation: self.nodeForPropertySyntaxValidation,
2581        }
2582    }
2583}
2584
2585/// Inserts a new rule with the given 'ruleText' in a stylesheet with given 'styleSheetId', at the
2586/// position specified by 'location'.
2587
2588#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2589#[serde(rename_all = "camelCase")]
2590pub struct AddRuleReturns<'a> {
2591    /// The newly created rule.
2592    rule: CSSRule<'a>,
2593}
2594
2595impl<'a> AddRuleReturns<'a> {
2596    pub fn builder(rule: CSSRule<'a>) -> AddRuleReturnsBuilder<'a> {
2597        AddRuleReturnsBuilder {
2598            rule: rule,
2599        }
2600    }
2601    pub fn rule(&self) -> &CSSRule<'a> { &self.rule }
2602}
2603
2604
2605pub struct AddRuleReturnsBuilder<'a> {
2606    rule: CSSRule<'a>,
2607}
2608
2609impl<'a> AddRuleReturnsBuilder<'a> {
2610    pub fn build(self) -> AddRuleReturns<'a> {
2611        AddRuleReturns {
2612            rule: self.rule,
2613        }
2614    }
2615}
2616
2617impl<'a> AddRuleParams<'a> { pub const METHOD: &'static str = "CSS.addRule"; }
2618
2619impl<'a> crate::CdpCommand<'a> for AddRuleParams<'a> {
2620    const METHOD: &'static str = "CSS.addRule";
2621    type Response = AddRuleReturns<'a>;
2622}
2623
2624/// Returns all class names from specified stylesheet.
2625
2626#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2627#[serde(rename_all = "camelCase")]
2628pub struct CollectClassNamesParams<'a> {
2629    styleSheetId: crate::dom::StyleSheetId<'a>,
2630}
2631
2632impl<'a> CollectClassNamesParams<'a> {
2633    pub fn builder(styleSheetId: crate::dom::StyleSheetId<'a>) -> CollectClassNamesParamsBuilder<'a> {
2634        CollectClassNamesParamsBuilder {
2635            styleSheetId: styleSheetId,
2636        }
2637    }
2638    pub fn styleSheetId(&self) -> &crate::dom::StyleSheetId<'a> { &self.styleSheetId }
2639}
2640
2641
2642pub struct CollectClassNamesParamsBuilder<'a> {
2643    styleSheetId: crate::dom::StyleSheetId<'a>,
2644}
2645
2646impl<'a> CollectClassNamesParamsBuilder<'a> {
2647    pub fn build(self) -> CollectClassNamesParams<'a> {
2648        CollectClassNamesParams {
2649            styleSheetId: self.styleSheetId,
2650        }
2651    }
2652}
2653
2654/// Returns all class names from specified stylesheet.
2655
2656#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2657#[serde(rename_all = "camelCase")]
2658pub struct CollectClassNamesReturns<'a> {
2659    /// Class name list.
2660    classNames: Vec<Cow<'a, str>>,
2661}
2662
2663impl<'a> CollectClassNamesReturns<'a> {
2664    pub fn builder(classNames: Vec<Cow<'a, str>>) -> CollectClassNamesReturnsBuilder<'a> {
2665        CollectClassNamesReturnsBuilder {
2666            classNames: classNames,
2667        }
2668    }
2669    pub fn classNames(&self) -> &[Cow<'a, str>] { &self.classNames }
2670}
2671
2672
2673pub struct CollectClassNamesReturnsBuilder<'a> {
2674    classNames: Vec<Cow<'a, str>>,
2675}
2676
2677impl<'a> CollectClassNamesReturnsBuilder<'a> {
2678    pub fn build(self) -> CollectClassNamesReturns<'a> {
2679        CollectClassNamesReturns {
2680            classNames: self.classNames,
2681        }
2682    }
2683}
2684
2685impl<'a> CollectClassNamesParams<'a> { pub const METHOD: &'static str = "CSS.collectClassNames"; }
2686
2687impl<'a> crate::CdpCommand<'a> for CollectClassNamesParams<'a> {
2688    const METHOD: &'static str = "CSS.collectClassNames";
2689    type Response = CollectClassNamesReturns<'a>;
2690}
2691
2692/// Creates a new special "via-inspector" stylesheet in the frame with given 'frameId'.
2693
2694#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2695#[serde(rename_all = "camelCase")]
2696pub struct CreateStyleSheetParams<'a> {
2697    /// Identifier of the frame where "via-inspector" stylesheet should be created.
2698    frameId: crate::page::FrameId<'a>,
2699    /// If true, creates a new stylesheet for every call. If false,
2700    /// returns a stylesheet previously created by a call with force=false
2701    /// for the frame's document if it exists or creates a new stylesheet
2702    /// (default: false).
2703    #[serde(skip_serializing_if = "Option::is_none")]
2704    force: Option<bool>,
2705}
2706
2707impl<'a> CreateStyleSheetParams<'a> {
2708    pub fn builder(frameId: crate::page::FrameId<'a>) -> CreateStyleSheetParamsBuilder<'a> {
2709        CreateStyleSheetParamsBuilder {
2710            frameId: frameId,
2711            force: None,
2712        }
2713    }
2714    pub fn frameId(&self) -> &crate::page::FrameId<'a> { &self.frameId }
2715    pub fn force(&self) -> Option<bool> { self.force }
2716}
2717
2718
2719pub struct CreateStyleSheetParamsBuilder<'a> {
2720    frameId: crate::page::FrameId<'a>,
2721    force: Option<bool>,
2722}
2723
2724impl<'a> CreateStyleSheetParamsBuilder<'a> {
2725    /// If true, creates a new stylesheet for every call. If false,
2726    /// returns a stylesheet previously created by a call with force=false
2727    /// for the frame's document if it exists or creates a new stylesheet
2728    /// (default: false).
2729    pub fn force(mut self, force: bool) -> Self { self.force = Some(force); self }
2730    pub fn build(self) -> CreateStyleSheetParams<'a> {
2731        CreateStyleSheetParams {
2732            frameId: self.frameId,
2733            force: self.force,
2734        }
2735    }
2736}
2737
2738/// Creates a new special "via-inspector" stylesheet in the frame with given 'frameId'.
2739
2740#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2741#[serde(rename_all = "camelCase")]
2742pub struct CreateStyleSheetReturns<'a> {
2743    /// Identifier of the created "via-inspector" stylesheet.
2744    styleSheetId: crate::dom::StyleSheetId<'a>,
2745}
2746
2747impl<'a> CreateStyleSheetReturns<'a> {
2748    pub fn builder(styleSheetId: crate::dom::StyleSheetId<'a>) -> CreateStyleSheetReturnsBuilder<'a> {
2749        CreateStyleSheetReturnsBuilder {
2750            styleSheetId: styleSheetId,
2751        }
2752    }
2753    pub fn styleSheetId(&self) -> &crate::dom::StyleSheetId<'a> { &self.styleSheetId }
2754}
2755
2756
2757pub struct CreateStyleSheetReturnsBuilder<'a> {
2758    styleSheetId: crate::dom::StyleSheetId<'a>,
2759}
2760
2761impl<'a> CreateStyleSheetReturnsBuilder<'a> {
2762    pub fn build(self) -> CreateStyleSheetReturns<'a> {
2763        CreateStyleSheetReturns {
2764            styleSheetId: self.styleSheetId,
2765        }
2766    }
2767}
2768
2769impl<'a> CreateStyleSheetParams<'a> { pub const METHOD: &'static str = "CSS.createStyleSheet"; }
2770
2771impl<'a> crate::CdpCommand<'a> for CreateStyleSheetParams<'a> {
2772    const METHOD: &'static str = "CSS.createStyleSheet";
2773    type Response = CreateStyleSheetReturns<'a>;
2774}
2775
2776#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2777pub struct DisableParams {}
2778
2779impl DisableParams { pub const METHOD: &'static str = "CSS.disable"; }
2780
2781impl<'a> crate::CdpCommand<'a> for DisableParams {
2782    const METHOD: &'static str = "CSS.disable";
2783    type Response = crate::EmptyReturns;
2784}
2785
2786#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2787pub struct EnableParams {}
2788
2789impl EnableParams { pub const METHOD: &'static str = "CSS.enable"; }
2790
2791impl<'a> crate::CdpCommand<'a> for EnableParams {
2792    const METHOD: &'static str = "CSS.enable";
2793    type Response = crate::EmptyReturns;
2794}
2795
2796/// Ensures that the given node will have specified pseudo-classes whenever its style is computed by
2797/// the browser.
2798
2799#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2800#[serde(rename_all = "camelCase")]
2801pub struct ForcePseudoStateParams<'a> {
2802    /// The element id for which to force the pseudo state.
2803    nodeId: crate::dom::NodeId,
2804    /// Element pseudo classes to force when computing the element's style.
2805    forcedPseudoClasses: Vec<Cow<'a, str>>,
2806}
2807
2808impl<'a> ForcePseudoStateParams<'a> {
2809    pub fn builder(nodeId: crate::dom::NodeId, forcedPseudoClasses: Vec<Cow<'a, str>>) -> ForcePseudoStateParamsBuilder<'a> {
2810        ForcePseudoStateParamsBuilder {
2811            nodeId: nodeId,
2812            forcedPseudoClasses: forcedPseudoClasses,
2813        }
2814    }
2815    pub fn nodeId(&self) -> &crate::dom::NodeId { &self.nodeId }
2816    pub fn forcedPseudoClasses(&self) -> &[Cow<'a, str>] { &self.forcedPseudoClasses }
2817}
2818
2819
2820pub struct ForcePseudoStateParamsBuilder<'a> {
2821    nodeId: crate::dom::NodeId,
2822    forcedPseudoClasses: Vec<Cow<'a, str>>,
2823}
2824
2825impl<'a> ForcePseudoStateParamsBuilder<'a> {
2826    pub fn build(self) -> ForcePseudoStateParams<'a> {
2827        ForcePseudoStateParams {
2828            nodeId: self.nodeId,
2829            forcedPseudoClasses: self.forcedPseudoClasses,
2830        }
2831    }
2832}
2833
2834impl<'a> ForcePseudoStateParams<'a> { pub const METHOD: &'static str = "CSS.forcePseudoState"; }
2835
2836impl<'a> crate::CdpCommand<'a> for ForcePseudoStateParams<'a> {
2837    const METHOD: &'static str = "CSS.forcePseudoState";
2838    type Response = crate::EmptyReturns;
2839}
2840
2841/// Ensures that the given node is in its starting-style state.
2842
2843#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2844#[serde(rename_all = "camelCase")]
2845pub struct ForceStartingStyleParams {
2846    /// The element id for which to force the starting-style state.
2847    nodeId: crate::dom::NodeId,
2848    /// Boolean indicating if this is on or off.
2849    forced: bool,
2850}
2851
2852impl ForceStartingStyleParams {
2853    pub fn builder(nodeId: crate::dom::NodeId, forced: bool) -> ForceStartingStyleParamsBuilder {
2854        ForceStartingStyleParamsBuilder {
2855            nodeId: nodeId,
2856            forced: forced,
2857        }
2858    }
2859    pub fn nodeId(&self) -> &crate::dom::NodeId { &self.nodeId }
2860    pub fn forced(&self) -> bool { self.forced }
2861}
2862
2863
2864pub struct ForceStartingStyleParamsBuilder {
2865    nodeId: crate::dom::NodeId,
2866    forced: bool,
2867}
2868
2869impl ForceStartingStyleParamsBuilder {
2870    pub fn build(self) -> ForceStartingStyleParams {
2871        ForceStartingStyleParams {
2872            nodeId: self.nodeId,
2873            forced: self.forced,
2874        }
2875    }
2876}
2877
2878impl ForceStartingStyleParams { pub const METHOD: &'static str = "CSS.forceStartingStyle"; }
2879
2880impl<'a> crate::CdpCommand<'a> for ForceStartingStyleParams {
2881    const METHOD: &'static str = "CSS.forceStartingStyle";
2882    type Response = crate::EmptyReturns;
2883}
2884
2885
2886#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2887#[serde(rename_all = "camelCase")]
2888pub struct GetBackgroundColorsParams {
2889    /// Id of the node to get background colors for.
2890    nodeId: crate::dom::NodeId,
2891}
2892
2893impl GetBackgroundColorsParams {
2894    pub fn builder(nodeId: crate::dom::NodeId) -> GetBackgroundColorsParamsBuilder {
2895        GetBackgroundColorsParamsBuilder {
2896            nodeId: nodeId,
2897        }
2898    }
2899    pub fn nodeId(&self) -> &crate::dom::NodeId { &self.nodeId }
2900}
2901
2902
2903pub struct GetBackgroundColorsParamsBuilder {
2904    nodeId: crate::dom::NodeId,
2905}
2906
2907impl GetBackgroundColorsParamsBuilder {
2908    pub fn build(self) -> GetBackgroundColorsParams {
2909        GetBackgroundColorsParams {
2910            nodeId: self.nodeId,
2911        }
2912    }
2913}
2914
2915
2916#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2917#[serde(rename_all = "camelCase")]
2918pub struct GetBackgroundColorsReturns<'a> {
2919    /// The range of background colors behind this element, if it contains any visible text. If no
2920    /// visible text is present, this will be undefined. In the case of a flat background color,
2921    /// this will consist of simply that color. In the case of a gradient, this will consist of each
2922    /// of the color stops. For anything more complicated, this will be an empty array. Images will
2923    /// be ignored (as if the image had failed to load).
2924    #[serde(skip_serializing_if = "Option::is_none")]
2925    backgroundColors: Option<Vec<Cow<'a, str>>>,
2926    /// The computed font size for this node, as a CSS computed value string (e.g. '12px').
2927    #[serde(skip_serializing_if = "Option::is_none")]
2928    computedFontSize: Option<Cow<'a, str>>,
2929    /// The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or
2930    /// '100').
2931    #[serde(skip_serializing_if = "Option::is_none")]
2932    computedFontWeight: Option<Cow<'a, str>>,
2933}
2934
2935impl<'a> GetBackgroundColorsReturns<'a> {
2936    pub fn builder() -> GetBackgroundColorsReturnsBuilder<'a> {
2937        GetBackgroundColorsReturnsBuilder {
2938            backgroundColors: None,
2939            computedFontSize: None,
2940            computedFontWeight: None,
2941        }
2942    }
2943    pub fn backgroundColors(&self) -> Option<&[Cow<'a, str>]> { self.backgroundColors.as_deref() }
2944    pub fn computedFontSize(&self) -> Option<&str> { self.computedFontSize.as_deref() }
2945    pub fn computedFontWeight(&self) -> Option<&str> { self.computedFontWeight.as_deref() }
2946}
2947
2948#[derive(Default)]
2949pub struct GetBackgroundColorsReturnsBuilder<'a> {
2950    backgroundColors: Option<Vec<Cow<'a, str>>>,
2951    computedFontSize: Option<Cow<'a, str>>,
2952    computedFontWeight: Option<Cow<'a, str>>,
2953}
2954
2955impl<'a> GetBackgroundColorsReturnsBuilder<'a> {
2956    /// The range of background colors behind this element, if it contains any visible text. If no
2957    /// visible text is present, this will be undefined. In the case of a flat background color,
2958    /// this will consist of simply that color. In the case of a gradient, this will consist of each
2959    /// of the color stops. For anything more complicated, this will be an empty array. Images will
2960    /// be ignored (as if the image had failed to load).
2961    pub fn backgroundColors(mut self, backgroundColors: Vec<Cow<'a, str>>) -> Self { self.backgroundColors = Some(backgroundColors); self }
2962    /// The computed font size for this node, as a CSS computed value string (e.g. '12px').
2963    pub fn computedFontSize(mut self, computedFontSize: impl Into<Cow<'a, str>>) -> Self { self.computedFontSize = Some(computedFontSize.into()); self }
2964    /// The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or
2965    /// '100').
2966    pub fn computedFontWeight(mut self, computedFontWeight: impl Into<Cow<'a, str>>) -> Self { self.computedFontWeight = Some(computedFontWeight.into()); self }
2967    pub fn build(self) -> GetBackgroundColorsReturns<'a> {
2968        GetBackgroundColorsReturns {
2969            backgroundColors: self.backgroundColors,
2970            computedFontSize: self.computedFontSize,
2971            computedFontWeight: self.computedFontWeight,
2972        }
2973    }
2974}
2975
2976impl GetBackgroundColorsParams { pub const METHOD: &'static str = "CSS.getBackgroundColors"; }
2977
2978impl<'a> crate::CdpCommand<'a> for GetBackgroundColorsParams {
2979    const METHOD: &'static str = "CSS.getBackgroundColors";
2980    type Response = GetBackgroundColorsReturns<'a>;
2981}
2982
2983/// Returns the computed style for a DOM node identified by 'nodeId'.
2984
2985#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2986#[serde(rename_all = "camelCase")]
2987pub struct GetComputedStyleForNodeParams {
2988    nodeId: crate::dom::NodeId,
2989}
2990
2991impl GetComputedStyleForNodeParams {
2992    pub fn builder(nodeId: crate::dom::NodeId) -> GetComputedStyleForNodeParamsBuilder {
2993        GetComputedStyleForNodeParamsBuilder {
2994            nodeId: nodeId,
2995        }
2996    }
2997    pub fn nodeId(&self) -> &crate::dom::NodeId { &self.nodeId }
2998}
2999
3000
3001pub struct GetComputedStyleForNodeParamsBuilder {
3002    nodeId: crate::dom::NodeId,
3003}
3004
3005impl GetComputedStyleForNodeParamsBuilder {
3006    pub fn build(self) -> GetComputedStyleForNodeParams {
3007        GetComputedStyleForNodeParams {
3008            nodeId: self.nodeId,
3009        }
3010    }
3011}
3012
3013/// Returns the computed style for a DOM node identified by 'nodeId'.
3014
3015#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3016#[serde(rename_all = "camelCase")]
3017pub struct GetComputedStyleForNodeReturns<'a> {
3018    /// Computed style for the specified DOM node.
3019    computedStyle: Vec<CSSComputedStyleProperty<'a>>,
3020    /// A list of non-standard "extra fields" which blink stores alongside each
3021    /// computed style.
3022    extraFields: ComputedStyleExtraFields,
3023}
3024
3025impl<'a> GetComputedStyleForNodeReturns<'a> {
3026    pub fn builder(computedStyle: Vec<CSSComputedStyleProperty<'a>>, extraFields: ComputedStyleExtraFields) -> GetComputedStyleForNodeReturnsBuilder<'a> {
3027        GetComputedStyleForNodeReturnsBuilder {
3028            computedStyle: computedStyle,
3029            extraFields: extraFields,
3030        }
3031    }
3032    pub fn computedStyle(&self) -> &[CSSComputedStyleProperty<'a>] { &self.computedStyle }
3033    pub fn extraFields(&self) -> &ComputedStyleExtraFields { &self.extraFields }
3034}
3035
3036
3037pub struct GetComputedStyleForNodeReturnsBuilder<'a> {
3038    computedStyle: Vec<CSSComputedStyleProperty<'a>>,
3039    extraFields: ComputedStyleExtraFields,
3040}
3041
3042impl<'a> GetComputedStyleForNodeReturnsBuilder<'a> {
3043    pub fn build(self) -> GetComputedStyleForNodeReturns<'a> {
3044        GetComputedStyleForNodeReturns {
3045            computedStyle: self.computedStyle,
3046            extraFields: self.extraFields,
3047        }
3048    }
3049}
3050
3051impl GetComputedStyleForNodeParams { pub const METHOD: &'static str = "CSS.getComputedStyleForNode"; }
3052
3053impl<'a> crate::CdpCommand<'a> for GetComputedStyleForNodeParams {
3054    const METHOD: &'static str = "CSS.getComputedStyleForNode";
3055    type Response = GetComputedStyleForNodeReturns<'a>;
3056}
3057
3058/// Resolve the specified values in the context of the provided element.
3059/// For example, a value of '1em' is evaluated according to the computed
3060/// 'font-size' of the element and a value 'calc(1px + 2px)' will be
3061/// resolved to '3px'.
3062/// If the 'propertyName' was specified the 'values' are resolved as if
3063/// they were property's declaration. If a value cannot be parsed according
3064/// to the provided property syntax, the value is parsed using combined
3065/// syntax as if null 'propertyName' was provided. If the value cannot be
3066/// resolved even then, return the provided value without any changes.
3067/// Note: this function currently does not resolve CSS random() function,
3068/// it returns unmodified random() function parts.'
3069
3070#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3071#[serde(rename_all = "camelCase")]
3072pub struct ResolveValuesParams<'a> {
3073    /// Cascade-dependent keywords (revert/revert-layer) do not work.
3074    values: Vec<Cow<'a, str>>,
3075    /// Id of the node in whose context the expression is evaluated
3076    nodeId: crate::dom::NodeId,
3077    /// Only longhands and custom property names are accepted.
3078    #[serde(skip_serializing_if = "Option::is_none")]
3079    propertyName: Option<Cow<'a, str>>,
3080    /// Pseudo element type, only works for pseudo elements that generate
3081    /// elements in the tree, such as ::before and ::after.
3082    #[serde(skip_serializing_if = "Option::is_none")]
3083    pseudoType: Option<crate::dom::PseudoType>,
3084    /// Pseudo element custom ident.
3085    #[serde(skip_serializing_if = "Option::is_none")]
3086    pseudoIdentifier: Option<Cow<'a, str>>,
3087}
3088
3089impl<'a> ResolveValuesParams<'a> {
3090    pub fn builder(values: Vec<Cow<'a, str>>, nodeId: crate::dom::NodeId) -> ResolveValuesParamsBuilder<'a> {
3091        ResolveValuesParamsBuilder {
3092            values: values,
3093            nodeId: nodeId,
3094            propertyName: None,
3095            pseudoType: None,
3096            pseudoIdentifier: None,
3097        }
3098    }
3099    pub fn values(&self) -> &[Cow<'a, str>] { &self.values }
3100    pub fn nodeId(&self) -> &crate::dom::NodeId { &self.nodeId }
3101    pub fn propertyName(&self) -> Option<&str> { self.propertyName.as_deref() }
3102    pub fn pseudoType(&self) -> Option<&crate::dom::PseudoType> { self.pseudoType.as_ref() }
3103    pub fn pseudoIdentifier(&self) -> Option<&str> { self.pseudoIdentifier.as_deref() }
3104}
3105
3106
3107pub struct ResolveValuesParamsBuilder<'a> {
3108    values: Vec<Cow<'a, str>>,
3109    nodeId: crate::dom::NodeId,
3110    propertyName: Option<Cow<'a, str>>,
3111    pseudoType: Option<crate::dom::PseudoType>,
3112    pseudoIdentifier: Option<Cow<'a, str>>,
3113}
3114
3115impl<'a> ResolveValuesParamsBuilder<'a> {
3116    /// Only longhands and custom property names are accepted.
3117    pub fn propertyName(mut self, propertyName: impl Into<Cow<'a, str>>) -> Self { self.propertyName = Some(propertyName.into()); self }
3118    /// Pseudo element type, only works for pseudo elements that generate
3119    /// elements in the tree, such as ::before and ::after.
3120    pub fn pseudoType(mut self, pseudoType: crate::dom::PseudoType) -> Self { self.pseudoType = Some(pseudoType); self }
3121    /// Pseudo element custom ident.
3122    pub fn pseudoIdentifier(mut self, pseudoIdentifier: impl Into<Cow<'a, str>>) -> Self { self.pseudoIdentifier = Some(pseudoIdentifier.into()); self }
3123    pub fn build(self) -> ResolveValuesParams<'a> {
3124        ResolveValuesParams {
3125            values: self.values,
3126            nodeId: self.nodeId,
3127            propertyName: self.propertyName,
3128            pseudoType: self.pseudoType,
3129            pseudoIdentifier: self.pseudoIdentifier,
3130        }
3131    }
3132}
3133
3134/// Resolve the specified values in the context of the provided element.
3135/// For example, a value of '1em' is evaluated according to the computed
3136/// 'font-size' of the element and a value 'calc(1px + 2px)' will be
3137/// resolved to '3px'.
3138/// If the 'propertyName' was specified the 'values' are resolved as if
3139/// they were property's declaration. If a value cannot be parsed according
3140/// to the provided property syntax, the value is parsed using combined
3141/// syntax as if null 'propertyName' was provided. If the value cannot be
3142/// resolved even then, return the provided value without any changes.
3143/// Note: this function currently does not resolve CSS random() function,
3144/// it returns unmodified random() function parts.'
3145
3146#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3147#[serde(rename_all = "camelCase")]
3148pub struct ResolveValuesReturns<'a> {
3149    results: Vec<Cow<'a, str>>,
3150}
3151
3152impl<'a> ResolveValuesReturns<'a> {
3153    pub fn builder(results: Vec<Cow<'a, str>>) -> ResolveValuesReturnsBuilder<'a> {
3154        ResolveValuesReturnsBuilder {
3155            results: results,
3156        }
3157    }
3158    pub fn results(&self) -> &[Cow<'a, str>] { &self.results }
3159}
3160
3161
3162pub struct ResolveValuesReturnsBuilder<'a> {
3163    results: Vec<Cow<'a, str>>,
3164}
3165
3166impl<'a> ResolveValuesReturnsBuilder<'a> {
3167    pub fn build(self) -> ResolveValuesReturns<'a> {
3168        ResolveValuesReturns {
3169            results: self.results,
3170        }
3171    }
3172}
3173
3174impl<'a> ResolveValuesParams<'a> { pub const METHOD: &'static str = "CSS.resolveValues"; }
3175
3176impl<'a> crate::CdpCommand<'a> for ResolveValuesParams<'a> {
3177    const METHOD: &'static str = "CSS.resolveValues";
3178    type Response = ResolveValuesReturns<'a>;
3179}
3180
3181
3182#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3183#[serde(rename_all = "camelCase")]
3184pub struct GetLonghandPropertiesParams<'a> {
3185    shorthandName: Cow<'a, str>,
3186    value: Cow<'a, str>,
3187}
3188
3189impl<'a> GetLonghandPropertiesParams<'a> {
3190    pub fn builder(shorthandName: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>) -> GetLonghandPropertiesParamsBuilder<'a> {
3191        GetLonghandPropertiesParamsBuilder {
3192            shorthandName: shorthandName.into(),
3193            value: value.into(),
3194        }
3195    }
3196    pub fn shorthandName(&self) -> &str { self.shorthandName.as_ref() }
3197    pub fn value(&self) -> &str { self.value.as_ref() }
3198}
3199
3200
3201pub struct GetLonghandPropertiesParamsBuilder<'a> {
3202    shorthandName: Cow<'a, str>,
3203    value: Cow<'a, str>,
3204}
3205
3206impl<'a> GetLonghandPropertiesParamsBuilder<'a> {
3207    pub fn build(self) -> GetLonghandPropertiesParams<'a> {
3208        GetLonghandPropertiesParams {
3209            shorthandName: self.shorthandName,
3210            value: self.value,
3211        }
3212    }
3213}
3214
3215
3216#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3217#[serde(rename_all = "camelCase")]
3218pub struct GetLonghandPropertiesReturns<'a> {
3219    longhandProperties: Vec<CSSProperty<'a>>,
3220}
3221
3222impl<'a> GetLonghandPropertiesReturns<'a> {
3223    pub fn builder(longhandProperties: Vec<CSSProperty<'a>>) -> GetLonghandPropertiesReturnsBuilder<'a> {
3224        GetLonghandPropertiesReturnsBuilder {
3225            longhandProperties: longhandProperties,
3226        }
3227    }
3228    pub fn longhandProperties(&self) -> &[CSSProperty<'a>] { &self.longhandProperties }
3229}
3230
3231
3232pub struct GetLonghandPropertiesReturnsBuilder<'a> {
3233    longhandProperties: Vec<CSSProperty<'a>>,
3234}
3235
3236impl<'a> GetLonghandPropertiesReturnsBuilder<'a> {
3237    pub fn build(self) -> GetLonghandPropertiesReturns<'a> {
3238        GetLonghandPropertiesReturns {
3239            longhandProperties: self.longhandProperties,
3240        }
3241    }
3242}
3243
3244impl<'a> GetLonghandPropertiesParams<'a> { pub const METHOD: &'static str = "CSS.getLonghandProperties"; }
3245
3246impl<'a> crate::CdpCommand<'a> for GetLonghandPropertiesParams<'a> {
3247    const METHOD: &'static str = "CSS.getLonghandProperties";
3248    type Response = GetLonghandPropertiesReturns<'a>;
3249}
3250
3251/// Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM
3252/// attributes) for a DOM node identified by 'nodeId'.
3253
3254#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3255#[serde(rename_all = "camelCase")]
3256pub struct GetInlineStylesForNodeParams {
3257    nodeId: crate::dom::NodeId,
3258}
3259
3260impl GetInlineStylesForNodeParams {
3261    pub fn builder(nodeId: crate::dom::NodeId) -> GetInlineStylesForNodeParamsBuilder {
3262        GetInlineStylesForNodeParamsBuilder {
3263            nodeId: nodeId,
3264        }
3265    }
3266    pub fn nodeId(&self) -> &crate::dom::NodeId { &self.nodeId }
3267}
3268
3269
3270pub struct GetInlineStylesForNodeParamsBuilder {
3271    nodeId: crate::dom::NodeId,
3272}
3273
3274impl GetInlineStylesForNodeParamsBuilder {
3275    pub fn build(self) -> GetInlineStylesForNodeParams {
3276        GetInlineStylesForNodeParams {
3277            nodeId: self.nodeId,
3278        }
3279    }
3280}
3281
3282/// Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM
3283/// attributes) for a DOM node identified by 'nodeId'.
3284
3285#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3286#[serde(rename_all = "camelCase")]
3287pub struct GetInlineStylesForNodeReturns<'a> {
3288    /// Inline style for the specified DOM node.
3289    #[serde(skip_serializing_if = "Option::is_none")]
3290    inlineStyle: Option<CSSStyle<'a>>,
3291    /// Attribute-defined element style (e.g. resulting from "width=20 height=100%").
3292    #[serde(skip_serializing_if = "Option::is_none")]
3293    attributesStyle: Option<CSSStyle<'a>>,
3294}
3295
3296impl<'a> GetInlineStylesForNodeReturns<'a> {
3297    pub fn builder() -> GetInlineStylesForNodeReturnsBuilder<'a> {
3298        GetInlineStylesForNodeReturnsBuilder {
3299            inlineStyle: None,
3300            attributesStyle: None,
3301        }
3302    }
3303    pub fn inlineStyle(&self) -> Option<&CSSStyle<'a>> { self.inlineStyle.as_ref() }
3304    pub fn attributesStyle(&self) -> Option<&CSSStyle<'a>> { self.attributesStyle.as_ref() }
3305}
3306
3307#[derive(Default)]
3308pub struct GetInlineStylesForNodeReturnsBuilder<'a> {
3309    inlineStyle: Option<CSSStyle<'a>>,
3310    attributesStyle: Option<CSSStyle<'a>>,
3311}
3312
3313impl<'a> GetInlineStylesForNodeReturnsBuilder<'a> {
3314    /// Inline style for the specified DOM node.
3315    pub fn inlineStyle(mut self, inlineStyle: CSSStyle<'a>) -> Self { self.inlineStyle = Some(inlineStyle); self }
3316    /// Attribute-defined element style (e.g. resulting from "width=20 height=100%").
3317    pub fn attributesStyle(mut self, attributesStyle: CSSStyle<'a>) -> Self { self.attributesStyle = Some(attributesStyle); self }
3318    pub fn build(self) -> GetInlineStylesForNodeReturns<'a> {
3319        GetInlineStylesForNodeReturns {
3320            inlineStyle: self.inlineStyle,
3321            attributesStyle: self.attributesStyle,
3322        }
3323    }
3324}
3325
3326impl GetInlineStylesForNodeParams { pub const METHOD: &'static str = "CSS.getInlineStylesForNode"; }
3327
3328impl<'a> crate::CdpCommand<'a> for GetInlineStylesForNodeParams {
3329    const METHOD: &'static str = "CSS.getInlineStylesForNode";
3330    type Response = GetInlineStylesForNodeReturns<'a>;
3331}
3332
3333/// Returns the styles coming from animations & transitions
3334/// including the animation & transition styles coming from inheritance chain.
3335
3336#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3337#[serde(rename_all = "camelCase")]
3338pub struct GetAnimatedStylesForNodeParams {
3339    nodeId: crate::dom::NodeId,
3340}
3341
3342impl GetAnimatedStylesForNodeParams {
3343    pub fn builder(nodeId: crate::dom::NodeId) -> GetAnimatedStylesForNodeParamsBuilder {
3344        GetAnimatedStylesForNodeParamsBuilder {
3345            nodeId: nodeId,
3346        }
3347    }
3348    pub fn nodeId(&self) -> &crate::dom::NodeId { &self.nodeId }
3349}
3350
3351
3352pub struct GetAnimatedStylesForNodeParamsBuilder {
3353    nodeId: crate::dom::NodeId,
3354}
3355
3356impl GetAnimatedStylesForNodeParamsBuilder {
3357    pub fn build(self) -> GetAnimatedStylesForNodeParams {
3358        GetAnimatedStylesForNodeParams {
3359            nodeId: self.nodeId,
3360        }
3361    }
3362}
3363
3364/// Returns the styles coming from animations & transitions
3365/// including the animation & transition styles coming from inheritance chain.
3366
3367#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3368#[serde(rename_all = "camelCase")]
3369pub struct GetAnimatedStylesForNodeReturns<'a> {
3370    /// Styles coming from animations.
3371    #[serde(skip_serializing_if = "Option::is_none")]
3372    animationStyles: Option<Vec<CSSAnimationStyle<'a>>>,
3373    /// Style coming from transitions.
3374    #[serde(skip_serializing_if = "Option::is_none")]
3375    transitionsStyle: Option<CSSStyle<'a>>,
3376    /// Inherited style entries for animationsStyle and transitionsStyle from
3377    /// the inheritance chain of the element.
3378    #[serde(skip_serializing_if = "Option::is_none")]
3379    inherited: Option<Vec<InheritedAnimatedStyleEntry<'a>>>,
3380}
3381
3382impl<'a> GetAnimatedStylesForNodeReturns<'a> {
3383    pub fn builder() -> GetAnimatedStylesForNodeReturnsBuilder<'a> {
3384        GetAnimatedStylesForNodeReturnsBuilder {
3385            animationStyles: None,
3386            transitionsStyle: None,
3387            inherited: None,
3388        }
3389    }
3390    pub fn animationStyles(&self) -> Option<&[CSSAnimationStyle<'a>]> { self.animationStyles.as_deref() }
3391    pub fn transitionsStyle(&self) -> Option<&CSSStyle<'a>> { self.transitionsStyle.as_ref() }
3392    pub fn inherited(&self) -> Option<&[InheritedAnimatedStyleEntry<'a>]> { self.inherited.as_deref() }
3393}
3394
3395#[derive(Default)]
3396pub struct GetAnimatedStylesForNodeReturnsBuilder<'a> {
3397    animationStyles: Option<Vec<CSSAnimationStyle<'a>>>,
3398    transitionsStyle: Option<CSSStyle<'a>>,
3399    inherited: Option<Vec<InheritedAnimatedStyleEntry<'a>>>,
3400}
3401
3402impl<'a> GetAnimatedStylesForNodeReturnsBuilder<'a> {
3403    /// Styles coming from animations.
3404    pub fn animationStyles(mut self, animationStyles: Vec<CSSAnimationStyle<'a>>) -> Self { self.animationStyles = Some(animationStyles); self }
3405    /// Style coming from transitions.
3406    pub fn transitionsStyle(mut self, transitionsStyle: CSSStyle<'a>) -> Self { self.transitionsStyle = Some(transitionsStyle); self }
3407    /// Inherited style entries for animationsStyle and transitionsStyle from
3408    /// the inheritance chain of the element.
3409    pub fn inherited(mut self, inherited: Vec<InheritedAnimatedStyleEntry<'a>>) -> Self { self.inherited = Some(inherited); self }
3410    pub fn build(self) -> GetAnimatedStylesForNodeReturns<'a> {
3411        GetAnimatedStylesForNodeReturns {
3412            animationStyles: self.animationStyles,
3413            transitionsStyle: self.transitionsStyle,
3414            inherited: self.inherited,
3415        }
3416    }
3417}
3418
3419impl GetAnimatedStylesForNodeParams { pub const METHOD: &'static str = "CSS.getAnimatedStylesForNode"; }
3420
3421impl<'a> crate::CdpCommand<'a> for GetAnimatedStylesForNodeParams {
3422    const METHOD: &'static str = "CSS.getAnimatedStylesForNode";
3423    type Response = GetAnimatedStylesForNodeReturns<'a>;
3424}
3425
3426/// Returns requested styles for a DOM node identified by 'nodeId'.
3427
3428#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3429#[serde(rename_all = "camelCase")]
3430pub struct GetMatchedStylesForNodeParams {
3431    nodeId: crate::dom::NodeId,
3432}
3433
3434impl GetMatchedStylesForNodeParams {
3435    pub fn builder(nodeId: crate::dom::NodeId) -> GetMatchedStylesForNodeParamsBuilder {
3436        GetMatchedStylesForNodeParamsBuilder {
3437            nodeId: nodeId,
3438        }
3439    }
3440    pub fn nodeId(&self) -> &crate::dom::NodeId { &self.nodeId }
3441}
3442
3443
3444pub struct GetMatchedStylesForNodeParamsBuilder {
3445    nodeId: crate::dom::NodeId,
3446}
3447
3448impl GetMatchedStylesForNodeParamsBuilder {
3449    pub fn build(self) -> GetMatchedStylesForNodeParams {
3450        GetMatchedStylesForNodeParams {
3451            nodeId: self.nodeId,
3452        }
3453    }
3454}
3455
3456/// Returns requested styles for a DOM node identified by 'nodeId'.
3457
3458#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3459#[serde(rename_all = "camelCase")]
3460pub struct GetMatchedStylesForNodeReturns<'a> {
3461    /// Inline style for the specified DOM node.
3462    #[serde(skip_serializing_if = "Option::is_none")]
3463    inlineStyle: Option<CSSStyle<'a>>,
3464    /// Attribute-defined element style (e.g. resulting from "width=20 height=100%").
3465    #[serde(skip_serializing_if = "Option::is_none")]
3466    attributesStyle: Option<CSSStyle<'a>>,
3467    /// CSS rules matching this node, from all applicable stylesheets.
3468    #[serde(skip_serializing_if = "Option::is_none")]
3469    matchedCSSRules: Option<Vec<RuleMatch<'a>>>,
3470    /// Pseudo style matches for this node.
3471    #[serde(skip_serializing_if = "Option::is_none")]
3472    pseudoElements: Option<Vec<PseudoElementMatches<'a>>>,
3473    /// A chain of inherited styles (from the immediate node parent up to the DOM tree root).
3474    #[serde(skip_serializing_if = "Option::is_none")]
3475    inherited: Option<Vec<InheritedStyleEntry<'a>>>,
3476    /// A chain of inherited pseudo element styles (from the immediate node parent up to the DOM tree root).
3477    #[serde(skip_serializing_if = "Option::is_none")]
3478    inheritedPseudoElements: Option<Vec<InheritedPseudoElementMatches<'a>>>,
3479    /// A list of CSS keyframed animations matching this node.
3480    #[serde(skip_serializing_if = "Option::is_none")]
3481    cssKeyframesRules: Option<Vec<CSSKeyframesRule<'a>>>,
3482    /// A list of CSS @position-try rules matching this node, based on the position-try-fallbacks property.
3483    #[serde(skip_serializing_if = "Option::is_none")]
3484    cssPositionTryRules: Option<Vec<CSSPositionTryRule<'a>>>,
3485    /// Index of the active fallback in the applied position-try-fallback property,
3486    /// will not be set if there is no active position-try fallback.
3487    #[serde(skip_serializing_if = "Option::is_none")]
3488    activePositionFallbackIndex: Option<u64>,
3489    /// A list of CSS at-property rules matching this node.
3490    #[serde(skip_serializing_if = "Option::is_none")]
3491    cssPropertyRules: Option<Vec<CSSPropertyRule<'a>>>,
3492    /// A list of CSS property registrations matching this node.
3493    #[serde(skip_serializing_if = "Option::is_none")]
3494    cssPropertyRegistrations: Option<Vec<CSSPropertyRegistration<'a>>>,
3495    /// A list of simple @rules matching this node or its pseudo-elements.
3496    #[serde(skip_serializing_if = "Option::is_none")]
3497    cssAtRules: Option<Vec<CSSAtRule<'a>>>,
3498    /// Id of the first parent element that does not have display: contents.
3499    #[serde(skip_serializing_if = "Option::is_none")]
3500    parentLayoutNodeId: Option<crate::dom::NodeId>,
3501    /// A list of CSS at-function rules referenced by styles of this node.
3502    #[serde(skip_serializing_if = "Option::is_none")]
3503    cssFunctionRules: Option<Vec<CSSFunctionRule<'a>>>,
3504}
3505
3506impl<'a> GetMatchedStylesForNodeReturns<'a> {
3507    pub fn builder() -> GetMatchedStylesForNodeReturnsBuilder<'a> {
3508        GetMatchedStylesForNodeReturnsBuilder {
3509            inlineStyle: None,
3510            attributesStyle: None,
3511            matchedCSSRules: None,
3512            pseudoElements: None,
3513            inherited: None,
3514            inheritedPseudoElements: None,
3515            cssKeyframesRules: None,
3516            cssPositionTryRules: None,
3517            activePositionFallbackIndex: None,
3518            cssPropertyRules: None,
3519            cssPropertyRegistrations: None,
3520            cssAtRules: None,
3521            parentLayoutNodeId: None,
3522            cssFunctionRules: None,
3523        }
3524    }
3525    pub fn inlineStyle(&self) -> Option<&CSSStyle<'a>> { self.inlineStyle.as_ref() }
3526    pub fn attributesStyle(&self) -> Option<&CSSStyle<'a>> { self.attributesStyle.as_ref() }
3527    pub fn matchedCSSRules(&self) -> Option<&[RuleMatch<'a>]> { self.matchedCSSRules.as_deref() }
3528    pub fn pseudoElements(&self) -> Option<&[PseudoElementMatches<'a>]> { self.pseudoElements.as_deref() }
3529    pub fn inherited(&self) -> Option<&[InheritedStyleEntry<'a>]> { self.inherited.as_deref() }
3530    pub fn inheritedPseudoElements(&self) -> Option<&[InheritedPseudoElementMatches<'a>]> { self.inheritedPseudoElements.as_deref() }
3531    pub fn cssKeyframesRules(&self) -> Option<&[CSSKeyframesRule<'a>]> { self.cssKeyframesRules.as_deref() }
3532    pub fn cssPositionTryRules(&self) -> Option<&[CSSPositionTryRule<'a>]> { self.cssPositionTryRules.as_deref() }
3533    pub fn activePositionFallbackIndex(&self) -> Option<u64> { self.activePositionFallbackIndex }
3534    pub fn cssPropertyRules(&self) -> Option<&[CSSPropertyRule<'a>]> { self.cssPropertyRules.as_deref() }
3535    pub fn cssPropertyRegistrations(&self) -> Option<&[CSSPropertyRegistration<'a>]> { self.cssPropertyRegistrations.as_deref() }
3536    pub fn cssAtRules(&self) -> Option<&[CSSAtRule<'a>]> { self.cssAtRules.as_deref() }
3537    pub fn parentLayoutNodeId(&self) -> Option<&crate::dom::NodeId> { self.parentLayoutNodeId.as_ref() }
3538    pub fn cssFunctionRules(&self) -> Option<&[CSSFunctionRule<'a>]> { self.cssFunctionRules.as_deref() }
3539}
3540
3541#[derive(Default)]
3542pub struct GetMatchedStylesForNodeReturnsBuilder<'a> {
3543    inlineStyle: Option<CSSStyle<'a>>,
3544    attributesStyle: Option<CSSStyle<'a>>,
3545    matchedCSSRules: Option<Vec<RuleMatch<'a>>>,
3546    pseudoElements: Option<Vec<PseudoElementMatches<'a>>>,
3547    inherited: Option<Vec<InheritedStyleEntry<'a>>>,
3548    inheritedPseudoElements: Option<Vec<InheritedPseudoElementMatches<'a>>>,
3549    cssKeyframesRules: Option<Vec<CSSKeyframesRule<'a>>>,
3550    cssPositionTryRules: Option<Vec<CSSPositionTryRule<'a>>>,
3551    activePositionFallbackIndex: Option<u64>,
3552    cssPropertyRules: Option<Vec<CSSPropertyRule<'a>>>,
3553    cssPropertyRegistrations: Option<Vec<CSSPropertyRegistration<'a>>>,
3554    cssAtRules: Option<Vec<CSSAtRule<'a>>>,
3555    parentLayoutNodeId: Option<crate::dom::NodeId>,
3556    cssFunctionRules: Option<Vec<CSSFunctionRule<'a>>>,
3557}
3558
3559impl<'a> GetMatchedStylesForNodeReturnsBuilder<'a> {
3560    /// Inline style for the specified DOM node.
3561    pub fn inlineStyle(mut self, inlineStyle: CSSStyle<'a>) -> Self { self.inlineStyle = Some(inlineStyle); self }
3562    /// Attribute-defined element style (e.g. resulting from "width=20 height=100%").
3563    pub fn attributesStyle(mut self, attributesStyle: CSSStyle<'a>) -> Self { self.attributesStyle = Some(attributesStyle); self }
3564    /// CSS rules matching this node, from all applicable stylesheets.
3565    pub fn matchedCSSRules(mut self, matchedCSSRules: Vec<RuleMatch<'a>>) -> Self { self.matchedCSSRules = Some(matchedCSSRules); self }
3566    /// Pseudo style matches for this node.
3567    pub fn pseudoElements(mut self, pseudoElements: Vec<PseudoElementMatches<'a>>) -> Self { self.pseudoElements = Some(pseudoElements); self }
3568    /// A chain of inherited styles (from the immediate node parent up to the DOM tree root).
3569    pub fn inherited(mut self, inherited: Vec<InheritedStyleEntry<'a>>) -> Self { self.inherited = Some(inherited); self }
3570    /// A chain of inherited pseudo element styles (from the immediate node parent up to the DOM tree root).
3571    pub fn inheritedPseudoElements(mut self, inheritedPseudoElements: Vec<InheritedPseudoElementMatches<'a>>) -> Self { self.inheritedPseudoElements = Some(inheritedPseudoElements); self }
3572    /// A list of CSS keyframed animations matching this node.
3573    pub fn cssKeyframesRules(mut self, cssKeyframesRules: Vec<CSSKeyframesRule<'a>>) -> Self { self.cssKeyframesRules = Some(cssKeyframesRules); self }
3574    /// A list of CSS @position-try rules matching this node, based on the position-try-fallbacks property.
3575    pub fn cssPositionTryRules(mut self, cssPositionTryRules: Vec<CSSPositionTryRule<'a>>) -> Self { self.cssPositionTryRules = Some(cssPositionTryRules); self }
3576    /// Index of the active fallback in the applied position-try-fallback property,
3577    /// will not be set if there is no active position-try fallback.
3578    pub fn activePositionFallbackIndex(mut self, activePositionFallbackIndex: u64) -> Self { self.activePositionFallbackIndex = Some(activePositionFallbackIndex); self }
3579    /// A list of CSS at-property rules matching this node.
3580    pub fn cssPropertyRules(mut self, cssPropertyRules: Vec<CSSPropertyRule<'a>>) -> Self { self.cssPropertyRules = Some(cssPropertyRules); self }
3581    /// A list of CSS property registrations matching this node.
3582    pub fn cssPropertyRegistrations(mut self, cssPropertyRegistrations: Vec<CSSPropertyRegistration<'a>>) -> Self { self.cssPropertyRegistrations = Some(cssPropertyRegistrations); self }
3583    /// A list of simple @rules matching this node or its pseudo-elements.
3584    pub fn cssAtRules(mut self, cssAtRules: Vec<CSSAtRule<'a>>) -> Self { self.cssAtRules = Some(cssAtRules); self }
3585    /// Id of the first parent element that does not have display: contents.
3586    pub fn parentLayoutNodeId(mut self, parentLayoutNodeId: crate::dom::NodeId) -> Self { self.parentLayoutNodeId = Some(parentLayoutNodeId); self }
3587    /// A list of CSS at-function rules referenced by styles of this node.
3588    pub fn cssFunctionRules(mut self, cssFunctionRules: Vec<CSSFunctionRule<'a>>) -> Self { self.cssFunctionRules = Some(cssFunctionRules); self }
3589    pub fn build(self) -> GetMatchedStylesForNodeReturns<'a> {
3590        GetMatchedStylesForNodeReturns {
3591            inlineStyle: self.inlineStyle,
3592            attributesStyle: self.attributesStyle,
3593            matchedCSSRules: self.matchedCSSRules,
3594            pseudoElements: self.pseudoElements,
3595            inherited: self.inherited,
3596            inheritedPseudoElements: self.inheritedPseudoElements,
3597            cssKeyframesRules: self.cssKeyframesRules,
3598            cssPositionTryRules: self.cssPositionTryRules,
3599            activePositionFallbackIndex: self.activePositionFallbackIndex,
3600            cssPropertyRules: self.cssPropertyRules,
3601            cssPropertyRegistrations: self.cssPropertyRegistrations,
3602            cssAtRules: self.cssAtRules,
3603            parentLayoutNodeId: self.parentLayoutNodeId,
3604            cssFunctionRules: self.cssFunctionRules,
3605        }
3606    }
3607}
3608
3609impl GetMatchedStylesForNodeParams { pub const METHOD: &'static str = "CSS.getMatchedStylesForNode"; }
3610
3611impl<'a> crate::CdpCommand<'a> for GetMatchedStylesForNodeParams {
3612    const METHOD: &'static str = "CSS.getMatchedStylesForNode";
3613    type Response = GetMatchedStylesForNodeReturns<'a>;
3614}
3615
3616/// Returns the values of the default UA-defined environment variables used in env()
3617
3618#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3619#[serde(rename_all = "camelCase")]
3620pub struct GetEnvironmentVariablesReturns {
3621    environmentVariables: serde_json::Map<String, JsonValue>,
3622}
3623
3624impl GetEnvironmentVariablesReturns {
3625    pub fn builder(environmentVariables: serde_json::Map<String, JsonValue>) -> GetEnvironmentVariablesReturnsBuilder {
3626        GetEnvironmentVariablesReturnsBuilder {
3627            environmentVariables: environmentVariables,
3628        }
3629    }
3630    pub fn environmentVariables(&self) -> &serde_json::Map<String, JsonValue> { &self.environmentVariables }
3631}
3632
3633
3634pub struct GetEnvironmentVariablesReturnsBuilder {
3635    environmentVariables: serde_json::Map<String, JsonValue>,
3636}
3637
3638impl GetEnvironmentVariablesReturnsBuilder {
3639    pub fn build(self) -> GetEnvironmentVariablesReturns {
3640        GetEnvironmentVariablesReturns {
3641            environmentVariables: self.environmentVariables,
3642        }
3643    }
3644}
3645
3646#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3647pub struct GetEnvironmentVariablesParams {}
3648
3649impl GetEnvironmentVariablesParams { pub const METHOD: &'static str = "CSS.getEnvironmentVariables"; }
3650
3651impl<'a> crate::CdpCommand<'a> for GetEnvironmentVariablesParams {
3652    const METHOD: &'static str = "CSS.getEnvironmentVariables";
3653    type Response = GetEnvironmentVariablesReturns;
3654}
3655
3656/// Returns all media queries parsed by the rendering engine.
3657
3658#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3659#[serde(rename_all = "camelCase")]
3660pub struct GetMediaQueriesReturns<'a> {
3661    medias: Vec<CSSMedia<'a>>,
3662}
3663
3664impl<'a> GetMediaQueriesReturns<'a> {
3665    pub fn builder(medias: Vec<CSSMedia<'a>>) -> GetMediaQueriesReturnsBuilder<'a> {
3666        GetMediaQueriesReturnsBuilder {
3667            medias: medias,
3668        }
3669    }
3670    pub fn medias(&self) -> &[CSSMedia<'a>] { &self.medias }
3671}
3672
3673
3674pub struct GetMediaQueriesReturnsBuilder<'a> {
3675    medias: Vec<CSSMedia<'a>>,
3676}
3677
3678impl<'a> GetMediaQueriesReturnsBuilder<'a> {
3679    pub fn build(self) -> GetMediaQueriesReturns<'a> {
3680        GetMediaQueriesReturns {
3681            medias: self.medias,
3682        }
3683    }
3684}
3685
3686#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3687pub struct GetMediaQueriesParams {}
3688
3689impl GetMediaQueriesParams { pub const METHOD: &'static str = "CSS.getMediaQueries"; }
3690
3691impl<'a> crate::CdpCommand<'a> for GetMediaQueriesParams {
3692    const METHOD: &'static str = "CSS.getMediaQueries";
3693    type Response = GetMediaQueriesReturns<'a>;
3694}
3695
3696/// Requests information about platform fonts which we used to render child TextNodes in the given
3697/// node.
3698
3699#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3700#[serde(rename_all = "camelCase")]
3701pub struct GetPlatformFontsForNodeParams {
3702    nodeId: crate::dom::NodeId,
3703}
3704
3705impl GetPlatformFontsForNodeParams {
3706    pub fn builder(nodeId: crate::dom::NodeId) -> GetPlatformFontsForNodeParamsBuilder {
3707        GetPlatformFontsForNodeParamsBuilder {
3708            nodeId: nodeId,
3709        }
3710    }
3711    pub fn nodeId(&self) -> &crate::dom::NodeId { &self.nodeId }
3712}
3713
3714
3715pub struct GetPlatformFontsForNodeParamsBuilder {
3716    nodeId: crate::dom::NodeId,
3717}
3718
3719impl GetPlatformFontsForNodeParamsBuilder {
3720    pub fn build(self) -> GetPlatformFontsForNodeParams {
3721        GetPlatformFontsForNodeParams {
3722            nodeId: self.nodeId,
3723        }
3724    }
3725}
3726
3727/// Requests information about platform fonts which we used to render child TextNodes in the given
3728/// node.
3729
3730#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3731#[serde(rename_all = "camelCase")]
3732pub struct GetPlatformFontsForNodeReturns<'a> {
3733    /// Usage statistics for every employed platform font.
3734    fonts: Vec<PlatformFontUsage<'a>>,
3735}
3736
3737impl<'a> GetPlatformFontsForNodeReturns<'a> {
3738    pub fn builder(fonts: Vec<PlatformFontUsage<'a>>) -> GetPlatformFontsForNodeReturnsBuilder<'a> {
3739        GetPlatformFontsForNodeReturnsBuilder {
3740            fonts: fonts,
3741        }
3742    }
3743    pub fn fonts(&self) -> &[PlatformFontUsage<'a>] { &self.fonts }
3744}
3745
3746
3747pub struct GetPlatformFontsForNodeReturnsBuilder<'a> {
3748    fonts: Vec<PlatformFontUsage<'a>>,
3749}
3750
3751impl<'a> GetPlatformFontsForNodeReturnsBuilder<'a> {
3752    pub fn build(self) -> GetPlatformFontsForNodeReturns<'a> {
3753        GetPlatformFontsForNodeReturns {
3754            fonts: self.fonts,
3755        }
3756    }
3757}
3758
3759impl GetPlatformFontsForNodeParams { pub const METHOD: &'static str = "CSS.getPlatformFontsForNode"; }
3760
3761impl<'a> crate::CdpCommand<'a> for GetPlatformFontsForNodeParams {
3762    const METHOD: &'static str = "CSS.getPlatformFontsForNode";
3763    type Response = GetPlatformFontsForNodeReturns<'a>;
3764}
3765
3766/// Returns the current textual content for a stylesheet.
3767
3768#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3769#[serde(rename_all = "camelCase")]
3770pub struct GetStyleSheetTextParams<'a> {
3771    styleSheetId: crate::dom::StyleSheetId<'a>,
3772}
3773
3774impl<'a> GetStyleSheetTextParams<'a> {
3775    pub fn builder(styleSheetId: crate::dom::StyleSheetId<'a>) -> GetStyleSheetTextParamsBuilder<'a> {
3776        GetStyleSheetTextParamsBuilder {
3777            styleSheetId: styleSheetId,
3778        }
3779    }
3780    pub fn styleSheetId(&self) -> &crate::dom::StyleSheetId<'a> { &self.styleSheetId }
3781}
3782
3783
3784pub struct GetStyleSheetTextParamsBuilder<'a> {
3785    styleSheetId: crate::dom::StyleSheetId<'a>,
3786}
3787
3788impl<'a> GetStyleSheetTextParamsBuilder<'a> {
3789    pub fn build(self) -> GetStyleSheetTextParams<'a> {
3790        GetStyleSheetTextParams {
3791            styleSheetId: self.styleSheetId,
3792        }
3793    }
3794}
3795
3796/// Returns the current textual content for a stylesheet.
3797
3798#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3799#[serde(rename_all = "camelCase")]
3800pub struct GetStyleSheetTextReturns<'a> {
3801    /// The stylesheet text.
3802    text: Cow<'a, str>,
3803}
3804
3805impl<'a> GetStyleSheetTextReturns<'a> {
3806    pub fn builder(text: impl Into<Cow<'a, str>>) -> GetStyleSheetTextReturnsBuilder<'a> {
3807        GetStyleSheetTextReturnsBuilder {
3808            text: text.into(),
3809        }
3810    }
3811    pub fn text(&self) -> &str { self.text.as_ref() }
3812}
3813
3814
3815pub struct GetStyleSheetTextReturnsBuilder<'a> {
3816    text: Cow<'a, str>,
3817}
3818
3819impl<'a> GetStyleSheetTextReturnsBuilder<'a> {
3820    pub fn build(self) -> GetStyleSheetTextReturns<'a> {
3821        GetStyleSheetTextReturns {
3822            text: self.text,
3823        }
3824    }
3825}
3826
3827impl<'a> GetStyleSheetTextParams<'a> { pub const METHOD: &'static str = "CSS.getStyleSheetText"; }
3828
3829impl<'a> crate::CdpCommand<'a> for GetStyleSheetTextParams<'a> {
3830    const METHOD: &'static str = "CSS.getStyleSheetText";
3831    type Response = GetStyleSheetTextReturns<'a>;
3832}
3833
3834/// Returns all layers parsed by the rendering engine for the tree scope of a node.
3835/// Given a DOM element identified by nodeId, getLayersForNode returns the root
3836/// layer for the nearest ancestor document or shadow root. The layer root contains
3837/// the full layer tree for the tree scope and their ordering.
3838
3839#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3840#[serde(rename_all = "camelCase")]
3841pub struct GetLayersForNodeParams {
3842    nodeId: crate::dom::NodeId,
3843}
3844
3845impl GetLayersForNodeParams {
3846    pub fn builder(nodeId: crate::dom::NodeId) -> GetLayersForNodeParamsBuilder {
3847        GetLayersForNodeParamsBuilder {
3848            nodeId: nodeId,
3849        }
3850    }
3851    pub fn nodeId(&self) -> &crate::dom::NodeId { &self.nodeId }
3852}
3853
3854
3855pub struct GetLayersForNodeParamsBuilder {
3856    nodeId: crate::dom::NodeId,
3857}
3858
3859impl GetLayersForNodeParamsBuilder {
3860    pub fn build(self) -> GetLayersForNodeParams {
3861        GetLayersForNodeParams {
3862            nodeId: self.nodeId,
3863        }
3864    }
3865}
3866
3867/// Returns all layers parsed by the rendering engine for the tree scope of a node.
3868/// Given a DOM element identified by nodeId, getLayersForNode returns the root
3869/// layer for the nearest ancestor document or shadow root. The layer root contains
3870/// the full layer tree for the tree scope and their ordering.
3871
3872#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3873#[serde(rename_all = "camelCase")]
3874pub struct GetLayersForNodeReturns<'a> {
3875    rootLayer: CSSLayerData<'a>,
3876}
3877
3878impl<'a> GetLayersForNodeReturns<'a> {
3879    pub fn builder(rootLayer: CSSLayerData<'a>) -> GetLayersForNodeReturnsBuilder<'a> {
3880        GetLayersForNodeReturnsBuilder {
3881            rootLayer: rootLayer,
3882        }
3883    }
3884    pub fn rootLayer(&self) -> &CSSLayerData<'a> { &self.rootLayer }
3885}
3886
3887
3888pub struct GetLayersForNodeReturnsBuilder<'a> {
3889    rootLayer: CSSLayerData<'a>,
3890}
3891
3892impl<'a> GetLayersForNodeReturnsBuilder<'a> {
3893    pub fn build(self) -> GetLayersForNodeReturns<'a> {
3894        GetLayersForNodeReturns {
3895            rootLayer: self.rootLayer,
3896        }
3897    }
3898}
3899
3900impl GetLayersForNodeParams { pub const METHOD: &'static str = "CSS.getLayersForNode"; }
3901
3902impl<'a> crate::CdpCommand<'a> for GetLayersForNodeParams {
3903    const METHOD: &'static str = "CSS.getLayersForNode";
3904    type Response = GetLayersForNodeReturns<'a>;
3905}
3906
3907/// Given a CSS selector text and a style sheet ID, getLocationForSelector
3908/// returns an array of locations of the CSS selector in the style sheet.
3909
3910#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3911#[serde(rename_all = "camelCase")]
3912pub struct GetLocationForSelectorParams<'a> {
3913    styleSheetId: crate::dom::StyleSheetId<'a>,
3914    selectorText: Cow<'a, str>,
3915}
3916
3917impl<'a> GetLocationForSelectorParams<'a> {
3918    pub fn builder(styleSheetId: crate::dom::StyleSheetId<'a>, selectorText: impl Into<Cow<'a, str>>) -> GetLocationForSelectorParamsBuilder<'a> {
3919        GetLocationForSelectorParamsBuilder {
3920            styleSheetId: styleSheetId,
3921            selectorText: selectorText.into(),
3922        }
3923    }
3924    pub fn styleSheetId(&self) -> &crate::dom::StyleSheetId<'a> { &self.styleSheetId }
3925    pub fn selectorText(&self) -> &str { self.selectorText.as_ref() }
3926}
3927
3928
3929pub struct GetLocationForSelectorParamsBuilder<'a> {
3930    styleSheetId: crate::dom::StyleSheetId<'a>,
3931    selectorText: Cow<'a, str>,
3932}
3933
3934impl<'a> GetLocationForSelectorParamsBuilder<'a> {
3935    pub fn build(self) -> GetLocationForSelectorParams<'a> {
3936        GetLocationForSelectorParams {
3937            styleSheetId: self.styleSheetId,
3938            selectorText: self.selectorText,
3939        }
3940    }
3941}
3942
3943/// Given a CSS selector text and a style sheet ID, getLocationForSelector
3944/// returns an array of locations of the CSS selector in the style sheet.
3945
3946#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3947#[serde(rename_all = "camelCase")]
3948pub struct GetLocationForSelectorReturns {
3949    ranges: Vec<SourceRange>,
3950}
3951
3952impl GetLocationForSelectorReturns {
3953    pub fn builder(ranges: Vec<SourceRange>) -> GetLocationForSelectorReturnsBuilder {
3954        GetLocationForSelectorReturnsBuilder {
3955            ranges: ranges,
3956        }
3957    }
3958    pub fn ranges(&self) -> &[SourceRange] { &self.ranges }
3959}
3960
3961
3962pub struct GetLocationForSelectorReturnsBuilder {
3963    ranges: Vec<SourceRange>,
3964}
3965
3966impl GetLocationForSelectorReturnsBuilder {
3967    pub fn build(self) -> GetLocationForSelectorReturns {
3968        GetLocationForSelectorReturns {
3969            ranges: self.ranges,
3970        }
3971    }
3972}
3973
3974impl<'a> GetLocationForSelectorParams<'a> { pub const METHOD: &'static str = "CSS.getLocationForSelector"; }
3975
3976impl<'a> crate::CdpCommand<'a> for GetLocationForSelectorParams<'a> {
3977    const METHOD: &'static str = "CSS.getLocationForSelector";
3978    type Response = GetLocationForSelectorReturns;
3979}
3980
3981/// Starts tracking the given node for the computed style updates
3982/// and whenever the computed style is updated for node, it queues
3983/// a 'computedStyleUpdated' event with throttling.
3984/// There can only be 1 node tracked for computed style updates
3985/// so passing a new node id removes tracking from the previous node.
3986/// Pass 'undefined' to disable tracking.
3987
3988#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3989#[serde(rename_all = "camelCase")]
3990pub struct TrackComputedStyleUpdatesForNodeParams {
3991    #[serde(skip_serializing_if = "Option::is_none")]
3992    nodeId: Option<crate::dom::NodeId>,
3993}
3994
3995impl TrackComputedStyleUpdatesForNodeParams {
3996    pub fn builder() -> TrackComputedStyleUpdatesForNodeParamsBuilder {
3997        TrackComputedStyleUpdatesForNodeParamsBuilder {
3998            nodeId: None,
3999        }
4000    }
4001    pub fn nodeId(&self) -> Option<&crate::dom::NodeId> { self.nodeId.as_ref() }
4002}
4003
4004#[derive(Default)]
4005pub struct TrackComputedStyleUpdatesForNodeParamsBuilder {
4006    nodeId: Option<crate::dom::NodeId>,
4007}
4008
4009impl TrackComputedStyleUpdatesForNodeParamsBuilder {
4010    pub fn nodeId(mut self, nodeId: crate::dom::NodeId) -> Self { self.nodeId = Some(nodeId); self }
4011    pub fn build(self) -> TrackComputedStyleUpdatesForNodeParams {
4012        TrackComputedStyleUpdatesForNodeParams {
4013            nodeId: self.nodeId,
4014        }
4015    }
4016}
4017
4018impl TrackComputedStyleUpdatesForNodeParams { pub const METHOD: &'static str = "CSS.trackComputedStyleUpdatesForNode"; }
4019
4020impl<'a> crate::CdpCommand<'a> for TrackComputedStyleUpdatesForNodeParams {
4021    const METHOD: &'static str = "CSS.trackComputedStyleUpdatesForNode";
4022    type Response = crate::EmptyReturns;
4023}
4024
4025/// Starts tracking the given computed styles for updates. The specified array of properties
4026/// replaces the one previously specified. Pass empty array to disable tracking.
4027/// Use takeComputedStyleUpdates to retrieve the list of nodes that had properties modified.
4028/// The changes to computed style properties are only tracked for nodes pushed to the front-end
4029/// by the DOM agent. If no changes to the tracked properties occur after the node has been pushed
4030/// to the front-end, no updates will be issued for the node.
4031
4032#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4033#[serde(rename_all = "camelCase")]
4034pub struct TrackComputedStyleUpdatesParams<'a> {
4035    propertiesToTrack: Vec<CSSComputedStyleProperty<'a>>,
4036}
4037
4038impl<'a> TrackComputedStyleUpdatesParams<'a> {
4039    pub fn builder(propertiesToTrack: Vec<CSSComputedStyleProperty<'a>>) -> TrackComputedStyleUpdatesParamsBuilder<'a> {
4040        TrackComputedStyleUpdatesParamsBuilder {
4041            propertiesToTrack: propertiesToTrack,
4042        }
4043    }
4044    pub fn propertiesToTrack(&self) -> &[CSSComputedStyleProperty<'a>] { &self.propertiesToTrack }
4045}
4046
4047
4048pub struct TrackComputedStyleUpdatesParamsBuilder<'a> {
4049    propertiesToTrack: Vec<CSSComputedStyleProperty<'a>>,
4050}
4051
4052impl<'a> TrackComputedStyleUpdatesParamsBuilder<'a> {
4053    pub fn build(self) -> TrackComputedStyleUpdatesParams<'a> {
4054        TrackComputedStyleUpdatesParams {
4055            propertiesToTrack: self.propertiesToTrack,
4056        }
4057    }
4058}
4059
4060impl<'a> TrackComputedStyleUpdatesParams<'a> { pub const METHOD: &'static str = "CSS.trackComputedStyleUpdates"; }
4061
4062impl<'a> crate::CdpCommand<'a> for TrackComputedStyleUpdatesParams<'a> {
4063    const METHOD: &'static str = "CSS.trackComputedStyleUpdates";
4064    type Response = crate::EmptyReturns;
4065}
4066
4067/// Polls the next batch of computed style updates.
4068
4069#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4070#[serde(rename_all = "camelCase")]
4071pub struct TakeComputedStyleUpdatesReturns {
4072    /// The list of node Ids that have their tracked computed styles updated.
4073    nodeIds: Vec<crate::dom::NodeId>,
4074}
4075
4076impl TakeComputedStyleUpdatesReturns {
4077    pub fn builder(nodeIds: Vec<crate::dom::NodeId>) -> TakeComputedStyleUpdatesReturnsBuilder {
4078        TakeComputedStyleUpdatesReturnsBuilder {
4079            nodeIds: nodeIds,
4080        }
4081    }
4082    pub fn nodeIds(&self) -> &[crate::dom::NodeId] { &self.nodeIds }
4083}
4084
4085
4086pub struct TakeComputedStyleUpdatesReturnsBuilder {
4087    nodeIds: Vec<crate::dom::NodeId>,
4088}
4089
4090impl TakeComputedStyleUpdatesReturnsBuilder {
4091    pub fn build(self) -> TakeComputedStyleUpdatesReturns {
4092        TakeComputedStyleUpdatesReturns {
4093            nodeIds: self.nodeIds,
4094        }
4095    }
4096}
4097
4098#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4099pub struct TakeComputedStyleUpdatesParams {}
4100
4101impl TakeComputedStyleUpdatesParams { pub const METHOD: &'static str = "CSS.takeComputedStyleUpdates"; }
4102
4103impl<'a> crate::CdpCommand<'a> for TakeComputedStyleUpdatesParams {
4104    const METHOD: &'static str = "CSS.takeComputedStyleUpdates";
4105    type Response = TakeComputedStyleUpdatesReturns;
4106}
4107
4108/// Find a rule with the given active property for the given node and set the new value for this
4109/// property
4110
4111#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4112#[serde(rename_all = "camelCase")]
4113pub struct SetEffectivePropertyValueForNodeParams<'a> {
4114    /// The element id for which to set property.
4115    nodeId: crate::dom::NodeId,
4116    propertyName: Cow<'a, str>,
4117    value: Cow<'a, str>,
4118}
4119
4120impl<'a> SetEffectivePropertyValueForNodeParams<'a> {
4121    pub fn builder(nodeId: crate::dom::NodeId, propertyName: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>) -> SetEffectivePropertyValueForNodeParamsBuilder<'a> {
4122        SetEffectivePropertyValueForNodeParamsBuilder {
4123            nodeId: nodeId,
4124            propertyName: propertyName.into(),
4125            value: value.into(),
4126        }
4127    }
4128    pub fn nodeId(&self) -> &crate::dom::NodeId { &self.nodeId }
4129    pub fn propertyName(&self) -> &str { self.propertyName.as_ref() }
4130    pub fn value(&self) -> &str { self.value.as_ref() }
4131}
4132
4133
4134pub struct SetEffectivePropertyValueForNodeParamsBuilder<'a> {
4135    nodeId: crate::dom::NodeId,
4136    propertyName: Cow<'a, str>,
4137    value: Cow<'a, str>,
4138}
4139
4140impl<'a> SetEffectivePropertyValueForNodeParamsBuilder<'a> {
4141    pub fn build(self) -> SetEffectivePropertyValueForNodeParams<'a> {
4142        SetEffectivePropertyValueForNodeParams {
4143            nodeId: self.nodeId,
4144            propertyName: self.propertyName,
4145            value: self.value,
4146        }
4147    }
4148}
4149
4150impl<'a> SetEffectivePropertyValueForNodeParams<'a> { pub const METHOD: &'static str = "CSS.setEffectivePropertyValueForNode"; }
4151
4152impl<'a> crate::CdpCommand<'a> for SetEffectivePropertyValueForNodeParams<'a> {
4153    const METHOD: &'static str = "CSS.setEffectivePropertyValueForNode";
4154    type Response = crate::EmptyReturns;
4155}
4156
4157/// Modifies the property rule property name.
4158
4159#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4160#[serde(rename_all = "camelCase")]
4161pub struct SetPropertyRulePropertyNameParams<'a> {
4162    styleSheetId: crate::dom::StyleSheetId<'a>,
4163    range: SourceRange,
4164    propertyName: Cow<'a, str>,
4165}
4166
4167impl<'a> SetPropertyRulePropertyNameParams<'a> {
4168    pub fn builder(styleSheetId: crate::dom::StyleSheetId<'a>, range: SourceRange, propertyName: impl Into<Cow<'a, str>>) -> SetPropertyRulePropertyNameParamsBuilder<'a> {
4169        SetPropertyRulePropertyNameParamsBuilder {
4170            styleSheetId: styleSheetId,
4171            range: range,
4172            propertyName: propertyName.into(),
4173        }
4174    }
4175    pub fn styleSheetId(&self) -> &crate::dom::StyleSheetId<'a> { &self.styleSheetId }
4176    pub fn range(&self) -> &SourceRange { &self.range }
4177    pub fn propertyName(&self) -> &str { self.propertyName.as_ref() }
4178}
4179
4180
4181pub struct SetPropertyRulePropertyNameParamsBuilder<'a> {
4182    styleSheetId: crate::dom::StyleSheetId<'a>,
4183    range: SourceRange,
4184    propertyName: Cow<'a, str>,
4185}
4186
4187impl<'a> SetPropertyRulePropertyNameParamsBuilder<'a> {
4188    pub fn build(self) -> SetPropertyRulePropertyNameParams<'a> {
4189        SetPropertyRulePropertyNameParams {
4190            styleSheetId: self.styleSheetId,
4191            range: self.range,
4192            propertyName: self.propertyName,
4193        }
4194    }
4195}
4196
4197/// Modifies the property rule property name.
4198
4199#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4200#[serde(rename_all = "camelCase")]
4201pub struct SetPropertyRulePropertyNameReturns<'a> {
4202    /// The resulting key text after modification.
4203    propertyName: ProtocolValue<'a>,
4204}
4205
4206impl<'a> SetPropertyRulePropertyNameReturns<'a> {
4207    pub fn builder(propertyName: ProtocolValue<'a>) -> SetPropertyRulePropertyNameReturnsBuilder<'a> {
4208        SetPropertyRulePropertyNameReturnsBuilder {
4209            propertyName: propertyName,
4210        }
4211    }
4212    pub fn propertyName(&self) -> &ProtocolValue<'a> { &self.propertyName }
4213}
4214
4215
4216pub struct SetPropertyRulePropertyNameReturnsBuilder<'a> {
4217    propertyName: ProtocolValue<'a>,
4218}
4219
4220impl<'a> SetPropertyRulePropertyNameReturnsBuilder<'a> {
4221    pub fn build(self) -> SetPropertyRulePropertyNameReturns<'a> {
4222        SetPropertyRulePropertyNameReturns {
4223            propertyName: self.propertyName,
4224        }
4225    }
4226}
4227
4228impl<'a> SetPropertyRulePropertyNameParams<'a> { pub const METHOD: &'static str = "CSS.setPropertyRulePropertyName"; }
4229
4230impl<'a> crate::CdpCommand<'a> for SetPropertyRulePropertyNameParams<'a> {
4231    const METHOD: &'static str = "CSS.setPropertyRulePropertyName";
4232    type Response = SetPropertyRulePropertyNameReturns<'a>;
4233}
4234
4235/// Modifies the keyframe rule key text.
4236
4237#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4238#[serde(rename_all = "camelCase")]
4239pub struct SetKeyframeKeyParams<'a> {
4240    styleSheetId: crate::dom::StyleSheetId<'a>,
4241    range: SourceRange,
4242    keyText: Cow<'a, str>,
4243}
4244
4245impl<'a> SetKeyframeKeyParams<'a> {
4246    pub fn builder(styleSheetId: crate::dom::StyleSheetId<'a>, range: SourceRange, keyText: impl Into<Cow<'a, str>>) -> SetKeyframeKeyParamsBuilder<'a> {
4247        SetKeyframeKeyParamsBuilder {
4248            styleSheetId: styleSheetId,
4249            range: range,
4250            keyText: keyText.into(),
4251        }
4252    }
4253    pub fn styleSheetId(&self) -> &crate::dom::StyleSheetId<'a> { &self.styleSheetId }
4254    pub fn range(&self) -> &SourceRange { &self.range }
4255    pub fn keyText(&self) -> &str { self.keyText.as_ref() }
4256}
4257
4258
4259pub struct SetKeyframeKeyParamsBuilder<'a> {
4260    styleSheetId: crate::dom::StyleSheetId<'a>,
4261    range: SourceRange,
4262    keyText: Cow<'a, str>,
4263}
4264
4265impl<'a> SetKeyframeKeyParamsBuilder<'a> {
4266    pub fn build(self) -> SetKeyframeKeyParams<'a> {
4267        SetKeyframeKeyParams {
4268            styleSheetId: self.styleSheetId,
4269            range: self.range,
4270            keyText: self.keyText,
4271        }
4272    }
4273}
4274
4275/// Modifies the keyframe rule key text.
4276
4277#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4278#[serde(rename_all = "camelCase")]
4279pub struct SetKeyframeKeyReturns<'a> {
4280    /// The resulting key text after modification.
4281    keyText: ProtocolValue<'a>,
4282}
4283
4284impl<'a> SetKeyframeKeyReturns<'a> {
4285    pub fn builder(keyText: ProtocolValue<'a>) -> SetKeyframeKeyReturnsBuilder<'a> {
4286        SetKeyframeKeyReturnsBuilder {
4287            keyText: keyText,
4288        }
4289    }
4290    pub fn keyText(&self) -> &ProtocolValue<'a> { &self.keyText }
4291}
4292
4293
4294pub struct SetKeyframeKeyReturnsBuilder<'a> {
4295    keyText: ProtocolValue<'a>,
4296}
4297
4298impl<'a> SetKeyframeKeyReturnsBuilder<'a> {
4299    pub fn build(self) -> SetKeyframeKeyReturns<'a> {
4300        SetKeyframeKeyReturns {
4301            keyText: self.keyText,
4302        }
4303    }
4304}
4305
4306impl<'a> SetKeyframeKeyParams<'a> { pub const METHOD: &'static str = "CSS.setKeyframeKey"; }
4307
4308impl<'a> crate::CdpCommand<'a> for SetKeyframeKeyParams<'a> {
4309    const METHOD: &'static str = "CSS.setKeyframeKey";
4310    type Response = SetKeyframeKeyReturns<'a>;
4311}
4312
4313/// Modifies the rule selector.
4314
4315#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4316#[serde(rename_all = "camelCase")]
4317pub struct SetMediaTextParams<'a> {
4318    styleSheetId: crate::dom::StyleSheetId<'a>,
4319    range: SourceRange,
4320    text: Cow<'a, str>,
4321}
4322
4323impl<'a> SetMediaTextParams<'a> {
4324    pub fn builder(styleSheetId: crate::dom::StyleSheetId<'a>, range: SourceRange, text: impl Into<Cow<'a, str>>) -> SetMediaTextParamsBuilder<'a> {
4325        SetMediaTextParamsBuilder {
4326            styleSheetId: styleSheetId,
4327            range: range,
4328            text: text.into(),
4329        }
4330    }
4331    pub fn styleSheetId(&self) -> &crate::dom::StyleSheetId<'a> { &self.styleSheetId }
4332    pub fn range(&self) -> &SourceRange { &self.range }
4333    pub fn text(&self) -> &str { self.text.as_ref() }
4334}
4335
4336
4337pub struct SetMediaTextParamsBuilder<'a> {
4338    styleSheetId: crate::dom::StyleSheetId<'a>,
4339    range: SourceRange,
4340    text: Cow<'a, str>,
4341}
4342
4343impl<'a> SetMediaTextParamsBuilder<'a> {
4344    pub fn build(self) -> SetMediaTextParams<'a> {
4345        SetMediaTextParams {
4346            styleSheetId: self.styleSheetId,
4347            range: self.range,
4348            text: self.text,
4349        }
4350    }
4351}
4352
4353/// Modifies the rule selector.
4354
4355#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4356#[serde(rename_all = "camelCase")]
4357pub struct SetMediaTextReturns<'a> {
4358    /// The resulting CSS media rule after modification.
4359    media: CSSMedia<'a>,
4360}
4361
4362impl<'a> SetMediaTextReturns<'a> {
4363    pub fn builder(media: CSSMedia<'a>) -> SetMediaTextReturnsBuilder<'a> {
4364        SetMediaTextReturnsBuilder {
4365            media: media,
4366        }
4367    }
4368    pub fn media(&self) -> &CSSMedia<'a> { &self.media }
4369}
4370
4371
4372pub struct SetMediaTextReturnsBuilder<'a> {
4373    media: CSSMedia<'a>,
4374}
4375
4376impl<'a> SetMediaTextReturnsBuilder<'a> {
4377    pub fn build(self) -> SetMediaTextReturns<'a> {
4378        SetMediaTextReturns {
4379            media: self.media,
4380        }
4381    }
4382}
4383
4384impl<'a> SetMediaTextParams<'a> { pub const METHOD: &'static str = "CSS.setMediaText"; }
4385
4386impl<'a> crate::CdpCommand<'a> for SetMediaTextParams<'a> {
4387    const METHOD: &'static str = "CSS.setMediaText";
4388    type Response = SetMediaTextReturns<'a>;
4389}
4390
4391/// Modifies the expression of a container query.
4392
4393#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4394#[serde(rename_all = "camelCase")]
4395pub struct SetContainerQueryTextParams<'a> {
4396    styleSheetId: crate::dom::StyleSheetId<'a>,
4397    range: SourceRange,
4398    text: Cow<'a, str>,
4399}
4400
4401impl<'a> SetContainerQueryTextParams<'a> {
4402    pub fn builder(styleSheetId: crate::dom::StyleSheetId<'a>, range: SourceRange, text: impl Into<Cow<'a, str>>) -> SetContainerQueryTextParamsBuilder<'a> {
4403        SetContainerQueryTextParamsBuilder {
4404            styleSheetId: styleSheetId,
4405            range: range,
4406            text: text.into(),
4407        }
4408    }
4409    pub fn styleSheetId(&self) -> &crate::dom::StyleSheetId<'a> { &self.styleSheetId }
4410    pub fn range(&self) -> &SourceRange { &self.range }
4411    pub fn text(&self) -> &str { self.text.as_ref() }
4412}
4413
4414
4415pub struct SetContainerQueryTextParamsBuilder<'a> {
4416    styleSheetId: crate::dom::StyleSheetId<'a>,
4417    range: SourceRange,
4418    text: Cow<'a, str>,
4419}
4420
4421impl<'a> SetContainerQueryTextParamsBuilder<'a> {
4422    pub fn build(self) -> SetContainerQueryTextParams<'a> {
4423        SetContainerQueryTextParams {
4424            styleSheetId: self.styleSheetId,
4425            range: self.range,
4426            text: self.text,
4427        }
4428    }
4429}
4430
4431/// Modifies the expression of a container query.
4432
4433#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4434#[serde(rename_all = "camelCase")]
4435pub struct SetContainerQueryTextReturns<'a> {
4436    /// The resulting CSS container query rule after modification.
4437    containerQuery: CSSContainerQuery<'a>,
4438}
4439
4440impl<'a> SetContainerQueryTextReturns<'a> {
4441    pub fn builder(containerQuery: CSSContainerQuery<'a>) -> SetContainerQueryTextReturnsBuilder<'a> {
4442        SetContainerQueryTextReturnsBuilder {
4443            containerQuery: containerQuery,
4444        }
4445    }
4446    pub fn containerQuery(&self) -> &CSSContainerQuery<'a> { &self.containerQuery }
4447}
4448
4449
4450pub struct SetContainerQueryTextReturnsBuilder<'a> {
4451    containerQuery: CSSContainerQuery<'a>,
4452}
4453
4454impl<'a> SetContainerQueryTextReturnsBuilder<'a> {
4455    pub fn build(self) -> SetContainerQueryTextReturns<'a> {
4456        SetContainerQueryTextReturns {
4457            containerQuery: self.containerQuery,
4458        }
4459    }
4460}
4461
4462impl<'a> SetContainerQueryTextParams<'a> { pub const METHOD: &'static str = "CSS.setContainerQueryText"; }
4463
4464impl<'a> crate::CdpCommand<'a> for SetContainerQueryTextParams<'a> {
4465    const METHOD: &'static str = "CSS.setContainerQueryText";
4466    type Response = SetContainerQueryTextReturns<'a>;
4467}
4468
4469/// Modifies the expression of a supports at-rule.
4470
4471#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4472#[serde(rename_all = "camelCase")]
4473pub struct SetSupportsTextParams<'a> {
4474    styleSheetId: crate::dom::StyleSheetId<'a>,
4475    range: SourceRange,
4476    text: Cow<'a, str>,
4477}
4478
4479impl<'a> SetSupportsTextParams<'a> {
4480    pub fn builder(styleSheetId: crate::dom::StyleSheetId<'a>, range: SourceRange, text: impl Into<Cow<'a, str>>) -> SetSupportsTextParamsBuilder<'a> {
4481        SetSupportsTextParamsBuilder {
4482            styleSheetId: styleSheetId,
4483            range: range,
4484            text: text.into(),
4485        }
4486    }
4487    pub fn styleSheetId(&self) -> &crate::dom::StyleSheetId<'a> { &self.styleSheetId }
4488    pub fn range(&self) -> &SourceRange { &self.range }
4489    pub fn text(&self) -> &str { self.text.as_ref() }
4490}
4491
4492
4493pub struct SetSupportsTextParamsBuilder<'a> {
4494    styleSheetId: crate::dom::StyleSheetId<'a>,
4495    range: SourceRange,
4496    text: Cow<'a, str>,
4497}
4498
4499impl<'a> SetSupportsTextParamsBuilder<'a> {
4500    pub fn build(self) -> SetSupportsTextParams<'a> {
4501        SetSupportsTextParams {
4502            styleSheetId: self.styleSheetId,
4503            range: self.range,
4504            text: self.text,
4505        }
4506    }
4507}
4508
4509/// Modifies the expression of a supports at-rule.
4510
4511#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4512#[serde(rename_all = "camelCase")]
4513pub struct SetSupportsTextReturns<'a> {
4514    /// The resulting CSS Supports rule after modification.
4515    supports: CSSSupports<'a>,
4516}
4517
4518impl<'a> SetSupportsTextReturns<'a> {
4519    pub fn builder(supports: CSSSupports<'a>) -> SetSupportsTextReturnsBuilder<'a> {
4520        SetSupportsTextReturnsBuilder {
4521            supports: supports,
4522        }
4523    }
4524    pub fn supports(&self) -> &CSSSupports<'a> { &self.supports }
4525}
4526
4527
4528pub struct SetSupportsTextReturnsBuilder<'a> {
4529    supports: CSSSupports<'a>,
4530}
4531
4532impl<'a> SetSupportsTextReturnsBuilder<'a> {
4533    pub fn build(self) -> SetSupportsTextReturns<'a> {
4534        SetSupportsTextReturns {
4535            supports: self.supports,
4536        }
4537    }
4538}
4539
4540impl<'a> SetSupportsTextParams<'a> { pub const METHOD: &'static str = "CSS.setSupportsText"; }
4541
4542impl<'a> crate::CdpCommand<'a> for SetSupportsTextParams<'a> {
4543    const METHOD: &'static str = "CSS.setSupportsText";
4544    type Response = SetSupportsTextReturns<'a>;
4545}
4546
4547/// Modifies the expression of a navigation at-rule.
4548
4549#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4550#[serde(rename_all = "camelCase")]
4551pub struct SetNavigationTextParams<'a> {
4552    styleSheetId: crate::dom::StyleSheetId<'a>,
4553    range: SourceRange,
4554    text: Cow<'a, str>,
4555}
4556
4557impl<'a> SetNavigationTextParams<'a> {
4558    pub fn builder(styleSheetId: crate::dom::StyleSheetId<'a>, range: SourceRange, text: impl Into<Cow<'a, str>>) -> SetNavigationTextParamsBuilder<'a> {
4559        SetNavigationTextParamsBuilder {
4560            styleSheetId: styleSheetId,
4561            range: range,
4562            text: text.into(),
4563        }
4564    }
4565    pub fn styleSheetId(&self) -> &crate::dom::StyleSheetId<'a> { &self.styleSheetId }
4566    pub fn range(&self) -> &SourceRange { &self.range }
4567    pub fn text(&self) -> &str { self.text.as_ref() }
4568}
4569
4570
4571pub struct SetNavigationTextParamsBuilder<'a> {
4572    styleSheetId: crate::dom::StyleSheetId<'a>,
4573    range: SourceRange,
4574    text: Cow<'a, str>,
4575}
4576
4577impl<'a> SetNavigationTextParamsBuilder<'a> {
4578    pub fn build(self) -> SetNavigationTextParams<'a> {
4579        SetNavigationTextParams {
4580            styleSheetId: self.styleSheetId,
4581            range: self.range,
4582            text: self.text,
4583        }
4584    }
4585}
4586
4587/// Modifies the expression of a navigation at-rule.
4588
4589#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4590#[serde(rename_all = "camelCase")]
4591pub struct SetNavigationTextReturns<'a> {
4592    /// The resulting CSS Navigation rule after modification.
4593    navigation: CSSNavigation<'a>,
4594}
4595
4596impl<'a> SetNavigationTextReturns<'a> {
4597    pub fn builder(navigation: CSSNavigation<'a>) -> SetNavigationTextReturnsBuilder<'a> {
4598        SetNavigationTextReturnsBuilder {
4599            navigation: navigation,
4600        }
4601    }
4602    pub fn navigation(&self) -> &CSSNavigation<'a> { &self.navigation }
4603}
4604
4605
4606pub struct SetNavigationTextReturnsBuilder<'a> {
4607    navigation: CSSNavigation<'a>,
4608}
4609
4610impl<'a> SetNavigationTextReturnsBuilder<'a> {
4611    pub fn build(self) -> SetNavigationTextReturns<'a> {
4612        SetNavigationTextReturns {
4613            navigation: self.navigation,
4614        }
4615    }
4616}
4617
4618impl<'a> SetNavigationTextParams<'a> { pub const METHOD: &'static str = "CSS.setNavigationText"; }
4619
4620impl<'a> crate::CdpCommand<'a> for SetNavigationTextParams<'a> {
4621    const METHOD: &'static str = "CSS.setNavigationText";
4622    type Response = SetNavigationTextReturns<'a>;
4623}
4624
4625/// Modifies the expression of a scope at-rule.
4626
4627#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4628#[serde(rename_all = "camelCase")]
4629pub struct SetScopeTextParams<'a> {
4630    styleSheetId: crate::dom::StyleSheetId<'a>,
4631    range: SourceRange,
4632    text: Cow<'a, str>,
4633}
4634
4635impl<'a> SetScopeTextParams<'a> {
4636    pub fn builder(styleSheetId: crate::dom::StyleSheetId<'a>, range: SourceRange, text: impl Into<Cow<'a, str>>) -> SetScopeTextParamsBuilder<'a> {
4637        SetScopeTextParamsBuilder {
4638            styleSheetId: styleSheetId,
4639            range: range,
4640            text: text.into(),
4641        }
4642    }
4643    pub fn styleSheetId(&self) -> &crate::dom::StyleSheetId<'a> { &self.styleSheetId }
4644    pub fn range(&self) -> &SourceRange { &self.range }
4645    pub fn text(&self) -> &str { self.text.as_ref() }
4646}
4647
4648
4649pub struct SetScopeTextParamsBuilder<'a> {
4650    styleSheetId: crate::dom::StyleSheetId<'a>,
4651    range: SourceRange,
4652    text: Cow<'a, str>,
4653}
4654
4655impl<'a> SetScopeTextParamsBuilder<'a> {
4656    pub fn build(self) -> SetScopeTextParams<'a> {
4657        SetScopeTextParams {
4658            styleSheetId: self.styleSheetId,
4659            range: self.range,
4660            text: self.text,
4661        }
4662    }
4663}
4664
4665/// Modifies the expression of a scope at-rule.
4666
4667#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4668#[serde(rename_all = "camelCase")]
4669pub struct SetScopeTextReturns<'a> {
4670    /// The resulting CSS Scope rule after modification.
4671    scope: CSSScope<'a>,
4672}
4673
4674impl<'a> SetScopeTextReturns<'a> {
4675    pub fn builder(scope: CSSScope<'a>) -> SetScopeTextReturnsBuilder<'a> {
4676        SetScopeTextReturnsBuilder {
4677            scope: scope,
4678        }
4679    }
4680    pub fn scope(&self) -> &CSSScope<'a> { &self.scope }
4681}
4682
4683
4684pub struct SetScopeTextReturnsBuilder<'a> {
4685    scope: CSSScope<'a>,
4686}
4687
4688impl<'a> SetScopeTextReturnsBuilder<'a> {
4689    pub fn build(self) -> SetScopeTextReturns<'a> {
4690        SetScopeTextReturns {
4691            scope: self.scope,
4692        }
4693    }
4694}
4695
4696impl<'a> SetScopeTextParams<'a> { pub const METHOD: &'static str = "CSS.setScopeText"; }
4697
4698impl<'a> crate::CdpCommand<'a> for SetScopeTextParams<'a> {
4699    const METHOD: &'static str = "CSS.setScopeText";
4700    type Response = SetScopeTextReturns<'a>;
4701}
4702
4703/// Modifies the rule selector.
4704
4705#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4706#[serde(rename_all = "camelCase")]
4707pub struct SetRuleSelectorParams<'a> {
4708    styleSheetId: crate::dom::StyleSheetId<'a>,
4709    range: SourceRange,
4710    selector: Cow<'a, str>,
4711}
4712
4713impl<'a> SetRuleSelectorParams<'a> {
4714    pub fn builder(styleSheetId: crate::dom::StyleSheetId<'a>, range: SourceRange, selector: impl Into<Cow<'a, str>>) -> SetRuleSelectorParamsBuilder<'a> {
4715        SetRuleSelectorParamsBuilder {
4716            styleSheetId: styleSheetId,
4717            range: range,
4718            selector: selector.into(),
4719        }
4720    }
4721    pub fn styleSheetId(&self) -> &crate::dom::StyleSheetId<'a> { &self.styleSheetId }
4722    pub fn range(&self) -> &SourceRange { &self.range }
4723    pub fn selector(&self) -> &str { self.selector.as_ref() }
4724}
4725
4726
4727pub struct SetRuleSelectorParamsBuilder<'a> {
4728    styleSheetId: crate::dom::StyleSheetId<'a>,
4729    range: SourceRange,
4730    selector: Cow<'a, str>,
4731}
4732
4733impl<'a> SetRuleSelectorParamsBuilder<'a> {
4734    pub fn build(self) -> SetRuleSelectorParams<'a> {
4735        SetRuleSelectorParams {
4736            styleSheetId: self.styleSheetId,
4737            range: self.range,
4738            selector: self.selector,
4739        }
4740    }
4741}
4742
4743/// Modifies the rule selector.
4744
4745#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4746#[serde(rename_all = "camelCase")]
4747pub struct SetRuleSelectorReturns<'a> {
4748    /// The resulting selector list after modification.
4749    selectorList: SelectorList<'a>,
4750}
4751
4752impl<'a> SetRuleSelectorReturns<'a> {
4753    pub fn builder(selectorList: SelectorList<'a>) -> SetRuleSelectorReturnsBuilder<'a> {
4754        SetRuleSelectorReturnsBuilder {
4755            selectorList: selectorList,
4756        }
4757    }
4758    pub fn selectorList(&self) -> &SelectorList<'a> { &self.selectorList }
4759}
4760
4761
4762pub struct SetRuleSelectorReturnsBuilder<'a> {
4763    selectorList: SelectorList<'a>,
4764}
4765
4766impl<'a> SetRuleSelectorReturnsBuilder<'a> {
4767    pub fn build(self) -> SetRuleSelectorReturns<'a> {
4768        SetRuleSelectorReturns {
4769            selectorList: self.selectorList,
4770        }
4771    }
4772}
4773
4774impl<'a> SetRuleSelectorParams<'a> { pub const METHOD: &'static str = "CSS.setRuleSelector"; }
4775
4776impl<'a> crate::CdpCommand<'a> for SetRuleSelectorParams<'a> {
4777    const METHOD: &'static str = "CSS.setRuleSelector";
4778    type Response = SetRuleSelectorReturns<'a>;
4779}
4780
4781/// Sets the new stylesheet text.
4782
4783#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4784#[serde(rename_all = "camelCase")]
4785pub struct SetStyleSheetTextParams<'a> {
4786    styleSheetId: crate::dom::StyleSheetId<'a>,
4787    text: Cow<'a, str>,
4788}
4789
4790impl<'a> SetStyleSheetTextParams<'a> {
4791    pub fn builder(styleSheetId: crate::dom::StyleSheetId<'a>, text: impl Into<Cow<'a, str>>) -> SetStyleSheetTextParamsBuilder<'a> {
4792        SetStyleSheetTextParamsBuilder {
4793            styleSheetId: styleSheetId,
4794            text: text.into(),
4795        }
4796    }
4797    pub fn styleSheetId(&self) -> &crate::dom::StyleSheetId<'a> { &self.styleSheetId }
4798    pub fn text(&self) -> &str { self.text.as_ref() }
4799}
4800
4801
4802pub struct SetStyleSheetTextParamsBuilder<'a> {
4803    styleSheetId: crate::dom::StyleSheetId<'a>,
4804    text: Cow<'a, str>,
4805}
4806
4807impl<'a> SetStyleSheetTextParamsBuilder<'a> {
4808    pub fn build(self) -> SetStyleSheetTextParams<'a> {
4809        SetStyleSheetTextParams {
4810            styleSheetId: self.styleSheetId,
4811            text: self.text,
4812        }
4813    }
4814}
4815
4816/// Sets the new stylesheet text.
4817
4818#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4819#[serde(rename_all = "camelCase")]
4820pub struct SetStyleSheetTextReturns<'a> {
4821    /// URL of source map associated with script (if any).
4822    #[serde(skip_serializing_if = "Option::is_none")]
4823    sourceMapURL: Option<Cow<'a, str>>,
4824}
4825
4826impl<'a> SetStyleSheetTextReturns<'a> {
4827    pub fn builder() -> SetStyleSheetTextReturnsBuilder<'a> {
4828        SetStyleSheetTextReturnsBuilder {
4829            sourceMapURL: None,
4830        }
4831    }
4832    pub fn sourceMapURL(&self) -> Option<&str> { self.sourceMapURL.as_deref() }
4833}
4834
4835#[derive(Default)]
4836pub struct SetStyleSheetTextReturnsBuilder<'a> {
4837    sourceMapURL: Option<Cow<'a, str>>,
4838}
4839
4840impl<'a> SetStyleSheetTextReturnsBuilder<'a> {
4841    /// URL of source map associated with script (if any).
4842    pub fn sourceMapURL(mut self, sourceMapURL: impl Into<Cow<'a, str>>) -> Self { self.sourceMapURL = Some(sourceMapURL.into()); self }
4843    pub fn build(self) -> SetStyleSheetTextReturns<'a> {
4844        SetStyleSheetTextReturns {
4845            sourceMapURL: self.sourceMapURL,
4846        }
4847    }
4848}
4849
4850impl<'a> SetStyleSheetTextParams<'a> { pub const METHOD: &'static str = "CSS.setStyleSheetText"; }
4851
4852impl<'a> crate::CdpCommand<'a> for SetStyleSheetTextParams<'a> {
4853    const METHOD: &'static str = "CSS.setStyleSheetText";
4854    type Response = SetStyleSheetTextReturns<'a>;
4855}
4856
4857/// Applies specified style edits one after another in the given order.
4858
4859#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4860#[serde(rename_all = "camelCase")]
4861pub struct SetStyleTextsParams<'a> {
4862    edits: Vec<StyleDeclarationEdit<'a>>,
4863    /// NodeId for the DOM node in whose context custom property declarations for registered properties should be
4864    /// validated. If omitted, declarations in the new rule text can only be validated statically, which may produce
4865    /// incorrect results if the declaration contains a var() for example.
4866    #[serde(skip_serializing_if = "Option::is_none")]
4867    nodeForPropertySyntaxValidation: Option<crate::dom::NodeId>,
4868}
4869
4870impl<'a> SetStyleTextsParams<'a> {
4871    pub fn builder(edits: Vec<StyleDeclarationEdit<'a>>) -> SetStyleTextsParamsBuilder<'a> {
4872        SetStyleTextsParamsBuilder {
4873            edits: edits,
4874            nodeForPropertySyntaxValidation: None,
4875        }
4876    }
4877    pub fn edits(&self) -> &[StyleDeclarationEdit<'a>] { &self.edits }
4878    pub fn nodeForPropertySyntaxValidation(&self) -> Option<&crate::dom::NodeId> { self.nodeForPropertySyntaxValidation.as_ref() }
4879}
4880
4881
4882pub struct SetStyleTextsParamsBuilder<'a> {
4883    edits: Vec<StyleDeclarationEdit<'a>>,
4884    nodeForPropertySyntaxValidation: Option<crate::dom::NodeId>,
4885}
4886
4887impl<'a> SetStyleTextsParamsBuilder<'a> {
4888    /// NodeId for the DOM node in whose context custom property declarations for registered properties should be
4889    /// validated. If omitted, declarations in the new rule text can only be validated statically, which may produce
4890    /// incorrect results if the declaration contains a var() for example.
4891    pub fn nodeForPropertySyntaxValidation(mut self, nodeForPropertySyntaxValidation: crate::dom::NodeId) -> Self { self.nodeForPropertySyntaxValidation = Some(nodeForPropertySyntaxValidation); self }
4892    pub fn build(self) -> SetStyleTextsParams<'a> {
4893        SetStyleTextsParams {
4894            edits: self.edits,
4895            nodeForPropertySyntaxValidation: self.nodeForPropertySyntaxValidation,
4896        }
4897    }
4898}
4899
4900/// Applies specified style edits one after another in the given order.
4901
4902#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4903#[serde(rename_all = "camelCase")]
4904pub struct SetStyleTextsReturns<'a> {
4905    /// The resulting styles after modification.
4906    styles: Vec<CSSStyle<'a>>,
4907}
4908
4909impl<'a> SetStyleTextsReturns<'a> {
4910    pub fn builder(styles: Vec<CSSStyle<'a>>) -> SetStyleTextsReturnsBuilder<'a> {
4911        SetStyleTextsReturnsBuilder {
4912            styles: styles,
4913        }
4914    }
4915    pub fn styles(&self) -> &[CSSStyle<'a>] { &self.styles }
4916}
4917
4918
4919pub struct SetStyleTextsReturnsBuilder<'a> {
4920    styles: Vec<CSSStyle<'a>>,
4921}
4922
4923impl<'a> SetStyleTextsReturnsBuilder<'a> {
4924    pub fn build(self) -> SetStyleTextsReturns<'a> {
4925        SetStyleTextsReturns {
4926            styles: self.styles,
4927        }
4928    }
4929}
4930
4931impl<'a> SetStyleTextsParams<'a> { pub const METHOD: &'static str = "CSS.setStyleTexts"; }
4932
4933impl<'a> crate::CdpCommand<'a> for SetStyleTextsParams<'a> {
4934    const METHOD: &'static str = "CSS.setStyleTexts";
4935    type Response = SetStyleTextsReturns<'a>;
4936}
4937
4938#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4939pub struct StartRuleUsageTrackingParams {}
4940
4941impl StartRuleUsageTrackingParams { pub const METHOD: &'static str = "CSS.startRuleUsageTracking"; }
4942
4943impl<'a> crate::CdpCommand<'a> for StartRuleUsageTrackingParams {
4944    const METHOD: &'static str = "CSS.startRuleUsageTracking";
4945    type Response = crate::EmptyReturns;
4946}
4947
4948/// Stop tracking rule usage and return the list of rules that were used since last call to
4949/// 'takeCoverageDelta' (or since start of coverage instrumentation).
4950
4951#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4952#[serde(rename_all = "camelCase")]
4953pub struct StopRuleUsageTrackingReturns<'a> {
4954    ruleUsage: Vec<RuleUsage<'a>>,
4955}
4956
4957impl<'a> StopRuleUsageTrackingReturns<'a> {
4958    pub fn builder(ruleUsage: Vec<RuleUsage<'a>>) -> StopRuleUsageTrackingReturnsBuilder<'a> {
4959        StopRuleUsageTrackingReturnsBuilder {
4960            ruleUsage: ruleUsage,
4961        }
4962    }
4963    pub fn ruleUsage(&self) -> &[RuleUsage<'a>] { &self.ruleUsage }
4964}
4965
4966
4967pub struct StopRuleUsageTrackingReturnsBuilder<'a> {
4968    ruleUsage: Vec<RuleUsage<'a>>,
4969}
4970
4971impl<'a> StopRuleUsageTrackingReturnsBuilder<'a> {
4972    pub fn build(self) -> StopRuleUsageTrackingReturns<'a> {
4973        StopRuleUsageTrackingReturns {
4974            ruleUsage: self.ruleUsage,
4975        }
4976    }
4977}
4978
4979#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4980pub struct StopRuleUsageTrackingParams {}
4981
4982impl StopRuleUsageTrackingParams { pub const METHOD: &'static str = "CSS.stopRuleUsageTracking"; }
4983
4984impl<'a> crate::CdpCommand<'a> for StopRuleUsageTrackingParams {
4985    const METHOD: &'static str = "CSS.stopRuleUsageTracking";
4986    type Response = StopRuleUsageTrackingReturns<'a>;
4987}
4988
4989/// Obtain list of rules that became used since last call to this method (or since start of coverage
4990/// instrumentation).
4991
4992#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4993#[serde(rename_all = "camelCase")]
4994pub struct TakeCoverageDeltaReturns<'a> {
4995    coverage: Vec<RuleUsage<'a>>,
4996    /// Monotonically increasing time, in seconds.
4997    timestamp: f64,
4998}
4999
5000impl<'a> TakeCoverageDeltaReturns<'a> {
5001    pub fn builder(coverage: Vec<RuleUsage<'a>>, timestamp: f64) -> TakeCoverageDeltaReturnsBuilder<'a> {
5002        TakeCoverageDeltaReturnsBuilder {
5003            coverage: coverage,
5004            timestamp: timestamp,
5005        }
5006    }
5007    pub fn coverage(&self) -> &[RuleUsage<'a>] { &self.coverage }
5008    pub fn timestamp(&self) -> f64 { self.timestamp }
5009}
5010
5011
5012pub struct TakeCoverageDeltaReturnsBuilder<'a> {
5013    coverage: Vec<RuleUsage<'a>>,
5014    timestamp: f64,
5015}
5016
5017impl<'a> TakeCoverageDeltaReturnsBuilder<'a> {
5018    pub fn build(self) -> TakeCoverageDeltaReturns<'a> {
5019        TakeCoverageDeltaReturns {
5020            coverage: self.coverage,
5021            timestamp: self.timestamp,
5022        }
5023    }
5024}
5025
5026#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5027pub struct TakeCoverageDeltaParams {}
5028
5029impl TakeCoverageDeltaParams { pub const METHOD: &'static str = "CSS.takeCoverageDelta"; }
5030
5031impl<'a> crate::CdpCommand<'a> for TakeCoverageDeltaParams {
5032    const METHOD: &'static str = "CSS.takeCoverageDelta";
5033    type Response = TakeCoverageDeltaReturns<'a>;
5034}
5035
5036/// Enables/disables rendering of local CSS fonts (enabled by default).
5037
5038#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5039#[serde(rename_all = "camelCase")]
5040pub struct SetLocalFontsEnabledParams {
5041    /// Whether rendering of local fonts is enabled.
5042    enabled: bool,
5043}
5044
5045impl SetLocalFontsEnabledParams {
5046    pub fn builder(enabled: bool) -> SetLocalFontsEnabledParamsBuilder {
5047        SetLocalFontsEnabledParamsBuilder {
5048            enabled: enabled,
5049        }
5050    }
5051    pub fn enabled(&self) -> bool { self.enabled }
5052}
5053
5054
5055pub struct SetLocalFontsEnabledParamsBuilder {
5056    enabled: bool,
5057}
5058
5059impl SetLocalFontsEnabledParamsBuilder {
5060    pub fn build(self) -> SetLocalFontsEnabledParams {
5061        SetLocalFontsEnabledParams {
5062            enabled: self.enabled,
5063        }
5064    }
5065}
5066
5067impl SetLocalFontsEnabledParams { pub const METHOD: &'static str = "CSS.setLocalFontsEnabled"; }
5068
5069impl<'a> crate::CdpCommand<'a> for SetLocalFontsEnabledParams {
5070    const METHOD: &'static str = "CSS.setLocalFontsEnabled";
5071    type Response = crate::EmptyReturns;
5072}