1use serde::{Deserialize, Serialize};
2#[doc = "Provides the reasons why the given layer was composited.\n[compositingReasons](https://chromedevtools.github.io/devtools-protocol/tot/LayerTree/#method-compositingReasons)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct CompositingReasonsParams {
5 #[doc = "The id of the layer for which we want to get the reasons it was composited."]
6 #[serde(rename = "layerId")]
7 pub layer_id: super::types::LayerId,
8}
9impl CompositingReasonsParams {
10 pub fn new(layer_id: impl Into<super::types::LayerId>) -> Self {
11 Self {
12 layer_id: layer_id.into(),
13 }
14 }
15}
16#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
17pub enum CompositingReasonsMethod {
18 #[serde(rename = "LayerTree.compositingReasons")]
19 CompositingReasons,
20}
21#[doc = "Provides the reasons why the given layer was composited.\n[compositingReasons](https://chromedevtools.github.io/devtools-protocol/tot/LayerTree/#method-compositingReasons)"]
22#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
23pub struct CompositingReasons {
24 pub method: CompositingReasonsMethod,
25 pub params: CompositingReasonsParams,
26}
27impl CompositingReasons {
28 pub const IDENTIFIER: &'static str = "LayerTree.compositingReasons";
29 pub fn identifier(&self) -> &'static str {
30 Self::IDENTIFIER
31 }
32}
33impl crate::CommandResult for CompositingReasons {
34 type Result = super::results::CompositingReasonsResult;
35}
36#[doc = "Disables compositing tree inspection.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/LayerTree/#method-disable)"]
37#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
38pub struct DisableParams {}
39#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
40pub enum DisableMethod {
41 #[serde(rename = "LayerTree.disable")]
42 Disable,
43}
44#[doc = "Disables compositing tree inspection.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/LayerTree/#method-disable)"]
45#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
46pub struct Disable {
47 pub method: DisableMethod,
48 pub params: DisableParams,
49}
50impl Disable {
51 pub const IDENTIFIER: &'static str = "LayerTree.disable";
52 pub fn identifier(&self) -> &'static str {
53 Self::IDENTIFIER
54 }
55}
56impl crate::CommandResult for Disable {
57 type Result = super::results::DisableResult;
58}
59#[doc = "Enables compositing tree inspection.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/LayerTree/#method-enable)"]
60#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
61pub struct EnableParams {}
62#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
63pub enum EnableMethod {
64 #[serde(rename = "LayerTree.enable")]
65 Enable,
66}
67#[doc = "Enables compositing tree inspection.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/LayerTree/#method-enable)"]
68#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
69pub struct Enable {
70 pub method: EnableMethod,
71 pub params: EnableParams,
72}
73impl Enable {
74 pub const IDENTIFIER: &'static str = "LayerTree.enable";
75 pub fn identifier(&self) -> &'static str {
76 Self::IDENTIFIER
77 }
78}
79impl crate::CommandResult for Enable {
80 type Result = super::results::EnableResult;
81}
82#[doc = "Returns the snapshot identifier.\n[loadSnapshot](https://chromedevtools.github.io/devtools-protocol/tot/LayerTree/#method-loadSnapshot)"]
83#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
84pub struct LoadSnapshotParams {
85 #[doc = "An array of tiles composing the snapshot."]
86 #[serde(rename = "tiles")]
87 #[serde(skip_serializing_if = "Vec::is_empty")]
88 pub tiles: Vec<super::types::PictureTile>,
89}
90impl LoadSnapshotParams {
91 pub fn new(tiles: Vec<super::types::PictureTile>) -> Self {
92 Self { tiles }
93 }
94}
95#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
96pub enum LoadSnapshotMethod {
97 #[serde(rename = "LayerTree.loadSnapshot")]
98 LoadSnapshot,
99}
100#[doc = "Returns the snapshot identifier.\n[loadSnapshot](https://chromedevtools.github.io/devtools-protocol/tot/LayerTree/#method-loadSnapshot)"]
101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
102pub struct LoadSnapshot {
103 pub method: LoadSnapshotMethod,
104 pub params: LoadSnapshotParams,
105}
106impl LoadSnapshot {
107 pub const IDENTIFIER: &'static str = "LayerTree.loadSnapshot";
108 pub fn identifier(&self) -> &'static str {
109 Self::IDENTIFIER
110 }
111}
112impl crate::CommandResult for LoadSnapshot {
113 type Result = super::results::LoadSnapshotResult;
114}
115#[doc = "Returns the layer snapshot identifier.\n[makeSnapshot](https://chromedevtools.github.io/devtools-protocol/tot/LayerTree/#method-makeSnapshot)"]
116#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
117pub struct MakeSnapshotParams {
118 #[doc = "The id of the layer."]
119 #[serde(rename = "layerId")]
120 pub layer_id: super::types::LayerId,
121}
122impl MakeSnapshotParams {
123 pub fn new(layer_id: impl Into<super::types::LayerId>) -> Self {
124 Self {
125 layer_id: layer_id.into(),
126 }
127 }
128}
129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
130pub enum MakeSnapshotMethod {
131 #[serde(rename = "LayerTree.makeSnapshot")]
132 MakeSnapshot,
133}
134#[doc = "Returns the layer snapshot identifier.\n[makeSnapshot](https://chromedevtools.github.io/devtools-protocol/tot/LayerTree/#method-makeSnapshot)"]
135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
136pub struct MakeSnapshot {
137 pub method: MakeSnapshotMethod,
138 pub params: MakeSnapshotParams,
139}
140impl MakeSnapshot {
141 pub const IDENTIFIER: &'static str = "LayerTree.makeSnapshot";
142 pub fn identifier(&self) -> &'static str {
143 Self::IDENTIFIER
144 }
145}
146impl crate::CommandResult for MakeSnapshot {
147 type Result = super::results::MakeSnapshotResult;
148}
149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
150pub struct ProfileSnapshotParams {
151 #[doc = "The id of the layer snapshot."]
152 #[serde(rename = "snapshotId")]
153 pub snapshot_id: super::types::SnapshotId,
154 #[doc = "The maximum number of times to replay the snapshot (1, if not specified)."]
155 #[serde(rename = "minRepeatCount")]
156 #[serde(skip_serializing_if = "Option::is_none")]
157 #[serde(default)]
158 pub min_repeat_count: Option<i64>,
159 #[doc = "The minimum duration (in seconds) to replay the snapshot."]
160 #[serde(rename = "minDuration")]
161 #[serde(skip_serializing_if = "Option::is_none")]
162 #[serde(default)]
163 pub min_duration: Option<f64>,
164 #[doc = "The clip rectangle to apply when replaying the snapshot."]
165 #[serde(rename = "clipRect")]
166 #[serde(skip_serializing_if = "Option::is_none")]
167 #[serde(default)]
168 pub clip_rect: Option<crate::browser_protocol::dom::types::Rect>,
169}
170impl ProfileSnapshotParams {
171 pub fn new(snapshot_id: impl Into<super::types::SnapshotId>) -> Self {
172 Self {
173 snapshot_id: snapshot_id.into(),
174 min_repeat_count: None,
175 min_duration: None,
176 clip_rect: None,
177 }
178 }
179}
180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
181pub enum ProfileSnapshotMethod {
182 #[serde(rename = "LayerTree.profileSnapshot")]
183 ProfileSnapshot,
184}
185#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
186pub struct ProfileSnapshot {
187 pub method: ProfileSnapshotMethod,
188 pub params: ProfileSnapshotParams,
189}
190impl ProfileSnapshot {
191 pub const IDENTIFIER: &'static str = "LayerTree.profileSnapshot";
192 pub fn identifier(&self) -> &'static str {
193 Self::IDENTIFIER
194 }
195}
196impl crate::CommandResult for ProfileSnapshot {
197 type Result = super::results::ProfileSnapshotResult;
198}
199#[doc = "Releases layer snapshot captured by the back-end.\n[releaseSnapshot](https://chromedevtools.github.io/devtools-protocol/tot/LayerTree/#method-releaseSnapshot)"]
200#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
201pub struct ReleaseSnapshotParams {
202 #[doc = "The id of the layer snapshot."]
203 #[serde(rename = "snapshotId")]
204 pub snapshot_id: super::types::SnapshotId,
205}
206impl ReleaseSnapshotParams {
207 pub fn new(snapshot_id: impl Into<super::types::SnapshotId>) -> Self {
208 Self {
209 snapshot_id: snapshot_id.into(),
210 }
211 }
212}
213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
214pub enum ReleaseSnapshotMethod {
215 #[serde(rename = "LayerTree.releaseSnapshot")]
216 ReleaseSnapshot,
217}
218#[doc = "Releases layer snapshot captured by the back-end.\n[releaseSnapshot](https://chromedevtools.github.io/devtools-protocol/tot/LayerTree/#method-releaseSnapshot)"]
219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
220pub struct ReleaseSnapshot {
221 pub method: ReleaseSnapshotMethod,
222 pub params: ReleaseSnapshotParams,
223}
224impl ReleaseSnapshot {
225 pub const IDENTIFIER: &'static str = "LayerTree.releaseSnapshot";
226 pub fn identifier(&self) -> &'static str {
227 Self::IDENTIFIER
228 }
229}
230impl crate::CommandResult for ReleaseSnapshot {
231 type Result = super::results::ReleaseSnapshotResult;
232}
233#[doc = "Replays the layer snapshot and returns the resulting bitmap.\n[replaySnapshot](https://chromedevtools.github.io/devtools-protocol/tot/LayerTree/#method-replaySnapshot)"]
234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
235pub struct ReplaySnapshotParams {
236 #[doc = "The id of the layer snapshot."]
237 #[serde(rename = "snapshotId")]
238 pub snapshot_id: super::types::SnapshotId,
239 #[doc = "The first step to replay from (replay from the very start if not specified)."]
240 #[serde(rename = "fromStep")]
241 #[serde(skip_serializing_if = "Option::is_none")]
242 #[serde(default)]
243 pub from_step: Option<i64>,
244 #[doc = "The last step to replay to (replay till the end if not specified)."]
245 #[serde(rename = "toStep")]
246 #[serde(skip_serializing_if = "Option::is_none")]
247 #[serde(default)]
248 pub to_step: Option<i64>,
249 #[doc = "The scale to apply while replaying (defaults to 1)."]
250 #[serde(rename = "scale")]
251 #[serde(skip_serializing_if = "Option::is_none")]
252 #[serde(default)]
253 pub scale: Option<f64>,
254}
255impl ReplaySnapshotParams {
256 pub fn new(snapshot_id: impl Into<super::types::SnapshotId>) -> Self {
257 Self {
258 snapshot_id: snapshot_id.into(),
259 from_step: None,
260 to_step: None,
261 scale: None,
262 }
263 }
264}
265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
266pub enum ReplaySnapshotMethod {
267 #[serde(rename = "LayerTree.replaySnapshot")]
268 ReplaySnapshot,
269}
270#[doc = "Replays the layer snapshot and returns the resulting bitmap.\n[replaySnapshot](https://chromedevtools.github.io/devtools-protocol/tot/LayerTree/#method-replaySnapshot)"]
271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
272pub struct ReplaySnapshot {
273 pub method: ReplaySnapshotMethod,
274 pub params: ReplaySnapshotParams,
275}
276impl ReplaySnapshot {
277 pub const IDENTIFIER: &'static str = "LayerTree.replaySnapshot";
278 pub fn identifier(&self) -> &'static str {
279 Self::IDENTIFIER
280 }
281}
282impl crate::CommandResult for ReplaySnapshot {
283 type Result = super::results::ReplaySnapshotResult;
284}
285#[doc = "Replays the layer snapshot and returns canvas log.\n[snapshotCommandLog](https://chromedevtools.github.io/devtools-protocol/tot/LayerTree/#method-snapshotCommandLog)"]
286#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
287pub struct SnapshotCommandLogParams {
288 #[doc = "The id of the layer snapshot."]
289 #[serde(rename = "snapshotId")]
290 pub snapshot_id: super::types::SnapshotId,
291}
292impl SnapshotCommandLogParams {
293 pub fn new(snapshot_id: impl Into<super::types::SnapshotId>) -> Self {
294 Self {
295 snapshot_id: snapshot_id.into(),
296 }
297 }
298}
299#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
300pub enum SnapshotCommandLogMethod {
301 #[serde(rename = "LayerTree.snapshotCommandLog")]
302 SnapshotCommandLog,
303}
304#[doc = "Replays the layer snapshot and returns canvas log.\n[snapshotCommandLog](https://chromedevtools.github.io/devtools-protocol/tot/LayerTree/#method-snapshotCommandLog)"]
305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
306pub struct SnapshotCommandLog {
307 pub method: SnapshotCommandLogMethod,
308 pub params: SnapshotCommandLogParams,
309}
310impl SnapshotCommandLog {
311 pub const IDENTIFIER: &'static str = "LayerTree.snapshotCommandLog";
312 pub fn identifier(&self) -> &'static str {
313 Self::IDENTIFIER
314 }
315}
316impl crate::CommandResult for SnapshotCommandLog {
317 type Result = super::results::SnapshotCommandLogResult;
318}
319group_enum ! (LayerTreeCommands { CompositingReasons (CompositingReasons) , Disable (Disable) , Enable (Enable) , LoadSnapshot (LoadSnapshot) , MakeSnapshot (MakeSnapshot) , ProfileSnapshot (ProfileSnapshot) , ReleaseSnapshot (ReleaseSnapshot) , ReplaySnapshot (ReplaySnapshot) , SnapshotCommandLog (SnapshotCommandLog) } + identifiable);