CDPotion.Domain.LayerTree (cdpotion v0.1.4)

Summary

Types

Information about a compositing layer.

Unique Layer identifier.

Array of timings, one per paint step.

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

Rectangle where scrolling happens on the main thread.

Unique snapshot identifier.

Sticky position constraints.

Functions

Provides the reasons why the given layer was composited.

Disables compositing tree inspection.

Enables compositing tree inspection.

Returns the snapshot identifier.

Returns the layer snapshot identifier.

Parameters:

  • (Required) snapshot_id: The id of the layer snapshot.
  • (Optional) min_repeat_count: The maximum number of times to replay the snapshot (1, if not specified).
  • (Optional) min_duration: The minimum duration (in seconds) to replay the snapshot.
  • (Optional) clip_rect: The clip rectangle to apply when replaying the snapshot.

Releases layer snapshot captured by the back-end.

Replays the layer snapshot and returns the resulting bitmap.

Replays the layer snapshot and returns canvas log.

Types

@type layer() :: %{
  anchorX: number() | nil,
  anchorY: number() | nil,
  anchorZ: number() | nil,
  backendNodeId: CDPotion.Domain.DOM.backend_node_id() | nil,
  drawsContent: boolean(),
  height: number(),
  invisible: boolean() | nil,
  layerId: layer_id(),
  offsetX: number(),
  offsetY: number(),
  paintCount: integer(),
  parentLayerId: layer_id() | nil,
  scrollRects: [scroll_rect()] | nil,
  stickyPositionConstraint: sticky_position_constraint() | nil,
  transform: [number()] | nil,
  width: number()
}

Information about a compositing layer.

@type layer_id() :: String.t()

Unique Layer identifier.

Link to this type

paint_profile()

@type paint_profile() :: [number()]

Array of timings, one per paint step.

Link to this type

picture_tile()

@type picture_tile() :: %{picture: String.t(), x: number(), y: number()}

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

Link to this type

scroll_rect()

@type scroll_rect() :: %{
  rect: CDPotion.Domain.DOM.rect(),
  type: :RepaintsOnScroll | :TouchEventHandler | :WheelEventHandler
}

Rectangle where scrolling happens on the main thread.

Link to this type

snapshot_id()

@type snapshot_id() :: String.t()

Unique snapshot identifier.

Link to this type

sticky_position_constraint()

@type sticky_position_constraint() :: %{
  containingBlockRect: CDPotion.Domain.DOM.rect(),
  nearestLayerShiftingContainingBlock: layer_id() | nil,
  nearestLayerShiftingStickyBox: layer_id() | nil,
  stickyBoxRect: CDPotion.Domain.DOM.rect()
}

Sticky position constraints.

Functions

Link to this function

compositing_reasons(layer_id)

@spec compositing_reasons(layer_id()) :: {String.t(), map()}

Provides the reasons why the given layer was composited.

Parameters:

  • (Required) layer_id: The id of the layer for which we want to get the reasons it was composited.
@spec disable() :: {String.t(), map()}

Disables compositing tree inspection.

@spec enable() :: {String.t(), map()}

Enables compositing tree inspection.

Link to this function

load_snapshot(tiles)

@spec load_snapshot([picture_tile()]) :: {String.t(), map()}

Returns the snapshot identifier.

Parameters:

  • (Required) tiles: An array of tiles composing the snapshot.
Link to this function

make_snapshot(layer_id)

@spec make_snapshot(layer_id()) :: {String.t(), map()}

Returns the layer snapshot identifier.

Parameters:

  • (Required) layer_id: The id of the layer.
Link to this function

profile_snapshot(snapshot_id, min_repeat_count \\ nil, min_duration \\ nil, clip_rect \\ nil)

@spec profile_snapshot(
  snapshot_id(),
  integer(),
  number(),
  CDPotion.Domain.DOM.rect()
) :: {String.t(), map()}

Parameters:

  • (Required) snapshot_id: The id of the layer snapshot.
  • (Optional) min_repeat_count: The maximum number of times to replay the snapshot (1, if not specified).
  • (Optional) min_duration: The minimum duration (in seconds) to replay the snapshot.
  • (Optional) clip_rect: The clip rectangle to apply when replaying the snapshot.
Link to this function

release_snapshot(snapshot_id)

@spec release_snapshot(snapshot_id()) :: {String.t(), map()}

Releases layer snapshot captured by the back-end.

Parameters:

  • (Required) snapshot_id: The id of the layer snapshot.
Link to this function

replay_snapshot(snapshot_id, from_step \\ nil, to_step \\ nil, scale \\ nil)

@spec replay_snapshot(snapshot_id(), integer(), integer(), number()) ::
  {String.t(), map()}

Replays the layer snapshot and returns the resulting bitmap.

Parameters:

  • (Required) snapshot_id: The id of the layer snapshot.
  • (Optional) from_step: The first step to replay from (replay from the very start if not specified).
  • (Optional) to_step: The last step to replay to (replay till the end if not specified).
  • (Optional) scale: The scale to apply while replaying (defaults to 1).
Link to this function

snapshot_command_log(snapshot_id)

@spec snapshot_command_log(snapshot_id()) :: {String.t(), map()}

Replays the layer snapshot and returns canvas log.

Parameters:

  • (Required) snapshot_id: The id of the layer snapshot.