rustenium_cdp_definitions/browser_protocol/dom_snapshot/
commands.rs1use serde::{Deserialize, Serialize};
2#[doc = "Disables DOM snapshot agent for the given page.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot/#method-disable)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct DisableParams {}
5#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6pub enum DisableMethod {
7 #[serde(rename = "DOMSnapshot.disable")]
8 Disable,
9}
10#[doc = "Disables DOM snapshot agent for the given page.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot/#method-disable)"]
11#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12pub struct Disable {
13 pub method: DisableMethod,
14 pub params: DisableParams,
15}
16impl Disable {
17 pub const IDENTIFIER: &'static str = "DOMSnapshot.disable";
18 pub fn identifier(&self) -> &'static str {
19 Self::IDENTIFIER
20 }
21}
22impl crate::CommandResult for Disable {
23 type Result = super::results::DisableResult;
24}
25#[doc = "Enables DOM snapshot agent for the given page.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot/#method-enable)"]
26#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
27pub struct EnableParams {}
28#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
29pub enum EnableMethod {
30 #[serde(rename = "DOMSnapshot.enable")]
31 Enable,
32}
33#[doc = "Enables DOM snapshot agent for the given page.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot/#method-enable)"]
34#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
35pub struct Enable {
36 pub method: EnableMethod,
37 pub params: EnableParams,
38}
39impl Enable {
40 pub const IDENTIFIER: &'static str = "DOMSnapshot.enable";
41 pub fn identifier(&self) -> &'static str {
42 Self::IDENTIFIER
43 }
44}
45impl crate::CommandResult for Enable {
46 type Result = super::results::EnableResult;
47}
48#[doc = "Returns a document snapshot, including the full DOM tree of the root node (including iframes,\ntemplate contents, and imported documents) in a flattened array, as well as layout and\nwhite-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is\nflattened.\n[captureSnapshot](https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot/#method-captureSnapshot)"]
49#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
50pub struct CaptureSnapshotParams {
51 #[doc = "Whitelist of computed styles to return."]
52 #[serde(rename = "computedStyles")]
53 #[serde(skip_serializing_if = "Vec::is_empty")]
54 pub computed_styles: Vec<String>,
55 #[doc = "Whether to include layout object paint orders into the snapshot."]
56 #[serde(rename = "includePaintOrder")]
57 #[serde(skip_serializing_if = "Option::is_none")]
58 #[serde(default)]
59 pub include_paint_order: Option<bool>,
60 #[doc = "Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot"]
61 #[serde(rename = "includeDOMRects")]
62 #[serde(skip_serializing_if = "Option::is_none")]
63 #[serde(default)]
64 pub include_dom_rects: Option<bool>,
65 #[doc = "Whether to include blended background colors in the snapshot (default: false).\nBlended background color is achieved by blending background colors of all elements\nthat overlap with the current element."]
66 #[serde(rename = "includeBlendedBackgroundColors")]
67 #[serde(skip_serializing_if = "Option::is_none")]
68 #[serde(default)]
69 pub include_blended_background_colors: Option<bool>,
70 #[doc = "Whether to include text color opacity in the snapshot (default: false).\nAn element might have the opacity property set that affects the text color of the element.\nThe final text color opacity is computed based on the opacity of all overlapping elements."]
71 #[serde(rename = "includeTextColorOpacities")]
72 #[serde(skip_serializing_if = "Option::is_none")]
73 #[serde(default)]
74 pub include_text_color_opacities: Option<bool>,
75}
76impl CaptureSnapshotParams {
77 pub fn new(computed_styles: Vec<String>) -> Self {
78 Self {
79 computed_styles,
80 include_paint_order: None,
81 include_dom_rects: None,
82 include_blended_background_colors: None,
83 include_text_color_opacities: None,
84 }
85 }
86}
87#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
88pub enum CaptureSnapshotMethod {
89 #[serde(rename = "DOMSnapshot.captureSnapshot")]
90 CaptureSnapshot,
91}
92#[doc = "Returns a document snapshot, including the full DOM tree of the root node (including iframes,\ntemplate contents, and imported documents) in a flattened array, as well as layout and\nwhite-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is\nflattened.\n[captureSnapshot](https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot/#method-captureSnapshot)"]
93#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
94pub struct CaptureSnapshot {
95 pub method: CaptureSnapshotMethod,
96 pub params: CaptureSnapshotParams,
97}
98impl CaptureSnapshot {
99 pub const IDENTIFIER: &'static str = "DOMSnapshot.captureSnapshot";
100 pub fn identifier(&self) -> &'static str {
101 Self::IDENTIFIER
102 }
103}
104impl crate::CommandResult for CaptureSnapshot {
105 type Result = super::results::CaptureSnapshotResult;
106}
107group_enum ! (DomSnapshotCommands { Disable (Disable) , Enable (Enable) , CaptureSnapshot (CaptureSnapshot) } + identifiable);