Re: [csswg-drafts] [css-view-transitions-2] Elements with content-visibility in new Document (#10773)

A few notes from internal sync:
- This is not only a cross-document issue. Also when elements are added during the update callback of a same-document transition, they would need their initial content-visibility determination before capturing the new state.
- In chromium there is a "forced lifecycle" step before capturing the new state that does this.
- Other things in the rendering lifecycle can affect the new state capture, e.g. the right elements might not be there at all before  determining the size via a `ResizeObserver`.

I see two options on how to resolve this:

## 1. "Forced" style and layout + content visibility determination before capturing the new state

This would not be a cross-document specific thing, but rather a view-transition "capture the new state" thing - right before capturing the new state, we would calculate the style, run the layout, and also make the initial determination of content visibility.

## 2. Async capturing of new state, during the style/layout loop

Instead of capturing the new state synchronously as a result of resolving the update callback (same-document) or revealing a new page (cross-document), we would queue that, and run it at the style/layout/`ResizeObserver` loop's first iteration, after determining the initial content-visibility state. Note that that capture also resolves the `ready` promise of the `ViewTransition`.

Though (2) feels perhaps more correct, it would also be a breaking change, as it would inverse the order when it comes to `requestAnimationFrame`, which would now be called mid-transition, before the `ready` promise of the `ViewTransition` object.

@emilio @vmpstr @nt1m thoughts?


-- 
GitHub Notification of comment by noamr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10773#issuecomment-2669107798 using your GitHub account


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

Received on Wednesday, 19 February 2025 16:11:13 UTC