layer_tree
Layer
dataclass
Information about a compositing layer.
Source code in zendriver/cdp/layer_tree.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
|
anchor_x: typing.Optional[float] = None
class-attribute
instance-attribute
anchor_y: typing.Optional[float] = None
class-attribute
instance-attribute
anchor_z: typing.Optional[float] = None
class-attribute
instance-attribute
backend_node_id: typing.Optional[dom.BackendNodeId] = None
class-attribute
instance-attribute
draws_content: bool
instance-attribute
height: float
instance-attribute
invisible: typing.Optional[bool] = None
class-attribute
instance-attribute
layer_id: LayerId
instance-attribute
offset_x: float
instance-attribute
offset_y: float
instance-attribute
paint_count: int
instance-attribute
parent_layer_id: typing.Optional[LayerId] = None
class-attribute
instance-attribute
scroll_rects: typing.Optional[typing.List[ScrollRect]] = None
class-attribute
instance-attribute
sticky_position_constraint: typing.Optional[StickyPositionConstraint] = None
class-attribute
instance-attribute
transform: typing.Optional[typing.List[float]] = None
class-attribute
instance-attribute
width: float
instance-attribute
__init__(layer_id, offset_x, offset_y, width, height, paint_count, draws_content, parent_layer_id=None, backend_node_id=None, transform=None, anchor_x=None, anchor_y=None, anchor_z=None, invisible=None, scroll_rects=None, sticky_position_constraint=None)
from_json(json)
classmethod
Source code in zendriver/cdp/layer_tree.py
to_json()
Source code in zendriver/cdp/layer_tree.py
LayerId
Bases: str
Unique Layer identifier.
Source code in zendriver/cdp/layer_tree.py
__repr__()
from_json(json)
classmethod
LayerPainted
dataclass
Source code in zendriver/cdp/layer_tree.py
clip: dom.Rect
instance-attribute
layer_id: LayerId
instance-attribute
__init__(layer_id, clip)
LayerTreeDidChange
dataclass
Source code in zendriver/cdp/layer_tree.py
layers: typing.Optional[typing.List[Layer]]
instance-attribute
__init__(layers)
PaintProfile
Bases: list
Array of timings, one per paint step.
Source code in zendriver/cdp/layer_tree.py
__repr__()
from_json(json)
classmethod
PictureTile
dataclass
Serialized fragment of layer picture along with its offset within the layer.
Source code in zendriver/cdp/layer_tree.py
picture: str
instance-attribute
x: float
instance-attribute
y: float
instance-attribute
__init__(x, y, picture)
from_json(json)
classmethod
ScrollRect
dataclass
Rectangle where scrolling happens on the main thread.
Source code in zendriver/cdp/layer_tree.py
rect: dom.Rect
instance-attribute
type_: str
instance-attribute
__init__(rect, type_)
from_json(json)
classmethod
SnapshotId
Bases: str
Unique snapshot identifier.
Source code in zendriver/cdp/layer_tree.py
__repr__()
from_json(json)
classmethod
StickyPositionConstraint
dataclass
Sticky position constraints.
Source code in zendriver/cdp/layer_tree.py
containing_block_rect: dom.Rect
instance-attribute
nearest_layer_shifting_containing_block: typing.Optional[LayerId] = None
class-attribute
instance-attribute
nearest_layer_shifting_sticky_box: typing.Optional[LayerId] = None
class-attribute
instance-attribute
sticky_box_rect: dom.Rect
instance-attribute
__init__(sticky_box_rect, containing_block_rect, nearest_layer_shifting_sticky_box=None, nearest_layer_shifting_containing_block=None)
from_json(json)
classmethod
Source code in zendriver/cdp/layer_tree.py
to_json()
Source code in zendriver/cdp/layer_tree.py
compositing_reasons(layer_id)
Provides the reasons why the given layer was composited.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer_id
|
LayerId
|
The id of the layer for which we want to get the reasons it was composited. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Tuple[List[str], List[str]]]
|
A tuple with the following items: 0. compositingReasons - A list of strings specifying reasons for the given layer to become composited. 1. compositingReasonIds - A list of strings specifying reason IDs for the given layer to become composited. |
Source code in zendriver/cdp/layer_tree.py
disable()
Disables compositing tree inspection.
enable()
Enables compositing tree inspection.
load_snapshot(tiles)
Returns the snapshot identifier.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tiles
|
List[PictureTile]
|
An array of tiles composing the snapshot. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, SnapshotId]
|
The id of the snapshot. |
Source code in zendriver/cdp/layer_tree.py
make_snapshot(layer_id)
Returns the layer snapshot identifier.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer_id
|
LayerId
|
The id of the layer. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, SnapshotId]
|
The id of the layer snapshot. |
Source code in zendriver/cdp/layer_tree.py
profile_snapshot(snapshot_id, min_repeat_count=None, min_duration=None, clip_rect=None)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
snapshot_id
|
SnapshotId
|
The id of the layer snapshot. |
required |
min_repeat_count
|
Optional[int]
|
(Optional) The maximum number of times to replay the snapshot (1, if not specified). |
None
|
min_duration
|
Optional[float]
|
(Optional) The minimum duration (in seconds) to replay the snapshot. |
None
|
clip_rect
|
Optional[Rect]
|
(Optional) The clip rectangle to apply when replaying the snapshot. |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[PaintProfile]]
|
The array of paint profiles, one per run. |
Source code in zendriver/cdp/layer_tree.py
release_snapshot(snapshot_id)
Releases layer snapshot captured by the back-end.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
snapshot_id
|
SnapshotId
|
The id of the layer snapshot. |
required |
Source code in zendriver/cdp/layer_tree.py
replay_snapshot(snapshot_id, from_step=None, to_step=None, scale=None)
Replays the layer snapshot and returns the resulting bitmap.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
snapshot_id
|
SnapshotId
|
The id of the layer snapshot. |
required |
from_step
|
Optional[int]
|
(Optional) The first step to replay from (replay from the very start if not specified). |
None
|
to_step
|
Optional[int]
|
(Optional) The last step to replay to (replay till the end if not specified). |
None
|
scale
|
Optional[float]
|
(Optional) The scale to apply while replaying (defaults to 1). |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, str]
|
A data: URL for resulting image. |
Source code in zendriver/cdp/layer_tree.py
snapshot_command_log(snapshot_id)
Replays the layer snapshot and returns canvas log.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
snapshot_id
|
SnapshotId
|
The id of the layer snapshot. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[dict]]
|
The array of canvas function calls. |