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

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

  Log Message:
  -----------
  N[cleanup] Have LayoutIntegration::FlexLayout own the per-layout flex state
https://bugs.webkit.org/show_bug.cgi?id=320299

Reviewed by Antti Koivisto.

FlexLayoutState lived on RenderFlexibleBox and was engaged for all of 
layoutBlock, even though it
only describes how far the flex algorithm has got. That is why the scrollbar 
reconciliation relayout
needed m_inPostFlexUpdateScrollbarLayout: it runs after the algorithm is done 
but inside layoutBlock,
so it still saw an engaged state sitting at whatever phase the algorithm 
finished in.

Move the state to FlexLayout and scope it to FlexLayout::layout(), which is 
exactly the flex
algorithm's lifetime. Anything laying out flex content outside of that now sees 
no state at all and
takes the "not in flex layout" path on its own, so the flag and its FIXMEs go 
away.

FlexFormattingContext takes the state and passes it to FlexIntegrationUtils, 
which can hold a plain
FlexLayoutState& rather than an optional -- the formatting context only exists 
while the algorithm
runs, so the state is always there.

RenderFlexibleBox now reads the state through named queries on FlexLayout 
(isInLayout, layoutPhase,
and the block-size definiteness trio) instead of an optional member. 
FlexLayoutState::Phase becomes a
WebCore-scope LayoutPhase enum so those queries can hand it back without 
exposing the state class.

No change in behaviour.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::FlexFormattingContext::FlexFormattingContext):
(WebCore::FlexFormattingContext::computeFlexBaseAndHypotheticalMainSizes):
(WebCore::FlexFormattingContext::computeFlexLines):
(WebCore::FlexFormattingContext::computeMainSizeForFlexItems):
(WebCore::FlexFormattingContext::layoutFlexItems):
(WebCore::FlexFormattingContext::hypotheticalCrossSizeForFlexItems):
(WebCore::FlexFormattingContext::handleMainAxisAlignment):
(WebCore::FlexFormattingContext::computeCrossSizeForFlexItems):
(WebCore::FlexFormattingContext::handleCrossAxisAlignmentForFlexItems):
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h:
* Source/WebCore/layout/formattingContexts/flex/FlexLayoutState.h:
(WebCore::FlexLayoutState::phase const):
(WebCore::FlexLayoutState::setPhase):
* Source/WebCore/layout/integration/flex/FlexIntegrationUtils.cpp:
(WebCore::LayoutIntegration::FlexIntegrationUtils::FlexIntegrationUtils):
(WebCore::LayoutIntegration::FlexIntegrationUtils::flexLayoutState const):
* Source/WebCore/layout/integration/flex/FlexIntegrationUtils.h:
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::layout):
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h:
(WebCore::LayoutIntegration::FlexLayout::isInLayout const):
(WebCore::LayoutIntegration::FlexLayout::layoutPhase const):
(WebCore::LayoutIntegration::FlexLayout::isFlexBoxBlockSizeDefinite const):
(WebCore::LayoutIntegration::FlexLayout::isFlexBoxBlockSizeIndefinite const):
(WebCore::LayoutIntegration::FlexLayout::setFlexBoxBlockSizeIsDefinite):
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutBlock):
(WebCore::RenderFlexibleBox::canUseFlexItemForPercentageResolution):
(WebCore::RenderFlexibleBox::isComputingFlexBaseSizes const):
(WebCore::RenderFlexibleBox::isInCrossAxisStretchLayout const):
(WebCore::RenderFlexibleBox::canResolvePercentAgainstContainerBlockSize):
* Source/WebCore/rendering/RenderFlexibleBox.h:
(WebCore::RenderFlexibleBox::isComputingFlexBaseSizes const): Deleted.
(WebCore::RenderFlexibleBox::isInCrossAxisStretchLayout const): Deleted.

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



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

Reply via email to