跳到主要内容

LayerTree🧪

✅️️ Methods

🔨LayerTree.compositingReasons

提供给定图层被合成的原因。

EN
Provides the reasons why the given layer was composited.
参数必填标记类型描述原文
layerId✔️LayerId我们想要获取其合成原因的图层的ID。
ENThe id of the layer for which we want to get the reasons it was composited.
返回对象类型描述原文
compositingReasonsarray[string]指定给定图层成为合成图层的原因的字符串列表。
ENA list of strings specifying reasons for the given layer to become composited.
compositingReasonIdsarray[string]指定给定图层成为合成层的原因ID的字符串列表。
ENA list of strings specifying reason IDs for the given layer to become composited.

🔨LayerTree.disable

禁用合成树检查。

EN
Disables compositing tree inspection.

🔨LayerTree.enable

启用合成树检查。

EN
Enables compositing tree inspection.

🔨LayerTree.loadSnapshot

返回快照标识符。

EN
Returns the snapshot identifier.
参数必填标记类型描述原文
tiles✔️array[PictureTile]组成快照的图块数组。
ENAn array of tiles composing the snapshot.
返回对象类型描述原文
snapshotIdSnapshotId快照的id。
ENThe id of the snapshot.

🔨LayerTree.makeSnapshot

返回图层快照标识符。

EN
Returns the layer snapshot identifier.
参数必填标记类型描述原文
layerId✔️LayerId图层的id。
ENThe id of the layer.
返回对象类型描述原文
snapshotIdSnapshotId图层快照的id。
ENThe id of the layer snapshot.

🔨LayerTree.profileSnapshot

参数必填标记类型描述原文
snapshotId✔️SnapshotId图层快照的id。
ENThe id of the layer snapshot.
minRepeatCountinteger重放快照的最大次数(如果未指定,则为1)。
ENThe maximum number of times to replay the snapshot (1, if not specified).
minDurationnumber回放快照的最小持续时间(以秒为单位)。
ENThe minimum duration (in seconds) to replay the snapshot.
clipRectDOM.Rect在重放快照时应用的裁剪矩形。
ENThe clip rectangle to apply when replaying the snapshot.
返回对象类型描述原文
timingsarray[PaintProfile]每次运行对应的绘制配置文件数组,每个运行一个。
ENThe array of paint profiles, one per run.

🔨LayerTree.releaseSnapshot

后端捕获的''Releases''层快照。

EN
Releases layer snapshot captured by the back-end.
参数必填标记类型描述原文
snapshotId✔️SnapshotId图层快照的id。
ENThe id of the layer snapshot.

🔨LayerTree.replaySnapshot

重放图层快照并返回生成的位图。

EN
Replays the layer snapshot and returns the resulting bitmap.
参数必填标记类型描述原文
snapshotId✔️SnapshotId图层快照的id。
ENThe id of the layer snapshot.
fromStepinteger从(如果未指定,则从最开始)开始重放的第一步。
ENThe first step to replay from (replay from the very start if not specified).
toStepinteger要重放到的最后一步(如果未指定,则重放至结束)。
ENThe last step to replay to (replay till the end if not specified).
scalenumber在回放过程中应用的缩放比例(默认为1)。
ENThe scale to apply while replaying (defaults to 1).
返回对象类型描述原文
dataURLstring一个用于结果图像的 data: URL。
ENA data: URL for resulting image.

🔨LayerTree.snapshotCommandLog

重放图层快照并返回画布日志。

EN
Replays the layer snapshot and returns canvas log.
参数必填标记类型描述原文
snapshotId✔️SnapshotId图层快照的id。
ENThe id of the layer snapshot.
返回对象类型描述原文
commandLogarray[object]画布函数调用的数组。
ENThe array of canvas function calls.

✅️️ Events

👋LayerTree.layerPainted

参数必填标记类型描述原文
layerId✔️LayerId已绘制图层的id。
ENThe id of the painted layer.
clip✔️DOM.Rect裁剪矩形。
ENClip rectangle.

👋LayerTree.layerTreeDidChange

参数必填标记类型描述原文
layersarray[Layer]图层树,如果不在合成模式下则不存在。
ENLayer tree, absent if not in the compositing mode.

✅️️ Types

📌LayerTree.Layer

关于合成层的信息。

EN
Information about a compositing layer.

返回类型:object

属性必填标记类型描述原文
layerId✔️LayerId此图层的唯一标识符。
ENThe unique id for this layer.
parentLayerIdLayerId父级ID(根节点不存在)。
ENThe id of parent (not present for root).
backendNodeIdDOM.BackendNodeId与此图层关联的节点的后端标识符。
ENThe backend id for the node associated with this layer.
offsetX✔️number相对于父图层的偏移量,X坐标。
ENOffset from parent layer, X coordinate.
offsetY✔️number从父层偏移,Y坐标。
ENOffset from parent layer, Y coordinate.
width✔️number图层宽度。
ENLayer width.
height✔️number图层高度。
ENLayer height.
transformarray[number]图层变换矩阵,默认为单位矩阵
ENTransformation matrix for layer, default is identity matrix
anchorXnumber变换锚点X,若未指定变换则不存在
ENTransform anchor point X, absent if no transform specified
anchorYnumber变换锚点Y,如果未指定变换则不存在
ENTransform anchor point Y, absent if no transform specified
anchorZnumber变换锚点Z,如果未指定变换则不存在
ENTransform anchor point Z, absent if no transform specified
paintCount✔️integer表示该图层已绘制的次数。
ENIndicates how many time this layer has painted.
drawsContent✔️boolean指示该图层是否承载任何内容,而非仅用于变换/滚动目的。
ENIndicates whether this layer hosts any content, rather than being used for transform/scrolling purposes only.
invisibleboolean设置图层是否不可见。
ENSet if layer is not visible.
scrollRectsarray[ScrollRect]仅在主线程上滚动的矩形。
ENRectangles scrolling on main thread only.
stickyPositionConstraintStickyPositionConstraint粘性位置约束信息
ENSticky position constraint information

📌LayerTree.LayerId

唯一的图层标识符。

EN
Unique Layer identifier.

返回类型:string


📌LayerTree.PaintProfile

时间点数组,每个绘制步骤一个。

EN
Array of timings, one per paint step.

返回类型:array


📌LayerTree.PictureTile

图层图片的序列化片段及其在图层内的偏移量。

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

返回类型:object

属性必填标记类型描述原文
x✔️number从所属层左边界偏移
ENOffset from owning layer left boundary
y✔️number从所属图层顶部边界的偏移量
ENOffset from owning layer top boundary
picture✔️stringBase64编码的快照数据。(通过JSON传递时编码为base64字符串)
ENBase64-encoded snapshot data. (Encoded as a base64 string when passed over JSON)

📌LayerTree.ScrollRect

主线程上发生滚动的矩形区域。

EN
Rectangle where scrolling happens on the main thread.

返回类型:object

属性必填标记类型描述原文
rect✔️DOM.Rect矩形本身。
ENRectangle itself.
type✔️string矩形强制在主线程滚动的原因
允许的值:RepaintsOnScrollTouchEventHandlerWheelEventHandler
ENReason for rectangle to force scrolling on the main thread
Allowed Values: RepaintsOnScroll, TouchEventHandler, WheelEventHandler

📌LayerTree.SnapshotId

唯一的快照标识符。

EN
Unique snapshot identifier.

返回类型:string


📌LayerTree.StickyPositionConstraint

粘性定位约束。

EN
Sticky position constraints.

返回类型:object

属性必填标记类型描述原文
stickyBoxRect✔️DOM.Rect粘性元素在发生偏移前的布局矩形
ENLayout rectangle of the sticky element before being shifted
containingBlockRect✔️DOM.Rect粘性元素包含块的布局矩形
ENLayout rectangle of the containing block of the sticky element
nearestLayerShiftingStickyBoxLayerId最近的粘性层,该层会移动粘性框
ENThe nearest sticky layer that shifts the sticky box
nearestLayerShiftingContainingBlockLayerId''和``里面的内容保持不变,翻译如下:
最近导致包含块偏移的粘性层
ENThe nearest sticky layer that shifts the containing block