Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4a230cd0dad3946daaccb6e703481a6c22a6ec98
https://github.com/WebKit/WebKit/commit/4a230cd0dad3946daaccb6e703481a6c22a6ec98
Author: Alan Baradlay <[email protected]>
Date: 2026-07-29 (Wed, 29 Jul 2026)
Changed paths:
M Source/WebCore/Headers.cmake
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
M Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h
R Source/WebCore/layout/formattingContexts/flex/FlexItemContentCache.h
M Source/WebCore/layout/integration/flex/FlexIntegrationUtils.cpp
M Source/WebCore/layout/integration/flex/FlexIntegrationUtils.h
A Source/WebCore/layout/integration/flex/FlexItemContentCache.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:
-----------
[cleanup] Fix the layering between the flex formatting context and its
integration
https://bugs.webkit.org/show_bug.cgi?id=320501
Reviewed by Antti Koivisto.
The flex code is three layers: RenderFlexibleBox, the LayoutIntegration classes
that reach the render tree for it,
and the formatting context that runs the algorithm. Dependencies should point
down that list. Four places went the
other way.
FlexFormattingContext held a FlexIntegrationUtils by value, so the formatting
context's header had to include the
integration layer's, and the formatting context constructed the thing that
exists to serve it. FlexLayout builds it
now and passes FlexIntegrationUtils&, which the formatting context keeps by
reference, so a forward declaration is
enough and the include is gone. Its constructor also drops the
FlexItemContentCache argument, which was only there
to build the FlexIntegrationUtils.
FlexItemContentCache was in the formatting context's directory but the
formatting context never touched it. The
integration layer owns it, fills it, and keys it on the renderer -- even its
TZONE implementation lives in
FlexIntegrationUtils.cpp -- so move it to layout/integration/flex and into the
LayoutIntegration namespace.
The formatting context read one renderer-keyed set out of FlexLayoutState
directly, reaching for the item's renderer
to do it. That read goes through
FlexIntegrationUtils::hasFlexItemCompletedLayout instead, which leaves every
reader
and writer of the renderer-keyed layout state in the integration layer.
RenderFlexibleBox befriended five classes but only two of them touch anything
private: LayoutIntegration::FlexLayout
for RenderBlock::updateBlockChildDirtyBitsBeforeLayout, and
FlexItemIntrinsicWidthComputationScope for the intrinsic
width flag. The other three, including both formatting context classes, are
removed. RenderFlexibleBox also included
FlexFormattingContext.h in both its header and its implementation without
needing either; the header already had the
FlexFormattingUtils.h it uses for GapType.
FlexLayoutState stays where it is: moving it to the integration layer would put
the include the formatting context's
header just lost back again. Its renderer coupling is a forward declaration and
weak sets, which is what an algorithm
that runs on renderers looks like.
* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::FlexFormattingContext::FlexFormattingContext):
(WebCore::FlexFormattingContext::computeCrossSizeForFlexItems):
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h:
* Source/WebCore/layout/formattingContexts/flex/FlexItemContentCache.h: Removed.
* Source/WebCore/layout/integration/flex/FlexIntegrationUtils.cpp:
(WebCore::LayoutIntegration::FlexIntegrationUtils::hasFlexItemCompletedLayout
const):
* Source/WebCore/layout/integration/flex/FlexIntegrationUtils.h:
* Source/WebCore/layout/integration/flex/FlexItemContentCache.h: Copied from
Source/WebCore/layout/formattingContexts/flex/FlexItemContentCache.h.
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::layout):
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h:
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
* Source/WebCore/rendering/RenderFlexibleBox.h:
Canonical link: https://commits.webkit.org/318153@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications