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

khushalsagar has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-view-transitions-2] Clip captured snapshots to viewport for elements ==
Currently when an element is snapshotted for a ViewTransition its captured in its entirety (modulo implementation constraints), see  [here](https://drafts.csswg.org/css-view-transitions-1/#capture-the-image-algorithm:~:text=Render%20element%20and%20its%20descendants%2C%20at%20the%20same%20size%20it%20appears%20in%20its%20node%20document%2C%20over%20an%20infinite%20transparent%20canvas%2C%20following%20the%20capture%20rendering%20characteristics.).

But for the root the snapshot is clipped to viewport, see [here](https://drafts.csswg.org/css-view-transitions-1/#capture-the-image-algorithm:~:text=Render%20the%20region%20of%20document%20(including%20its%20canvas%20background%20and%20any%20top%20layer%20content)%20that%20intersects%20the%20snapshot%20containing%20block).

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 https://github.com/w3c/csswg-drafts/issues/8282 but I'm filing it separately so the use-case is not lost. Since https://github.com/w3c/csswg-drafts/issues/8282 could be limited to which elements participate in a transition while this is about how much content of an element is painted. 

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9481 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 17 October 2023 15:09:01 UTC