Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f12d815fa9b7597b305ceab3077c1c09ba71a5aa
https://github.com/WebKit/WebKit/commit/f12d815fa9b7597b305ceab3077c1c09ba71a5aa
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/formattingContexts/flex/FlexFormattingUtils.cpp
M Source/WebCore/layout/formattingContexts/flex/FlexLayoutState.h
M Source/WebCore/rendering/RenderFlexibleBox.cpp
M Source/WebCore/rendering/RenderFlexibleBox.h
Log Message:
-----------
[cleanup] Move flex-item completed-layout tracking from RenderFlexibleBox
into FlexLayoutState
https://bugs.webkit.org/show_bug.cgi?id=320117
Reviewed by Antti Koivisto.
The set tracking which flex items have already been laid out during the current
pass was a SingleThreadWeakHashSet member on RenderFlexibleBox
(m_flexItemsWithCompletedLayout) with mark/has accessors, cleared by hand at the
top of layoutBlock. That is transient per-layout state -- exactly what
FlexLayoutState (added in 320044) exists to hold. Move the set and its accessors
onto FlexLayoutState (setFlexItemHasCompletedLayout /
hasFlexItemCompletedLayout);
RenderFlexibleBox and FlexFormattingContext reach it through the container's
FlexLayoutState. The manual clear() is gone -- each layout engages a fresh
FlexLayoutState, so the set starts empty.
While in this code, tidy up the surrounding per-flex-item layout helpers. No
behavior change:
- Simplify layoutFlexItemWithMainSize: fold the relayout decision into one
shouldMarkFlexItemForLayout lambda, inline the one-line
setOverridingMainSizeForFlexItem, and drop
updateFlexItemDirtyBitsBeforeLayout --
its isOutOfFlowPositioned early return was dead code, since the flex algorithm
only ever iterates in-flow items.
- Consolidate the stretch relayout: applyStretchedLogicalHeightToFlexItem loses
its
needsRelayout bool and delegates to layoutFlexItemForStretchedCrossSize
(renamed
from relayoutFlexItemForStretchedCrossSize); the caller handles the "already
the
right size, just mark it definite" case inline.
- Rename FlexFormattingContext::flexLayoutState() to layoutState(), plus a
couple of
guard-clause / ternary simplifications (isHorizontalFlow,
resetAutoMarginsAndLogicalTopInCrossAxis).
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::FlexFormattingContext::computeFlexBaseAndHypotheticalMainSizes):
(WebCore::FlexFormattingContext::computeFlexLines):
(WebCore::FlexFormattingContext::computeMainSizeForFlexItems):
(WebCore::FlexFormattingContext::layoutFlexItems):
(WebCore::FlexFormattingContext::hypotheticalCrossSizeForFlexItems):
(WebCore::FlexFormattingContext::handleMainAxisAlignment):
(WebCore::FlexFormattingContext::computeCrossSizeForFlexItems):
(WebCore::FlexFormattingContext::handleCrossAxisAlignmentForFlexItems):
(WebCore::FlexFormattingContext::applyStretchAlignmentToFlexItem):
(WebCore::FlexFormattingContext::applyStretchMinMaxCrossSize):
(WebCore::FlexFormattingContext::layoutState const):
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h:
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingUtils.cpp:
(WebCore::FlexFormattingUtils::isHorizontalFlow):
* Source/WebCore/layout/formattingContexts/flex/FlexLayoutState.h:
(WebCore::FlexLayoutState::setFlexItemHasCompletedLayout):
(WebCore::FlexLayoutState::hasFlexItemCompletedLayout const):
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutBlock):
(WebCore::RenderFlexibleBox::computeBlockAxisContentSizeForFlexItem):
(WebCore::RenderFlexibleBox::applyStretchedLogicalHeightToFlexItem):
(WebCore::RenderFlexibleBox::layoutFlexItemForStretchedCrossSize):
(WebCore::RenderFlexibleBox::layoutFlexItemWithMainSize):
(WebCore::RenderFlexibleBox::resetAutoMarginsAndLogicalTopInCrossAxis):
(WebCore::RenderFlexibleBox::setOverridingMainSizeForFlexItem): Deleted.
* Source/WebCore/rendering/RenderFlexibleBox.h:
Canonical link: https://commits.webkit.org/317850@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications