cdp_protocol/
layer_tree.rs

1// Auto-generated from Chrome at version 143.0.7499.110 domain: LayerTree
2use super::dom;
3#[allow(unused_imports)]
4use super::types::*;
5#[allow(unused_imports)]
6use serde::{Deserialize, Serialize};
7#[allow(unused_imports)]
8use serde_json::Value as Json;
9pub type LayerId = String;
10pub type SnapshotId = String;
11pub type PaintProfile = Vec<JsFloat>;
12#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
13pub enum ScrollRectType {
14    #[serde(rename = "RepaintsOnScroll")]
15    RepaintsOnScroll,
16    #[serde(rename = "TouchEventHandler")]
17    TouchEventHandler,
18    #[serde(rename = "WheelEventHandler")]
19    WheelEventHandler,
20}
21#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
22pub struct ScrollRect {
23    #[serde(rename = "rect")]
24    pub rect: dom::Rect,
25    #[serde(rename = "type")]
26    pub r#type: ScrollRectType,
27}
28#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
29pub struct StickyPositionConstraint {
30    #[serde(rename = "stickyBoxRect")]
31    pub sticky_box_rect: dom::Rect,
32    #[serde(rename = "containingBlockRect")]
33    pub containing_block_rect: dom::Rect,
34    #[serde(skip_serializing_if = "Option::is_none")]
35    #[serde(rename = "nearestLayerShiftingStickyBox")]
36    pub nearest_layer_shifting_sticky_box: Option<LayerId>,
37    #[serde(skip_serializing_if = "Option::is_none")]
38    #[serde(rename = "nearestLayerShiftingContainingBlock")]
39    pub nearest_layer_shifting_containing_block: Option<LayerId>,
40}
41#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
42pub struct PictureTile {
43    #[serde(default)]
44    #[serde(rename = "x")]
45    pub x: JsFloat,
46    #[serde(default)]
47    #[serde(rename = "y")]
48    pub y: JsFloat,
49    #[serde(rename = "picture")]
50    pub picture: Vec<u8>,
51}
52#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
53pub struct Layer {
54    #[serde(rename = "layerId")]
55    pub layer_id: LayerId,
56    #[serde(skip_serializing_if = "Option::is_none")]
57    #[serde(rename = "parentLayerId")]
58    pub parent_layer_id: Option<LayerId>,
59    #[serde(skip_serializing_if = "Option::is_none")]
60    #[serde(rename = "backendNodeId")]
61    pub backend_node_id: Option<dom::BackendNodeId>,
62    #[serde(default)]
63    #[serde(rename = "offsetX")]
64    pub offset_x: JsFloat,
65    #[serde(default)]
66    #[serde(rename = "offsetY")]
67    pub offset_y: JsFloat,
68    #[serde(default)]
69    #[serde(rename = "width")]
70    pub width: JsFloat,
71    #[serde(default)]
72    #[serde(rename = "height")]
73    pub height: JsFloat,
74    #[serde(skip_serializing_if = "Option::is_none")]
75    #[serde(default)]
76    #[serde(rename = "transform")]
77    pub transform: Option<Vec<JsFloat>>,
78    #[serde(skip_serializing_if = "Option::is_none")]
79    #[serde(default)]
80    #[serde(rename = "anchorX")]
81    pub anchor_x: Option<JsFloat>,
82    #[serde(skip_serializing_if = "Option::is_none")]
83    #[serde(default)]
84    #[serde(rename = "anchorY")]
85    pub anchor_y: Option<JsFloat>,
86    #[serde(skip_serializing_if = "Option::is_none")]
87    #[serde(default)]
88    #[serde(rename = "anchorZ")]
89    pub anchor_z: Option<JsFloat>,
90    #[serde(default)]
91    #[serde(rename = "paintCount")]
92    pub paint_count: JsUInt,
93    #[serde(default)]
94    #[serde(rename = "drawsContent")]
95    pub draws_content: bool,
96    #[serde(skip_serializing_if = "Option::is_none")]
97    #[serde(default)]
98    #[serde(rename = "invisible")]
99    pub invisible: Option<bool>,
100    #[serde(skip_serializing_if = "Option::is_none")]
101    #[serde(rename = "scrollRects")]
102    pub scroll_rects: Option<Vec<ScrollRect>>,
103    #[serde(skip_serializing_if = "Option::is_none")]
104    #[serde(rename = "stickyPositionConstraint")]
105    pub sticky_position_constraint: Option<StickyPositionConstraint>,
106}
107#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
108pub struct CompositingReasons {
109    #[serde(rename = "layerId")]
110    pub layer_id: LayerId,
111}
112#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
113#[serde(rename_all = "camelCase")]
114pub struct Disable(pub Option<serde_json::Value>);
115#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
116#[serde(rename_all = "camelCase")]
117pub struct Enable(pub Option<serde_json::Value>);
118#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
119pub struct LoadSnapshot {
120    #[serde(rename = "tiles")]
121    pub tiles: Vec<PictureTile>,
122}
123#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
124pub struct MakeSnapshot {
125    #[serde(rename = "layerId")]
126    pub layer_id: LayerId,
127}
128#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
129pub struct ProfileSnapshot {
130    #[serde(rename = "snapshotId")]
131    pub snapshot_id: SnapshotId,
132    #[serde(skip_serializing_if = "Option::is_none")]
133    #[serde(default)]
134    #[serde(rename = "minRepeatCount")]
135    pub min_repeat_count: Option<JsUInt>,
136    #[serde(skip_serializing_if = "Option::is_none")]
137    #[serde(default)]
138    #[serde(rename = "minDuration")]
139    pub min_duration: Option<JsFloat>,
140    #[serde(skip_serializing_if = "Option::is_none")]
141    #[serde(rename = "clipRect")]
142    pub clip_rect: Option<dom::Rect>,
143}
144#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
145pub struct ReleaseSnapshot {
146    #[serde(rename = "snapshotId")]
147    pub snapshot_id: SnapshotId,
148}
149#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
150pub struct ReplaySnapshot {
151    #[serde(rename = "snapshotId")]
152    pub snapshot_id: SnapshotId,
153    #[serde(skip_serializing_if = "Option::is_none")]
154    #[serde(default)]
155    #[serde(rename = "fromStep")]
156    pub from_step: Option<JsUInt>,
157    #[serde(skip_serializing_if = "Option::is_none")]
158    #[serde(default)]
159    #[serde(rename = "toStep")]
160    pub to_step: Option<JsUInt>,
161    #[serde(skip_serializing_if = "Option::is_none")]
162    #[serde(default)]
163    #[serde(rename = "scale")]
164    pub scale: Option<JsFloat>,
165}
166#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
167pub struct SnapshotCommandLog {
168    #[serde(rename = "snapshotId")]
169    pub snapshot_id: SnapshotId,
170}
171#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
172pub struct CompositingReasonsReturnObject {
173    #[serde(rename = "compositingReasons")]
174    pub compositing_reasons: Vec<String>,
175    #[serde(rename = "compositingReasonIds")]
176    pub compositing_reason_ids: Vec<String>,
177}
178#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
179#[serde(rename_all = "camelCase")]
180pub struct DisableReturnObject {}
181#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
182#[serde(rename_all = "camelCase")]
183pub struct EnableReturnObject {}
184#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
185pub struct LoadSnapshotReturnObject {
186    #[serde(rename = "snapshotId")]
187    pub snapshot_id: SnapshotId,
188}
189#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
190pub struct MakeSnapshotReturnObject {
191    #[serde(rename = "snapshotId")]
192    pub snapshot_id: SnapshotId,
193}
194#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
195pub struct ProfileSnapshotReturnObject {
196    #[serde(rename = "timings")]
197    pub timings: Vec<PaintProfile>,
198}
199#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
200#[serde(rename_all = "camelCase")]
201pub struct ReleaseSnapshotReturnObject {}
202#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
203pub struct ReplaySnapshotReturnObject {
204    #[serde(default)]
205    #[serde(rename = "dataURL")]
206    pub data_url: String,
207}
208#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
209pub struct SnapshotCommandLogReturnObject {}
210impl Method for CompositingReasons {
211    const NAME: &'static str = "LayerTree.compositingReasons";
212    type ReturnObject = CompositingReasonsReturnObject;
213}
214impl Method for Disable {
215    const NAME: &'static str = "LayerTree.disable";
216    type ReturnObject = DisableReturnObject;
217}
218impl Method for Enable {
219    const NAME: &'static str = "LayerTree.enable";
220    type ReturnObject = EnableReturnObject;
221}
222impl Method for LoadSnapshot {
223    const NAME: &'static str = "LayerTree.loadSnapshot";
224    type ReturnObject = LoadSnapshotReturnObject;
225}
226impl Method for MakeSnapshot {
227    const NAME: &'static str = "LayerTree.makeSnapshot";
228    type ReturnObject = MakeSnapshotReturnObject;
229}
230impl Method for ProfileSnapshot {
231    const NAME: &'static str = "LayerTree.profileSnapshot";
232    type ReturnObject = ProfileSnapshotReturnObject;
233}
234impl Method for ReleaseSnapshot {
235    const NAME: &'static str = "LayerTree.releaseSnapshot";
236    type ReturnObject = ReleaseSnapshotReturnObject;
237}
238impl Method for ReplaySnapshot {
239    const NAME: &'static str = "LayerTree.replaySnapshot";
240    type ReturnObject = ReplaySnapshotReturnObject;
241}
242impl Method for SnapshotCommandLog {
243    const NAME: &'static str = "LayerTree.snapshotCommandLog";
244    type ReturnObject = SnapshotCommandLogReturnObject;
245}
246pub mod events {
247    #[allow(unused_imports)]
248    use super::super::types::*;
249    #[allow(unused_imports)]
250    use serde::{Deserialize, Serialize};
251    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
252    pub struct LayerPaintedEvent {
253        pub params: LayerPaintedEventParams,
254    }
255    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
256    pub struct LayerPaintedEventParams {
257        #[serde(rename = "layerId")]
258        pub layer_id: super::LayerId,
259        #[serde(rename = "clip")]
260        pub clip: super::super::dom::Rect,
261    }
262    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
263    pub struct LayerTreeDidChangeEvent {
264        pub params: LayerTreeDidChangeEventParams,
265    }
266    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
267    pub struct LayerTreeDidChangeEventParams {
268        #[serde(skip_serializing_if = "Option::is_none")]
269        #[serde(rename = "layers")]
270        pub layers: Option<Vec<super::Layer>>,
271    }
272}