Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intersection observer and mark paint timing steps should run after (or during) "update the rendering", not before. #8277

Closed
emilio opened this issue Sep 9, 2022 · 1 comment · Fixed by #8348
Labels
interop Implementations are not interoperable with each other topic: rendering

Comments

@emilio
Copy link
Contributor

emilio commented Sep 9, 2022

https://html.spec.whatwg.org/#update-the-rendering says that step 14 is:

For each fully active Document in docs, run the update intersection observations steps for that Document, passing in now as the timestamp

Same for mark paint timing.

And step 16 is:

For each fully active Document in docs, update the rendering or user interface of that Document and its browsing context to reflect the current state.

Which is presumably when layout and style updates happen, or at least that's where ResizeObserver expects them to happen: https://drafts.csswg.org/resize-observer/#html-event-loop

It seems to me like IntersectionObserver and mark paint timing should happen at least after updating layout and style, not before. That's what happens in Gecko and I'd be extremely surprised if it wasn't what happens in other browsers. ResizeObserver needs to be during, because it can run script and cause further layout and style changes.

cc @rniwa @Loirooriol

@emilio emilio added topic: rendering agenda+ To be discussed at a triage meeting labels Sep 9, 2022
@Loirooriol
Copy link
Contributor

Quick test:

new IntersectionObserver(() => console.log("IntersectionObserver")).observe(document.documentElement);
new ResizeObserver(() => console.log("ResizeObserver")).observe(document.documentElement);

Gecko and Blink: 1st ResizeObserver, 2nd IntersectionObserver
WebKit: 1st IntersectionObserver, 2nd ResizeObserver

@domenic domenic added the interop Implementations are not interoperable with each other label Sep 9, 2022
@past past removed the agenda+ To be discussed at a triage meeting label Sep 30, 2022
emilio added a commit to emilio/html that referenced this issue Oct 2, 2022
emilio added a commit to emilio/web-platform-tests that referenced this issue Oct 2, 2022
emilio added a commit to emilio/html that referenced this issue Oct 3, 2022
Fixes whatwg#8277. This matches Blink and Gecko.

Co-authored-by: Domenic Denicola <d@domenic.me>
emilio added a commit to emilio/html that referenced this issue Oct 3, 2022
Fixes whatwg#8277. This matches Blink and Gecko.

Co-authored-by: Domenic Denicola <d@domenic.me>
emilio added a commit to emilio/html that referenced this issue Oct 3, 2022
Fixes whatwg#8277. This matches Blink and Gecko.

Co-authored-by: Domenic Denicola <d@domenic.me>
domenic pushed a commit that referenced this issue Oct 4, 2022
This includes upstreaming the monkeypatch from the Resize Observer specification, which adds more detail to the "update the rendering" steps to include an explicit "Recalculate styles and update layout" step. This enables us to be clear that intersection observer integration and marking paint timing happens after that step.

Fixes #8277.
emilio added a commit to web-platform-tests/wpt that referenced this issue Oct 4, 2022
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Oct 21, 2022
…f ResizeObserver vs. IntersectionObserver notifications, a=testonly

Automatic update from web-platform-tests
[resize-observer] [html] Test ordering of ResizeObserver vs. IntersectionObserver notifications.

For whatwg/html#8277

--

wpt-commits: ea5b028ad08a086ab2dc50aca337623523b3e8bf
wpt-pr: 36216
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Oct 26, 2022
…f ResizeObserver vs. IntersectionObserver notifications, a=testonly

Automatic update from web-platform-tests
[resize-observer] [html] Test ordering of ResizeObserver vs. IntersectionObserver notifications.

For whatwg/html#8277

--

wpt-commits: ea5b028ad08a086ab2dc50aca337623523b3e8bf
wpt-pr: 36216
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interop Implementations are not interoperable with each other topic: rendering
Development

Successfully merging a pull request may close this issue.

4 participants