Skip to content

[css-view-transitions-2] Clip captured snapshots to viewport for elements #9481

@khushalsagar

Description

@khushalsagar

Currently when an element is snapshotted for a ViewTransition its captured in its entirety (modulo implementation constraints), see here.

But for the root the snapshot is clipped to viewport, see here.

The reason for this divergence is:

  • The root is likely to be large in a lot of cases and rendering it completely is wasteful of memory/compute.
  • A partially onscreen element may be brought more onscreen during the transition animations so all its content is conservatively painted.

Its unclear if the tradeoff above makes sense in all cases, maybe the author should decide this based on the transition animations they will be creating? @jakearchibald has brought up cases where the root is slightly scrolled during the transition (from a header which animates away) and needs a small margin of offscreen content to be painted.

This intersects with #8282 but I'm filing it separately so the use-case is not lost. Since #8282 could be limited to which elements participate in a transition while this is about how much content of an element is painted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions