Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1da6dfcfae3507006ffd02ec8cd72644947b4626
https://github.com/WebKit/WebKit/commit/1da6dfcfae3507006ffd02ec8cd72644947b4626
Author: Alan Baradlay <[email protected]>
Date: 2026-07-27 (Mon, 27 Jul 2026)
Changed paths:
M Source/WebCore/inspector/InspectorOverlay.cpp
M Source/WebCore/layout/formattingContexts/flex/FlexFormattingUtils.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.h
Log Message:
-----------
[cleanup] Hide the flex formatting context's helper class internals
https://bugs.webkit.org/show_bug.cgi?id=320363
Reviewed by Antti Koivisto.
FlexLayout, FlexIntegrationUtils and FlexFormattingUtils had accumulated public
methods that only their
own implementations call. Sort out what each of them actually offers its
callers.
The flex item list becomes private to FlexLayout. Its only reader outside the
flex algorithm was
InspectorOverlay, through a RenderFlexibleBox::flexItems() forwarder, so let
the overlay collect the
container's in-flow children itself. It needs them in order-modified document
order, since the line-start
indices it caches during layout are relative to that order, so it repeats the
stable sort by used 'order'
value. Three baseline helpers inside FlexLayout were also reading the list back
through the renderer
(flexBox().flexItems()); they now use the member directly, which is what they
were doing before the list
moved off RenderFlexibleBox in 320317.
The margin-trim setters lose a layer.
FlexIntegrationUtils::addItemAtFlexLineStart and friends were
one-line forwarders whose only callers were the trim functions right above them
in the same file, and
which reached FlexLayout by going out through the renderer. Fold them into
those callers.
Everything else here is visibility only:
- FlexIntegrationUtils: setTrimmedMarginForChild,
invalidateFlexItemContentLogicalWidthsIfNeeded,
resetAutoMarginsAndLogicalTopInCrossAxis and
dirtyPercentHeightDescendantsWithinFlexItem are steps of
the public operations above them, called from nowhere else.
- FlexLayout: isInLayout and the three block-size-definiteness accessors only
back the percentage
resolution entry points on the same class. The formatting context reaches the
same state through
FlexLayoutState directly.
- FlexFormattingUtils: six of the RenderBox-taking overloads are what their
FlexLayoutItem siblings
unwrap to, and callers outside the class hold a FlexLayoutItem. The three
that a bare RenderBox does
reach -- crossAxisExtentForFlexItem, mainAxisExtentForFlexItem and
overflowAlignmentForFlexItem, from
FlexLayout's baseline and static-position helpers -- stay public.
Also narrow the flex layout state's scope to the formatting context call
itself, rather than opening it
before the item list is built. Nothing between the two lays out a flex item, so
nothing consults the
phase there.
No change in behaviour.
* Source/WebCore/inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::buildFlexOverlay):
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingUtils.h:
* Source/WebCore/layout/integration/flex/FlexIntegrationUtils.cpp:
(WebCore::LayoutIntegration::FlexIntegrationUtils::trimMainAxisMarginStart):
(WebCore::LayoutIntegration::FlexIntegrationUtils::trimMainAxisMarginEnd):
(WebCore::LayoutIntegration::FlexIntegrationUtils::trimCrossAxisMarginStart):
(WebCore::LayoutIntegration::FlexIntegrationUtils::trimCrossAxisMarginEnd):
(WebCore::LayoutIntegration::FlexIntegrationUtils::addItemAtFlexLineStart):
Deleted.
(WebCore::LayoutIntegration::FlexIntegrationUtils::addItemAtFlexLineEnd):
Deleted.
(WebCore::LayoutIntegration::FlexIntegrationUtils::addItemOnFirstFlexLine):
Deleted.
(WebCore::LayoutIntegration::FlexIntegrationUtils::addItemOnLastFlexLine):
Deleted.
* Source/WebCore/layout/integration/flex/FlexIntegrationUtils.h:
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::layout):
(WebCore::LayoutIntegration::FlexLayout::flexItemForFirstBaseline):
(WebCore::LayoutIntegration::FlexLayout::flexItemForLastBaseline):
(WebCore::LayoutIntegration::FlexLayout::baselineFlexItemInLine):
(WebCore::LayoutIntegration::FlexLayout::flexItemForFirstBaseline const):
(WebCore::LayoutIntegration::FlexLayout::flexItemForLastBaseline const):
(WebCore::LayoutIntegration::FlexLayout::baselineFlexItemInLine const):
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h:
(WebCore::LayoutIntegration::FlexLayout::isInLayout const):
(WebCore::LayoutIntegration::FlexLayout::isFlexBoxBlockSizeDefinite const):
(WebCore::LayoutIntegration::FlexLayout::isFlexBoxBlockSizeIndefinite const):
(WebCore::LayoutIntegration::FlexLayout::setFlexBoxBlockSizeIsDefinite):
* Source/WebCore/rendering/RenderFlexibleBox.h:
Canonical link: https://commits.webkit.org/318002@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications