Skip to main content

cdp_driver/protocol/
dom.rs

1// @generated by `just generate-methods` from protocol/*.json.
2// Do not edit by hand; edit xtask/ and regenerate.
3
4//! This domain exposes DOM read/write operations. Each DOM Node is
5//! represented with its mirror object that has an `id`. This `id` can be used
6//! to get additional information on the Node, resolve it into the JavaScript
7//! object wrapper, etc. It is important that client receives DOM events only
8//! for the nodes that are known to the client. Backend keeps track of the
9//! nodes that were sent to the client and never sends the same node twice. It
10//! is client's responsibility to collect information about the nodes that
11//! were sent to the client. Note that `iframe` owner elements will return
12//! corresponding document elements as their child nodes.
13//!
14//! Types, command parameters and event payloads for the `DOM`
15//! domain. The method-name constants for the same domain are in
16//! [`crate::methods`].
17
18use serde::{Deserialize, Serialize};
19
20/// Unique DOM node identifier.
21pub type NodeId = i64;
22
23/// Unique DOM node identifier used to reference a node that may not have been
24/// pushed to the front-end.
25pub type BackendNodeId = i64;
26
27/// Unique identifier for a CSS stylesheet.
28pub type StyleSheetId = String;
29
30/// Backend node with a friendly name.
31#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
32pub struct BackendNode {
33    /// `Node`'s nodeType.
34    #[serde(rename = "nodeType")]
35    pub node_type: i64,
36    /// `Node`'s nodeName.
37    #[serde(rename = "nodeName")]
38    pub node_name: String,
39    #[serde(rename = "backendNodeId")]
40    pub backend_node_id: BackendNodeId,
41}
42
43/// Pseudo element type.
44#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
45pub enum PseudoType {
46    /// `first-line`
47    #[serde(rename = "first-line")]
48    FirstLine,
49    /// `first-letter`
50    #[serde(rename = "first-letter")]
51    FirstLetter,
52    /// `checkmark`
53    #[serde(rename = "checkmark")]
54    Checkmark,
55    /// `before`
56    #[serde(rename = "before")]
57    Before,
58    /// `after`
59    #[serde(rename = "after")]
60    After,
61    /// `expand-icon`
62    #[serde(rename = "expand-icon")]
63    ExpandIcon,
64    /// `picker-icon`
65    #[serde(rename = "picker-icon")]
66    PickerIcon,
67    /// `interest-button`
68    #[serde(rename = "interest-button")]
69    InterestButton,
70    /// `marker`
71    #[serde(rename = "marker")]
72    Marker,
73    /// `backdrop`
74    #[serde(rename = "backdrop")]
75    Backdrop,
76    /// `column`
77    #[serde(rename = "column")]
78    Column,
79    /// `selection`
80    #[serde(rename = "selection")]
81    Selection,
82    /// `search-text`
83    #[serde(rename = "search-text")]
84    SearchText,
85    /// `target-text`
86    #[serde(rename = "target-text")]
87    TargetText,
88    /// `spelling-error`
89    #[serde(rename = "spelling-error")]
90    SpellingError,
91    /// `grammar-error`
92    #[serde(rename = "grammar-error")]
93    GrammarError,
94    /// `highlight`
95    #[serde(rename = "highlight")]
96    Highlight,
97    /// `first-line-inherited`
98    #[serde(rename = "first-line-inherited")]
99    FirstLineInherited,
100    /// `scroll-marker`
101    #[serde(rename = "scroll-marker")]
102    ScrollMarker,
103    /// `scroll-marker-group`
104    #[serde(rename = "scroll-marker-group")]
105    ScrollMarkerGroup,
106    /// `scroll-button`
107    #[serde(rename = "scroll-button")]
108    ScrollButton,
109    /// `scrollbar`
110    #[serde(rename = "scrollbar")]
111    Scrollbar,
112    /// `scrollbar-thumb`
113    #[serde(rename = "scrollbar-thumb")]
114    ScrollbarThumb,
115    /// `scrollbar-button`
116    #[serde(rename = "scrollbar-button")]
117    ScrollbarButton,
118    /// `scrollbar-track`
119    #[serde(rename = "scrollbar-track")]
120    ScrollbarTrack,
121    /// `scrollbar-track-piece`
122    #[serde(rename = "scrollbar-track-piece")]
123    ScrollbarTrackPiece,
124    /// `scrollbar-corner`
125    #[serde(rename = "scrollbar-corner")]
126    ScrollbarCorner,
127    /// `resizer`
128    #[serde(rename = "resizer")]
129    Resizer,
130    /// `input-list-button`
131    #[serde(rename = "input-list-button")]
132    InputListButton,
133    /// `view-transition`
134    #[serde(rename = "view-transition")]
135    ViewTransition,
136    /// `view-transition-group`
137    #[serde(rename = "view-transition-group")]
138    ViewTransitionGroup,
139    /// `view-transition-image-pair`
140    #[serde(rename = "view-transition-image-pair")]
141    ViewTransitionImagePair,
142    /// `view-transition-group-children`
143    #[serde(rename = "view-transition-group-children")]
144    ViewTransitionGroupChildren,
145    /// `view-transition-old`
146    #[serde(rename = "view-transition-old")]
147    ViewTransitionOld,
148    /// `view-transition-new`
149    #[serde(rename = "view-transition-new")]
150    ViewTransitionNew,
151    /// `placeholder`
152    #[serde(rename = "placeholder")]
153    Placeholder,
154    /// `file-selector-button`
155    #[serde(rename = "file-selector-button")]
156    FileSelectorButton,
157    /// `details-content`
158    #[serde(rename = "details-content")]
159    DetailsContent,
160    /// `picker`
161    #[serde(rename = "picker")]
162    Picker,
163    /// `select-listbox`
164    #[serde(rename = "select-listbox")]
165    SelectListbox,
166    /// `permission-icon`
167    #[serde(rename = "permission-icon")]
168    PermissionIcon,
169    /// `overscroll-area-parent`
170    #[serde(rename = "overscroll-area-parent")]
171    OverscrollAreaParent,
172    /// `overscroll-backdrop`
173    #[serde(rename = "overscroll-backdrop")]
174    OverscrollBackdrop,
175    /// `skeleton`
176    #[serde(rename = "skeleton")]
177    Skeleton,
178    /// A value this vendored schema does not list. Chrome adds values ahead of
179    /// the published protocol, so an unrecognised one is kept as it arrived
180    /// rather than failing the payload it came in.
181    #[serde(untagged)]
182    Unrecognized(String),
183}
184
185/// Shadow root type.
186#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
187pub enum ShadowRootType {
188    /// `user-agent`
189    #[serde(rename = "user-agent")]
190    UserAgent,
191    /// `open`
192    #[serde(rename = "open")]
193    Open,
194    /// `closed`
195    #[serde(rename = "closed")]
196    Closed,
197    /// A value this vendored schema does not list. Chrome adds values ahead of
198    /// the published protocol, so an unrecognised one is kept as it arrived
199    /// rather than failing the payload it came in.
200    #[serde(untagged)]
201    Unrecognized(String),
202}
203
204/// Document compatibility mode.
205#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
206pub enum CompatibilityMode {
207    /// `QuirksMode`
208    QuirksMode,
209    /// `LimitedQuirksMode`
210    LimitedQuirksMode,
211    /// `NoQuirksMode`
212    NoQuirksMode,
213    /// A value this vendored schema does not list. Chrome adds values ahead of
214    /// the published protocol, so an unrecognised one is kept as it arrived
215    /// rather than failing the payload it came in.
216    #[serde(untagged)]
217    Unrecognized(String),
218}
219
220/// ContainerSelector physical axes
221#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
222pub enum PhysicalAxes {
223    /// `Horizontal`
224    Horizontal,
225    /// `Vertical`
226    Vertical,
227    /// `Both`
228    Both,
229    /// A value this vendored schema does not list. Chrome adds values ahead of
230    /// the published protocol, so an unrecognised one is kept as it arrived
231    /// rather than failing the payload it came in.
232    #[serde(untagged)]
233    Unrecognized(String),
234}
235
236/// ContainerSelector logical axes
237#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
238pub enum LogicalAxes {
239    /// `Inline`
240    Inline,
241    /// `Block`
242    Block,
243    /// `Both`
244    Both,
245    /// A value this vendored schema does not list. Chrome adds values ahead of
246    /// the published protocol, so an unrecognised one is kept as it arrived
247    /// rather than failing the payload it came in.
248    #[serde(untagged)]
249    Unrecognized(String),
250}
251
252/// Physical scroll orientation
253#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
254pub enum ScrollOrientation {
255    /// `horizontal`
256    #[serde(rename = "horizontal")]
257    Horizontal,
258    /// `vertical`
259    #[serde(rename = "vertical")]
260    Vertical,
261    /// A value this vendored schema does not list. Chrome adds values ahead of
262    /// the published protocol, so an unrecognised one is kept as it arrived
263    /// rather than failing the payload it came in.
264    #[serde(untagged)]
265    Unrecognized(String),
266}
267
268/// DOM interaction is implemented in terms of mirror objects that represent
269/// the actual DOM nodes. DOMNode is a base node mirror type.
270#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
271pub struct Node {
272    /// Node identifier that is passed into the rest of the DOM messages as the
273    /// `nodeId`. Backend will only push node with given `id` once. It is aware of
274    /// all requested nodes and will only fire DOM events for nodes known to the
275    /// client.
276    #[serde(rename = "nodeId")]
277    pub node_id: NodeId,
278    /// The id of the parent node if any.
279    #[serde(rename = "parentId", default, skip_serializing_if = "Option::is_none")]
280    pub parent_id: Option<NodeId>,
281    /// The BackendNodeId for this node.
282    #[serde(rename = "backendNodeId")]
283    pub backend_node_id: BackendNodeId,
284    /// `Node`'s nodeType.
285    #[serde(rename = "nodeType")]
286    pub node_type: i64,
287    /// `Node`'s nodeName.
288    #[serde(rename = "nodeName")]
289    pub node_name: String,
290    /// `Node`'s localName.
291    #[serde(rename = "localName")]
292    pub local_name: String,
293    /// `Node`'s nodeValue.
294    #[serde(rename = "nodeValue")]
295    pub node_value: String,
296    /// Child count for `Container` nodes.
297    #[serde(
298        rename = "childNodeCount",
299        default,
300        skip_serializing_if = "Option::is_none"
301    )]
302    pub child_node_count: Option<i64>,
303    /// Child nodes of this node when requested with children.
304    #[serde(default, skip_serializing_if = "Option::is_none")]
305    pub children: Option<Vec<Node>>,
306    /// Attributes of the `Element` node in the form of flat array `\[name1,
307    /// value1, name2, value2\]`.
308    #[serde(default, skip_serializing_if = "Option::is_none")]
309    pub attributes: Option<Vec<String>>,
310    /// Document URL that `Document` or `FrameOwner` node points to.
311    #[serde(
312        rename = "documentURL",
313        default,
314        skip_serializing_if = "Option::is_none"
315    )]
316    pub document_url: Option<String>,
317    /// Base URL that `Document` or `FrameOwner` node uses for URL completion.
318    #[serde(rename = "baseURL", default, skip_serializing_if = "Option::is_none")]
319    pub base_url: Option<String>,
320    /// `DocumentType`'s publicId.
321    #[serde(rename = "publicId", default, skip_serializing_if = "Option::is_none")]
322    pub public_id: Option<String>,
323    /// `DocumentType`'s systemId.
324    #[serde(rename = "systemId", default, skip_serializing_if = "Option::is_none")]
325    pub system_id: Option<String>,
326    /// `DocumentType`'s internalSubset.
327    #[serde(
328        rename = "internalSubset",
329        default,
330        skip_serializing_if = "Option::is_none"
331    )]
332    pub internal_subset: Option<String>,
333    /// `Document`'s XML version in case of XML documents.
334    #[serde(
335        rename = "xmlVersion",
336        default,
337        skip_serializing_if = "Option::is_none"
338    )]
339    pub xml_version: Option<String>,
340    /// `Attr`'s name.
341    #[serde(default, skip_serializing_if = "Option::is_none")]
342    pub name: Option<String>,
343    /// `Attr`'s value.
344    #[serde(default, skip_serializing_if = "Option::is_none")]
345    pub value: Option<String>,
346    /// Pseudo element type for this node.
347    #[serde(
348        rename = "pseudoType",
349        default,
350        skip_serializing_if = "Option::is_none"
351    )]
352    pub pseudo_type: Option<PseudoType>,
353    /// Pseudo element identifier for this node. Only present if there is a valid
354    /// pseudoType.
355    #[serde(
356        rename = "pseudoIdentifier",
357        default,
358        skip_serializing_if = "Option::is_none"
359    )]
360    pub pseudo_identifier: Option<String>,
361    /// Shadow root type.
362    #[serde(
363        rename = "shadowRootType",
364        default,
365        skip_serializing_if = "Option::is_none"
366    )]
367    pub shadow_root_type: Option<ShadowRootType>,
368    /// Frame ID for frame owner elements.
369    #[serde(rename = "frameId", default, skip_serializing_if = "Option::is_none")]
370    pub frame_id: Option<crate::protocol::page::FrameId>,
371    /// Content document for frame owner elements.
372    #[serde(
373        rename = "contentDocument",
374        default,
375        skip_serializing_if = "Option::is_none"
376    )]
377    pub content_document: Option<Box<Node>>,
378    /// Shadow root list for given element host.
379    #[serde(
380        rename = "shadowRoots",
381        default,
382        skip_serializing_if = "Option::is_none"
383    )]
384    pub shadow_roots: Option<Vec<Node>>,
385    /// Content document fragment for template elements.
386    #[serde(
387        rename = "templateContent",
388        default,
389        skip_serializing_if = "Option::is_none"
390    )]
391    pub template_content: Option<Box<Node>>,
392    /// Pseudo elements associated with this node.
393    #[serde(
394        rename = "pseudoElements",
395        default,
396        skip_serializing_if = "Option::is_none"
397    )]
398    pub pseudo_elements: Option<Vec<Node>>,
399    /// Deprecated, as the HTML Imports API has been removed (crbug.com/937746).
400    /// This property used to return the imported document for the HTMLImport
401    /// links. The property is always undefined now.
402    ///
403    /// Deprecated in the protocol.
404    #[serde(
405        rename = "importedDocument",
406        default,
407        skip_serializing_if = "Option::is_none"
408    )]
409    pub imported_document: Option<Box<Node>>,
410    /// Distributed nodes for given insertion point.
411    #[serde(
412        rename = "distributedNodes",
413        default,
414        skip_serializing_if = "Option::is_none"
415    )]
416    pub distributed_nodes: Option<Vec<BackendNode>>,
417    /// Whether the node is SVG.
418    #[serde(rename = "isSVG", default, skip_serializing_if = "Option::is_none")]
419    pub is_svg: Option<bool>,
420    #[serde(
421        rename = "compatibilityMode",
422        default,
423        skip_serializing_if = "Option::is_none"
424    )]
425    pub compatibility_mode: Option<CompatibilityMode>,
426    #[serde(
427        rename = "assignedSlot",
428        default,
429        skip_serializing_if = "Option::is_none"
430    )]
431    pub assigned_slot: Option<BackendNode>,
432    /// Experimental: may change without notice.
433    #[serde(
434        rename = "isScrollable",
435        default,
436        skip_serializing_if = "Option::is_none"
437    )]
438    pub is_scrollable: Option<bool>,
439    /// Experimental: may change without notice.
440    #[serde(
441        rename = "affectedByStartingStyles",
442        default,
443        skip_serializing_if = "Option::is_none"
444    )]
445    pub affected_by_starting_styles: Option<bool>,
446    /// Experimental: may change without notice.
447    #[serde(
448        rename = "adoptedStyleSheets",
449        default,
450        skip_serializing_if = "Option::is_none"
451    )]
452    pub adopted_style_sheets: Option<Vec<StyleSheetId>>,
453    /// Experimental: may change without notice.
454    #[serde(
455        rename = "adProvenance",
456        default,
457        skip_serializing_if = "Option::is_none"
458    )]
459    pub ad_provenance: Option<crate::protocol::network::AdProvenance>,
460}
461
462/// A structure to hold the top-level node of a detached tree and an array of
463/// its retained descendants.
464#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
465pub struct DetachedElementInfo {
466    #[serde(rename = "treeNode")]
467    pub tree_node: Node,
468    #[serde(rename = "retainedNodeIds")]
469    pub retained_node_ids: Vec<NodeId>,
470}
471
472/// A structure holding an RGBA color.
473#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
474pub struct Rgba {
475    /// The red component, in the \[0-255\] range.
476    pub r: i64,
477    /// The green component, in the \[0-255\] range.
478    pub g: i64,
479    /// The blue component, in the \[0-255\] range.
480    pub b: i64,
481    /// The alpha component, in the \[0-1\] range (default: 1).
482    #[serde(default, skip_serializing_if = "Option::is_none")]
483    pub a: Option<f64>,
484}
485
486/// An array of quad vertices, x immediately followed by y for each point,
487/// points clock-wise.
488pub type Quad = Vec<f64>;
489
490/// Box model.
491#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
492pub struct BoxModel {
493    /// Content box
494    pub content: Quad,
495    /// Padding box
496    pub padding: Quad,
497    /// Border box
498    pub border: Quad,
499    /// Margin box
500    pub margin: Quad,
501    /// Node width
502    pub width: i64,
503    /// Node height
504    pub height: i64,
505    /// Shape outside coordinates
506    #[serde(
507        rename = "shapeOutside",
508        default,
509        skip_serializing_if = "Option::is_none"
510    )]
511    pub shape_outside: Option<ShapeOutsideInfo>,
512}
513
514/// CSS Shape Outside details.
515#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
516pub struct ShapeOutsideInfo {
517    /// Shape bounds
518    pub bounds: Quad,
519    /// Shape coordinate details
520    pub shape: Vec<serde_json::Value>,
521    /// Margin shape bounds
522    #[serde(rename = "marginShape")]
523    pub margin_shape: Vec<serde_json::Value>,
524}
525
526/// Rectangle.
527#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
528pub struct Rect {
529    /// X coordinate
530    pub x: f64,
531    /// Y coordinate
532    pub y: f64,
533    /// Rectangle width
534    pub width: f64,
535    /// Rectangle height
536    pub height: f64,
537}
538
539#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
540pub struct CssComputedStyleProperty {
541    /// Computed style property name.
542    pub name: String,
543    /// Computed style property value.
544    pub value: String,
545}
546
547/// Collects class names for the node with given id and all of it's child
548/// nodes.
549///
550/// Experimental: may change without notice.
551///
552/// Parameters of `DOM.collectClassNamesFromSubtree`.
553#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
554pub struct CollectClassNamesFromSubtreeParams {
555    /// Id of the node to collect class names.
556    #[serde(rename = "nodeId")]
557    pub node_id: NodeId,
558}
559
560/// What `DOM.collectClassNamesFromSubtree` answers with.
561#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
562pub struct CollectClassNamesFromSubtreeReturns {
563    /// Class name list.
564    #[serde(rename = "classNames")]
565    pub class_names: Vec<String>,
566}
567
568impl crate::typed::Command for CollectClassNamesFromSubtreeParams {
569    const METHOD: &'static str = "DOM.collectClassNamesFromSubtree";
570    type Returns = CollectClassNamesFromSubtreeReturns;
571}
572
573/// Creates a deep copy of the specified node and places it into the target
574/// container before the given anchor.
575///
576/// Experimental: may change without notice.
577///
578/// Parameters of `DOM.copyTo`.
579#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
580pub struct CopyToParams {
581    /// Id of the node to copy.
582    #[serde(rename = "nodeId")]
583    pub node_id: NodeId,
584    /// Id of the element to drop the copy into.
585    #[serde(rename = "targetNodeId")]
586    pub target_node_id: NodeId,
587    /// Drop the copy before this node (if absent, the copy becomes the last child
588    /// of `targetNodeId`).
589    #[serde(
590        rename = "insertBeforeNodeId",
591        default,
592        skip_serializing_if = "Option::is_none"
593    )]
594    pub insert_before_node_id: Option<NodeId>,
595}
596
597/// What `DOM.copyTo` answers with.
598#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
599pub struct CopyToReturns {
600    /// Id of the node clone.
601    #[serde(rename = "nodeId")]
602    pub node_id: NodeId,
603}
604
605impl crate::typed::Command for CopyToParams {
606    const METHOD: &'static str = "DOM.copyTo";
607    type Returns = CopyToReturns;
608}
609
610/// Describes node given its id, does not require domain to be enabled. Does
611/// not start tracking any objects, can be used for automation.
612///
613/// Parameters of `DOM.describeNode`.
614#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
615pub struct DescribeNodeParams {
616    /// Identifier of the node.
617    #[serde(rename = "nodeId", default, skip_serializing_if = "Option::is_none")]
618    pub node_id: Option<NodeId>,
619    /// Identifier of the backend node.
620    #[serde(
621        rename = "backendNodeId",
622        default,
623        skip_serializing_if = "Option::is_none"
624    )]
625    pub backend_node_id: Option<BackendNodeId>,
626    /// JavaScript object id of the node wrapper.
627    #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")]
628    pub object_id: Option<crate::protocol::runtime::RemoteObjectId>,
629    /// The maximum depth at which children should be retrieved, defaults to 1.
630    /// Use -1 for the entire subtree or provide an integer larger than 0.
631    #[serde(default, skip_serializing_if = "Option::is_none")]
632    pub depth: Option<i64>,
633    /// Whether or not iframes and shadow roots should be traversed when returning
634    /// the subtree (default is false).
635    #[serde(default, skip_serializing_if = "Option::is_none")]
636    pub pierce: Option<bool>,
637}
638
639/// What `DOM.describeNode` answers with.
640#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
641pub struct DescribeNodeReturns {
642    /// Node description.
643    pub node: Node,
644}
645
646impl crate::typed::Command for DescribeNodeParams {
647    const METHOD: &'static str = "DOM.describeNode";
648    type Returns = DescribeNodeReturns;
649}
650
651/// Scrolls the specified rect of the given node into view if not already
652/// visible. Note: exactly one between nodeId, backendNodeId and objectId
653/// should be passed to identify the node.
654///
655/// Parameters of `DOM.scrollIntoViewIfNeeded`.
656#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
657pub struct ScrollIntoViewIfNeededParams {
658    /// Identifier of the node.
659    #[serde(rename = "nodeId", default, skip_serializing_if = "Option::is_none")]
660    pub node_id: Option<NodeId>,
661    /// Identifier of the backend node.
662    #[serde(
663        rename = "backendNodeId",
664        default,
665        skip_serializing_if = "Option::is_none"
666    )]
667    pub backend_node_id: Option<BackendNodeId>,
668    /// JavaScript object id of the node wrapper.
669    #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")]
670    pub object_id: Option<crate::protocol::runtime::RemoteObjectId>,
671    /// The rect to be scrolled into view, relative to the node's border box, in
672    /// CSS pixels. When omitted, center of the node will be used, similar to
673    /// Element.scrollIntoView.
674    #[serde(default, skip_serializing_if = "Option::is_none")]
675    pub rect: Option<Rect>,
676}
677
678impl crate::typed::Command for ScrollIntoViewIfNeededParams {
679    const METHOD: &'static str = "DOM.scrollIntoViewIfNeeded";
680    type Returns = crate::typed::NoReturns;
681}
682
683/// Disables DOM agent for the given page.
684///
685/// Parameters of `DOM.disable`.
686#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
687pub struct DisableParams {}
688
689impl crate::typed::Command for DisableParams {
690    const METHOD: &'static str = "DOM.disable";
691    type Returns = crate::typed::NoReturns;
692}
693
694/// Discards search results from the session with the given id.
695/// `getSearchResults` should no longer be called for that search.
696///
697/// Experimental: may change without notice.
698///
699/// Parameters of `DOM.discardSearchResults`.
700#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
701pub struct DiscardSearchResultsParams {
702    /// Unique search session identifier.
703    #[serde(rename = "searchId")]
704    pub search_id: String,
705}
706
707impl crate::typed::Command for DiscardSearchResultsParams {
708    const METHOD: &'static str = "DOM.discardSearchResults";
709    type Returns = crate::typed::NoReturns;
710}
711
712/// Enables DOM agent for the given page.
713///
714/// Parameters of `DOM.enable`.
715#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
716pub struct EnableParams {
717    /// Whether to include whitespaces in the children array of returned Nodes.
718    ///
719    /// Experimental: may change without notice.
720    #[serde(
721        rename = "includeWhitespace",
722        default,
723        skip_serializing_if = "Option::is_none"
724    )]
725    pub include_whitespace: Option<EnableIncludeWhitespace>,
726}
727
728/// The values `includeWhitespace` accepts on `enable`.
729#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
730pub enum EnableIncludeWhitespace {
731    /// `none`
732    #[serde(rename = "none")]
733    None,
734    /// `all`
735    #[serde(rename = "all")]
736    All,
737    /// A value this vendored schema does not list. Chrome adds values ahead of
738    /// the published protocol, so an unrecognised one is kept as it arrived
739    /// rather than failing the payload it came in.
740    #[serde(untagged)]
741    Unrecognized(String),
742}
743
744impl crate::typed::Command for EnableParams {
745    const METHOD: &'static str = "DOM.enable";
746    type Returns = crate::typed::NoReturns;
747}
748
749/// Focuses the given element.
750///
751/// Parameters of `DOM.focus`.
752#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
753pub struct FocusParams {
754    /// Identifier of the node.
755    #[serde(rename = "nodeId", default, skip_serializing_if = "Option::is_none")]
756    pub node_id: Option<NodeId>,
757    /// Identifier of the backend node.
758    #[serde(
759        rename = "backendNodeId",
760        default,
761        skip_serializing_if = "Option::is_none"
762    )]
763    pub backend_node_id: Option<BackendNodeId>,
764    /// JavaScript object id of the node wrapper.
765    #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")]
766    pub object_id: Option<crate::protocol::runtime::RemoteObjectId>,
767}
768
769impl crate::typed::Command for FocusParams {
770    const METHOD: &'static str = "DOM.focus";
771    type Returns = crate::typed::NoReturns;
772}
773
774/// Returns attributes for the specified node.
775///
776/// Parameters of `DOM.getAttributes`.
777#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
778pub struct GetAttributesParams {
779    /// Id of the node to retrieve attributes for.
780    #[serde(rename = "nodeId")]
781    pub node_id: NodeId,
782}
783
784/// What `DOM.getAttributes` answers with.
785#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
786pub struct GetAttributesReturns {
787    /// An interleaved array of node attribute names and values.
788    pub attributes: Vec<String>,
789}
790
791impl crate::typed::Command for GetAttributesParams {
792    const METHOD: &'static str = "DOM.getAttributes";
793    type Returns = GetAttributesReturns;
794}
795
796/// Returns boxes for the given node.
797///
798/// Parameters of `DOM.getBoxModel`.
799#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
800pub struct GetBoxModelParams {
801    /// Identifier of the node.
802    #[serde(rename = "nodeId", default, skip_serializing_if = "Option::is_none")]
803    pub node_id: Option<NodeId>,
804    /// Identifier of the backend node.
805    #[serde(
806        rename = "backendNodeId",
807        default,
808        skip_serializing_if = "Option::is_none"
809    )]
810    pub backend_node_id: Option<BackendNodeId>,
811    /// JavaScript object id of the node wrapper.
812    #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")]
813    pub object_id: Option<crate::protocol::runtime::RemoteObjectId>,
814}
815
816/// What `DOM.getBoxModel` answers with.
817#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
818pub struct GetBoxModelReturns {
819    /// Box model for the node.
820    pub model: BoxModel,
821}
822
823impl crate::typed::Command for GetBoxModelParams {
824    const METHOD: &'static str = "DOM.getBoxModel";
825    type Returns = GetBoxModelReturns;
826}
827
828/// Returns quads that describe node position on the page. This method might
829/// return multiple quads for inline nodes.
830///
831/// Experimental: may change without notice.
832///
833/// Parameters of `DOM.getContentQuads`.
834#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
835pub struct GetContentQuadsParams {
836    /// Identifier of the node.
837    #[serde(rename = "nodeId", default, skip_serializing_if = "Option::is_none")]
838    pub node_id: Option<NodeId>,
839    /// Identifier of the backend node.
840    #[serde(
841        rename = "backendNodeId",
842        default,
843        skip_serializing_if = "Option::is_none"
844    )]
845    pub backend_node_id: Option<BackendNodeId>,
846    /// JavaScript object id of the node wrapper.
847    #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")]
848    pub object_id: Option<crate::protocol::runtime::RemoteObjectId>,
849}
850
851/// What `DOM.getContentQuads` answers with.
852#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
853pub struct GetContentQuadsReturns {
854    /// Quads that describe node layout relative to viewport.
855    pub quads: Vec<Quad>,
856}
857
858impl crate::typed::Command for GetContentQuadsParams {
859    const METHOD: &'static str = "DOM.getContentQuads";
860    type Returns = GetContentQuadsReturns;
861}
862
863/// Returns the root DOM node (and optionally the subtree) to the caller.
864/// Implicitly enables the DOM domain events for the current target.
865///
866/// Parameters of `DOM.getDocument`.
867#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
868pub struct GetDocumentParams {
869    /// The maximum depth at which children should be retrieved, defaults to 1.
870    /// Use -1 for the entire subtree or provide an integer larger than 0.
871    #[serde(default, skip_serializing_if = "Option::is_none")]
872    pub depth: Option<i64>,
873    /// Whether or not iframes and shadow roots should be traversed when returning
874    /// the subtree (default is false).
875    #[serde(default, skip_serializing_if = "Option::is_none")]
876    pub pierce: Option<bool>,
877}
878
879/// What `DOM.getDocument` answers with.
880#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
881pub struct GetDocumentReturns {
882    /// Resulting node.
883    pub root: Node,
884}
885
886impl crate::typed::Command for GetDocumentParams {
887    const METHOD: &'static str = "DOM.getDocument";
888    type Returns = GetDocumentReturns;
889}
890
891/// Returns the root DOM node (and optionally the subtree) to the caller.
892/// Deprecated, as it is not designed to work well with the rest of the DOM
893/// agent. Use DOMSnapshot.captureSnapshot instead.
894///
895/// Deprecated in the protocol.
896///
897/// Parameters of `DOM.getFlattenedDocument`.
898#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
899pub struct GetFlattenedDocumentParams {
900    /// The maximum depth at which children should be retrieved, defaults to 1.
901    /// Use -1 for the entire subtree or provide an integer larger than 0.
902    #[serde(default, skip_serializing_if = "Option::is_none")]
903    pub depth: Option<i64>,
904    /// Whether or not iframes and shadow roots should be traversed when returning
905    /// the subtree (default is false).
906    #[serde(default, skip_serializing_if = "Option::is_none")]
907    pub pierce: Option<bool>,
908}
909
910/// What `DOM.getFlattenedDocument` answers with.
911#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
912pub struct GetFlattenedDocumentReturns {
913    /// Resulting node.
914    pub nodes: Vec<Node>,
915}
916
917impl crate::typed::Command for GetFlattenedDocumentParams {
918    const METHOD: &'static str = "DOM.getFlattenedDocument";
919    type Returns = GetFlattenedDocumentReturns;
920}
921
922/// Finds nodes with a given computed style in a subtree.
923///
924/// Experimental: may change without notice.
925///
926/// Parameters of `DOM.getNodesForSubtreeByStyle`.
927#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
928pub struct GetNodesForSubtreeByStyleParams {
929    /// Node ID pointing to the root of a subtree.
930    #[serde(rename = "nodeId")]
931    pub node_id: NodeId,
932    /// The style to filter nodes by (includes nodes if any of properties
933    /// matches).
934    #[serde(rename = "computedStyles")]
935    pub computed_styles: Vec<CssComputedStyleProperty>,
936    /// Whether or not iframes and shadow roots in the same target should be
937    /// traversed when returning the results (default is false).
938    #[serde(default, skip_serializing_if = "Option::is_none")]
939    pub pierce: Option<bool>,
940}
941
942/// What `DOM.getNodesForSubtreeByStyle` answers with.
943#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
944pub struct GetNodesForSubtreeByStyleReturns {
945    /// Resulting nodes.
946    #[serde(rename = "nodeIds")]
947    pub node_ids: Vec<NodeId>,
948}
949
950impl crate::typed::Command for GetNodesForSubtreeByStyleParams {
951    const METHOD: &'static str = "DOM.getNodesForSubtreeByStyle";
952    type Returns = GetNodesForSubtreeByStyleReturns;
953}
954
955/// Returns node id at given location. Depending on whether DOM domain is
956/// enabled, nodeId is either returned or not.
957///
958/// Parameters of `DOM.getNodeForLocation`.
959#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
960pub struct GetNodeForLocationParams {
961    /// X coordinate.
962    pub x: i64,
963    /// Y coordinate.
964    pub y: i64,
965    /// False to skip to the nearest non-UA shadow root ancestor (default: false).
966    #[serde(
967        rename = "includeUserAgentShadowDOM",
968        default,
969        skip_serializing_if = "Option::is_none"
970    )]
971    pub include_user_agent_shadow_dom: Option<bool>,
972    /// Whether to ignore pointer-events: none on elements and hit test them.
973    #[serde(
974        rename = "ignorePointerEventsNone",
975        default,
976        skip_serializing_if = "Option::is_none"
977    )]
978    pub ignore_pointer_events_none: Option<bool>,
979}
980
981/// What `DOM.getNodeForLocation` answers with.
982#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
983pub struct GetNodeForLocationReturns {
984    /// Resulting node.
985    #[serde(rename = "backendNodeId")]
986    pub backend_node_id: BackendNodeId,
987    /// Frame this node belongs to.
988    #[serde(rename = "frameId")]
989    pub frame_id: crate::protocol::page::FrameId,
990    /// Id of the node at given coordinates, only when enabled and requested
991    /// document.
992    #[serde(rename = "nodeId", default, skip_serializing_if = "Option::is_none")]
993    pub node_id: Option<NodeId>,
994}
995
996impl crate::typed::Command for GetNodeForLocationParams {
997    const METHOD: &'static str = "DOM.getNodeForLocation";
998    type Returns = GetNodeForLocationReturns;
999}
1000
1001/// Returns node's HTML markup.
1002///
1003/// Parameters of `DOM.getOuterHTML`.
1004#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1005pub struct GetOuterHtmlParams {
1006    /// Identifier of the node.
1007    #[serde(rename = "nodeId", default, skip_serializing_if = "Option::is_none")]
1008    pub node_id: Option<NodeId>,
1009    /// Identifier of the backend node.
1010    #[serde(
1011        rename = "backendNodeId",
1012        default,
1013        skip_serializing_if = "Option::is_none"
1014    )]
1015    pub backend_node_id: Option<BackendNodeId>,
1016    /// JavaScript object id of the node wrapper.
1017    #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")]
1018    pub object_id: Option<crate::protocol::runtime::RemoteObjectId>,
1019    /// Include all shadow roots. Equals to false if not specified.
1020    ///
1021    /// Experimental: may change without notice.
1022    #[serde(
1023        rename = "includeShadowDOM",
1024        default,
1025        skip_serializing_if = "Option::is_none"
1026    )]
1027    pub include_shadow_dom: Option<bool>,
1028}
1029
1030/// What `DOM.getOuterHTML` answers with.
1031#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1032pub struct GetOuterHtmlReturns {
1033    /// Outer HTML markup.
1034    #[serde(rename = "outerHTML")]
1035    pub outer_html: String,
1036}
1037
1038impl crate::typed::Command for GetOuterHtmlParams {
1039    const METHOD: &'static str = "DOM.getOuterHTML";
1040    type Returns = GetOuterHtmlReturns;
1041}
1042
1043/// Returns the id of the nearest ancestor that is a relayout boundary.
1044///
1045/// Experimental: may change without notice.
1046///
1047/// Parameters of `DOM.getRelayoutBoundary`.
1048#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1049pub struct GetRelayoutBoundaryParams {
1050    /// Id of the node.
1051    #[serde(rename = "nodeId")]
1052    pub node_id: NodeId,
1053}
1054
1055/// What `DOM.getRelayoutBoundary` answers with.
1056#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1057pub struct GetRelayoutBoundaryReturns {
1058    /// Relayout boundary node id for the given node.
1059    #[serde(rename = "nodeId")]
1060    pub node_id: NodeId,
1061}
1062
1063impl crate::typed::Command for GetRelayoutBoundaryParams {
1064    const METHOD: &'static str = "DOM.getRelayoutBoundary";
1065    type Returns = GetRelayoutBoundaryReturns;
1066}
1067
1068/// Returns search results from given `fromIndex` to given `toIndex` from the
1069/// search with the given identifier.
1070///
1071/// Experimental: may change without notice.
1072///
1073/// Parameters of `DOM.getSearchResults`.
1074#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1075pub struct GetSearchResultsParams {
1076    /// Unique search session identifier.
1077    #[serde(rename = "searchId")]
1078    pub search_id: String,
1079    /// Start index of the search result to be returned.
1080    #[serde(rename = "fromIndex")]
1081    pub from_index: i64,
1082    /// End index of the search result to be returned.
1083    #[serde(rename = "toIndex")]
1084    pub to_index: i64,
1085}
1086
1087/// What `DOM.getSearchResults` answers with.
1088#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1089pub struct GetSearchResultsReturns {
1090    /// Ids of the search result nodes.
1091    #[serde(rename = "nodeIds")]
1092    pub node_ids: Vec<NodeId>,
1093}
1094
1095impl crate::typed::Command for GetSearchResultsParams {
1096    const METHOD: &'static str = "DOM.getSearchResults";
1097    type Returns = GetSearchResultsReturns;
1098}
1099
1100/// Hides any highlight.
1101///
1102/// Parameters of `DOM.hideHighlight`.
1103#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1104pub struct HideHighlightParams {}
1105
1106impl crate::typed::Command for HideHighlightParams {
1107    const METHOD: &'static str = "DOM.hideHighlight";
1108    type Returns = crate::typed::NoReturns;
1109}
1110
1111/// Highlights DOM node.
1112///
1113/// Parameters of `DOM.highlightNode`.
1114#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1115pub struct HighlightNodeParams {}
1116
1117impl crate::typed::Command for HighlightNodeParams {
1118    const METHOD: &'static str = "DOM.highlightNode";
1119    type Returns = crate::typed::NoReturns;
1120}
1121
1122/// Highlights given rectangle.
1123///
1124/// Parameters of `DOM.highlightRect`.
1125#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1126pub struct HighlightRectParams {}
1127
1128impl crate::typed::Command for HighlightRectParams {
1129    const METHOD: &'static str = "DOM.highlightRect";
1130    type Returns = crate::typed::NoReturns;
1131}
1132
1133/// Marks last undoable state.
1134///
1135/// Experimental: may change without notice.
1136///
1137/// Parameters of `DOM.markUndoableState`.
1138#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1139pub struct MarkUndoableStateParams {}
1140
1141impl crate::typed::Command for MarkUndoableStateParams {
1142    const METHOD: &'static str = "DOM.markUndoableState";
1143    type Returns = crate::typed::NoReturns;
1144}
1145
1146/// Moves node into the new container, places it before the given anchor.
1147///
1148/// Parameters of `DOM.moveTo`.
1149#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1150pub struct MoveToParams {
1151    /// Id of the node to move.
1152    #[serde(rename = "nodeId")]
1153    pub node_id: NodeId,
1154    /// Id of the element to drop the moved node into.
1155    #[serde(rename = "targetNodeId")]
1156    pub target_node_id: NodeId,
1157    /// Drop node before this one (if absent, the moved node becomes the last
1158    /// child of `targetNodeId`).
1159    #[serde(
1160        rename = "insertBeforeNodeId",
1161        default,
1162        skip_serializing_if = "Option::is_none"
1163    )]
1164    pub insert_before_node_id: Option<NodeId>,
1165}
1166
1167/// What `DOM.moveTo` answers with.
1168#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1169pub struct MoveToReturns {
1170    /// New id of the moved node.
1171    #[serde(rename = "nodeId")]
1172    pub node_id: NodeId,
1173}
1174
1175impl crate::typed::Command for MoveToParams {
1176    const METHOD: &'static str = "DOM.moveTo";
1177    type Returns = MoveToReturns;
1178}
1179
1180/// Searches for a given string in the DOM tree. Use `getSearchResults` to
1181/// access search results or `cancelSearch` to end this search session.
1182///
1183/// Experimental: may change without notice.
1184///
1185/// Parameters of `DOM.performSearch`.
1186#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1187pub struct PerformSearchParams {
1188    /// Plain text or query selector or XPath search query.
1189    pub query: String,
1190    /// True to search in user agent shadow DOM.
1191    #[serde(
1192        rename = "includeUserAgentShadowDOM",
1193        default,
1194        skip_serializing_if = "Option::is_none"
1195    )]
1196    pub include_user_agent_shadow_dom: Option<bool>,
1197}
1198
1199/// What `DOM.performSearch` answers with.
1200#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1201pub struct PerformSearchReturns {
1202    /// Unique search session identifier.
1203    #[serde(rename = "searchId")]
1204    pub search_id: String,
1205    /// Number of search results.
1206    #[serde(rename = "resultCount")]
1207    pub result_count: i64,
1208}
1209
1210impl crate::typed::Command for PerformSearchParams {
1211    const METHOD: &'static str = "DOM.performSearch";
1212    type Returns = PerformSearchReturns;
1213}
1214
1215/// Requests that the node is sent to the caller given its path. // FIXME, use
1216/// XPath
1217///
1218/// Experimental: may change without notice.
1219///
1220/// Parameters of `DOM.pushNodeByPathToFrontend`.
1221#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1222pub struct PushNodeByPathToFrontendParams {
1223    /// Path to node in the proprietary format.
1224    pub path: String,
1225}
1226
1227/// What `DOM.pushNodeByPathToFrontend` answers with.
1228#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1229pub struct PushNodeByPathToFrontendReturns {
1230    /// Id of the node for given path.
1231    #[serde(rename = "nodeId")]
1232    pub node_id: NodeId,
1233}
1234
1235impl crate::typed::Command for PushNodeByPathToFrontendParams {
1236    const METHOD: &'static str = "DOM.pushNodeByPathToFrontend";
1237    type Returns = PushNodeByPathToFrontendReturns;
1238}
1239
1240/// Requests that a batch of nodes is sent to the caller given their backend
1241/// node ids.
1242///
1243/// Experimental: may change without notice.
1244///
1245/// Parameters of `DOM.pushNodesByBackendIdsToFrontend`.
1246#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1247pub struct PushNodesByBackendIdsToFrontendParams {
1248    /// The array of backend node ids.
1249    #[serde(rename = "backendNodeIds")]
1250    pub backend_node_ids: Vec<BackendNodeId>,
1251}
1252
1253/// What `DOM.pushNodesByBackendIdsToFrontend` answers with.
1254#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1255pub struct PushNodesByBackendIdsToFrontendReturns {
1256    /// The array of ids of pushed nodes that correspond to the backend ids
1257    /// specified in backendNodeIds.
1258    #[serde(rename = "nodeIds")]
1259    pub node_ids: Vec<NodeId>,
1260}
1261
1262impl crate::typed::Command for PushNodesByBackendIdsToFrontendParams {
1263    const METHOD: &'static str = "DOM.pushNodesByBackendIdsToFrontend";
1264    type Returns = PushNodesByBackendIdsToFrontendReturns;
1265}
1266
1267/// Executes `querySelector` on a given node.
1268///
1269/// Parameters of `DOM.querySelector`.
1270#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1271pub struct QuerySelectorParams {
1272    /// Id of the node to query upon.
1273    #[serde(rename = "nodeId")]
1274    pub node_id: NodeId,
1275    /// Selector string.
1276    pub selector: String,
1277}
1278
1279/// What `DOM.querySelector` answers with.
1280#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1281pub struct QuerySelectorReturns {
1282    /// Query selector result.
1283    #[serde(rename = "nodeId")]
1284    pub node_id: NodeId,
1285}
1286
1287impl crate::typed::Command for QuerySelectorParams {
1288    const METHOD: &'static str = "DOM.querySelector";
1289    type Returns = QuerySelectorReturns;
1290}
1291
1292/// Executes `querySelectorAll` on a given node.
1293///
1294/// Parameters of `DOM.querySelectorAll`.
1295#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1296pub struct QuerySelectorAllParams {
1297    /// Id of the node to query upon.
1298    #[serde(rename = "nodeId")]
1299    pub node_id: NodeId,
1300    /// Selector string.
1301    pub selector: String,
1302}
1303
1304/// What `DOM.querySelectorAll` answers with.
1305#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1306pub struct QuerySelectorAllReturns {
1307    /// Query selector result.
1308    #[serde(rename = "nodeIds")]
1309    pub node_ids: Vec<NodeId>,
1310}
1311
1312impl crate::typed::Command for QuerySelectorAllParams {
1313    const METHOD: &'static str = "DOM.querySelectorAll";
1314    type Returns = QuerySelectorAllReturns;
1315}
1316
1317/// Returns NodeIds of current top layer elements. Top layer is rendered
1318/// closest to the user within a viewport, therefore its elements always
1319/// appear on top of all other content.
1320///
1321/// Experimental: may change without notice.
1322///
1323/// Parameters of `DOM.getTopLayerElements`.
1324#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1325pub struct GetTopLayerElementsParams {}
1326
1327/// What `DOM.getTopLayerElements` answers with.
1328#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1329pub struct GetTopLayerElementsReturns {
1330    /// NodeIds of top layer elements
1331    #[serde(rename = "nodeIds")]
1332    pub node_ids: Vec<NodeId>,
1333}
1334
1335impl crate::typed::Command for GetTopLayerElementsParams {
1336    const METHOD: &'static str = "DOM.getTopLayerElements";
1337    type Returns = GetTopLayerElementsReturns;
1338}
1339
1340/// Returns the NodeId of the matched element according to certain relations.
1341///
1342/// Experimental: may change without notice.
1343///
1344/// Parameters of `DOM.getElementByRelation`.
1345#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1346pub struct GetElementByRelationParams {
1347    /// Id of the node from which to query the relation.
1348    #[serde(rename = "nodeId")]
1349    pub node_id: NodeId,
1350    /// Type of relation to get.
1351    pub relation: GetElementByRelationRelation,
1352}
1353
1354/// The values `relation` accepts on `getElementByRelation`.
1355#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
1356pub enum GetElementByRelationRelation {
1357    /// `PopoverTarget`
1358    PopoverTarget,
1359    /// `InterestTarget`
1360    InterestTarget,
1361    /// `CommandFor`
1362    CommandFor,
1363    /// A value this vendored schema does not list. Chrome adds values ahead of
1364    /// the published protocol, so an unrecognised one is kept as it arrived
1365    /// rather than failing the payload it came in.
1366    #[serde(untagged)]
1367    Unrecognized(String),
1368}
1369
1370/// What `DOM.getElementByRelation` answers with.
1371#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1372pub struct GetElementByRelationReturns {
1373    /// NodeId of the element matching the queried relation.
1374    #[serde(rename = "nodeId")]
1375    pub node_id: NodeId,
1376}
1377
1378impl crate::typed::Command for GetElementByRelationParams {
1379    const METHOD: &'static str = "DOM.getElementByRelation";
1380    type Returns = GetElementByRelationReturns;
1381}
1382
1383/// Re-does the last undone action.
1384///
1385/// Experimental: may change without notice.
1386///
1387/// Parameters of `DOM.redo`.
1388#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1389pub struct RedoParams {}
1390
1391impl crate::typed::Command for RedoParams {
1392    const METHOD: &'static str = "DOM.redo";
1393    type Returns = crate::typed::NoReturns;
1394}
1395
1396/// Removes attribute with given name from an element with given id.
1397///
1398/// Parameters of `DOM.removeAttribute`.
1399#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1400pub struct RemoveAttributeParams {
1401    /// Id of the element to remove attribute from.
1402    #[serde(rename = "nodeId")]
1403    pub node_id: NodeId,
1404    /// Name of the attribute to remove.
1405    pub name: String,
1406}
1407
1408impl crate::typed::Command for RemoveAttributeParams {
1409    const METHOD: &'static str = "DOM.removeAttribute";
1410    type Returns = crate::typed::NoReturns;
1411}
1412
1413/// Removes node with given id.
1414///
1415/// Parameters of `DOM.removeNode`.
1416#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1417pub struct RemoveNodeParams {
1418    /// Id of the node to remove.
1419    #[serde(rename = "nodeId")]
1420    pub node_id: NodeId,
1421}
1422
1423impl crate::typed::Command for RemoveNodeParams {
1424    const METHOD: &'static str = "DOM.removeNode";
1425    type Returns = crate::typed::NoReturns;
1426}
1427
1428/// Requests that children of the node with given id are returned to the
1429/// caller in form of `setChildNodes` events where not only immediate children
1430/// are retrieved, but all children down to the specified depth.
1431///
1432/// Parameters of `DOM.requestChildNodes`.
1433#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1434pub struct RequestChildNodesParams {
1435    /// Id of the node to get children for.
1436    #[serde(rename = "nodeId")]
1437    pub node_id: NodeId,
1438    /// The maximum depth at which children should be retrieved, defaults to 1.
1439    /// Use -1 for the entire subtree or provide an integer larger than 0.
1440    #[serde(default, skip_serializing_if = "Option::is_none")]
1441    pub depth: Option<i64>,
1442    /// Whether or not iframes and shadow roots should be traversed when returning
1443    /// the sub-tree (default is false).
1444    #[serde(default, skip_serializing_if = "Option::is_none")]
1445    pub pierce: Option<bool>,
1446}
1447
1448impl crate::typed::Command for RequestChildNodesParams {
1449    const METHOD: &'static str = "DOM.requestChildNodes";
1450    type Returns = crate::typed::NoReturns;
1451}
1452
1453/// Requests that the node is sent to the caller given the JavaScript node
1454/// object reference. All nodes that form the path from the node to the root
1455/// are also sent to the client as a series of `setChildNodes` notifications.
1456///
1457/// Parameters of `DOM.requestNode`.
1458#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1459pub struct RequestNodeParams {
1460    /// JavaScript object id to convert into node.
1461    #[serde(rename = "objectId")]
1462    pub object_id: crate::protocol::runtime::RemoteObjectId,
1463}
1464
1465/// What `DOM.requestNode` answers with.
1466#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1467pub struct RequestNodeReturns {
1468    /// Node id for given object.
1469    #[serde(rename = "nodeId")]
1470    pub node_id: NodeId,
1471}
1472
1473impl crate::typed::Command for RequestNodeParams {
1474    const METHOD: &'static str = "DOM.requestNode";
1475    type Returns = RequestNodeReturns;
1476}
1477
1478/// Resolves the JavaScript node object for a given NodeId or BackendNodeId.
1479///
1480/// Parameters of `DOM.resolveNode`.
1481#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1482pub struct ResolveNodeParams {
1483    /// Id of the node to resolve.
1484    #[serde(rename = "nodeId", default, skip_serializing_if = "Option::is_none")]
1485    pub node_id: Option<NodeId>,
1486    /// Backend identifier of the node to resolve.
1487    #[serde(
1488        rename = "backendNodeId",
1489        default,
1490        skip_serializing_if = "Option::is_none"
1491    )]
1492    pub backend_node_id: Option<BackendNodeId>,
1493    /// Symbolic group name that can be used to release multiple objects.
1494    #[serde(
1495        rename = "objectGroup",
1496        default,
1497        skip_serializing_if = "Option::is_none"
1498    )]
1499    pub object_group: Option<String>,
1500    /// Execution context in which to resolve the node.
1501    #[serde(
1502        rename = "executionContextId",
1503        default,
1504        skip_serializing_if = "Option::is_none"
1505    )]
1506    pub execution_context_id: Option<crate::protocol::runtime::ExecutionContextId>,
1507}
1508
1509/// What `DOM.resolveNode` answers with.
1510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1511pub struct ResolveNodeReturns {
1512    /// JavaScript object wrapper for given node.
1513    pub object: crate::protocol::runtime::RemoteObject,
1514}
1515
1516impl crate::typed::Command for ResolveNodeParams {
1517    const METHOD: &'static str = "DOM.resolveNode";
1518    type Returns = ResolveNodeReturns;
1519}
1520
1521/// Sets attribute for an element with given id.
1522///
1523/// Parameters of `DOM.setAttributeValue`.
1524#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1525pub struct SetAttributeValueParams {
1526    /// Id of the element to set attribute for.
1527    #[serde(rename = "nodeId")]
1528    pub node_id: NodeId,
1529    /// Attribute name.
1530    pub name: String,
1531    /// Attribute value.
1532    pub value: String,
1533}
1534
1535impl crate::typed::Command for SetAttributeValueParams {
1536    const METHOD: &'static str = "DOM.setAttributeValue";
1537    type Returns = crate::typed::NoReturns;
1538}
1539
1540/// Sets attributes on element with given id. This method is useful when user
1541/// edits some existing attribute value and types in several attribute
1542/// name/value pairs.
1543///
1544/// Parameters of `DOM.setAttributesAsText`.
1545#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1546pub struct SetAttributesAsTextParams {
1547    /// Id of the element to set attributes for.
1548    #[serde(rename = "nodeId")]
1549    pub node_id: NodeId,
1550    /// Text with a number of attributes. Will parse this text using HTML parser.
1551    pub text: String,
1552    /// Attribute name to replace with new attributes derived from text in case
1553    /// text parsed successfully.
1554    #[serde(default, skip_serializing_if = "Option::is_none")]
1555    pub name: Option<String>,
1556}
1557
1558impl crate::typed::Command for SetAttributesAsTextParams {
1559    const METHOD: &'static str = "DOM.setAttributesAsText";
1560    type Returns = crate::typed::NoReturns;
1561}
1562
1563/// Sets files for the given file input element.
1564///
1565/// Parameters of `DOM.setFileInputFiles`.
1566#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1567pub struct SetFileInputFilesParams {
1568    /// Array of file paths to set.
1569    pub files: Vec<String>,
1570    /// Identifier of the node.
1571    #[serde(rename = "nodeId", default, skip_serializing_if = "Option::is_none")]
1572    pub node_id: Option<NodeId>,
1573    /// Identifier of the backend node.
1574    #[serde(
1575        rename = "backendNodeId",
1576        default,
1577        skip_serializing_if = "Option::is_none"
1578    )]
1579    pub backend_node_id: Option<BackendNodeId>,
1580    /// JavaScript object id of the node wrapper.
1581    #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")]
1582    pub object_id: Option<crate::protocol::runtime::RemoteObjectId>,
1583}
1584
1585impl crate::typed::Command for SetFileInputFilesParams {
1586    const METHOD: &'static str = "DOM.setFileInputFiles";
1587    type Returns = crate::typed::NoReturns;
1588}
1589
1590/// Sets if stack traces should be captured for Nodes. See
1591/// `Node.getNodeStackTraces`. Default is disabled.
1592///
1593/// Experimental: may change without notice.
1594///
1595/// Parameters of `DOM.setNodeStackTracesEnabled`.
1596#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1597pub struct SetNodeStackTracesEnabledParams {
1598    /// Enable or disable.
1599    pub enable: bool,
1600}
1601
1602impl crate::typed::Command for SetNodeStackTracesEnabledParams {
1603    const METHOD: &'static str = "DOM.setNodeStackTracesEnabled";
1604    type Returns = crate::typed::NoReturns;
1605}
1606
1607/// Gets stack traces associated with a Node. As of now, only provides stack
1608/// trace for Node creation.
1609///
1610/// Experimental: may change without notice.
1611///
1612/// Parameters of `DOM.getNodeStackTraces`.
1613#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1614pub struct GetNodeStackTracesParams {
1615    /// Id of the node to get stack traces for.
1616    #[serde(rename = "nodeId")]
1617    pub node_id: NodeId,
1618}
1619
1620/// What `DOM.getNodeStackTraces` answers with.
1621#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1622pub struct GetNodeStackTracesReturns {
1623    /// Creation stack trace, if available.
1624    #[serde(default, skip_serializing_if = "Option::is_none")]
1625    pub creation: Option<crate::protocol::runtime::StackTrace>,
1626}
1627
1628impl crate::typed::Command for GetNodeStackTracesParams {
1629    const METHOD: &'static str = "DOM.getNodeStackTraces";
1630    type Returns = GetNodeStackTracesReturns;
1631}
1632
1633/// Returns file information for the given File wrapper.
1634///
1635/// Experimental: may change without notice.
1636///
1637/// Parameters of `DOM.getFileInfo`.
1638#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1639pub struct GetFileInfoParams {
1640    /// JavaScript object id of the node wrapper.
1641    #[serde(rename = "objectId")]
1642    pub object_id: crate::protocol::runtime::RemoteObjectId,
1643}
1644
1645/// What `DOM.getFileInfo` answers with.
1646#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1647pub struct GetFileInfoReturns {
1648    pub path: String,
1649}
1650
1651impl crate::typed::Command for GetFileInfoParams {
1652    const METHOD: &'static str = "DOM.getFileInfo";
1653    type Returns = GetFileInfoReturns;
1654}
1655
1656/// Returns list of detached nodes
1657///
1658/// Experimental: may change without notice.
1659///
1660/// Parameters of `DOM.getDetachedDomNodes`.
1661#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1662pub struct GetDetachedDomNodesParams {}
1663
1664/// What `DOM.getDetachedDomNodes` answers with.
1665#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1666pub struct GetDetachedDomNodesReturns {
1667    /// The list of detached nodes
1668    #[serde(rename = "detachedNodes")]
1669    pub detached_nodes: Vec<DetachedElementInfo>,
1670}
1671
1672impl crate::typed::Command for GetDetachedDomNodesParams {
1673    const METHOD: &'static str = "DOM.getDetachedDomNodes";
1674    type Returns = GetDetachedDomNodesReturns;
1675}
1676
1677/// Enables console to refer to the node with given id via $x (see Command
1678/// Line API for more details $x functions).
1679///
1680/// Experimental: may change without notice.
1681///
1682/// Parameters of `DOM.setInspectedNode`.
1683#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1684pub struct SetInspectedNodeParams {
1685    /// DOM node id to be accessible by means of $x command line API.
1686    #[serde(rename = "nodeId")]
1687    pub node_id: NodeId,
1688}
1689
1690impl crate::typed::Command for SetInspectedNodeParams {
1691    const METHOD: &'static str = "DOM.setInspectedNode";
1692    type Returns = crate::typed::NoReturns;
1693}
1694
1695/// Sets node name for a node with given id.
1696///
1697/// Parameters of `DOM.setNodeName`.
1698#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1699pub struct SetNodeNameParams {
1700    /// Id of the node to set name for.
1701    #[serde(rename = "nodeId")]
1702    pub node_id: NodeId,
1703    /// New node's name.
1704    pub name: String,
1705}
1706
1707/// What `DOM.setNodeName` answers with.
1708#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1709pub struct SetNodeNameReturns {
1710    /// New node's id.
1711    #[serde(rename = "nodeId")]
1712    pub node_id: NodeId,
1713}
1714
1715impl crate::typed::Command for SetNodeNameParams {
1716    const METHOD: &'static str = "DOM.setNodeName";
1717    type Returns = SetNodeNameReturns;
1718}
1719
1720/// Sets node value for a node with given id.
1721///
1722/// Parameters of `DOM.setNodeValue`.
1723#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1724pub struct SetNodeValueParams {
1725    /// Id of the node to set value for.
1726    #[serde(rename = "nodeId")]
1727    pub node_id: NodeId,
1728    /// New node's value.
1729    pub value: String,
1730}
1731
1732impl crate::typed::Command for SetNodeValueParams {
1733    const METHOD: &'static str = "DOM.setNodeValue";
1734    type Returns = crate::typed::NoReturns;
1735}
1736
1737/// Sets node HTML markup, returns new node id.
1738///
1739/// Parameters of `DOM.setOuterHTML`.
1740#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1741pub struct SetOuterHtmlParams {
1742    /// Id of the node to set markup for.
1743    #[serde(rename = "nodeId")]
1744    pub node_id: NodeId,
1745    /// Outer HTML markup to set.
1746    #[serde(rename = "outerHTML")]
1747    pub outer_html: String,
1748}
1749
1750impl crate::typed::Command for SetOuterHtmlParams {
1751    const METHOD: &'static str = "DOM.setOuterHTML";
1752    type Returns = crate::typed::NoReturns;
1753}
1754
1755/// Undoes the last performed action.
1756///
1757/// Experimental: may change without notice.
1758///
1759/// Parameters of `DOM.undo`.
1760#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1761pub struct UndoParams {}
1762
1763impl crate::typed::Command for UndoParams {
1764    const METHOD: &'static str = "DOM.undo";
1765    type Returns = crate::typed::NoReturns;
1766}
1767
1768/// Returns iframe node that owns iframe with the given domain.
1769///
1770/// Experimental: may change without notice.
1771///
1772/// Parameters of `DOM.getFrameOwner`.
1773#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1774pub struct GetFrameOwnerParams {
1775    #[serde(rename = "frameId")]
1776    pub frame_id: crate::protocol::page::FrameId,
1777}
1778
1779/// What `DOM.getFrameOwner` answers with.
1780#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1781pub struct GetFrameOwnerReturns {
1782    /// Resulting node.
1783    #[serde(rename = "backendNodeId")]
1784    pub backend_node_id: BackendNodeId,
1785    /// Id of the node at given coordinates, only when enabled and requested
1786    /// document.
1787    #[serde(rename = "nodeId", default, skip_serializing_if = "Option::is_none")]
1788    pub node_id: Option<NodeId>,
1789}
1790
1791impl crate::typed::Command for GetFrameOwnerParams {
1792    const METHOD: &'static str = "DOM.getFrameOwner";
1793    type Returns = GetFrameOwnerReturns;
1794}
1795
1796/// Returns the query container of the given node based on container query
1797/// conditions: containerName, physical and logical axes, and whether it
1798/// queries scroll-state or anchored elements. If no axes are provided and
1799/// queriesScrollState is false, the style container is returned, which is the
1800/// direct parent or the closest element with a matching container-name.
1801///
1802/// Experimental: may change without notice.
1803///
1804/// Parameters of `DOM.getContainerForNode`.
1805#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1806pub struct GetContainerForNodeParams {
1807    #[serde(rename = "nodeId")]
1808    pub node_id: NodeId,
1809    #[serde(
1810        rename = "containerName",
1811        default,
1812        skip_serializing_if = "Option::is_none"
1813    )]
1814    pub container_name: Option<String>,
1815    #[serde(
1816        rename = "physicalAxes",
1817        default,
1818        skip_serializing_if = "Option::is_none"
1819    )]
1820    pub physical_axes: Option<PhysicalAxes>,
1821    #[serde(
1822        rename = "logicalAxes",
1823        default,
1824        skip_serializing_if = "Option::is_none"
1825    )]
1826    pub logical_axes: Option<LogicalAxes>,
1827    #[serde(
1828        rename = "queriesScrollState",
1829        default,
1830        skip_serializing_if = "Option::is_none"
1831    )]
1832    pub queries_scroll_state: Option<bool>,
1833    #[serde(
1834        rename = "queriesAnchored",
1835        default,
1836        skip_serializing_if = "Option::is_none"
1837    )]
1838    pub queries_anchored: Option<bool>,
1839}
1840
1841/// What `DOM.getContainerForNode` answers with.
1842#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1843pub struct GetContainerForNodeReturns {
1844    /// The container node for the given node, or null if not found.
1845    #[serde(rename = "nodeId", default, skip_serializing_if = "Option::is_none")]
1846    pub node_id: Option<NodeId>,
1847}
1848
1849impl crate::typed::Command for GetContainerForNodeParams {
1850    const METHOD: &'static str = "DOM.getContainerForNode";
1851    type Returns = GetContainerForNodeReturns;
1852}
1853
1854/// Returns the descendants of a container query container that have container
1855/// queries against this container.
1856///
1857/// Experimental: may change without notice.
1858///
1859/// Parameters of `DOM.getQueryingDescendantsForContainer`.
1860#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1861pub struct GetQueryingDescendantsForContainerParams {
1862    /// Id of the container node to find querying descendants from.
1863    #[serde(rename = "nodeId")]
1864    pub node_id: NodeId,
1865}
1866
1867/// What `DOM.getQueryingDescendantsForContainer` answers with.
1868#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1869pub struct GetQueryingDescendantsForContainerReturns {
1870    /// Descendant nodes with container queries against the given container.
1871    #[serde(rename = "nodeIds")]
1872    pub node_ids: Vec<NodeId>,
1873}
1874
1875impl crate::typed::Command for GetQueryingDescendantsForContainerParams {
1876    const METHOD: &'static str = "DOM.getQueryingDescendantsForContainer";
1877    type Returns = GetQueryingDescendantsForContainerReturns;
1878}
1879
1880/// Returns the target anchor element of the given anchor query according to
1881/// <https://www.w3.org/TR/css-anchor-position-1/#target>.
1882///
1883/// Experimental: may change without notice.
1884///
1885/// Parameters of `DOM.getAnchorElement`.
1886#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1887pub struct GetAnchorElementParams {
1888    /// Id of the positioned element from which to find the anchor.
1889    #[serde(rename = "nodeId")]
1890    pub node_id: NodeId,
1891    /// An optional anchor specifier, as defined in
1892    /// <https://www.w3.org/TR/css-anchor-position-1/#anchor-specifier>. If not
1893    /// provided, it will return the implicit anchor element for the given
1894    /// positioned element.
1895    #[serde(
1896        rename = "anchorSpecifier",
1897        default,
1898        skip_serializing_if = "Option::is_none"
1899    )]
1900    pub anchor_specifier: Option<String>,
1901}
1902
1903/// What `DOM.getAnchorElement` answers with.
1904#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1905pub struct GetAnchorElementReturns {
1906    /// The anchor element of the given anchor query.
1907    #[serde(rename = "nodeId")]
1908    pub node_id: NodeId,
1909}
1910
1911impl crate::typed::Command for GetAnchorElementParams {
1912    const METHOD: &'static str = "DOM.getAnchorElement";
1913    type Returns = GetAnchorElementReturns;
1914}
1915
1916/// When enabling, this API force-opens the popover identified by nodeId and
1917/// keeps it open until disabled.
1918///
1919/// Experimental: may change without notice.
1920///
1921/// Parameters of `DOM.forceShowPopover`.
1922#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1923pub struct ForceShowPopoverParams {
1924    /// Id of the popover HTMLElement
1925    #[serde(rename = "nodeId")]
1926    pub node_id: NodeId,
1927    /// If true, opens the popover and keeps it open. If false, closes the popover
1928    /// if it was previously force-opened.
1929    pub enable: bool,
1930    /// Optional ID of the element invoking this popover, used to establish the
1931    /// implicit anchor. If not provided, it will fall back to the first invoker
1932    /// in the document, preferring elements with a popovertarget attribute over
1933    /// those with a commandfor attribute. Note that if there are multiple
1934    /// invokers, this is just an estimate.
1935    #[serde(
1936        rename = "invokerNodeId",
1937        default,
1938        skip_serializing_if = "Option::is_none"
1939    )]
1940    pub invoker_node_id: Option<BackendNodeId>,
1941}
1942
1943/// What `DOM.forceShowPopover` answers with.
1944#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1945pub struct ForceShowPopoverReturns {
1946    /// List of popovers that were closed in order to respect popover stacking
1947    /// order.
1948    #[serde(rename = "nodeIds")]
1949    pub node_ids: Vec<NodeId>,
1950}
1951
1952impl crate::typed::Command for ForceShowPopoverParams {
1953    const METHOD: &'static str = "DOM.forceShowPopover";
1954    type Returns = ForceShowPopoverReturns;
1955}
1956
1957/// Returns candidate nodes that are configured as triggers for the given
1958/// popover.
1959///
1960/// Experimental: may change without notice.
1961///
1962/// Parameters of `DOM.getImplicitAnchorCandidates`.
1963#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1964pub struct GetImplicitAnchorCandidatesParams {
1965    /// Id of the popover HTMLElement.
1966    #[serde(rename = "nodeId")]
1967    pub node_id: NodeId,
1968}
1969
1970/// What `DOM.getImplicitAnchorCandidates` answers with.
1971#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1972pub struct GetImplicitAnchorCandidatesReturns {
1973    /// Candidate elements that can invoke this popover.
1974    #[serde(rename = "backendNodeIds")]
1975    pub backend_node_ids: Vec<BackendNodeId>,
1976}
1977
1978impl crate::typed::Command for GetImplicitAnchorCandidatesParams {
1979    const METHOD: &'static str = "DOM.getImplicitAnchorCandidates";
1980    type Returns = GetImplicitAnchorCandidatesReturns;
1981}
1982
1983/// When enabling, this API forces an element to gain interest in its target,
1984/// keeping interest active until disabled.
1985///
1986/// Experimental: may change without notice.
1987///
1988/// Parameters of `DOM.forceShowInterest`.
1989#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1990pub struct ForceShowInterestParams {
1991    /// Id of the interest invoker HTMLElement.
1992    #[serde(rename = "nodeId")]
1993    pub node_id: NodeId,
1994    /// If true, opens and holds interest. If false, releases forced interest.
1995    pub enable: bool,
1996}
1997
1998impl crate::typed::Command for ForceShowInterestParams {
1999    const METHOD: &'static str = "DOM.forceShowInterest";
2000    type Returns = crate::typed::NoReturns;
2001}
2002
2003/// Sets a spelling or grammar error marker on the given range of text. See
2004/// <https://github.com/Igalia/explainers/blob/main/force-spelling-grammar-markers/README.md>
2005/// Note: exactly one between nodeId, backendNodeId and objectId should be
2006/// passed to identify the node.
2007///
2008/// Experimental: may change without notice.
2009///
2010/// Parameters of `DOM.setTextMarker`.
2011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2012pub struct SetTextMarkerParams {
2013    /// Identifier of the node.
2014    #[serde(rename = "nodeId", default, skip_serializing_if = "Option::is_none")]
2015    pub node_id: Option<NodeId>,
2016    /// Identifier of the backend node.
2017    #[serde(
2018        rename = "backendNodeId",
2019        default,
2020        skip_serializing_if = "Option::is_none"
2021    )]
2022    pub backend_node_id: Option<BackendNodeId>,
2023    /// JavaScript object id of the node wrapper.
2024    #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")]
2025    pub object_id: Option<crate::protocol::runtime::RemoteObjectId>,
2026    /// The type of marker to set on the given range of text.
2027    pub r#type: SetTextMarkerType,
2028    /// Start offset into the element's rendered text in UTF-16 code units. For a
2029    /// text control, an offset into the control's value. Offsets count text in
2030    /// DOM order and do not enter shadow trees. To mark text inside a shadow
2031    /// tree, pass the element inside the shadow tree.
2032    pub start: i64,
2033    /// End offset (exclusive) in the same units and space as start.
2034    pub end: i64,
2035}
2036
2037/// The values `type` accepts on `setTextMarker`.
2038#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
2039pub enum SetTextMarkerType {
2040    /// `spelling`
2041    #[serde(rename = "spelling")]
2042    Spelling,
2043    /// `grammar`
2044    #[serde(rename = "grammar")]
2045    Grammar,
2046    /// A value this vendored schema does not list. Chrome adds values ahead of
2047    /// the published protocol, so an unrecognised one is kept as it arrived
2048    /// rather than failing the payload it came in.
2049    #[serde(untagged)]
2050    Unrecognized(String),
2051}
2052
2053impl crate::typed::Command for SetTextMarkerParams {
2054    const METHOD: &'static str = "DOM.setTextMarker";
2055    type Returns = crate::typed::NoReturns;
2056}
2057
2058/// Clears the spelling and grammar error text markers overlapping the ranges
2059/// set by setTextMarker in this session. These markers are also removed when
2060/// the DOM domain is disabled or the session ends.
2061///
2062/// Experimental: may change without notice.
2063///
2064/// Parameters of `DOM.clearTextMarkers`.
2065#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2066pub struct ClearTextMarkersParams {}
2067
2068impl crate::typed::Command for ClearTextMarkersParams {
2069    const METHOD: &'static str = "DOM.clearTextMarkers";
2070    type Returns = crate::typed::NoReturns;
2071}
2072
2073/// Fired when `Element`'s attribute is modified.
2074///
2075/// Payload of the `DOM.attributeModified` event.
2076#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2077pub struct AttributeModifiedEvent {
2078    /// Id of the node that has changed.
2079    #[serde(rename = "nodeId")]
2080    pub node_id: NodeId,
2081    /// Attribute name.
2082    pub name: String,
2083    /// Attribute value.
2084    pub value: String,
2085}
2086
2087impl crate::typed::Event for AttributeModifiedEvent {
2088    const METHOD: &'static str = "DOM.attributeModified";
2089}
2090
2091/// Fired when `Element`'s adoptedStyleSheets are modified.
2092///
2093/// Experimental: may change without notice.
2094///
2095/// Payload of the `DOM.adoptedStyleSheetsModified` event.
2096#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2097pub struct AdoptedStyleSheetsModifiedEvent {
2098    /// Id of the node that has changed.
2099    #[serde(rename = "nodeId")]
2100    pub node_id: NodeId,
2101    /// New adoptedStyleSheets array.
2102    ///
2103    /// Experimental: may change without notice.
2104    #[serde(rename = "adoptedStyleSheets")]
2105    pub adopted_style_sheets: Vec<StyleSheetId>,
2106}
2107
2108impl crate::typed::Event for AdoptedStyleSheetsModifiedEvent {
2109    const METHOD: &'static str = "DOM.adoptedStyleSheetsModified";
2110}
2111
2112/// Fired when `Element`'s attribute is removed.
2113///
2114/// Payload of the `DOM.attributeRemoved` event.
2115#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2116pub struct AttributeRemovedEvent {
2117    /// Id of the node that has changed.
2118    #[serde(rename = "nodeId")]
2119    pub node_id: NodeId,
2120    /// A ttribute name.
2121    pub name: String,
2122}
2123
2124impl crate::typed::Event for AttributeRemovedEvent {
2125    const METHOD: &'static str = "DOM.attributeRemoved";
2126}
2127
2128/// Mirrors `DOMCharacterDataModified` event.
2129///
2130/// Payload of the `DOM.characterDataModified` event.
2131#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2132pub struct CharacterDataModifiedEvent {
2133    /// Id of the node that has changed.
2134    #[serde(rename = "nodeId")]
2135    pub node_id: NodeId,
2136    /// New text value.
2137    #[serde(rename = "characterData")]
2138    pub character_data: String,
2139}
2140
2141impl crate::typed::Event for CharacterDataModifiedEvent {
2142    const METHOD: &'static str = "DOM.characterDataModified";
2143}
2144
2145/// Fired when `Container`'s child node count has changed.
2146///
2147/// Payload of the `DOM.childNodeCountUpdated` event.
2148#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2149pub struct ChildNodeCountUpdatedEvent {
2150    /// Id of the node that has changed.
2151    #[serde(rename = "nodeId")]
2152    pub node_id: NodeId,
2153    /// New node count.
2154    #[serde(rename = "childNodeCount")]
2155    pub child_node_count: i64,
2156}
2157
2158impl crate::typed::Event for ChildNodeCountUpdatedEvent {
2159    const METHOD: &'static str = "DOM.childNodeCountUpdated";
2160}
2161
2162/// Mirrors `DOMNodeInserted` event.
2163///
2164/// Payload of the `DOM.childNodeInserted` event.
2165#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2166pub struct ChildNodeInsertedEvent {
2167    /// Id of the node that has changed.
2168    #[serde(rename = "parentNodeId")]
2169    pub parent_node_id: NodeId,
2170    /// Id of the previous sibling.
2171    #[serde(rename = "previousNodeId")]
2172    pub previous_node_id: NodeId,
2173    /// Inserted node data.
2174    pub node: Node,
2175}
2176
2177impl crate::typed::Event for ChildNodeInsertedEvent {
2178    const METHOD: &'static str = "DOM.childNodeInserted";
2179}
2180
2181/// Mirrors `DOMNodeRemoved` event.
2182///
2183/// Payload of the `DOM.childNodeRemoved` event.
2184#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2185pub struct ChildNodeRemovedEvent {
2186    /// Parent id.
2187    #[serde(rename = "parentNodeId")]
2188    pub parent_node_id: NodeId,
2189    /// Id of the node that has been removed.
2190    #[serde(rename = "nodeId")]
2191    pub node_id: NodeId,
2192}
2193
2194impl crate::typed::Event for ChildNodeRemovedEvent {
2195    const METHOD: &'static str = "DOM.childNodeRemoved";
2196}
2197
2198/// Called when distribution is changed.
2199///
2200/// Experimental: may change without notice.
2201///
2202/// Payload of the `DOM.distributedNodesUpdated` event.
2203#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2204pub struct DistributedNodesUpdatedEvent {
2205    /// Insertion point where distributed nodes were updated.
2206    #[serde(rename = "insertionPointId")]
2207    pub insertion_point_id: NodeId,
2208    /// Distributed nodes for given insertion point.
2209    #[serde(rename = "distributedNodes")]
2210    pub distributed_nodes: Vec<BackendNode>,
2211}
2212
2213impl crate::typed::Event for DistributedNodesUpdatedEvent {
2214    const METHOD: &'static str = "DOM.distributedNodesUpdated";
2215}
2216
2217/// Fired when `Document` has been totally updated. Node ids are no longer
2218/// valid.
2219///
2220/// Payload of the `DOM.documentUpdated` event.
2221#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2222pub struct DocumentUpdatedEvent {}
2223
2224impl crate::typed::Event for DocumentUpdatedEvent {
2225    const METHOD: &'static str = "DOM.documentUpdated";
2226}
2227
2228/// Fired when `Element`'s inline style is modified via a CSS property
2229/// modification.
2230///
2231/// Experimental: may change without notice.
2232///
2233/// Payload of the `DOM.inlineStyleInvalidated` event.
2234#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2235pub struct InlineStyleInvalidatedEvent {
2236    /// Ids of the nodes for which the inline styles have been invalidated.
2237    #[serde(rename = "nodeIds")]
2238    pub node_ids: Vec<NodeId>,
2239}
2240
2241impl crate::typed::Event for InlineStyleInvalidatedEvent {
2242    const METHOD: &'static str = "DOM.inlineStyleInvalidated";
2243}
2244
2245/// Called when a pseudo element is added to an element.
2246///
2247/// Experimental: may change without notice.
2248///
2249/// Payload of the `DOM.pseudoElementAdded` event.
2250#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2251pub struct PseudoElementAddedEvent {
2252    /// Pseudo element's parent element id.
2253    #[serde(rename = "parentId")]
2254    pub parent_id: NodeId,
2255    /// The added pseudo element.
2256    #[serde(rename = "pseudoElement")]
2257    pub pseudo_element: Node,
2258}
2259
2260impl crate::typed::Event for PseudoElementAddedEvent {
2261    const METHOD: &'static str = "DOM.pseudoElementAdded";
2262}
2263
2264/// Called when top layer elements are changed.
2265///
2266/// Experimental: may change without notice.
2267///
2268/// Payload of the `DOM.topLayerElementsUpdated` event.
2269#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2270pub struct TopLayerElementsUpdatedEvent {}
2271
2272impl crate::typed::Event for TopLayerElementsUpdatedEvent {
2273    const METHOD: &'static str = "DOM.topLayerElementsUpdated";
2274}
2275
2276/// Fired when a node's scrollability state changes.
2277///
2278/// Experimental: may change without notice.
2279///
2280/// Payload of the `DOM.scrollableFlagUpdated` event.
2281#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2282pub struct ScrollableFlagUpdatedEvent {
2283    /// The id of the node.
2284    #[serde(rename = "nodeId")]
2285    pub node_id: NodeId,
2286    /// If the node is scrollable.
2287    #[serde(rename = "isScrollable")]
2288    pub is_scrollable: bool,
2289}
2290
2291impl crate::typed::Event for ScrollableFlagUpdatedEvent {
2292    const METHOD: &'static str = "DOM.scrollableFlagUpdated";
2293}
2294
2295/// Fired when a node's ad related state changes.
2296///
2297/// Experimental: may change without notice.
2298///
2299/// Payload of the `DOM.adRelatedStateUpdated` event.
2300#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2301pub struct AdRelatedStateUpdatedEvent {
2302    /// The id of the node.
2303    #[serde(rename = "nodeId")]
2304    pub node_id: NodeId,
2305    /// The provenance of the ad related node, if it is ad related.
2306    #[serde(
2307        rename = "adProvenance",
2308        default,
2309        skip_serializing_if = "Option::is_none"
2310    )]
2311    pub ad_provenance: Option<crate::protocol::network::AdProvenance>,
2312}
2313
2314impl crate::typed::Event for AdRelatedStateUpdatedEvent {
2315    const METHOD: &'static str = "DOM.adRelatedStateUpdated";
2316}
2317
2318/// Fired when a node's starting styles changes.
2319///
2320/// Experimental: may change without notice.
2321///
2322/// Payload of the `DOM.affectedByStartingStylesFlagUpdated` event.
2323#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2324pub struct AffectedByStartingStylesFlagUpdatedEvent {
2325    /// The id of the node.
2326    #[serde(rename = "nodeId")]
2327    pub node_id: NodeId,
2328    /// If the node has starting styles.
2329    #[serde(rename = "affectedByStartingStyles")]
2330    pub affected_by_starting_styles: bool,
2331}
2332
2333impl crate::typed::Event for AffectedByStartingStylesFlagUpdatedEvent {
2334    const METHOD: &'static str = "DOM.affectedByStartingStylesFlagUpdated";
2335}
2336
2337/// Called when a pseudo element is removed from an element.
2338///
2339/// Experimental: may change without notice.
2340///
2341/// Payload of the `DOM.pseudoElementRemoved` event.
2342#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2343pub struct PseudoElementRemovedEvent {
2344    /// Pseudo element's parent element id.
2345    #[serde(rename = "parentId")]
2346    pub parent_id: NodeId,
2347    /// The removed pseudo element id.
2348    #[serde(rename = "pseudoElementId")]
2349    pub pseudo_element_id: NodeId,
2350}
2351
2352impl crate::typed::Event for PseudoElementRemovedEvent {
2353    const METHOD: &'static str = "DOM.pseudoElementRemoved";
2354}
2355
2356/// Fired when backend wants to provide client with the missing DOM structure.
2357/// This happens upon most of the calls requesting node ids.
2358///
2359/// Payload of the `DOM.setChildNodes` event.
2360#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2361pub struct SetChildNodesEvent {
2362    /// Parent node id to populate with children.
2363    #[serde(rename = "parentId")]
2364    pub parent_id: NodeId,
2365    /// Child nodes array.
2366    pub nodes: Vec<Node>,
2367}
2368
2369impl crate::typed::Event for SetChildNodesEvent {
2370    const METHOD: &'static str = "DOM.setChildNodes";
2371}
2372
2373/// Called when shadow root is popped from the element.
2374///
2375/// Experimental: may change without notice.
2376///
2377/// Payload of the `DOM.shadowRootPopped` event.
2378#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2379pub struct ShadowRootPoppedEvent {
2380    /// Host element id.
2381    #[serde(rename = "hostId")]
2382    pub host_id: NodeId,
2383    /// Shadow root id.
2384    #[serde(rename = "rootId")]
2385    pub root_id: NodeId,
2386}
2387
2388impl crate::typed::Event for ShadowRootPoppedEvent {
2389    const METHOD: &'static str = "DOM.shadowRootPopped";
2390}
2391
2392/// Called when shadow root is pushed into the element.
2393///
2394/// Experimental: may change without notice.
2395///
2396/// Payload of the `DOM.shadowRootPushed` event.
2397#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
2398pub struct ShadowRootPushedEvent {
2399    /// Host element id.
2400    #[serde(rename = "hostId")]
2401    pub host_id: NodeId,
2402    /// Shadow root.
2403    pub root: Node,
2404}
2405
2406impl crate::typed::Event for ShadowRootPushedEvent {
2407    const METHOD: &'static str = "DOM.shadowRootPushed";
2408}