Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 41c6e8317ac1b6caf2629383b0d382be714b2c5e
https://github.com/WebKit/WebKit/commit/41c6e8317ac1b6caf2629383b0d382be714b2c5e
Author: Alan Baradlay <[email protected]>
Date: 2026-07-15 (Wed, 15 Jul 2026)
Changed paths:
M Source/WebCore/Headers.cmake
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/inspector/InspectorOverlay.cpp
M Source/WebCore/rendering/FlexLayoutUtils.cpp
M Source/WebCore/rendering/FlexLayoutUtils.h
A Source/WebCore/rendering/RenderFlexLayout.cpp
A Source/WebCore/rendering/RenderFlexLayout.h
M Source/WebCore/rendering/RenderFlexibleBox.cpp
M Source/WebCore/rendering/RenderFlexibleBox.h
Log Message:
-----------
[cleanup] Move RenderFlexibleBox::performFlexLayout into a new FlexLayout
class
https://bugs.webkit.org/show_bug.cgi?id=318604
Reviewed by Antti Koivisto.
The flex layout pipeline lived entirely inside RenderFlexibleBox. Move
performFlexLayout and
the pipeline it drives into a dedicated FlexLayout class
(rendering/RenderFlexLayout.{h,cpp}),
mirroring the LFC Layout::FlexLayout that drives the flex formatting context,
so the legacy
pipeline can converge on that shape.
RenderFlexibleBox::layoutBlock still collects the flex items and handles the
empty case, then
hands the FlexLayoutItems and a FlexLayoutConstraints (the container's flow
properties and fixed
border/padding, snapshotted from the formatting-context root) into
FlexLayout::performFlexLayout(). FlexLayout runs the rest: lines / main-size /
cross-size /
alignment / placement, the flex-base and content-based-min sizing subgraph,
margin trimming,
auto-margin and stretch handling, and it owns the FlexLayoutItem / FlexLines /
FlexSign types. It
reaches back through the RenderFlexibleBox& for the container's still-live
layout state and
geometry (as Layout::FlexLayout reaches through its formatting context) and
reads the snapshotted
properties from the constraints.
What stays on RenderFlexibleBox is what the rest of the engine reaches
directly: the public API
and virtuals (baselines, allowedLayoutOverflow, willStretchItem,
isChildEligibleForMarginTrim),
the percentage-resolution query descendants call during their own layout
(canUseFlexItemForPercentageResolution and its helpers), layoutBlock's own
setup and teardown,
the shared layout-phase state, the flex-formatting-context fallback, the public
scope guards, and
the cross-layout block-axis-size cache. FlexLayout does not read or write that
cache directly:
each item's previous value comes in on its FlexLayoutItem and the value
computed this layout is
returned in FlexLayout::Result for RenderFlexibleBox to store. computeGap moves
to FlexLayoutUtils
since InspectorOverlay uses it too, and canSetFlexItemContentLogicalHeight
becomes a static member
since both sides use it.
No change in behavior: the moved bodies are unchanged except for reaching
container state and
geometry through the back-reference and constraints.
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/inspector/InspectorOverlay.cpp:
* Source/WebCore/rendering/FlexLayoutUtils.cpp:
* Source/WebCore/rendering/FlexLayoutUtils.h:
* Source/WebCore/rendering/RenderFlexLayout.cpp: Added.
* Source/WebCore/rendering/RenderFlexLayout.h: Added.
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
* Source/WebCore/rendering/RenderFlexibleBox.h:
Canonical link: https://commits.webkit.org/317258@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications