1#![allow(dead_code)]
3use super::dom;
4#[allow(unused_imports)]
5use super::types::*;
6#[allow(unused_imports)]
7use derive_builder::Builder;
8#[allow(unused_imports)]
9use serde::{Deserialize, Serialize};
10#[allow(unused_imports)]
11use serde_json::Value as Json;
12pub type LayerId = String;
13pub type SnapshotId = String;
14pub type PaintProfile = Vec<JsFloat>;
15#[allow(deprecated)]
16#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
17pub enum ScrollRectType {
18 #[serde(rename = "RepaintsOnScroll")]
19 RepaintsOnScroll,
20 #[serde(rename = "TouchEventHandler")]
21 TouchEventHandler,
22 #[serde(rename = "WheelEventHandler")]
23 WheelEventHandler,
24}
25#[allow(deprecated)]
26#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
27#[builder(setter(into, strip_option))]
28#[serde(rename_all = "camelCase")]
29#[doc = "Rectangle where scrolling happens on the main thread."]
30pub struct ScrollRect {
31 #[doc = "Rectangle itself."]
32 pub rect: dom::Rect,
33 #[doc = "Reason for rectangle to force scrolling on the main thread"]
34 pub r#type: ScrollRectType,
35}
36#[allow(deprecated)]
37#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
38#[builder(setter(into, strip_option))]
39#[serde(rename_all = "camelCase")]
40#[doc = "Sticky position constraints."]
41pub struct StickyPositionConstraint {
42 #[doc = "Layout rectangle of the sticky element before being shifted"]
43 pub sticky_box_rect: dom::Rect,
44 #[doc = "Layout rectangle of the containing block of the sticky element"]
45 pub containing_block_rect: dom::Rect,
46 #[builder(default)]
47 #[serde(skip_serializing_if = "Option::is_none")]
48 #[doc = "The nearest sticky layer that shifts the sticky box"]
49 pub nearest_layer_shifting_sticky_box: Option<LayerId>,
50 #[builder(default)]
51 #[serde(skip_serializing_if = "Option::is_none")]
52 #[doc = "The nearest sticky layer that shifts the containing block"]
53 pub nearest_layer_shifting_containing_block: Option<LayerId>,
54}
55#[allow(deprecated)]
56#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
57#[builder(setter(into, strip_option))]
58#[serde(rename_all = "camelCase")]
59#[doc = "Serialized fragment of layer picture along with its offset within the layer."]
60pub struct PictureTile {
61 #[serde(default)]
62 #[doc = "Offset from owning layer left boundary"]
63 pub x: JsFloat,
64 #[serde(default)]
65 #[doc = "Offset from owning layer top boundary"]
66 pub y: JsFloat,
67 #[doc = "Base64-encoded snapshot data."]
68 pub picture: String,
69}
70#[allow(deprecated)]
71#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
72#[builder(setter(into, strip_option))]
73#[serde(rename_all = "camelCase")]
74#[doc = "Information about a compositing layer."]
75pub struct Layer {
76 #[doc = "The unique id for this layer."]
77 pub layer_id: LayerId,
78 #[builder(default)]
79 #[serde(skip_serializing_if = "Option::is_none")]
80 #[doc = "The id of parent (not present for root)."]
81 pub parent_layer_id: Option<LayerId>,
82 #[builder(default)]
83 #[serde(skip_serializing_if = "Option::is_none")]
84 #[doc = "The backend id for the node associated with this layer."]
85 pub backend_node_id: Option<dom::BackendNodeId>,
86 #[serde(default)]
87 #[doc = "Offset from parent layer, X coordinate."]
88 pub offset_x: JsFloat,
89 #[serde(default)]
90 #[doc = "Offset from parent layer, Y coordinate."]
91 pub offset_y: JsFloat,
92 #[serde(default)]
93 #[doc = "Layer width."]
94 pub width: JsFloat,
95 #[serde(default)]
96 #[doc = "Layer height."]
97 pub height: JsFloat,
98 #[builder(default)]
99 #[serde(skip_serializing_if = "Option::is_none")]
100 #[serde(default)]
101 #[doc = "Transformation matrix for layer, default is identity matrix"]
102 pub transform: Option<Vec<JsFloat>>,
103 #[builder(default)]
104 #[serde(skip_serializing_if = "Option::is_none")]
105 #[serde(default)]
106 #[doc = "Transform anchor point X, absent if no transform specified"]
107 pub anchor_x: Option<JsFloat>,
108 #[builder(default)]
109 #[serde(skip_serializing_if = "Option::is_none")]
110 #[serde(default)]
111 #[doc = "Transform anchor point Y, absent if no transform specified"]
112 pub anchor_y: Option<JsFloat>,
113 #[builder(default)]
114 #[serde(skip_serializing_if = "Option::is_none")]
115 #[serde(default)]
116 #[doc = "Transform anchor point Z, absent if no transform specified"]
117 pub anchor_z: Option<JsFloat>,
118 #[serde(default)]
119 #[doc = "Indicates how many time this layer has painted."]
120 pub paint_count: JsUInt,
121 #[serde(default)]
122 #[doc = "Indicates whether this layer hosts any content, rather than being used for\n transform/scrolling purposes only."]
123 pub draws_content: bool,
124 #[builder(default)]
125 #[serde(skip_serializing_if = "Option::is_none")]
126 #[serde(default)]
127 #[doc = "Set if layer is not visible."]
128 pub invisible: Option<bool>,
129 #[builder(default)]
130 #[serde(skip_serializing_if = "Option::is_none")]
131 #[doc = "Rectangles scrolling on main thread only."]
132 pub scroll_rects: Option<Vec<ScrollRect>>,
133 #[builder(default)]
134 #[serde(skip_serializing_if = "Option::is_none")]
135 #[doc = "Sticky position constraint information"]
136 pub sticky_position_constraint: Option<StickyPositionConstraint>,
137}
138#[allow(deprecated)]
139#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
140#[builder(setter(into, strip_option))]
141#[serde(rename_all = "camelCase")]
142#[doc = "Provides the reasons why the given layer was composited."]
143pub struct CompositingReasons {
144 #[doc = "The id of the layer for which we want to get the reasons it was composited."]
145 pub layer_id: LayerId,
146}
147#[allow(deprecated)]
148#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
149pub struct Disable(pub Option<Json>);
150#[allow(deprecated)]
151#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
152pub struct Enable(pub Option<Json>);
153#[allow(deprecated)]
154#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
155#[builder(setter(into, strip_option))]
156#[serde(rename_all = "camelCase")]
157#[doc = "Returns the snapshot identifier."]
158pub struct LoadSnapshot {
159 #[doc = "An array of tiles composing the snapshot."]
160 pub tiles: Vec<PictureTile>,
161}
162#[allow(deprecated)]
163#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
164#[builder(setter(into, strip_option))]
165#[serde(rename_all = "camelCase")]
166#[doc = "Returns the layer snapshot identifier."]
167pub struct MakeSnapshot {
168 #[doc = "The id of the layer."]
169 pub layer_id: LayerId,
170}
171#[allow(deprecated)]
172#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
173#[builder(setter(into, strip_option))]
174#[serde(rename_all = "camelCase")]
175pub struct ProfileSnapshot {
176 #[doc = "The id of the layer snapshot."]
177 pub snapshot_id: SnapshotId,
178 #[builder(default)]
179 #[serde(skip_serializing_if = "Option::is_none")]
180 #[serde(default)]
181 #[doc = "The maximum number of times to replay the snapshot (1, if not specified)."]
182 pub min_repeat_count: Option<JsUInt>,
183 #[builder(default)]
184 #[serde(skip_serializing_if = "Option::is_none")]
185 #[serde(default)]
186 #[doc = "The minimum duration (in seconds) to replay the snapshot."]
187 pub min_duration: Option<JsFloat>,
188 #[builder(default)]
189 #[serde(skip_serializing_if = "Option::is_none")]
190 #[doc = "The clip rectangle to apply when replaying the snapshot."]
191 pub clip_rect: Option<dom::Rect>,
192}
193#[allow(deprecated)]
194#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
195#[builder(setter(into, strip_option))]
196#[serde(rename_all = "camelCase")]
197#[doc = "Releases layer snapshot captured by the back-end."]
198pub struct ReleaseSnapshot {
199 #[doc = "The id of the layer snapshot."]
200 pub snapshot_id: SnapshotId,
201}
202#[allow(deprecated)]
203#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
204#[builder(setter(into, strip_option))]
205#[serde(rename_all = "camelCase")]
206#[doc = "Replays the layer snapshot and returns the resulting bitmap."]
207pub struct ReplaySnapshot {
208 #[doc = "The id of the layer snapshot."]
209 pub snapshot_id: SnapshotId,
210 #[builder(default)]
211 #[serde(skip_serializing_if = "Option::is_none")]
212 #[serde(default)]
213 #[doc = "The first step to replay from (replay from the very start if not specified)."]
214 pub from_step: Option<JsUInt>,
215 #[builder(default)]
216 #[serde(skip_serializing_if = "Option::is_none")]
217 #[serde(default)]
218 #[doc = "The last step to replay to (replay till the end if not specified)."]
219 pub to_step: Option<JsUInt>,
220 #[builder(default)]
221 #[serde(skip_serializing_if = "Option::is_none")]
222 #[serde(default)]
223 #[doc = "The scale to apply while replaying (defaults to 1)."]
224 pub scale: Option<JsFloat>,
225}
226#[allow(deprecated)]
227#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
228#[builder(setter(into, strip_option))]
229#[serde(rename_all = "camelCase")]
230#[doc = "Replays the layer snapshot and returns canvas log."]
231pub struct SnapshotCommandLog {
232 #[doc = "The id of the layer snapshot."]
233 pub snapshot_id: SnapshotId,
234}
235#[allow(deprecated)]
236#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
237#[serde(rename_all = "camelCase")]
238#[doc = "Provides the reasons why the given layer was composited."]
239pub struct CompositingReasonsReturnObject {
240 #[doc = "A list of strings specifying reasons for the given layer to become composited."]
241 pub compositing_reasons: Vec<String>,
242 #[doc = "A list of strings specifying reason IDs for the given layer to become composited."]
243 pub compositing_reason_ids: Vec<String>,
244}
245#[allow(deprecated)]
246#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
247#[doc = "Disables compositing tree inspection."]
248pub struct DisableReturnObject(pub Option<Json>);
249#[allow(deprecated)]
250#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
251#[doc = "Enables compositing tree inspection."]
252pub struct EnableReturnObject(pub Option<Json>);
253#[allow(deprecated)]
254#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
255#[serde(rename_all = "camelCase")]
256#[doc = "Returns the snapshot identifier."]
257pub struct LoadSnapshotReturnObject {
258 #[doc = "The id of the snapshot."]
259 pub snapshot_id: SnapshotId,
260}
261#[allow(deprecated)]
262#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
263#[serde(rename_all = "camelCase")]
264#[doc = "Returns the layer snapshot identifier."]
265pub struct MakeSnapshotReturnObject {
266 #[doc = "The id of the layer snapshot."]
267 pub snapshot_id: SnapshotId,
268}
269#[allow(deprecated)]
270#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
271#[serde(rename_all = "camelCase")]
272pub struct ProfileSnapshotReturnObject {
273 #[doc = "The array of paint profiles, one per run."]
274 pub timings: Vec<PaintProfile>,
275}
276#[allow(deprecated)]
277#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
278#[doc = "Releases layer snapshot captured by the back-end."]
279pub struct ReleaseSnapshotReturnObject(pub Option<Json>);
280#[allow(deprecated)]
281#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
282#[serde(rename_all = "camelCase")]
283#[doc = "Replays the layer snapshot and returns the resulting bitmap."]
284pub struct ReplaySnapshotReturnObject {
285 #[serde(default)]
286 #[doc = "A data: URL for resulting image."]
287 #[serde(rename = "dataURL")]
288 pub data_url: String,
289}
290#[allow(deprecated)]
291#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
292#[serde(rename_all = "camelCase")]
293#[doc = "Replays the layer snapshot and returns canvas log."]
294pub struct SnapshotCommandLogReturnObject {
295 #[doc = "The array of canvas function calls."]
296 pub command_log: Vec<Json>,
297}
298#[allow(deprecated)]
299impl Method for CompositingReasons {
300 const NAME: &'static str = "LayerTree.compositingReasons";
301 type ReturnObject = CompositingReasonsReturnObject;
302}
303#[allow(deprecated)]
304impl Method for Disable {
305 const NAME: &'static str = "LayerTree.disable";
306 type ReturnObject = DisableReturnObject;
307}
308#[allow(deprecated)]
309impl Method for Enable {
310 const NAME: &'static str = "LayerTree.enable";
311 type ReturnObject = EnableReturnObject;
312}
313#[allow(deprecated)]
314impl Method for LoadSnapshot {
315 const NAME: &'static str = "LayerTree.loadSnapshot";
316 type ReturnObject = LoadSnapshotReturnObject;
317}
318#[allow(deprecated)]
319impl Method for MakeSnapshot {
320 const NAME: &'static str = "LayerTree.makeSnapshot";
321 type ReturnObject = MakeSnapshotReturnObject;
322}
323#[allow(deprecated)]
324impl Method for ProfileSnapshot {
325 const NAME: &'static str = "LayerTree.profileSnapshot";
326 type ReturnObject = ProfileSnapshotReturnObject;
327}
328#[allow(deprecated)]
329impl Method for ReleaseSnapshot {
330 const NAME: &'static str = "LayerTree.releaseSnapshot";
331 type ReturnObject = ReleaseSnapshotReturnObject;
332}
333#[allow(deprecated)]
334impl Method for ReplaySnapshot {
335 const NAME: &'static str = "LayerTree.replaySnapshot";
336 type ReturnObject = ReplaySnapshotReturnObject;
337}
338#[allow(deprecated)]
339impl Method for SnapshotCommandLog {
340 const NAME: &'static str = "LayerTree.snapshotCommandLog";
341 type ReturnObject = SnapshotCommandLogReturnObject;
342}
343#[allow(dead_code)]
344pub mod events {
345 #[allow(unused_imports)]
346 use super::super::types::*;
347 #[allow(unused_imports)]
348 use derive_builder::Builder;
349 #[allow(unused_imports)]
350 use serde::{Deserialize, Serialize};
351 #[allow(unused_imports)]
352 use serde_json::Value as Json;
353 #[allow(deprecated)]
354 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
355 pub struct LayerPaintedEvent {
356 pub params: LayerPaintedEventParams,
357 }
358 #[allow(deprecated)]
359 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
360 #[serde(rename_all = "camelCase")]
361 pub struct LayerPaintedEventParams {
362 #[doc = "The id of the painted layer."]
363 pub layer_id: super::LayerId,
364 #[doc = "Clip rectangle."]
365 pub clip: super::super::dom::Rect,
366 }
367 #[allow(deprecated)]
368 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
369 pub struct LayerTreeDidChangeEvent {
370 pub params: LayerTreeDidChangeEventParams,
371 }
372 #[allow(deprecated)]
373 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
374 #[serde(rename_all = "camelCase")]
375 pub struct LayerTreeDidChangeEventParams {
376 #[builder(default)]
377 #[serde(skip_serializing_if = "Option::is_none")]
378 #[doc = "Layer tree, absent if not in the compositing mode."]
379 pub layers: Option<Vec<super::Layer>>,
380 }
381}