Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: eb9bd3226c415b8f1e15be4a1c329fa44a6893c3
      
https://github.com/WebKit/WebKit/commit/eb9bd3226c415b8f1e15be4a1c329fa44a6893c3
  Author: Alan Baradlay <[email protected]>
  Date:   2026-07-24 (Fri, 24 Jul 2026)

  Changed paths:
    M Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/flex/FlexLayoutState.h
    M Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
    M Source/WebCore/rendering/RenderFlexibleBox.cpp
    M Source/WebCore/rendering/RenderFlexibleBox.h

  Log Message:
  -----------
  [cleanup] Move the flex container's block-size definiteness onto 
FlexLayoutState
https://bugs.webkit.org/show_bug.cgi?id=320148

Reviewed by Antti Koivisto.

RenderFlexibleBox tracked whether the flex container's logical height (its 
block-axis
size) is definite -- i.e. whether a flex item's percentage can resolve against 
it -- in
an m_hasDefiniteHeight member. That is transient per-layout state; its own 
comment even
said it "is SizeIsUnknown outside of layoutBlock()". Move it onto 
FlexLayoutState next
to the other per-layout flex state, as a std::optional<bool> 
m_isBlockSizeDefinite
(engaged only during layout; nullopt means not-yet-computed). RenderFlexibleBox 
and
FlexFormattingContext go through isBlockSizeDefinite() / 
isBlockSizeIndefinite() /
setBlockSizeIsDefinite() / resetBlockSizeDefiniteness().

It is the container's block-axis size specifically (not a "main-axis size"): 
the block
axis is the main axis for a column flexbox -- where 
canComputePercentageFlexBasis reads
it -- and the cross axis for a row flexbox -- where flexItemCrossSizeIsDefinite 
reads
it. Both ask the same question, "does a percentage resolve against the 
container's
logical height", which is exactly what computePercentageLogicalHeight answers.

canComputePercentageFlexBasis keeps the same behavior: while laying ourselves 
out it
consults the cached value, and when not yet known computes it (running
computePercentageLogicalHeight, whose percent-height-descendant side effect 
callers
rely on) and caches it for the item's remaining sub-queries; reached outside 
our own
layout (percentage resolution for descendants, with m_flexLayoutState 
disengaged) it
just computes without caching.

Because the value now lives in the per-layout FlexLayoutState -- which starts 
fresh each
layoutBlock -- the two explicit resets that only existed to clear the 
persistent member
are no longer needed and are removed: the one at the end of layoutBlock, and the
per-child one in LayoutIntegration::FlexLayout::collectFlexItems (which reset a 
child
flexbox whose own FlexLayoutState is not even engaged at that point, so it was 
a no-op).

Also switch the writing-mode-parallel check from an isHorizontalWritingMode() 
equality
to writingMode().isOrthogonal(), matching the idiom already used in 
RenderFlexibleBox.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::FlexFormattingContext::computeFlexBaseAndHypotheticalMainSizes):
(WebCore::FlexFormattingContext::flexItemCrossSizeIsDefinite):
* Source/WebCore/layout/formattingContexts/flex/FlexLayoutState.h:
(WebCore::FlexLayoutState::phase const):
(WebCore::FlexLayoutState::isFlexBoxBlockSizeDefinite const):
(WebCore::FlexLayoutState::isFlexBoxBlockSizeIndefinite const):
(WebCore::FlexLayoutState::setFlexBoxBlockSizeIsDefinite):
(WebCore::FlexLayoutState::resetFlexBoxBlockSizeDefiniteness):
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::collectFlexItems):
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutBlock):
(WebCore::RenderFlexibleBox::canComputePercentageFlexBasis):
* Source/WebCore/rendering/RenderFlexibleBox.h:
(WebCore::RenderFlexibleBox::resetHasDefiniteHeight): Deleted.
(WebCore::RenderFlexibleBox::hasDefiniteHeight const): Deleted.
(WebCore::RenderFlexibleBox::setHasDefiniteHeight): Deleted.

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



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

Reply via email to