Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 69c6a0c0233b97fe8025cb675921ece2272c070e
      
https://github.com/WebKit/WebKit/commit/69c6a0c0233b97fe8025cb675921ece2272c070e
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-01-27 (Tue, 27 Jan 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-position/position-absolute-replaced-minmax-expected.txt
    M Source/WebCore/rendering/RenderReplaced.cpp

  Log Message:
  -----------
  Fix intrinsic sizing for absolutely positioned replaced elements with both 
insets specified
https://bugs.webkit.org/show_bug.cgi?id=306171
rdar://168815514

Reviewed by Alan Baradlay.

When an absolutely positioned replaced element has an aspect ratio but no
intrinsic size, and both inline-axis insets (left/right in horizontal
writing mode) are specified, the element's size should be determined by
the available space between the insets, not by intrinsic sizing keywords
like fit-content, min-content, or max-content.

Per CSS Positioned Layout Level 3 §3.8.2 [1] and CSS 2.2 §10.3.8 [2],
intrinsic sizing keywords on min-width and max-width should be treated
as their initial values when an absolutely positioned replaced element
with aspect ratio but no intrinsic size has both inline-axis insets
specified.

This particularly affects SVG images with only a viewBox attribute (no
width/height) when used as absolutely positioned <img> elements with both
left and right specified, along with max-width: fit-content.

[1] https://www.w3.org/TR/css-position-3/#abs-replaced-width
[2] https://www.w3.org/TR/CSS22/visudet.html#abs-replaced-width

* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeConstrainedLogicalWidth): For absolutely
positioned elements with both left and right specified, compute the
constrained width by subtracting the offset values from the container
width, rather than using the full container width.
(WebCore::RenderReplaced::computeReplacedLogicalWidth): When computing
width for absolutely positioned replaced elements with aspect ratio but
no intrinsic size, where both inline insets are specified, treat
intrinsic sizing keywords in min-width/max-width as their initial values
to avoid incorrect clamping based on non-existent intrinsic dimensions.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-position/position-absolute-replaced-minmax-expected.txt:
 Progressions

Canonical link: https://commits.webkit.org/306309@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to