use serde::{Serialize, Deserialize};
use serde_json::Value as JsonValue;
pub type LayerId = String;
pub type SnapshotId = String;
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ScrollRect {
pub rect: crate::dom::Rect,
#[serde(rename = "type")]
pub type_: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct StickyPositionConstraint {
pub stickyBoxRect: crate::dom::Rect,
pub containingBlockRect: crate::dom::Rect,
#[serde(skip_serializing_if = "Option::is_none")]
pub nearestLayerShiftingStickyBox: Option<LayerId>,
#[serde(skip_serializing_if = "Option::is_none")]
pub nearestLayerShiftingContainingBlock: Option<LayerId>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct PictureTile {
pub x: f64,
pub y: f64,
pub picture: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct Layer {
pub layerId: LayerId,
#[serde(skip_serializing_if = "Option::is_none")]
pub parentLayerId: Option<LayerId>,
#[serde(skip_serializing_if = "Option::is_none")]
pub backendNodeId: Option<crate::dom::BackendNodeId>,
pub offsetX: f64,
pub offsetY: f64,
pub width: f64,
pub height: f64,
#[serde(skip_serializing_if = "Option::is_none")]
pub transform: Option<Vec<f64>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub anchorX: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub anchorY: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub anchorZ: Option<f64>,
pub paintCount: u64,
pub drawsContent: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub invisible: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub scrollRects: Option<Vec<ScrollRect>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub stickyPositionConstraint: Option<StickyPositionConstraint>,
}
pub type PaintProfile = Vec<f64>;
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct CompositingReasonsParams {
pub layerId: LayerId,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct CompositingReasonsReturns {
pub compositingReasons: Vec<String>,
pub compositingReasonIds: Vec<String>,
}
impl CompositingReasonsParams { pub const METHOD: &'static str = "LayerTree.compositingReasons"; }
impl crate::CdpCommand for CompositingReasonsParams {
const METHOD: &'static str = "LayerTree.compositingReasons";
type Response = CompositingReasonsReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct DisableParams {}
impl DisableParams { pub const METHOD: &'static str = "LayerTree.disable"; }
impl crate::CdpCommand for DisableParams {
const METHOD: &'static str = "LayerTree.disable";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct EnableParams {}
impl EnableParams { pub const METHOD: &'static str = "LayerTree.enable"; }
impl crate::CdpCommand for EnableParams {
const METHOD: &'static str = "LayerTree.enable";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct LoadSnapshotParams {
pub tiles: Vec<PictureTile>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct LoadSnapshotReturns {
pub snapshotId: SnapshotId,
}
impl LoadSnapshotParams { pub const METHOD: &'static str = "LayerTree.loadSnapshot"; }
impl crate::CdpCommand for LoadSnapshotParams {
const METHOD: &'static str = "LayerTree.loadSnapshot";
type Response = LoadSnapshotReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct MakeSnapshotParams {
pub layerId: LayerId,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct MakeSnapshotReturns {
pub snapshotId: SnapshotId,
}
impl MakeSnapshotParams { pub const METHOD: &'static str = "LayerTree.makeSnapshot"; }
impl crate::CdpCommand for MakeSnapshotParams {
const METHOD: &'static str = "LayerTree.makeSnapshot";
type Response = MakeSnapshotReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ProfileSnapshotParams {
pub snapshotId: SnapshotId,
#[serde(skip_serializing_if = "Option::is_none")]
pub minRepeatCount: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub minDuration: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub clipRect: Option<crate::dom::Rect>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ProfileSnapshotReturns {
pub timings: Vec<PaintProfile>,
}
impl ProfileSnapshotParams { pub const METHOD: &'static str = "LayerTree.profileSnapshot"; }
impl crate::CdpCommand for ProfileSnapshotParams {
const METHOD: &'static str = "LayerTree.profileSnapshot";
type Response = ProfileSnapshotReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReleaseSnapshotParams {
pub snapshotId: SnapshotId,
}
impl ReleaseSnapshotParams { pub const METHOD: &'static str = "LayerTree.releaseSnapshot"; }
impl crate::CdpCommand for ReleaseSnapshotParams {
const METHOD: &'static str = "LayerTree.releaseSnapshot";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReplaySnapshotParams {
pub snapshotId: SnapshotId,
#[serde(skip_serializing_if = "Option::is_none")]
pub fromStep: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub toStep: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReplaySnapshotReturns {
pub dataURL: String,
}
impl ReplaySnapshotParams { pub const METHOD: &'static str = "LayerTree.replaySnapshot"; }
impl crate::CdpCommand for ReplaySnapshotParams {
const METHOD: &'static str = "LayerTree.replaySnapshot";
type Response = ReplaySnapshotReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SnapshotCommandLogParams {
pub snapshotId: SnapshotId,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SnapshotCommandLogReturns {
pub commandLog: Vec<serde_json::Map<String, JsonValue>>,
}
impl SnapshotCommandLogParams { pub const METHOD: &'static str = "LayerTree.snapshotCommandLog"; }
impl crate::CdpCommand for SnapshotCommandLogParams {
const METHOD: &'static str = "LayerTree.snapshotCommandLog";
type Response = SnapshotCommandLogReturns;
}