Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b3fb9c003b43f4ab24d2e8aaea5862166ed6ae86
https://github.com/WebKit/WebKit/commit/b3fb9c003b43f4ab24d2e8aaea5862166ed6ae86
Author: Alan Baradlay <[email protected]>
Date: 2026-07-16 (Thu, 16 Jul 2026)
Changed paths:
M Source/WebCore/rendering/RenderFlexLayout.cpp
M Source/WebCore/rendering/RenderFlexLayout.h
Log Message:
-----------
[cleanup] Add FlexLayout available-space helpers mirroring Layout::FlexLayout
and compute the flex gaps at use instead of threading them
https://bugs.webkit.org/show_bug.cgi?id=318625
Reviewed by Antti Koivisto.
The legacy flex layout computed the two gaps once at the top of
performFlexLayout and threaded them
through seven functions, and it open-coded the "container inner size minus the
inter-item or
inter-line gaps" arithmetic at five sites. The LFC Layout::FlexLayout it
converges on instead exposes
mainAxisAvailableSpaceForItemAlignment and
crossAxisAvailableSpaceForLineSizingAndAlignment and
computes the gap at the point of use.
Add those two helpers (each returns the available size for a single item or
line, otherwise the size
less (n - 1) gaps, computing the gap internally), route the five
available-space sites through them,
and drop the gapBetweenItems / gapBetweenLines parameters. The remaining sites
that need the gap
value itself (line collection, justify-content and align-content spacing, the
inter-line total)
compute it locally at use, the way computeFlexLines already did.
No change in behavior. The gap is a container invariant across the flex
container's own layout: a
percentage gap resolves against availableLogicalHeightForPercentageComputation,
which reads style,
the parent-set flex or grid override and aspect ratio rather than the live
logical height that layout
mutates, so computing it at use matches the old top-of-layout snapshot. The
distribute short-line
restructure is the same comparison with the gap term moved to the other side.
* Source/WebCore/rendering/RenderFlexLayout.cpp:
(WebCore::FlexLayout::performFlexLayout):
(WebCore::FlexLayout::computeMainSizeForFlexItems):
(WebCore::FlexLayout::resolveFlexibleLengthsForLineItems):
(WebCore::FlexLayout::mainAxisAvailableSpaceForItemAlignment const):
(WebCore::FlexLayout::crossAxisAvailableSpaceForLineSizingAndAlignment const):
(WebCore::FlexLayout::distributeMainAxisFreeSpaceForMultilineColumnIfNeeded):
(WebCore::FlexLayout::handleMainAxisAlignment):
(WebCore::FlexLayout::handleCrossAxisAlignmentForFlexLines):
(WebCore::FlexLayout::placeFlexItems):
(WebCore::FlexLayout::layoutColumnReverse):
* Source/WebCore/rendering/RenderFlexLayout.h:
Canonical link: https://commits.webkit.org/317352@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications