-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
intersect-resources: Always schedule pass after build #27657
intersect-resources: Always schedule pass after build #27657
Conversation
@choumx: is there any guarantee that the elt will be built and laid out by the time the next pass happens? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had one question (see above), but seeing as this code just removes an optimization, it should be pretty safe!
This PR makes it so there will be a pass after the element is built, at which point it'll be laid out. It might not be the very next pass -- depends on how long it takes to build. |
For the purposes of measuring, don't we care more about layout than build? |
Not sure if this answers your question, but layout must follow build in the element lifecycle. |
Sorry for the confusion, I'll try to ask my question more clearly. Is building the element expected to change its bounding box? Even if it does, do we care? Isn't it likely to change yet again when tldr: why are we measuring after build and after layoutCallback instead of only after layoutCallback? |
Oh, we only call I think I get what you're saying though -- there are some other somewhat subtle operation ordering here. "Build" should not affect measurements, but they're ordered as such (phases) to avoid layout thrashes. I.e. mutate all resources (build), then measure all resources, then mutate again (layout), etc. IntersectionObserver changes this flow slightly, since it effectively "measures" before elements are built. So elements that "illegally" change their size during |
* Always schedule pass after build. * Revert viewport-binding-natural debug code. * Fix test-resources.js.
Related to #25428.
Minor bug fix: we always need to schedule a pass after building a resource because it won't be laid out in the same pass (
Resource.build
is async). Surveyed the remaining "skip pass in intersection mode" cases and they look good.Also realized we're no longer using
scheduleWhenBuilt
parameter at all, so removed it. For some context on "why do we even have that button", the I think the last usage was removed in #12311.