1use serde::{Deserialize, Serialize};
13
14pub type LayerId = String;
16
17pub type SnapshotId = String;
19
20#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
22pub struct ScrollRect {
23 pub rect: crate::protocol::dom::Rect,
25 pub r#type: ScrollRectType,
27}
28
29#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
31pub enum ScrollRectType {
32 RepaintsOnScroll,
34 TouchEventHandler,
36 WheelEventHandler,
38 #[serde(untagged)]
42 Unrecognized(String),
43}
44
45#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
47pub struct StickyPositionConstraint {
48 #[serde(rename = "stickyBoxRect")]
50 pub sticky_box_rect: crate::protocol::dom::Rect,
51 #[serde(rename = "containingBlockRect")]
53 pub containing_block_rect: crate::protocol::dom::Rect,
54 #[serde(
56 rename = "nearestLayerShiftingStickyBox",
57 default,
58 skip_serializing_if = "Option::is_none"
59 )]
60 pub nearest_layer_shifting_sticky_box: Option<LayerId>,
61 #[serde(
63 rename = "nearestLayerShiftingContainingBlock",
64 default,
65 skip_serializing_if = "Option::is_none"
66 )]
67 pub nearest_layer_shifting_containing_block: Option<LayerId>,
68}
69
70#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
73pub struct PictureTile {
74 pub x: f64,
76 pub y: f64,
78 pub picture: String,
81}
82
83#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
85pub struct Layer {
86 #[serde(rename = "layerId")]
88 pub layer_id: LayerId,
89 #[serde(
91 rename = "parentLayerId",
92 default,
93 skip_serializing_if = "Option::is_none"
94 )]
95 pub parent_layer_id: Option<LayerId>,
96 #[serde(
98 rename = "backendNodeId",
99 default,
100 skip_serializing_if = "Option::is_none"
101 )]
102 pub backend_node_id: Option<crate::protocol::dom::BackendNodeId>,
103 #[serde(rename = "offsetX")]
105 pub offset_x: f64,
106 #[serde(rename = "offsetY")]
108 pub offset_y: f64,
109 pub width: f64,
111 pub height: f64,
113 #[serde(default, skip_serializing_if = "Option::is_none")]
115 pub transform: Option<Vec<f64>>,
116 #[serde(rename = "anchorX", default, skip_serializing_if = "Option::is_none")]
118 pub anchor_x: Option<f64>,
119 #[serde(rename = "anchorY", default, skip_serializing_if = "Option::is_none")]
121 pub anchor_y: Option<f64>,
122 #[serde(rename = "anchorZ", default, skip_serializing_if = "Option::is_none")]
124 pub anchor_z: Option<f64>,
125 #[serde(rename = "paintCount")]
127 pub paint_count: i64,
128 #[serde(rename = "drawsContent")]
131 pub draws_content: bool,
132 #[serde(default, skip_serializing_if = "Option::is_none")]
134 pub invisible: Option<bool>,
135 #[serde(
137 rename = "scrollRects",
138 default,
139 skip_serializing_if = "Option::is_none"
140 )]
141 pub scroll_rects: Option<Vec<ScrollRect>>,
142 #[serde(
144 rename = "stickyPositionConstraint",
145 default,
146 skip_serializing_if = "Option::is_none"
147 )]
148 pub sticky_position_constraint: Option<StickyPositionConstraint>,
149}
150
151pub type PaintProfile = Vec<f64>;
153
154#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
158pub struct CompositingReasonsParams {
159 #[serde(rename = "layerId")]
162 pub layer_id: LayerId,
163}
164
165#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
167pub struct CompositingReasonsReturns {
168 #[serde(rename = "compositingReasons")]
171 pub compositing_reasons: Vec<String>,
172 #[serde(rename = "compositingReasonIds")]
175 pub compositing_reason_ids: Vec<String>,
176}
177
178impl crate::typed::Command for CompositingReasonsParams {
179 const METHOD: &'static str = "LayerTree.compositingReasons";
180 type Returns = CompositingReasonsReturns;
181}
182
183#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
187pub struct DisableParams {}
188
189impl crate::typed::Command for DisableParams {
190 const METHOD: &'static str = "LayerTree.disable";
191 type Returns = crate::typed::NoReturns;
192}
193
194#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
198pub struct EnableParams {}
199
200impl crate::typed::Command for EnableParams {
201 const METHOD: &'static str = "LayerTree.enable";
202 type Returns = crate::typed::NoReturns;
203}
204
205#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
209pub struct LoadSnapshotParams {
210 pub tiles: Vec<PictureTile>,
212}
213
214#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
216pub struct LoadSnapshotReturns {
217 #[serde(rename = "snapshotId")]
219 pub snapshot_id: SnapshotId,
220}
221
222impl crate::typed::Command for LoadSnapshotParams {
223 const METHOD: &'static str = "LayerTree.loadSnapshot";
224 type Returns = LoadSnapshotReturns;
225}
226
227#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
231pub struct MakeSnapshotParams {
232 #[serde(rename = "layerId")]
234 pub layer_id: LayerId,
235}
236
237#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
239pub struct MakeSnapshotReturns {
240 #[serde(rename = "snapshotId")]
242 pub snapshot_id: SnapshotId,
243}
244
245impl crate::typed::Command for MakeSnapshotParams {
246 const METHOD: &'static str = "LayerTree.makeSnapshot";
247 type Returns = MakeSnapshotReturns;
248}
249
250#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
252pub struct ProfileSnapshotParams {
253 #[serde(rename = "snapshotId")]
255 pub snapshot_id: SnapshotId,
256 #[serde(
258 rename = "minRepeatCount",
259 default,
260 skip_serializing_if = "Option::is_none"
261 )]
262 pub min_repeat_count: Option<i64>,
263 #[serde(
265 rename = "minDuration",
266 default,
267 skip_serializing_if = "Option::is_none"
268 )]
269 pub min_duration: Option<f64>,
270 #[serde(rename = "clipRect", default, skip_serializing_if = "Option::is_none")]
272 pub clip_rect: Option<crate::protocol::dom::Rect>,
273}
274
275#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
277pub struct ProfileSnapshotReturns {
278 pub timings: Vec<PaintProfile>,
280}
281
282impl crate::typed::Command for ProfileSnapshotParams {
283 const METHOD: &'static str = "LayerTree.profileSnapshot";
284 type Returns = ProfileSnapshotReturns;
285}
286
287#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
291pub struct ReleaseSnapshotParams {
292 #[serde(rename = "snapshotId")]
294 pub snapshot_id: SnapshotId,
295}
296
297impl crate::typed::Command for ReleaseSnapshotParams {
298 const METHOD: &'static str = "LayerTree.releaseSnapshot";
299 type Returns = crate::typed::NoReturns;
300}
301
302#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
306pub struct ReplaySnapshotParams {
307 #[serde(rename = "snapshotId")]
309 pub snapshot_id: SnapshotId,
310 #[serde(rename = "fromStep", default, skip_serializing_if = "Option::is_none")]
313 pub from_step: Option<i64>,
314 #[serde(rename = "toStep", default, skip_serializing_if = "Option::is_none")]
316 pub to_step: Option<i64>,
317 #[serde(default, skip_serializing_if = "Option::is_none")]
319 pub scale: Option<f64>,
320}
321
322#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
324pub struct ReplaySnapshotReturns {
325 #[serde(rename = "dataURL")]
327 pub data_url: String,
328}
329
330impl crate::typed::Command for ReplaySnapshotParams {
331 const METHOD: &'static str = "LayerTree.replaySnapshot";
332 type Returns = ReplaySnapshotReturns;
333}
334
335#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
339pub struct SnapshotCommandLogParams {
340 #[serde(rename = "snapshotId")]
342 pub snapshot_id: SnapshotId,
343}
344
345#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
347pub struct SnapshotCommandLogReturns {
348 #[serde(rename = "commandLog")]
350 pub command_log: Vec<serde_json::Value>,
351}
352
353impl crate::typed::Command for SnapshotCommandLogParams {
354 const METHOD: &'static str = "LayerTree.snapshotCommandLog";
355 type Returns = SnapshotCommandLogReturns;
356}
357
358#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
360pub struct LayerPaintedEvent {
361 #[serde(rename = "layerId")]
363 pub layer_id: LayerId,
364 pub clip: crate::protocol::dom::Rect,
366}
367
368impl crate::typed::Event for LayerPaintedEvent {
369 const METHOD: &'static str = "LayerTree.layerPainted";
370}
371
372#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
374pub struct LayerTreeDidChangeEvent {
375 #[serde(default, skip_serializing_if = "Option::is_none")]
377 pub layers: Option<Vec<Layer>>,
378}
379
380impl crate::typed::Event for LayerTreeDidChangeEvent {
381 const METHOD: &'static str = "LayerTree.layerTreeDidChange";
382}