Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4b16b8ba98e8991bd6c78c45659ef72cc9fe60e0
      
https://github.com/WebKit/WebKit/commit/4b16b8ba98e8991bd6c78c45659ef72cc9fe60e0
  Author: Alan Baradlay <[email protected]>
  Date:   2026-05-01 (Fri, 01 May 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-content-box-padding-001-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-content-box-padding-001-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-content-box-padding-001.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-intrinsic-padding-001-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-intrinsic-padding-001-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-intrinsic-padding-001.html
    M Source/WebCore/rendering/RenderFlexibleBox.cpp

  Log Message:
  -----------
  Flex item with aspect-ratio and content-box padding computes wrong height in 
column flex
https://bugs.webkit.org/show_bug.cgi?id=313739

Reviewed by Sammy Gill.

A flex item with aspect-ratio: 1, width: 200px, and padding: 100px in a column
flex container should be 400x400 (200px content + 100px padding on each side).
Instead it was 400x200 - the height matched the CSS width value, ignoring
padding entirely.

The bug was in computeMainSizeFromAspectRatioUsing. The cross size inputs come
from different paths (Fixed, Percentage, Auto, Stretch) but they do not all use
the same box model. Percentage, Auto, and Stretch all return border-box values,
but Fixed returns the raw CSS value - which is content-box when box-sizing is
content-box. The code after the switchOn unconditionally subtracted cross-axis
border + padding (correct for border-box inputs, double-subtraction for 
content-box
Fixed inputs).

The fix normalizes the Fixed path to also return border-box.
Now all paths consistently return border-box, and the subtraction is correct 
for all of them.

The intrinsic ratio branch (for elements like <img> with a natural aspect ratio)
had the same inconsistency but in the opposite direction: it only subtracted for
border-box box-sizing, which was correct for the old Fixed path but wrong for 
the
Auto/Stretch paths that always returned border-box.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-content-box-padding-001-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-content-box-padding-001-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-content-box-padding-001.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-intrinsic-padding-001-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-intrinsic-padding-001-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-intrinsic-padding-001.html:
 Added.
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeMainSizeFromAspectRatioUsing const):

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



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

Reply via email to