use serde::{Deserialize, Serialize};
pub type LayerId = String;
pub type SnapshotId = String;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ScrollRect {
pub rect: crate::protocol::dom::Rect,
pub r#type: ScrollRectType,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ScrollRectType {
RepaintsOnScroll,
TouchEventHandler,
WheelEventHandler,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct StickyPositionConstraint {
#[serde(rename = "stickyBoxRect")]
pub sticky_box_rect: crate::protocol::dom::Rect,
#[serde(rename = "containingBlockRect")]
pub containing_block_rect: crate::protocol::dom::Rect,
#[serde(
rename = "nearestLayerShiftingStickyBox",
default,
skip_serializing_if = "Option::is_none"
)]
pub nearest_layer_shifting_sticky_box: Option<LayerId>,
#[serde(
rename = "nearestLayerShiftingContainingBlock",
default,
skip_serializing_if = "Option::is_none"
)]
pub nearest_layer_shifting_containing_block: Option<LayerId>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct PictureTile {
pub x: f64,
pub y: f64,
pub picture: String,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Layer {
#[serde(rename = "layerId")]
pub layer_id: LayerId,
#[serde(
rename = "parentLayerId",
default,
skip_serializing_if = "Option::is_none"
)]
pub parent_layer_id: Option<LayerId>,
#[serde(
rename = "backendNodeId",
default,
skip_serializing_if = "Option::is_none"
)]
pub backend_node_id: Option<crate::protocol::dom::BackendNodeId>,
#[serde(rename = "offsetX")]
pub offset_x: f64,
#[serde(rename = "offsetY")]
pub offset_y: f64,
pub width: f64,
pub height: f64,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub transform: Option<Vec<f64>>,
#[serde(rename = "anchorX", default, skip_serializing_if = "Option::is_none")]
pub anchor_x: Option<f64>,
#[serde(rename = "anchorY", default, skip_serializing_if = "Option::is_none")]
pub anchor_y: Option<f64>,
#[serde(rename = "anchorZ", default, skip_serializing_if = "Option::is_none")]
pub anchor_z: Option<f64>,
#[serde(rename = "paintCount")]
pub paint_count: i64,
#[serde(rename = "drawsContent")]
pub draws_content: bool,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub invisible: Option<bool>,
#[serde(
rename = "scrollRects",
default,
skip_serializing_if = "Option::is_none"
)]
pub scroll_rects: Option<Vec<ScrollRect>>,
#[serde(
rename = "stickyPositionConstraint",
default,
skip_serializing_if = "Option::is_none"
)]
pub sticky_position_constraint: Option<StickyPositionConstraint>,
}
pub type PaintProfile = Vec<f64>;
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CompositingReasonsParams {
#[serde(rename = "layerId")]
pub layer_id: LayerId,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CompositingReasonsReturns {
#[serde(rename = "compositingReasons")]
pub compositing_reasons: Vec<String>,
#[serde(rename = "compositingReasonIds")]
pub compositing_reason_ids: Vec<String>,
}
impl crate::typed::Command for CompositingReasonsParams {
const METHOD: &'static str = "LayerTree.compositingReasons";
type Returns = CompositingReasonsReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DisableParams {}
impl crate::typed::Command for DisableParams {
const METHOD: &'static str = "LayerTree.disable";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct EnableParams {}
impl crate::typed::Command for EnableParams {
const METHOD: &'static str = "LayerTree.enable";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct LoadSnapshotParams {
pub tiles: Vec<PictureTile>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct LoadSnapshotReturns {
#[serde(rename = "snapshotId")]
pub snapshot_id: SnapshotId,
}
impl crate::typed::Command for LoadSnapshotParams {
const METHOD: &'static str = "LayerTree.loadSnapshot";
type Returns = LoadSnapshotReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct MakeSnapshotParams {
#[serde(rename = "layerId")]
pub layer_id: LayerId,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct MakeSnapshotReturns {
#[serde(rename = "snapshotId")]
pub snapshot_id: SnapshotId,
}
impl crate::typed::Command for MakeSnapshotParams {
const METHOD: &'static str = "LayerTree.makeSnapshot";
type Returns = MakeSnapshotReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ProfileSnapshotParams {
#[serde(rename = "snapshotId")]
pub snapshot_id: SnapshotId,
#[serde(
rename = "minRepeatCount",
default,
skip_serializing_if = "Option::is_none"
)]
pub min_repeat_count: Option<i64>,
#[serde(
rename = "minDuration",
default,
skip_serializing_if = "Option::is_none"
)]
pub min_duration: Option<f64>,
#[serde(rename = "clipRect", default, skip_serializing_if = "Option::is_none")]
pub clip_rect: Option<crate::protocol::dom::Rect>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ProfileSnapshotReturns {
pub timings: Vec<PaintProfile>,
}
impl crate::typed::Command for ProfileSnapshotParams {
const METHOD: &'static str = "LayerTree.profileSnapshot";
type Returns = ProfileSnapshotReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ReleaseSnapshotParams {
#[serde(rename = "snapshotId")]
pub snapshot_id: SnapshotId,
}
impl crate::typed::Command for ReleaseSnapshotParams {
const METHOD: &'static str = "LayerTree.releaseSnapshot";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ReplaySnapshotParams {
#[serde(rename = "snapshotId")]
pub snapshot_id: SnapshotId,
#[serde(rename = "fromStep", default, skip_serializing_if = "Option::is_none")]
pub from_step: Option<i64>,
#[serde(rename = "toStep", default, skip_serializing_if = "Option::is_none")]
pub to_step: Option<i64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ReplaySnapshotReturns {
#[serde(rename = "dataURL")]
pub data_url: String,
}
impl crate::typed::Command for ReplaySnapshotParams {
const METHOD: &'static str = "LayerTree.replaySnapshot";
type Returns = ReplaySnapshotReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SnapshotCommandLogParams {
#[serde(rename = "snapshotId")]
pub snapshot_id: SnapshotId,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SnapshotCommandLogReturns {
#[serde(rename = "commandLog")]
pub command_log: Vec<serde_json::Value>,
}
impl crate::typed::Command for SnapshotCommandLogParams {
const METHOD: &'static str = "LayerTree.snapshotCommandLog";
type Returns = SnapshotCommandLogReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct LayerPaintedEvent {
#[serde(rename = "layerId")]
pub layer_id: LayerId,
pub clip: crate::protocol::dom::Rect,
}
impl crate::typed::Event for LayerPaintedEvent {
const METHOD: &'static str = "LayerTree.layerPainted";
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct LayerTreeDidChangeEvent {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub layers: Option<Vec<Layer>>,
}
impl crate::typed::Event for LayerTreeDidChangeEvent {
const METHOD: &'static str = "LayerTree.layerTreeDidChange";
}