Repository navigation
Ensure that img dimensions are derived synchronously - #13057
Open
TimvdLippe wants to merge 6 commits into
Open
TimvdLippe wants to merge 6 commits into
TimvdLippe wants to merge 6 commits into
Conversation
Browsers immediately resolve dimensions for an `<img>` that is a child of a `<picture>` with a preceding `<source>` sibling. This means that adding a `<source>` and then computing the style of the `<img>` should use the dimensions of the `<source>`. However, the spec didn't account for this, as it first schedules a task. That way, only after the task would be resolved, the dimensions would be computed. Instead, the sourceset should synchronously be updated. In the task the sourceset selects an image source, which again updates the sourceset. But moving the "select a source set" before the task could mean that an "error" event would be fired to soon. As such, only updating the sourceset but leaving the rest as-is ensures the relevant new tests pass and no regressions are introduced.
Member
|
Thanks for the PR! AI reviewReviewed at dca1812. Blockers
Suggestions
Nits
("when obtaining images on demand" is basically images disabled, but the user can choose to load specific images from the context menu or similar.) |
Contributor
Author
|
Confirmed with servo/servo#48902 that indeed those fixes makes all tests in |
aniebietafia
pushed a commit
to aniebietafia/servo
that referenced
this pull request
Oct 14, 2026
…ved (servo#48902) Based on reviewer feedback in whatwg/html#13057 Testing: new WPT passes Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
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.
Browsers immediately resolve dimensions for an
<img>that is a childof a
<picture>with a preceding<source>sibling. This means that adding a<source>and then computing the style of the<img>should use the dimensions of the<source>.However, the spec didn't account for this, as it first schedules a task.
That way, only after the task would be resolved, the dimensions would
be computed.
Instead, the source set should synchronously be updated. In the task, the source set selects an image source, which again updates the
source set. But moving the "select a source set" before the task could
mean that an "error" event would be fired too soon.
As such, only updating the source set but leaving the rest as-is ensures
the relevant new tests pass and no regressions are introduced.
Fixes #8207
(See WHATWG Working Mode: Changes for more details.)
/images.html ( diff )