- From: Khushal Sagar via GitHub <sysbot+gh@w3.org>
- Date: Mon, 08 May 2023 22:35:36 +0000
- To: public-css-archive@w3.org
> IMO the callback should be called synchronouosly That's not feasible because we can execute this step very late in the [update the rendering](https://html.spec.whatwg.org/#update-the-rendering) steps. Specifically, [step 8.7.5](https://drafts.csswg.org/css-view-transitions-1/#handle-transition-frame:~:text=Return.-,If%20transition%E2%80%99s%20initial%20snapshot%20root%20size%20is%20not%20equal%20to%20the%20snapshot%20root%20size%2C%20then%20skip%20the%20view%20transition%20for%20transition%2C%20and%20return.,-Update%20pseudo%2Delement) : ``` If transition’s initial snapshot root size is not equal to the snapshot root size, then skip the view transition for transition, and return. ``` The "Handle transition frame" algorithm is triggered [here](https://drafts.csswg.org/css-view-transitions-1/#ref-for-perform-pending-transition-operations%E2%91%A0:~:text=For%20each%20fully%20active%20Document%20in%20docs%2C%20perform%20pending%20transition%20operations%20for%20that%20Document.), right before step 16. The goal behind running it this late is that its supposed to reflect DOM changes into the corresponding pseudo-elements. So we want to run it at a point when script is guaranteed to not modify the DOM. But that also means we're at a point where running script is bad. It won't be logically incorrect for this feature but adding a hook where script can run implies the DOM can be dirtied and we'll need to re-run style/layout again. We can make the async approach by doing the following: - In step 8.4.1 assert that phase is either before `update-callback-called`, which means this is running in the regular transition flow. Or assert that its `done`, which means this is happening because the transition was skipped before the callback was invoked. - Make step 8.4.5 conditional to only update the phase if it was before `update-callback-called`. - Add step 8.4.7 to invoke the `finished` promise if the phase is `done`. This means we delay dispatching the `finished` promise until the update callback is done if we're skipping the transition. - Step 8.5.4 will post a task to call the update function. - In step 8.5.9, don't resolve the finished promise if this task was posted. I'll try to dig up the exact issue but IIRC we resolved on the fact that `ready` promise should reject immediately if you skip before `call the update callback` but `finished` should mirror the result of that callback. -- GitHub Notification of comment by khushalsagar Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7904#issuecomment-1539151397 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 8 May 2023 22:35:38 UTC