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.
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
First pass at IntersectionObserver in Resources #26236
First pass at IntersectionObserver in Resources #26236
Changes from all commits
8a46ce0
d0c1840
1e8c67a
c5e5d1a
cfbb1f7
9cc7a92
e495dce
b0cfb46
1786728
8cedc2a
0e52356
5f6b846
17789b1
26d86dc
7143746
b80beca
27700f4
4d86b4f
bbb5736
90262ff
27ff69e
08eea13
6c9293b
a31aba5
fbb0c9a
29bccff
b16c8f1
5865324
9e7df17
b17098c
cd371ec
ca847a5
96ee39a
7dee29e
3f5e69c
95ef085
e938211
3e9f93c
0521289
dbee300
949e23e
5f3e9ae
9bfe421
9489416
7e4f4e5
0c52272
82990f8
1430cc3
98b7b29
f23479f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Is
ClientRect
a thing? I know ofDOMRect
returned by thegetBoundingClientRect()
...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.
It is! :) We already use it in a few places. The type of
boundingClientRect
is surprisingly just: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.
Is there a real cost for asking for BCR twice? Also, I'm not sure this will always work correctly. InOb is not the same thing as ResizeObserver. InOb would legitimately skip most of resize events if they do not change intersection. I think this issue comes up here because we've been using
measure()
,requestMeasure()
,mutateElement()
and the rest of our infra to do all three: resize, position, and in-viewport monitoring. Separating them at this point would be difficult.Alternative approach could be do something like this:
getLayoutBox()
API and instead use an asynchronous API of some kind to either provide measurements or intersection.measureCallback()
APIs and replace them with async versions, that are cleaner map to resize observer concept.inViewport()
callback and replace with async API better mapped to InOb.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.
Great points. Totally agree on the "stale layout box" issue due to resizing and that updating our APIs is important for dev ergonomics as we migrate.
I like it. E.g. we only need position for resource scheduling and size for mutation (changeSize). I wonder if we can do away with caching measurements in general, long-term -- "if you need position/size, just use vsync".
Added your suggestions to the tracking issue.
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'd definitely support doing way with caching. The only reason it truly existed is to avoid measurements during scroll.