Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 180eaa125ce92bc2bf2cf767664f7eef93b416dc
      
https://github.com/WebKit/WebKit/commit/180eaa125ce92bc2bf2cf767664f7eef93b416dc
  Author: Alan Baradlay <[email protected]>
  Date:   2026-05-25 (Mon, 25 May 2026)

  Changed paths:
    M Source/WebCore/rendering/RenderFlexibleBox.cpp
    M Source/WebCore/rendering/RenderFlexibleBox.h

  Log Message:
  -----------
  [cleanup] Separate flex base/hypothetical main size determination from 
FlexLayoutItem construction
https://bugs.webkit.org/show_bug.cgi?id=315439

Reviewed by Antti Koivisto.

constructFlexLayoutItem was doing two unrelated things: running the spec
section 9.2.3 step (determine the flex base size and hypothetical main size
of each item) and constructing the FlexLayoutItem object that carries those
sizes into the rest of the flex algorithm. The function name described the
output object, not the layout step.

Renamed to flexBaseAndHypotheticalMainSize and changed the return type to a
new typed struct that mirrors the spec quantity:

    struct FlexBaseAndHypotheticalMainSize {
        LayoutUnit flexBaseContentSize;
        LayoutUnit hypotheticalMainContentSize;
        std::pair<LayoutUnit, LayoutUnit> minMaxMainSizes;
    };

The hypothetical main content size is now computed inside that function (it
was previously derived inside FlexLayoutItem's constructor as
constrainSizeByMinMax(flexBaseContentSize)). FlexLayoutItem's constructor now
takes the struct plus an everHadLayout flag, and queries mainAxisBorder-
AndPadding / mainAxisMargin from the flex item itself via a small
flexContainerIsHorizontalFlow helper instead of receiving them as parameters.

Three per-item bookkeeping steps that lived inside constructFlexLayoutItem
(reset definite-height cache on a nested flexbox, clear trimmed-margin
markings, mark preferred-widths dirty) were moved into a prepareFlexItem
lambda inside performFlexLayout's setup loop where they belong - they are
not part of the size determination.

No behavior change.

* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::flexContainerIsHorizontalFlow):
(WebCore::RenderFlexibleBox::FlexLayoutItem::FlexLayoutItem):
(WebCore::RenderFlexibleBox::performFlexLayout):
(WebCore::RenderFlexibleBox::flexBaseAndHypotheticalMainSize):
(WebCore::RenderFlexibleBox::constructFlexLayoutItem): Deleted.
* Source/WebCore/rendering/RenderFlexibleBox.h:

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



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

Reply via email to