LayerTree

Experimental

Dependencies: DOM

Commands

LayerTree.compositingReasons

Provides the reasons why the given layer was composited.

Parameters
Name Type Description
layerId LayerId The id of the layer for which we want to get the reasons it was composited.
Return Object
Name Type Description
compositingReasons array<string> A list of strings specifying reasons for the given layer to become composited.
compositingReasonIds array<string> A list of strings specifying reason IDs for the given layer to become composited.

LayerTree.disable

Disables compositing tree inspection.

LayerTree.enable

Enables compositing tree inspection.

LayerTree.loadSnapshot

Returns the snapshot identifier.

Parameters
Name Type Description
tiles array<PictureTile> An array of tiles composing the snapshot.
Return Object
Name Type Description
snapshotId SnapshotId The id of the snapshot.

LayerTree.makeSnapshot

Returns the layer snapshot identifier.

Parameters
Name Type Description
layerId LayerId The id of the layer.
Return Object
Name Type Description
snapshotId SnapshotId The id of the layer snapshot.

LayerTree.profileSnapshot

Parameters
Name Type Description
snapshotId SnapshotId The id of the layer snapshot.
minRepeatCount (optional) integer The maximum number of times to replay the snapshot (1, if not specified).
minDuration (optional) number The minimum duration (in seconds) to replay the snapshot.
clipRect (optional) DOM.Rect The clip rectangle to apply when replaying the snapshot.
Return Object
Name Type Description
timings array<PaintProfile> The array of paint profiles, one per run.

LayerTree.releaseSnapshot

Releases layer snapshot captured by the back-end.

Parameters
Name Type Description
snapshotId SnapshotId The id of the layer snapshot.

LayerTree.replaySnapshot

Replays the layer snapshot and returns the resulting bitmap.

Parameters
Name Type Description
snapshotId SnapshotId The id of the layer snapshot.
fromStep (optional) integer The first step to replay from (replay from the very start if not specified).
toStep (optional) integer The last step to replay to (replay till the end if not specified).
scale (optional) number The scale to apply while replaying (defaults to 1).
Return Object
Name Type Description
dataURL string A data: URL for resulting image.

LayerTree.snapshotCommandLog

Replays the layer snapshot and returns canvas log.

Parameters
Name Type Description
snapshotId SnapshotId The id of the layer snapshot.
Return Object
Name Type Description
commandLog array<object> The array of canvas function calls.

Events

LayerTree.layerPainted

Parameters
Name Type Description
layerId LayerId The id of the painted layer.
clip DOM.Rect Clip rectangle.

LayerTree.layerTreeDidChange

Parameters
Name Type Description
layers (optional) array<Layer> Layer tree, absent if not in the compositing mode.

Types

LayerId

(string)

Unique Layer identifier.

SnapshotId

(string)

Unique snapshot identifier.

ScrollRect

(object)

Rectangle where scrolling happens on the main thread.

Properties
Name Type Description
rect DOM.Rect Rectangle itself.
type string Reason for rectangle to force scrolling on the main thread

StickyPositionConstraint

(object)

Sticky position constraints.

Properties
Name Type Description
stickyBoxRect DOM.Rect Layout rectangle of the sticky element before being shifted
containingBlockRect DOM.Rect Layout rectangle of the containing block of the sticky element
nearestLayerShiftingStickyBox (optional) LayerId The nearest sticky layer that shifts the sticky box
nearestLayerShiftingContainingBlock (optional) LayerId The nearest sticky layer that shifts the containing block

PictureTile

(object)

Serialized fragment of layer picture along with its offset within the layer.

Properties
Name Type Description
x number Offset from owning layer left boundary
y number Offset from owning layer top boundary
picture binary Base64-encoded snapshot data.

Layer

(object)

Information about a compositing layer.

Properties
Name Type Description
layerId LayerId The unique id for this layer.
parentLayerId (optional) LayerId The id of parent (not present for root).
backendNodeId (optional) DOM.BackendNodeId The backend id for the node associated with this layer.
offsetX number Offset from parent layer, X coordinate.
offsetY number Offset from parent layer, Y coordinate.
width number Layer width.
height number Layer height.
transform (optional) array<number> Transformation matrix for layer, default is identity matrix
anchorX (optional) number Transform anchor point X, absent if no transform specified
anchorY (optional) number Transform anchor point Y, absent if no transform specified
anchorZ (optional) number Transform anchor point Z, absent if no transform specified
paintCount integer Indicates how many time this layer has painted.
drawsContent boolean Indicates whether this layer hosts any content, rather than being used for
transform/scrolling purposes only.
invisible (optional) boolean Set if layer is not visible.
scrollRects (optional) array<ScrollRect> Rectangles scrolling on main thread only.
stickyPositionConstraint (optional) StickyPositionConstraint Sticky position constraint information

PaintProfile

(array)

Array of timings, one per paint step.

Summary