Repository navigation
Implement srcset 'h' descriptor and two-dimensional sizes - #63737
Merged
Merged
Conversation
chromium-wpt-export-bot
marked this pull request as ready for review
October 16, 2026 01:54
Implements the parsing parts of whatwg/html#13053 behind the `SrcsetTwoDimensionalSizes` runtime flag: - Represent a resolved source size as a `TargetBoxSize` (`width`, optional `height`, and `object_fit`), and thread it through `SizesAttributeParser`, `HTMLImageElement::SourceSize()`, the preload scanner and `BestFitSource*`. One-dimensional sizes populate only `width`, so this is a no-op refactor for existing behavior. - Parse the `<positive-integer>h` height descriptor in `srcset` when paired with a `w` descriptor, and compute each candidate's source concrete width from the `TargetBoxSize` and the candidate's aspect ratio when fitting with `contain` or `cover`. - Parse the explicit `[contain | cover] <length> <length>` source size syntax in `sizes`. Making `sizes="auto"` two-dimensional (using the box height and computed `object-fit`), and using the `width`/`height` attributes as a default aspect ratio for candidates without an `h` descriptor, are implemented in follow-up CLs. Bug: 572724710 Change-Id: I17fd93318d0955fbb3d6ce8aed7d085174671ddd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8559899 Reviewed-by: Stefan Zager <szager@chromium.org> Commit-Queue: Noam Rosenthal <nrosenthal@google.com> Cr-Commit-Position: refs/heads/main@{#1720204}
chromium-wpt-export-bot
force-pushed
the
chromium-export-cl-8559899
branch
from
October 16, 2026 01:54
799db27 to
36aae1d
Compare
wpt-pr-bot
approved these changes
Oct 16, 2026
wpt-pr-bot
left a comment
Collaborator
There was a problem hiding this comment.
The review process for this patch is being conducted in the Chromium project.
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.
Implements the parsing parts of
whatwg/html#13053 behind the
SrcsetTwoDimensionalSizesruntime flag:TargetBoxSize(width,optional
height, andobject_fit), and thread it throughSizesAttributeParser,HTMLImageElement::SourceSize(), the preloadscanner and
BestFitSource*.One-dimensional sizes populate only
width, so this is a no-oprefactor for existing behavior.
\<positive-integer>hheight descriptor insrcsetwhenpaired with a
wdescriptor, and compute each candidate's sourceconcrete width from the
TargetBoxSizeand the candidate's aspectratio when fitting with
containorcover.[contain | cover] \<length> \<length>source sizesyntax in
sizes.Making
sizes="auto"two-dimensional (using the box height and computedobject-fit), and using thewidth/heightattributes as a defaultaspect ratio for candidates without an
hdescriptor, are implementedin follow-up CLs.
Bug: 572724710
Change-Id: I17fd93318d0955fbb3d6ce8aed7d085174671ddd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8559899
Reviewed-by: Stefan Zager <szager@chromium.org>
Commit-Queue: Noam Rosenthal <nrosenthal@google.com>
Cr-Commit-Position: refs/heads/main@{#1720204}