Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 981ec0c4d74559fa48cd6fa6173591a2c178ffbd
      
https://github.com/WebKit/WebKit/commit/981ec0c4d74559fa48cd6fa6173591a2c178ffbd
  Author: Alan Baradlay <[email protected]>
  Date:   2026-04-17 (Fri, 17 Apr 2026)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/rendering/RenderFlexibleBox.cpp
    M Source/WebCore/rendering/RenderFlexibleBox.h

  Log Message:
  -----------
  [Flex] Have layoutAndPlaceFlexItems return LineState instead of populating 
the vector directly
https://bugs.webkit.org/show_bug.cgi?id=312530

Reviewed by Antti Koivisto.

This is a refactor with no behavior change. layoutAndPlaceFlexItems
now returns a FlexLineResult instead of appending to a FlexLineStates
vector. The caller is responsible for constructing LineState and
appending. This allows the function to be reused in contexts where
the items should not be moved (e.g. re-laying out items after the
container's final main size is known).

Also extracts resolveFlexibleLengthsForLineItems as a shared helper
for resolving flexible lengths given a set of items and a container
main size.

Also fixes a pre-existing bug in computeNextFlexLine where
trimMainAxisMarginEnd operated on a copy of the last item instead
of the actual item in the line (auto vs auto&). This was harmless
before because the original code used pre-adjusted sums from
lineData, but the new resolveFlexibleLengthsForLineItems recomputes
sums from the items and needs the trimmed margin to be on the
actual item.

* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::resolveFlexibleLengthsForLineItems):
(WebCore::RenderFlexibleBox::computeNextFlexLine):
(WebCore::RenderFlexibleBox::performFlexLayout):
(WebCore::RenderFlexibleBox::layoutAndPlaceFlexItems):
* Source/WebCore/rendering/RenderFlexibleBox.h:

Canonical link: https://commits.webkit.org/311448@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to