script: Fully initialize ResizeObserverEntry fields#40036
Merged
jdm merged 3 commits intoservo:mainfrom Oct 21, 2025
Merged
Conversation
simonwuelker
commented
Oct 20, 2025
Comment on lines
-291
to
-292
| /// Returning an optional calculated size, instead of a boolean, | ||
| /// to avoid recalculating the size in the subsequent broadcast. |
Contributor
Author
There was a problem hiding this comment.
I've removed this optimization. Keeping it around would make the code a bit messy because when we initialize the ResizeObserverEntry fields then we have one of the three size values (depending on the observation type) and need to calculate the other two. Now that we have incremental layout, I think the cost of querying an element's area (without reflow) is very low.
Also note that we can't get around querying layout when populating the ResizeObserverEntry either way.
I don't mind undoing this change if someone objects.
Signed-off-by: Simon Wülker <[email protected]>
Signed-off-by: Simon Wülker <[email protected]>
b7a4e0e to
38e423b
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A
ResizeObserverEntrystores of three different lists of size values:border-box)content-box)device-pixel-content-box)Currently, servo only stores content box sizes and leaves the other two empty:
servo/components/script/dom/resizeobserver.rs
Lines 155 to 163 in 205b049
It's worth noting that the
device-pixel-content-boxobservation type is not supported yet, so the only size reported will be a zero-sized rectangle.servo/components/script/dom/resizeobserver.rs
Lines 328 to 329 in 205b049
Testing: New web platform tests start to pass
Fixes #38811
Part of #39790