Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 99c45603929e804210a2e905187f953bfeddad93
https://github.com/WebKit/WebKit/commit/99c45603929e804210a2e905187f953bfeddad93
Author: Alan Baradlay <[email protected]>
Date: 2026-07-22 (Wed, 22 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/FlexFormattingUtils.cpp
M Source/WebCore/layout/formattingContexts/flex/FlexFormattingUtils.h
M Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
M Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h
M Source/WebCore/rendering/RenderBlock.cpp
M Source/WebCore/rendering/RenderFlexibleBox.cpp
M Source/WebCore/rendering/RenderFlexibleBox.h
Log Message:
-----------
[cleanup] Reduce FlexFormattingContext's direct dependency on
RenderFlexibleBox
https://bugs.webkit.org/show_bug.cgi?id=319934
Reviewed by Antti Koivisto.
FlexFormattingContext reached into its RenderFlexibleBox for things it could
get elsewhere: it built its own FlexLayoutConstraints, and it called stateless
FlexFormattingUtils helpers in their static form while re-passing the container
it already holds via m_flexFormattingUtils.
Route these through the seams instead, mirroring how InlineFormattingContext
takes its constraints from the integration layer:
- The integration (LayoutIntegration::FlexLayout) now builds
FlexLayoutConstraints
and passes it into the FlexFormattingContext constructor by const reference,
so
the formatting context no longer constructs its own. flexLayoutConstraints()
and
mainAxisAvailableSpace() move from the formatting context to the integration.
- FlexLayoutItem takes the container's isHorizontalFlow as a constructor
argument
instead of walking up to the item's parent; the
flexContainerIsHorizontalFlow()
free function is removed.
- FlexFormattingUtils gains instance-method overloads (alongside the existing
statics kept for RenderFlexibleBox and the integration) so the formatting
context can call them via flexFormattingUtils() without re-passing the box.
- ScopedCrossAxisOverrideForFlexItem derives its container from the flex item's
parent rather than taking it as an argument.
No change in behavior.
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::FlexFormattingContext::FlexFormattingContext):
(WebCore::FlexFormattingContext::layout):
(WebCore::FlexLayoutItem::FlexLayoutItem):
(WebCore::FlexFormattingContext::computeFlexLines):
(WebCore::FlexFormattingContext::mainAxisAvailableSpaceForItemAlignment const):
(WebCore::FlexFormattingContext::crossAxisAvailableSpaceForLineSizingAndAlignment
const):
(WebCore::FlexFormattingContext::crossSizeForFlexLines):
(WebCore::FlexFormattingContext::computeCrossSizeForFlexItems):
(WebCore::FlexFormattingContext::handleCrossAxisAlignmentForFlexLines):
(WebCore::FlexFormattingContext::handleCrossAxisAlignmentForFlexItems):
(WebCore::FlexFormattingContext::performBaselineAlignment):
(WebCore::FlexFormattingContext::placeFlexItems):
(WebCore::FlexFormattingContext::layoutColumnReverse):
(WebCore::FlexFormattingContext::flexBaseSizeForFlexItem):
(WebCore::FlexFormattingContext::flexBaseSizeNeedsBlockAxisContentSize):
(WebCore::FlexFormattingContext::computeFlexItemMinMaxMainSizes):
(WebCore::FlexFormattingContext::computeUsedMaxMainSize):
(WebCore::FlexFormattingContext::computeUsedNonAutoMinMainSize):
(WebCore::FlexFormattingContext::computeContentBasedMinMainSize):
(WebCore::FlexFormattingContext::computeMainSizeFromAspectRatioUsing const):
(WebCore::FlexFormattingContext::flexItemIntrinsicLogicalWidth):
(WebCore::FlexFormattingContext::flexItemHasComputableAspectRatioAndCrossSizeIsConsideredDefinite):
(WebCore::FlexFormattingContext::applyStretchAlignmentToFlexItem):
(WebCore::FlexFormattingContext::applyStretchMinMaxCrossSize):
(WebCore::FlexFormattingContext::flexLayoutConstraints): Deleted.
(WebCore::FlexFormattingContext::mainAxisAvailableSpace): Deleted.
(WebCore::flexContainerIsHorizontalFlow): Deleted.
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h:
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingUtils.cpp:
(WebCore::FlexFormattingUtils::computeGap const):
(WebCore::FlexFormattingUtils::crossAxisMarginExtentForFlexItem const):
(WebCore::FlexFormattingUtils::preferredMainSizeLengthForFlexItem const):
(WebCore::FlexFormattingUtils::minMainSizeLengthForFlexItem const):
(WebCore::FlexFormattingUtils::preferredCrossSizeLengthForFlexItem const):
(WebCore::FlexFormattingUtils::hasAutoMarginsInCrossAxis const):
(WebCore::FlexFormattingUtils::useContentBasedMinimumSize const):
(WebCore::FlexFormattingUtils::innerCrossSizeForFlexItem const):
(WebCore::FlexFormattingUtils::mainAxisIsFlexItemInlineAxis const):
(WebCore::FlexFormattingUtils::flexBasisForFlexItem const):
(WebCore::FlexFormattingUtils::alignmentForFlexItem const):
(WebCore::FlexFormattingUtils::hasDefiniteCrossSizeForFlexItem const):
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingUtils.h:
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::flexLayoutConstraints const):
(WebCore::LayoutIntegration::FlexLayout::mainAxisAvailableSpace const):
(WebCore::LayoutIntegration::FlexLayout::collectFlexItems):
(WebCore::LayoutIntegration::FlexLayout::layout):
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h:
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeChildIntrinsicLogicalWidths const):
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::ScopedCrossAxisOverrideForFlexItem::ScopedCrossAxisOverrideForFlexItem):
* Source/WebCore/rendering/RenderFlexibleBox.h:
Canonical link: https://commits.webkit.org/317740@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications