browser_protocol/layertree/
mod.rs1use serde::{Serialize, Deserialize};
2use serde_json::Value as JsonValue;
3
4pub type LayerId = String;
7
8pub type SnapshotId = String;
11
12#[derive(Debug, Clone, Serialize, Deserialize, Default)]
15#[serde(rename_all = "camelCase")]
16pub struct ScrollRect {
17 pub rect: crate::dom::Rect,
20 #[serde(rename = "type")]
23 pub type_: String,
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize, Default)]
29#[serde(rename_all = "camelCase")]
30pub struct StickyPositionConstraint {
31 pub stickyBoxRect: crate::dom::Rect,
34 pub containingBlockRect: crate::dom::Rect,
37 #[serde(skip_serializing_if = "Option::is_none")]
40 pub nearestLayerShiftingStickyBox: Option<LayerId>,
41 #[serde(skip_serializing_if = "Option::is_none")]
44 pub nearestLayerShiftingContainingBlock: Option<LayerId>,
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize, Default)]
50#[serde(rename_all = "camelCase")]
51pub struct PictureTile {
52 pub x: f64,
55 pub y: f64,
58 pub picture: String,
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize, Default)]
66#[serde(rename_all = "camelCase")]
67pub struct Layer {
68 pub layerId: LayerId,
71 #[serde(skip_serializing_if = "Option::is_none")]
74 pub parentLayerId: Option<LayerId>,
75 #[serde(skip_serializing_if = "Option::is_none")]
78 pub backendNodeId: Option<crate::dom::BackendNodeId>,
79 pub offsetX: f64,
82 pub offsetY: f64,
85 pub width: f64,
88 pub height: f64,
91 #[serde(skip_serializing_if = "Option::is_none")]
94 pub transform: Option<Vec<f64>>,
95 #[serde(skip_serializing_if = "Option::is_none")]
98 pub anchorX: Option<f64>,
99 #[serde(skip_serializing_if = "Option::is_none")]
102 pub anchorY: Option<f64>,
103 #[serde(skip_serializing_if = "Option::is_none")]
106 pub anchorZ: Option<f64>,
107 pub paintCount: u64,
110 pub drawsContent: bool,
114 #[serde(skip_serializing_if = "Option::is_none")]
117 pub invisible: Option<bool>,
118 #[serde(skip_serializing_if = "Option::is_none")]
121 pub scrollRects: Option<Vec<ScrollRect>>,
122 #[serde(skip_serializing_if = "Option::is_none")]
125 pub stickyPositionConstraint: Option<StickyPositionConstraint>,
126}
127
128pub type PaintProfile = Vec<f64>;
131
132#[derive(Debug, Clone, Serialize, Deserialize, Default)]
135#[serde(rename_all = "camelCase")]
136pub struct CompositingReasonsParams {
137 pub layerId: LayerId,
140}
141
142#[derive(Debug, Clone, Serialize, Deserialize, Default)]
145#[serde(rename_all = "camelCase")]
146pub struct CompositingReasonsReturns {
147 pub compositingReasons: Vec<String>,
150 pub compositingReasonIds: Vec<String>,
153}
154
155impl CompositingReasonsParams { pub const METHOD: &'static str = "LayerTree.compositingReasons"; }
156
157impl crate::CdpCommand for CompositingReasonsParams {
158 const METHOD: &'static str = "LayerTree.compositingReasons";
159 type Response = CompositingReasonsReturns;
160}
161
162#[derive(Debug, Clone, Serialize, Deserialize, Default)]
163pub struct DisableParams {}
164
165impl DisableParams { pub const METHOD: &'static str = "LayerTree.disable"; }
166
167impl crate::CdpCommand for DisableParams {
168 const METHOD: &'static str = "LayerTree.disable";
169 type Response = crate::EmptyReturns;
170}
171
172#[derive(Debug, Clone, Serialize, Deserialize, Default)]
173pub struct EnableParams {}
174
175impl EnableParams { pub const METHOD: &'static str = "LayerTree.enable"; }
176
177impl crate::CdpCommand for EnableParams {
178 const METHOD: &'static str = "LayerTree.enable";
179 type Response = crate::EmptyReturns;
180}
181
182#[derive(Debug, Clone, Serialize, Deserialize, Default)]
185#[serde(rename_all = "camelCase")]
186pub struct LoadSnapshotParams {
187 pub tiles: Vec<PictureTile>,
190}
191
192#[derive(Debug, Clone, Serialize, Deserialize, Default)]
195#[serde(rename_all = "camelCase")]
196pub struct LoadSnapshotReturns {
197 pub snapshotId: SnapshotId,
200}
201
202impl LoadSnapshotParams { pub const METHOD: &'static str = "LayerTree.loadSnapshot"; }
203
204impl crate::CdpCommand for LoadSnapshotParams {
205 const METHOD: &'static str = "LayerTree.loadSnapshot";
206 type Response = LoadSnapshotReturns;
207}
208
209#[derive(Debug, Clone, Serialize, Deserialize, Default)]
212#[serde(rename_all = "camelCase")]
213pub struct MakeSnapshotParams {
214 pub layerId: LayerId,
217}
218
219#[derive(Debug, Clone, Serialize, Deserialize, Default)]
222#[serde(rename_all = "camelCase")]
223pub struct MakeSnapshotReturns {
224 pub snapshotId: SnapshotId,
227}
228
229impl MakeSnapshotParams { pub const METHOD: &'static str = "LayerTree.makeSnapshot"; }
230
231impl crate::CdpCommand for MakeSnapshotParams {
232 const METHOD: &'static str = "LayerTree.makeSnapshot";
233 type Response = MakeSnapshotReturns;
234}
235
236
237#[derive(Debug, Clone, Serialize, Deserialize, Default)]
238#[serde(rename_all = "camelCase")]
239pub struct ProfileSnapshotParams {
240 pub snapshotId: SnapshotId,
243 #[serde(skip_serializing_if = "Option::is_none")]
246 pub minRepeatCount: Option<u64>,
247 #[serde(skip_serializing_if = "Option::is_none")]
250 pub minDuration: Option<f64>,
251 #[serde(skip_serializing_if = "Option::is_none")]
254 pub clipRect: Option<crate::dom::Rect>,
255}
256
257
258#[derive(Debug, Clone, Serialize, Deserialize, Default)]
259#[serde(rename_all = "camelCase")]
260pub struct ProfileSnapshotReturns {
261 pub timings: Vec<PaintProfile>,
264}
265
266impl ProfileSnapshotParams { pub const METHOD: &'static str = "LayerTree.profileSnapshot"; }
267
268impl crate::CdpCommand for ProfileSnapshotParams {
269 const METHOD: &'static str = "LayerTree.profileSnapshot";
270 type Response = ProfileSnapshotReturns;
271}
272
273#[derive(Debug, Clone, Serialize, Deserialize, Default)]
276#[serde(rename_all = "camelCase")]
277pub struct ReleaseSnapshotParams {
278 pub snapshotId: SnapshotId,
281}
282
283impl ReleaseSnapshotParams { pub const METHOD: &'static str = "LayerTree.releaseSnapshot"; }
284
285impl crate::CdpCommand for ReleaseSnapshotParams {
286 const METHOD: &'static str = "LayerTree.releaseSnapshot";
287 type Response = crate::EmptyReturns;
288}
289
290#[derive(Debug, Clone, Serialize, Deserialize, Default)]
293#[serde(rename_all = "camelCase")]
294pub struct ReplaySnapshotParams {
295 pub snapshotId: SnapshotId,
298 #[serde(skip_serializing_if = "Option::is_none")]
301 pub fromStep: Option<i64>,
302 #[serde(skip_serializing_if = "Option::is_none")]
305 pub toStep: Option<i64>,
306 #[serde(skip_serializing_if = "Option::is_none")]
309 pub scale: Option<f64>,
310}
311
312#[derive(Debug, Clone, Serialize, Deserialize, Default)]
315#[serde(rename_all = "camelCase")]
316pub struct ReplaySnapshotReturns {
317 pub dataURL: String,
320}
321
322impl ReplaySnapshotParams { pub const METHOD: &'static str = "LayerTree.replaySnapshot"; }
323
324impl crate::CdpCommand for ReplaySnapshotParams {
325 const METHOD: &'static str = "LayerTree.replaySnapshot";
326 type Response = ReplaySnapshotReturns;
327}
328
329#[derive(Debug, Clone, Serialize, Deserialize, Default)]
332#[serde(rename_all = "camelCase")]
333pub struct SnapshotCommandLogParams {
334 pub snapshotId: SnapshotId,
337}
338
339#[derive(Debug, Clone, Serialize, Deserialize, Default)]
342#[serde(rename_all = "camelCase")]
343pub struct SnapshotCommandLogReturns {
344 pub commandLog: Vec<serde_json::Map<String, JsonValue>>,
347}
348
349impl SnapshotCommandLogParams { pub const METHOD: &'static str = "LayerTree.snapshotCommandLog"; }
350
351impl crate::CdpCommand for SnapshotCommandLogParams {
352 const METHOD: &'static str = "LayerTree.snapshotCommandLog";
353 type Response = SnapshotCommandLogReturns;
354}