-
Notifications
You must be signed in to change notification settings - Fork 3k
Run snapshot post-layout state steps in resizeObserver loop #11613
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
Open
lilles
wants to merge
1
commit into
whatwg:main
Choose a base branch
from
lilles:rune/run-post-layout-snapshot
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think this is fine, but it might be worth at least acknowledging the trade-offs we're making by making it run on every iteration. Also I wonder if we should update content-visibility before or after this...
E.g., what about:
continue
.Might be a bit easier to reason about?
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.
Actually, I just ignored the content-visibility part. Would it make sense to also move the viewport proximity to the content-visibility spec and say that it's done when asked to "Run snapshot post-layout state steps"?
Is the
continue
part for content-visibility guaranteed to terminate, though? I'm pretty sure it would not be for snapshotting scroll-animations.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.
Yes, it is, afaict, since you eventually run out of elements that need the initial determination done.
Hmm, it'd be a bit weird that how much a scroll animation advances would depend on whether there are any resize observers or so, I think that means we probably want to do this step only once (maybe at the end so it can react to Resize observers, like the focus fix up?).
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.
If it's done at the end, it would mean resize observers will not see scroll-animations, scroll-state queries, and anchor-positioning taken into account. I don't know what's worst. Doing it once at the start is another option.
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.
Yeah, indeed. Maybe just do it once on the first iteration of the loop? Any change by a resize observer would be for next frame, which seems fair?
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.
So, basically:
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 think that's fine. Do we want to merge with the initial c-v determination or so, or move that into the snapshot-post-layout state steps? That does run on every step of the loop r/n...
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.
Adding @vmpstr to get the input on whether it's intentional/important that the c-v determination runs for every iteration of resize observers.
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.
Yes, I had imagined that this should run once after at least the first round of resize observers so that animations could use the size set by the resizeobserver in the initially rendered frame.
This is really tricky, however I think for the use cases we have now, running after makes more sense.
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.
If running after resizeObservers needs to be done, we can:
a. run it right after broadcasting resize observations, if it hasn't been run before.
b. run it once when we no longer have active resize observations, and continue if necessary.