Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 38ad658016df9f935bc095c555f93179ae5bba89
      
https://github.com/WebKit/WebKit/commit/38ad658016df9f935bc095c555f93179ae5bba89
  Author: Alan Baradlay <[email protected]>
  Date:   2026-07-27 (Mon, 27 Jul 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollWidthHeight-negative-margin-002-expected.txt
    M Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
    M Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h

  Log Message:
  -----------
  [cleanup] Have LayoutIntegration::FlexLayout store the flex layout result 
instead of unpacking it into members
https://bugs.webkit.org/show_bug.cgi?id=320322

Reviewed by Antti Koivisto.

FlexFormattingContext::layout returns a Result with four fields, and FlexLayout 
copied each one into a
member of its own right after the call. Those four members are not state 
FlexLayout maintains, they are
just the last run's answers, kept around for the queries that run after layout: 
adjustAllowedLayoutOverflow
reads the two content-alignment overflows, and the baseline queries read the 
two line item counts. Store
the Result itself and let those queries read through it.

This also fixes align-content's start overflow going stale. The two overflows 
were treated differently:
justifyContentStartOverflow is a LayoutUnit the flex algorithm always writes, 
but alignContentStartOverflow
is a std::optional, left disengaged when handleCrossAxisAlignmentForFlexLines 
returns early (no lines to
align, or an alignment that cannot overflow the start edge). FlexLayout only 
assigned its member when the
optional was engaged, so a layout taking that early path kept the previous 
layout's value and reported an
overflow allowance that no longer had anything producing it. Resetting the 
whole result at the start of
layout() and reading the optional with value_or means "the algorithm did not 
compute one" now means no
overflow, which is what the early returns intend. This has been the behaviour 
since the two members were
introduced in 275209.

* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::initializeMarginTrimState):
(WebCore::LayoutIntegration::FlexLayout::adjustAllowedLayoutOverflow):
(WebCore::LayoutIntegration::FlexLayout::layout):
(WebCore::LayoutIntegration::FlexLayout::firstLineBaseline):
(WebCore::LayoutIntegration::FlexLayout::lastLineBaseline):
(WebCore::LayoutIntegration::FlexLayout::flexItemForFirstBaseline):
(WebCore::LayoutIntegration::FlexLayout::flexItemForLastBaseline):
(WebCore::LayoutIntegration::FlexLayout::adjustAllowedLayoutOverflow const):
(WebCore::LayoutIntegration::FlexLayout::firstLineBaseline const):
(WebCore::LayoutIntegration::FlexLayout::lastLineBaseline const):
(WebCore::LayoutIntegration::FlexLayout::flexItemForFirstBaseline const):
(WebCore::LayoutIntegration::FlexLayout::flexItemForLastBaseline const):
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h:
* 
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollWidthHeight-negative-margin-002-expected.txt:

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



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

Reply via email to