Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7b505e5caaaaf2cd057bab541a50f1bf52a06999
      
https://github.com/WebKit/WebKit/commit/7b505e5caaaaf2cd057bab541a50f1bf52a06999
  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/FlexFormattingContext.h
    M Source/WebCore/layout/integration/flex/FlexIntegrationUtils.cpp
    M Source/WebCore/layout/integration/flex/FlexIntegrationUtils.h
    M Source/WebCore/rendering/RenderBlock.cpp
    M Source/WebCore/rendering/RenderFlexibleBox.cpp
    M Source/WebCore/rendering/RenderFlexibleBox.h

  Log Message:
  -----------
  [cleanup] Move flex-item main-axis measurement and its cross-axis-override 
scope into FlexIntegrationUtils
https://bugs.webkit.org/show_bug.cgi?id=320206

Reviewed by Antti Koivisto.

Continuing to route FlexFormattingContext's flex-item work through 
FlexIntegrationUtils,
move the flex-item main-axis measurement and the cross-axis-override machinery 
it depends
on off the render side:

- computeMainAxisExtentForFlexItem moves from FlexFormattingContext to 
FlexIntegrationUtils.
  Its body is all render-tree measurement 
(min/maxContentLogicalWidthContribution,
  computeLogicalWidthUsing, computeContentLogicalHeight, table captions, 
scrollbars); the
  only FlexFormattingContext state it needs is mainAxisSizeForLengthResolution, 
now passed
  as an argument, and the container, reached via flexBox().
- OverridingSizesScope and ScopedCrossAxisOverrideForFlexItem move from 
RenderFlexibleBox
  nested classes to the LayoutIntegration namespace (in FlexIntegrationUtils), 
alongside
  ScopedFlexBasisAsFlexItemMainSize.
- FlexIntegrationUtils grows helpers that bundle the override scope with the 
measurement:
  computeMainAxisExtentForFlexItemWithCrossAxisOverride (the three 
intrinsic/stretch/content
  computeMainAxisExtent sites) and 
max/minContentMainAxisContributionForFlexItem (the two
  direct min/maxContentLogicalWidthContribution reads). FlexFormattingContext 
now constructs
  no override scope and performs no direct contribution reads.

ScopedCrossAxisOverrideForFlexItem keeps toggling RenderFlexibleBox's
m_inFlexItemIntrinsicWidthComputation, which stays on the renderer: it is set 
during
preferred-width computation (RenderBlock::computeChildIntrinsicLogicalWidths, 
where no
FlexLayoutState is engaged) as well as during flex layout, and 
canUseFlexItemForPercentageResolution
consumes it before the FlexLayoutState guard. The relocated scope reaches the 
private flag
via friendship, as RenderFlexibleBox already befriends FlexIntegrationUtils and 
FlexLayout;
RenderBlock's preferred-width path constructs the LayoutIntegration scope 
directly.

No behavior change.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::FlexFormattingContext::flexBaseSizeForFlexItem):
(WebCore::FlexFormattingContext::computeUsedMaxMainSize):
(WebCore::FlexFormattingContext::computeUsedNonAutoMinMainSize):
(WebCore::FlexFormattingContext::computeContentBasedMinMainSize):
(WebCore::FlexFormattingContext::computeMainAxisExtentForFlexItem): Deleted.
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h:
* Source/WebCore/layout/integration/flex/FlexIntegrationUtils.h:
* Source/WebCore/layout/integration/flex/FlexIntegrationUtils.cpp:
(WebCore::LayoutIntegration::FlexIntegrationUtils::computeMainAxisExtentForFlexItem):
(WebCore::LayoutIntegration::FlexIntegrationUtils::computeMainAxisExtentForFlexItemWithCrossAxisOverride):
(WebCore::LayoutIntegration::FlexIntegrationUtils::maxContentMainAxisContributionForFlexItem):
(WebCore::LayoutIntegration::FlexIntegrationUtils::minContentMainAxisContributionForFlexItem):
(WebCore::LayoutIntegration::OverridingSizesScope::OverridingSizesScope):
(WebCore::LayoutIntegration::OverridingSizesScope::~OverridingSizesScope):
(WebCore::LayoutIntegration::ScopedCrossAxisOverrideForFlexItem::ScopedCrossAxisOverrideForFlexItem):
(WebCore::LayoutIntegration::ScopedCrossAxisOverrideForFlexItem::~ScopedCrossAxisOverrideForFlexItem):
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::OverridingSizesScope::OverridingSizesScope): 
Deleted.
(WebCore::RenderFlexibleBox::OverridingSizesScope::~OverridingSizesScope): 
Deleted.
(WebCore::RenderFlexibleBox::ScopedCrossAxisOverrideForFlexItem::ScopedCrossAxisOverrideForFlexItem):
 Deleted.
(WebCore::RenderFlexibleBox::ScopedCrossAxisOverrideForFlexItem::~ScopedCrossAxisOverrideForFlexItem):
 Deleted.
* Source/WebCore/rendering/RenderFlexibleBox.h:
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeChildIntrinsicLogicalWidths):

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



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

Reply via email to