Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8dff76797a9ff21c5ff72eac5f0727233dd13f69
      
https://github.com/WebKit/WebKit/commit/8dff76797a9ff21c5ff72eac5f0727233dd13f69
  Author: Alan Baradlay <[email protected]>
  Date:   2026-10-01 (Thu, 01 Oct 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-size/calc-size-flex-basis-on-row-expected.txt
    M Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/flex/FlexFormattingUtils.cpp
    M Source/WebCore/rendering/RenderBlock.cpp
    M Source/WebCore/rendering/RenderBlock.h
    M Source/WebCore/style/values/flexbox/StyleFlexBasis.cpp

  Log Message:
  -----------
  [css-values-5 calc-size()] Add support for calc-size() on flex-basis in the 
inline axis
https://bugs.webkit.org/show_bug.cgi?id=324502
<rdar://problem/187738664>

Reviewed by Antti Koivisto.

    <div style="display: flex; width: 500px">
      <div style="flex-basis: calc-size(auto, size * 1.6 + 23px); width: 
125px">…</div>
    </div>

`auto` on flex-basis is the width property, 125px, so `size` is 125px and the 
item is 223px.

* Source/WebCore/style/values/flexbox/StyleFlexBasis.cpp:
(WebCore::Style::FlexBasis::tryPreferredSize const):
switchOn() answers a keyword-basis calc-size() with its basis keyword, so 
rebuilding the value from
the visitor dropped the calculation; carry it across instead.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingUtils.cpp:
(WebCore::Layout::FlexFormattingUtils::flexBasisForFlexItem):
Keeps a calc-size() rather than replacing it with the preferred main size, 
which is what `auto` there
is the basis of. Only where mainAxisIsFlexItemInlineAxis(), since nothing 
resolves one in the block
axis yet.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::flexBaseSizeForFlexItem):
Only a plain `auto` flex basis is the main size property itself. A calc-size() 
over an auto basis is
installed for the measurement like any other flex basis.

* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::fixedLogicalWidthContribution const):
(WebCore::RenderBlock::logicalWidthContributionsForSize const):
What a size value contributes, given what the content measures, in one place: 
the calc-size() branch
asked this twice, once about the installed main size and once about the width 
property.

(WebCore::RenderBlock::computeIntrinsicLogicalWidthContributions):
The flex base size comes from the max-content contribution, so `auto` resolves 
to what the width
property contributes rather than to the width this box would otherwise take.

* Source/WebCore/rendering/RenderBlock.h:

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-size/calc-size-flex-basis-on-row-expected.txt:

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



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

Reply via email to