Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0eee829a5be268a7a2c76f4fae8f167efbe9c7d0
      
https://github.com/WebKit/WebKit/commit/0eee829a5be268a7a2c76f4fae8f167efbe9c7d0
  Author: Alan Baradlay <[email protected]>
  Date:   2026-04-20 (Mon, 20 Apr 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-basis-content-percentage-height-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-basis-content-percentage-height.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-minimum-height-flex-items-025-expected.txt
    M Source/WebCore/rendering/RenderBlock.cpp
    M Source/WebCore/rendering/RenderFlexibleBox.cpp

  Log Message:
  -----------
  [css-flexbox] Definiteness evaluation should use used flex-basis instead of 
specified
https://bugs.webkit.org/show_bug.cgi?id=233196
<rdar://problem/85707621>

Reviewed by Sergio Villar Senin.

This patch fixes two related issues with how percentage heights resolve
inside flex items when flex-basis overrides the CSS height.

Issue 1: flex-basis: content should make CSS height indefinite

  <div style="display: flex; flex-direction: column;">
    <div style="flex: 1 1 content; height: 100px; min-height: 0">
      <div style="height: 100%"></div>
    </div>
  </div>

The inner div should be 0px tall. The flex item has height: 100px
but flex-basis: content, which tells the flex algorithm "size me
from my content, not my CSS height." The child's height: 100% has
nothing definite to resolve against because the flex item's actual
height will be content-dependent.

Instead the child was 100px -- it resolved against the CSS height
even though the flex algorithm won't use it.

availableLogicalHeightForPercentageComputation saw height: 100px
(a fixed value) and used it for percentage resolution without
checking whether flex-basis overrides it. When flex-basis is
anything other than 'auto', the flex algorithm ignores the CSS
height and uses the flex-basis value instead. The specified height
should not be treated as definite for percentage children in this
case.

The fix adds a flexBasisOverridesHeight check that skips the fixed
height when the item has a non-auto flex-basis and the logical
height aligns with the flex main axis.

Issue 2: definite flex-basis should make post-flexing size available

  <div style="display: flex; flex-direction: column; width: 100px">
    <div style="flex-basis: 100px; height: 200px;">
      <div style="height: 100%"></div>
    </div>
  </div>

The inner div should be 100px tall (the flex item's post-flexing
main size from flex-basis). After the fix for issue 1, the CSS
height (200px) is correctly blocked. But the child got 0px instead
of 100px because the flex item's overriding height was not made
available for percentage resolution.

The overriding height goes through canUseFlexItemForPercentageResolution
which calls canUseByStyle. For column flex (main axis = block axis),
canUseByStyle required the item to be fully inflexible (flex-grow=0
AND flex-shrink=0) with a definite flex-basis. The item has default
flex-shrink=1, so it was rejected. The container has auto height,
so the fallback (canComputePercentageFlexBasis) also failed.

But flexbox spec 9.8 rule 2 says: "If a flex item's flex basis is
definite, then its post-flexing main size is also definite." No
restriction on flexibility. The fix removes the inflexible
requirement -- definite flex-basis alone is sufficient.

Tests: fast/flexbox/flex-basis-content-percentage-height.html
       
imported/w3c/web-platform-tests/css/css-flexbox/flex-minimum-height-flex-items-025.html

* LayoutTests/TestExpectations:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-basis-content-percentage-height-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-basis-content-percentage-height.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-minimum-height-flex-items-025-expected.txt:
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::availableLogicalHeightForPercentageComputation const):
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::canUseFlexItemForPercentageResolution):

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Canonical link: https://commits.webkit.org/311579@main



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

Reply via email to