Skip to main content

cdp_driver/protocol/
dom_snapshot.rs

1// @generated by `just generate-methods` from protocol/*.json.
2// Do not edit by hand; edit xtask/ and regenerate.
3
4//! This domain facilitates obtaining document snapshots with DOM, layout, and
5//! style information.
6//!
7//! Types, command parameters and event payloads for the `DOMSnapshot`
8//! domain. The method-name constants for the same domain are in
9//! [`crate::methods`].
10//!
11//! This domain is experimental and may change without notice.
12
13use serde::{Deserialize, Serialize};
14
15/// A Node in the DOM tree.
16#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
17pub struct DomNode {
18    /// `Node`'s nodeType.
19    #[serde(rename = "nodeType")]
20    pub node_type: i64,
21    /// `Node`'s nodeName.
22    #[serde(rename = "nodeName")]
23    pub node_name: String,
24    /// `Node`'s nodeValue.
25    #[serde(rename = "nodeValue")]
26    pub node_value: String,
27    /// Only set for textarea elements, contains the text value.
28    #[serde(rename = "textValue", default, skip_serializing_if = "Option::is_none")]
29    pub text_value: Option<String>,
30    /// Only set for input elements, contains the input's associated text value.
31    #[serde(
32        rename = "inputValue",
33        default,
34        skip_serializing_if = "Option::is_none"
35    )]
36    pub input_value: Option<String>,
37    /// Only set for radio and checkbox input elements, indicates if the element
38    /// has been checked
39    #[serde(
40        rename = "inputChecked",
41        default,
42        skip_serializing_if = "Option::is_none"
43    )]
44    pub input_checked: Option<bool>,
45    /// Only set for option elements, indicates if the element has been selected
46    #[serde(
47        rename = "optionSelected",
48        default,
49        skip_serializing_if = "Option::is_none"
50    )]
51    pub option_selected: Option<bool>,
52    /// `Node`'s id, corresponds to DOM.Node.backendNodeId.
53    #[serde(rename = "backendNodeId")]
54    pub backend_node_id: crate::protocol::dom::BackendNodeId,
55    /// The indexes of the node's child nodes in the `domNodes` array returned by
56    /// `getSnapshot`, if any.
57    #[serde(
58        rename = "childNodeIndexes",
59        default,
60        skip_serializing_if = "Option::is_none"
61    )]
62    pub child_node_indexes: Option<Vec<i64>>,
63    /// Attributes of an `Element` node.
64    #[serde(default, skip_serializing_if = "Option::is_none")]
65    pub attributes: Option<Vec<NameValue>>,
66    /// Indexes of pseudo elements associated with this node in the `domNodes`
67    /// array returned by `getSnapshot`, if any.
68    #[serde(
69        rename = "pseudoElementIndexes",
70        default,
71        skip_serializing_if = "Option::is_none"
72    )]
73    pub pseudo_element_indexes: Option<Vec<i64>>,
74    /// The index of the node's related layout tree node in the `layoutTreeNodes`
75    /// array returned by `getSnapshot`, if any.
76    #[serde(
77        rename = "layoutNodeIndex",
78        default,
79        skip_serializing_if = "Option::is_none"
80    )]
81    pub layout_node_index: Option<i64>,
82    /// Document URL that `Document` or `FrameOwner` node points to.
83    #[serde(
84        rename = "documentURL",
85        default,
86        skip_serializing_if = "Option::is_none"
87    )]
88    pub document_url: Option<String>,
89    /// Base URL that `Document` or `FrameOwner` node uses for URL completion.
90    #[serde(rename = "baseURL", default, skip_serializing_if = "Option::is_none")]
91    pub base_url: Option<String>,
92    /// Only set for documents, contains the document's content language.
93    #[serde(
94        rename = "contentLanguage",
95        default,
96        skip_serializing_if = "Option::is_none"
97    )]
98    pub content_language: Option<String>,
99    /// Only set for documents, contains the document's character set encoding.
100    #[serde(
101        rename = "documentEncoding",
102        default,
103        skip_serializing_if = "Option::is_none"
104    )]
105    pub document_encoding: Option<String>,
106    /// `DocumentType` node's publicId.
107    #[serde(rename = "publicId", default, skip_serializing_if = "Option::is_none")]
108    pub public_id: Option<String>,
109    /// `DocumentType` node's systemId.
110    #[serde(rename = "systemId", default, skip_serializing_if = "Option::is_none")]
111    pub system_id: Option<String>,
112    /// Frame ID for frame owner elements and also for the document node.
113    #[serde(rename = "frameId", default, skip_serializing_if = "Option::is_none")]
114    pub frame_id: Option<crate::protocol::page::FrameId>,
115    /// The index of a frame owner element's content document in the `domNodes`
116    /// array returned by `getSnapshot`, if any.
117    #[serde(
118        rename = "contentDocumentIndex",
119        default,
120        skip_serializing_if = "Option::is_none"
121    )]
122    pub content_document_index: Option<i64>,
123    /// Type of a pseudo element node.
124    #[serde(
125        rename = "pseudoType",
126        default,
127        skip_serializing_if = "Option::is_none"
128    )]
129    pub pseudo_type: Option<crate::protocol::dom::PseudoType>,
130    /// Shadow root type.
131    #[serde(
132        rename = "shadowRootType",
133        default,
134        skip_serializing_if = "Option::is_none"
135    )]
136    pub shadow_root_type: Option<crate::protocol::dom::ShadowRootType>,
137    /// Whether this DOM node responds to mouse clicks. This includes nodes that
138    /// have had click event listeners attached via JavaScript as well as anchor
139    /// tags that naturally navigate when clicked.
140    #[serde(
141        rename = "isClickable",
142        default,
143        skip_serializing_if = "Option::is_none"
144    )]
145    pub is_clickable: Option<bool>,
146    /// Details of the node's event listeners, if any.
147    #[serde(
148        rename = "eventListeners",
149        default,
150        skip_serializing_if = "Option::is_none"
151    )]
152    pub event_listeners: Option<Vec<crate::protocol::dom_debugger::EventListener>>,
153    /// The selected url for nodes with a srcset attribute.
154    #[serde(
155        rename = "currentSourceURL",
156        default,
157        skip_serializing_if = "Option::is_none"
158    )]
159    pub current_source_url: Option<String>,
160    /// The url of the script (if any) that generates this node.
161    #[serde(rename = "originURL", default, skip_serializing_if = "Option::is_none")]
162    pub origin_url: Option<String>,
163    /// Scroll offsets, set when this node is a Document.
164    #[serde(
165        rename = "scrollOffsetX",
166        default,
167        skip_serializing_if = "Option::is_none"
168    )]
169    pub scroll_offset_x: Option<f64>,
170    #[serde(
171        rename = "scrollOffsetY",
172        default,
173        skip_serializing_if = "Option::is_none"
174    )]
175    pub scroll_offset_y: Option<f64>,
176}
177
178/// Details of post layout rendered text positions. The exact layout should
179/// not be regarded as stable and may change between versions.
180#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
181pub struct InlineTextBox {
182    /// The bounding box in document coordinates. Note that scroll offset of the
183    /// document is ignored.
184    #[serde(rename = "boundingBox")]
185    pub bounding_box: crate::protocol::dom::Rect,
186    /// The starting index in characters, for this post layout textbox substring.
187    /// Characters that would be represented as a surrogate pair in UTF-16 have
188    /// length 2.
189    #[serde(rename = "startCharacterIndex")]
190    pub start_character_index: i64,
191    /// The number of characters in this post layout textbox substring. Characters
192    /// that would be represented as a surrogate pair in UTF-16 have length 2.
193    #[serde(rename = "numCharacters")]
194    pub num_characters: i64,
195}
196
197/// Details of an element in the DOM tree with a LayoutObject.
198#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
199pub struct LayoutTreeNode {
200    /// The index of the related DOM node in the `domNodes` array returned by
201    /// `getSnapshot`.
202    #[serde(rename = "domNodeIndex")]
203    pub dom_node_index: i64,
204    /// The bounding box in document coordinates. Note that scroll offset of the
205    /// document is ignored.
206    #[serde(rename = "boundingBox")]
207    pub bounding_box: crate::protocol::dom::Rect,
208    /// Contents of the LayoutText, if any.
209    #[serde(
210        rename = "layoutText",
211        default,
212        skip_serializing_if = "Option::is_none"
213    )]
214    pub layout_text: Option<String>,
215    /// The post-layout inline text nodes, if any.
216    #[serde(
217        rename = "inlineTextNodes",
218        default,
219        skip_serializing_if = "Option::is_none"
220    )]
221    pub inline_text_nodes: Option<Vec<InlineTextBox>>,
222    /// Index into the `computedStyles` array returned by `getSnapshot`.
223    #[serde(
224        rename = "styleIndex",
225        default,
226        skip_serializing_if = "Option::is_none"
227    )]
228    pub style_index: Option<i64>,
229    /// Global paint order index, which is determined by the stacking order of the
230    /// nodes. Nodes that are painted together will have the same index. Only
231    /// provided if includePaintOrder in getSnapshot was true.
232    #[serde(
233        rename = "paintOrder",
234        default,
235        skip_serializing_if = "Option::is_none"
236    )]
237    pub paint_order: Option<i64>,
238    /// Set to true to indicate the element begins a new stacking context.
239    #[serde(
240        rename = "isStackingContext",
241        default,
242        skip_serializing_if = "Option::is_none"
243    )]
244    pub is_stacking_context: Option<bool>,
245}
246
247/// A subset of the full ComputedStyle as defined by the request whitelist.
248#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
249pub struct ComputedStyle {
250    /// Name/value pairs of computed style properties.
251    pub properties: Vec<NameValue>,
252}
253
254/// A name/value pair.
255#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
256pub struct NameValue {
257    /// Attribute/property name.
258    pub name: String,
259    /// Attribute/property value.
260    pub value: String,
261}
262
263/// Index of the string in the strings table.
264pub type StringIndex = i64;
265
266/// Index of the string in the strings table.
267pub type ArrayOfStrings = Vec<StringIndex>;
268
269/// Data that is only present on rare nodes.
270#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
271pub struct RareStringData {
272    pub index: Vec<i64>,
273    pub value: Vec<StringIndex>,
274}
275
276#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
277pub struct RareBooleanData {
278    pub index: Vec<i64>,
279}
280
281#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
282pub struct RareIntegerData {
283    pub index: Vec<i64>,
284    pub value: Vec<i64>,
285}
286
287pub type Rectangle = Vec<f64>;
288
289/// Document snapshot.
290#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
291pub struct DocumentSnapshot {
292    /// Document URL that `Document` or `FrameOwner` node points to.
293    #[serde(rename = "documentURL")]
294    pub document_url: StringIndex,
295    /// Document title.
296    pub title: StringIndex,
297    /// Base URL that `Document` or `FrameOwner` node uses for URL completion.
298    #[serde(rename = "baseURL")]
299    pub base_url: StringIndex,
300    /// Contains the document's content language.
301    #[serde(rename = "contentLanguage")]
302    pub content_language: StringIndex,
303    /// Contains the document's character set encoding.
304    #[serde(rename = "encodingName")]
305    pub encoding_name: StringIndex,
306    /// `DocumentType` node's publicId.
307    #[serde(rename = "publicId")]
308    pub public_id: StringIndex,
309    /// `DocumentType` node's systemId.
310    #[serde(rename = "systemId")]
311    pub system_id: StringIndex,
312    /// Frame ID for frame owner elements and also for the document node.
313    #[serde(rename = "frameId")]
314    pub frame_id: StringIndex,
315    /// A table with dom nodes.
316    pub nodes: NodeTreeSnapshot,
317    /// The nodes in the layout tree.
318    pub layout: LayoutTreeSnapshot,
319    /// The post-layout inline text nodes.
320    #[serde(rename = "textBoxes")]
321    pub text_boxes: TextBoxSnapshot,
322    /// Horizontal scroll offset.
323    #[serde(
324        rename = "scrollOffsetX",
325        default,
326        skip_serializing_if = "Option::is_none"
327    )]
328    pub scroll_offset_x: Option<f64>,
329    /// Vertical scroll offset.
330    #[serde(
331        rename = "scrollOffsetY",
332        default,
333        skip_serializing_if = "Option::is_none"
334    )]
335    pub scroll_offset_y: Option<f64>,
336    /// Document content width.
337    #[serde(
338        rename = "contentWidth",
339        default,
340        skip_serializing_if = "Option::is_none"
341    )]
342    pub content_width: Option<f64>,
343    /// Document content height.
344    #[serde(
345        rename = "contentHeight",
346        default,
347        skip_serializing_if = "Option::is_none"
348    )]
349    pub content_height: Option<f64>,
350}
351
352/// Table containing nodes.
353#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
354pub struct NodeTreeSnapshot {
355    /// Parent node index.
356    #[serde(
357        rename = "parentIndex",
358        default,
359        skip_serializing_if = "Option::is_none"
360    )]
361    pub parent_index: Option<Vec<i64>>,
362    /// `Node`'s nodeType.
363    #[serde(rename = "nodeType", default, skip_serializing_if = "Option::is_none")]
364    pub node_type: Option<Vec<i64>>,
365    /// Type of the shadow root the `Node` is in. String values are equal to the
366    /// `ShadowRootType` enum.
367    #[serde(
368        rename = "shadowRootType",
369        default,
370        skip_serializing_if = "Option::is_none"
371    )]
372    pub shadow_root_type: Option<RareStringData>,
373    /// `Node`'s nodeName.
374    #[serde(rename = "nodeName", default, skip_serializing_if = "Option::is_none")]
375    pub node_name: Option<Vec<StringIndex>>,
376    /// `Node`'s nodeValue.
377    #[serde(rename = "nodeValue", default, skip_serializing_if = "Option::is_none")]
378    pub node_value: Option<Vec<StringIndex>>,
379    /// `Node`'s id, corresponds to DOM.Node.backendNodeId.
380    #[serde(
381        rename = "backendNodeId",
382        default,
383        skip_serializing_if = "Option::is_none"
384    )]
385    pub backend_node_id: Option<Vec<crate::protocol::dom::BackendNodeId>>,
386    /// Attributes of an `Element` node. Flatten name, value pairs.
387    #[serde(default, skip_serializing_if = "Option::is_none")]
388    pub attributes: Option<Vec<ArrayOfStrings>>,
389    /// Only set for textarea elements, contains the text value.
390    #[serde(rename = "textValue", default, skip_serializing_if = "Option::is_none")]
391    pub text_value: Option<RareStringData>,
392    /// Only set for input elements, contains the input's associated text value.
393    #[serde(
394        rename = "inputValue",
395        default,
396        skip_serializing_if = "Option::is_none"
397    )]
398    pub input_value: Option<RareStringData>,
399    /// Only set for radio and checkbox input elements, indicates if the element
400    /// has been checked
401    #[serde(
402        rename = "inputChecked",
403        default,
404        skip_serializing_if = "Option::is_none"
405    )]
406    pub input_checked: Option<RareBooleanData>,
407    /// Only set for option elements, indicates if the element has been selected
408    #[serde(
409        rename = "optionSelected",
410        default,
411        skip_serializing_if = "Option::is_none"
412    )]
413    pub option_selected: Option<RareBooleanData>,
414    /// The index of the document in the list of the snapshot documents.
415    #[serde(
416        rename = "contentDocumentIndex",
417        default,
418        skip_serializing_if = "Option::is_none"
419    )]
420    pub content_document_index: Option<RareIntegerData>,
421    /// Type of a pseudo element node.
422    #[serde(
423        rename = "pseudoType",
424        default,
425        skip_serializing_if = "Option::is_none"
426    )]
427    pub pseudo_type: Option<RareStringData>,
428    /// Pseudo element identifier for this node. Only present if there is a valid
429    /// pseudoType.
430    #[serde(
431        rename = "pseudoIdentifier",
432        default,
433        skip_serializing_if = "Option::is_none"
434    )]
435    pub pseudo_identifier: Option<RareStringData>,
436    /// Whether this DOM node responds to mouse clicks. This includes nodes that
437    /// have had click event listeners attached via JavaScript as well as anchor
438    /// tags that naturally navigate when clicked.
439    #[serde(
440        rename = "isClickable",
441        default,
442        skip_serializing_if = "Option::is_none"
443    )]
444    pub is_clickable: Option<RareBooleanData>,
445    /// The selected url for nodes with a srcset attribute.
446    #[serde(
447        rename = "currentSourceURL",
448        default,
449        skip_serializing_if = "Option::is_none"
450    )]
451    pub current_source_url: Option<RareStringData>,
452    /// The url of the script (if any) that generates this node.
453    #[serde(rename = "originURL", default, skip_serializing_if = "Option::is_none")]
454    pub origin_url: Option<RareStringData>,
455}
456
457/// Table of details of an element in the DOM tree with a LayoutObject.
458#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
459pub struct LayoutTreeSnapshot {
460    /// Index of the corresponding node in the `NodeTreeSnapshot` array returned
461    /// by `captureSnapshot`.
462    #[serde(rename = "nodeIndex")]
463    pub node_index: Vec<i64>,
464    /// Array of indexes specifying computed style strings, filtered according to
465    /// the `computedStyles` parameter passed to `captureSnapshot`.
466    pub styles: Vec<ArrayOfStrings>,
467    /// The absolute position bounding box.
468    pub bounds: Vec<Rectangle>,
469    /// Contents of the LayoutText, if any.
470    pub text: Vec<StringIndex>,
471    /// Stacking context information.
472    #[serde(rename = "stackingContexts")]
473    pub stacking_contexts: RareBooleanData,
474    /// Global paint order index, which is determined by the stacking order of the
475    /// nodes. Nodes that are painted together will have the same index. Only
476    /// provided if includePaintOrder in captureSnapshot was true.
477    #[serde(
478        rename = "paintOrders",
479        default,
480        skip_serializing_if = "Option::is_none"
481    )]
482    pub paint_orders: Option<Vec<i64>>,
483    /// The offset rect of nodes. Only available when includeDOMRects is set to
484    /// true
485    #[serde(
486        rename = "offsetRects",
487        default,
488        skip_serializing_if = "Option::is_none"
489    )]
490    pub offset_rects: Option<Vec<Rectangle>>,
491    /// The scroll rect of nodes. Only available when includeDOMRects is set to
492    /// true
493    #[serde(
494        rename = "scrollRects",
495        default,
496        skip_serializing_if = "Option::is_none"
497    )]
498    pub scroll_rects: Option<Vec<Rectangle>>,
499    /// The client rect of nodes. Only available when includeDOMRects is set to
500    /// true
501    #[serde(
502        rename = "clientRects",
503        default,
504        skip_serializing_if = "Option::is_none"
505    )]
506    pub client_rects: Option<Vec<Rectangle>>,
507    /// The list of background colors that are blended with colors of overlapping
508    /// elements.
509    ///
510    /// Experimental: may change without notice.
511    #[serde(
512        rename = "blendedBackgroundColors",
513        default,
514        skip_serializing_if = "Option::is_none"
515    )]
516    pub blended_background_colors: Option<Vec<StringIndex>>,
517    /// The list of computed text opacities.
518    ///
519    /// Experimental: may change without notice.
520    #[serde(
521        rename = "textColorOpacities",
522        default,
523        skip_serializing_if = "Option::is_none"
524    )]
525    pub text_color_opacities: Option<Vec<f64>>,
526}
527
528/// Table of details of the post layout rendered text positions. The exact
529/// layout should not be regarded as stable and may change between versions.
530#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
531pub struct TextBoxSnapshot {
532    /// Index of the layout tree node that owns this box collection.
533    #[serde(rename = "layoutIndex")]
534    pub layout_index: Vec<i64>,
535    /// The absolute position bounding box.
536    pub bounds: Vec<Rectangle>,
537    /// The starting index in characters, for this post layout textbox substring.
538    /// Characters that would be represented as a surrogate pair in UTF-16 have
539    /// length 2.
540    pub start: Vec<i64>,
541    /// The number of characters in this post layout textbox substring. Characters
542    /// that would be represented as a surrogate pair in UTF-16 have length 2.
543    pub length: Vec<i64>,
544}
545
546/// Disables DOM snapshot agent for the given page.
547///
548/// Parameters of `DOMSnapshot.disable`.
549#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
550pub struct DisableParams {}
551
552impl crate::typed::Command for DisableParams {
553    const METHOD: &'static str = "DOMSnapshot.disable";
554    type Returns = crate::typed::NoReturns;
555}
556
557/// Enables DOM snapshot agent for the given page.
558///
559/// Parameters of `DOMSnapshot.enable`.
560#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
561pub struct EnableParams {}
562
563impl crate::typed::Command for EnableParams {
564    const METHOD: &'static str = "DOMSnapshot.enable";
565    type Returns = crate::typed::NoReturns;
566}
567
568/// Returns a document snapshot, including the full DOM tree of the root node
569/// (including iframes, template contents, and imported documents) in a
570/// flattened array, as well as layout and white-listed computed style
571/// information for the nodes. Shadow DOM in the returned DOM tree is
572/// flattened.
573///
574/// Deprecated in the protocol.
575///
576/// Parameters of `DOMSnapshot.getSnapshot`.
577#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
578pub struct GetSnapshotParams {
579    /// Whitelist of computed styles to return.
580    #[serde(rename = "computedStyleWhitelist")]
581    pub computed_style_whitelist: Vec<String>,
582    /// Whether or not to retrieve details of DOM listeners (default false).
583    #[serde(
584        rename = "includeEventListeners",
585        default,
586        skip_serializing_if = "Option::is_none"
587    )]
588    pub include_event_listeners: Option<bool>,
589    /// Whether to determine and include the paint order index of LayoutTreeNodes
590    /// (default false).
591    #[serde(
592        rename = "includePaintOrder",
593        default,
594        skip_serializing_if = "Option::is_none"
595    )]
596    pub include_paint_order: Option<bool>,
597    /// Whether to include UA shadow tree in the snapshot (default false).
598    #[serde(
599        rename = "includeUserAgentShadowTree",
600        default,
601        skip_serializing_if = "Option::is_none"
602    )]
603    pub include_user_agent_shadow_tree: Option<bool>,
604}
605
606/// What `DOMSnapshot.getSnapshot` answers with.
607#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
608pub struct GetSnapshotReturns {
609    /// The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root
610    /// document.
611    #[serde(rename = "domNodes")]
612    pub dom_nodes: Vec<DomNode>,
613    /// The nodes in the layout tree.
614    #[serde(rename = "layoutTreeNodes")]
615    pub layout_tree_nodes: Vec<LayoutTreeNode>,
616    /// Whitelisted ComputedStyle properties for each node in the layout tree.
617    #[serde(rename = "computedStyles")]
618    pub computed_styles: Vec<ComputedStyle>,
619}
620
621impl crate::typed::Command for GetSnapshotParams {
622    const METHOD: &'static str = "DOMSnapshot.getSnapshot";
623    type Returns = GetSnapshotReturns;
624}
625
626/// Returns a document snapshot, including the full DOM tree of the root node
627/// (including iframes, template contents, and imported documents) in a
628/// flattened array, as well as layout and white-listed computed style
629/// information for the nodes. Shadow DOM in the returned DOM tree is
630/// flattened.
631///
632/// Parameters of `DOMSnapshot.captureSnapshot`.
633#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
634pub struct CaptureSnapshotParams {
635    /// Whitelist of computed styles to return.
636    #[serde(rename = "computedStyles")]
637    pub computed_styles: Vec<String>,
638    /// Whether to include layout object paint orders into the snapshot.
639    #[serde(
640        rename = "includePaintOrder",
641        default,
642        skip_serializing_if = "Option::is_none"
643    )]
644    pub include_paint_order: Option<bool>,
645    /// Whether to include DOM rectangles (offsetRects, clientRects, scrollRects)
646    /// into the snapshot
647    #[serde(
648        rename = "includeDOMRects",
649        default,
650        skip_serializing_if = "Option::is_none"
651    )]
652    pub include_dom_rects: Option<bool>,
653    /// Whether to include blended background colors in the snapshot (default:
654    /// false). Blended background color is achieved by blending background colors
655    /// of all elements that overlap with the current element.
656    ///
657    /// Experimental: may change without notice.
658    #[serde(
659        rename = "includeBlendedBackgroundColors",
660        default,
661        skip_serializing_if = "Option::is_none"
662    )]
663    pub include_blended_background_colors: Option<bool>,
664    /// Whether to include text color opacity in the snapshot (default: false). An
665    /// element might have the opacity property set that affects the text color of
666    /// the element. The final text color opacity is computed based on the opacity
667    /// of all overlapping elements.
668    ///
669    /// Experimental: may change without notice.
670    #[serde(
671        rename = "includeTextColorOpacities",
672        default,
673        skip_serializing_if = "Option::is_none"
674    )]
675    pub include_text_color_opacities: Option<bool>,
676}
677
678/// What `DOMSnapshot.captureSnapshot` answers with.
679#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
680pub struct CaptureSnapshotReturns {
681    /// The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root
682    /// document.
683    pub documents: Vec<DocumentSnapshot>,
684    /// Shared string table that all string properties refer to with indexes.
685    pub strings: Vec<String>,
686}
687
688impl crate::typed::Command for CaptureSnapshotParams {
689    const METHOD: &'static str = "DOMSnapshot.captureSnapshot";
690    type Returns = CaptureSnapshotReturns;
691}