Skip to content

Add WPTs for normative 2D image source selection - #64736

Merged
noamr merged 1 commit into
noamr/untent-sizes-2dfrom
noamr/select-image-source-2d
Nov 5, 2026
Merged

noamr merged 1 commit into
noamr/untent-sizes-2dfrom
noamr/select-image-source-2d

Conversation

@noamr

@noamr noamr commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Tests normative image candidate selection (select an image source from a source set) when normalizing densities using 2D <source-size-value>s (contain / cover), sizes="auto" with object-fit, h descriptors, and width/height dimension attributes (stacked on #64025 for whatwg/html#13053):

  • select-an-image-source-2d.html:
    • Multi-candidate selection (0.5x, 1x, 1.25x, 1.5x, 2x, unsorted candidate lists, and all < DPR fallback) with cover and contain 2D sizes and h descriptors across <img>, <picture><source>, and <link rel="preload" as="image" imagesrcset imagesizes>, using aspect-ratio-preserving Math.ceil/Math.floor scaling so assertions hold at fractional devicePixelRatio values.
    • Mixed aspect ratios in the same srcset where sorting by 2D-normalized density (w / concreteWidth) inverts the relative order of candidates compared to their w descriptor values.
    • Deduplication of candidates with different w descriptors (or w+h vs x descriptors) that normalize to equal 2D pixel density, including cover 0px 0px, contain 400px 0px, and contain 0px 400px (Infinity density, 0x0 density-corrected natural dimensions), contrasted with cover 0px 400px (non-zero scaled width).
    • Media conditions combined with 2D <source-size-value>s and 1D fallbacks.
    • Normative 2D selection with dimension attribute aspect ratio (width and height attributes on <img> and <source>, inheritance, override, mixed per-candidate h descriptor + fallback aspect ratio, dynamic removeAttribute('height') re-selection, and fallback to src when all h descriptors are invalid).
    • Normative cache & deduplication invariants for 2D densities (cached lower-density candidate never preferred over >= DPR; cached duplicate at equal 2D density removed by deduplication before cache check; cached mid-density candidate never causing selection of higher uncached candidate).
    • CSS 'zoom' interaction with 2D source selection (zoom on <img> and ancestor not scaling target devicePixelRatio for explicit 2D sizes, while zoom: 2, zoom: 0.5, and fractional zoom: 1.1 on <iframe> scale child devicePixelRatio for both <img> and <link rel="preload">).
    • Normative 2D selection with sizes="auto" (loading="lazy") and object-fit (cover, contain, scale-down, fill, none, and 100px x 0px contain -> Infinity density) on both <img> and <picture><source>.
  • select-an-image-source-2d-cached.optional.html:
    • Optional preference for already-loaded higher-2D-density candidates (<img>, <picture><source>, data: URLs, and <link rel="preload" imagesizes imagesrcset>-warmed candidates), keeping an already-loaded candidate when 2D sizes changes from cover to contain, and dynamic iframe zoom re-selection.
  • preload/link-header-preload-imagesrcset-2d.html (+ .headers):
    • Link: HTTP response headers with rel=preload; as=image, h descriptors in imagesrcset, and cover / contain / media-conditioned 2D imagesizes.

@noamr
noamr force-pushed the noamr/untent-sizes-2d branch from 08a4a52 to 61669a0 Compare November 5, 2026 16:03
@noamr
noamr merged commit 5ff457f into noamr/untent-sizes-2d Nov 5, 2026
31 checks passed
@noamr
noamr deleted the noamr/select-image-source-2d branch November 5, 2026 20:52
@noamr

noamr commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Folded into #64025, which now contains all of these commits (fast-forwarded to fe3ba1b). Please review there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants