Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 392828b842971b70070a8ac4c036ae2cc55a6cda
      
https://github.com/WebKit/WebKit/commit/392828b842971b70070a8ac4c036ae2cc55a6cda
  Author: Alan Baradlay <[email protected]>
  Date:   2026-07-23 (Thu, 23 Jul 2026)

  Changed paths:
    M Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderFlexibleBox.cpp
    M Source/WebCore/rendering/RenderFlexibleBox.h

  Log Message:
  -----------
  [cleanup] Drive the flex-item logical-height reset off the FlexLayoutState 
phase instead of a scoped flag
https://bugs.webkit.org/show_bug.cgi?id=320097

Reviewed by Antti Koivisto.

204380 fixed "Flexbox sizing logic triggers full repaint on the flex items" by
resetting a stretched flex item's logical height *inside the item's own layout* 
--
via RenderBox::shouldResetLogicalHeightBeforeLayout() ->
resetLogicalHeightBeforeLayoutIfNeeded(), which runs after the item's 
LayoutRepainter
has snapshotted the pre-stretch bounds, so the stretch relayout repaints only 
the
strip it grew into. RenderFlexibleBox signalled "reset now" with a dedicated 
scoped
flag: m_shouldResetFlexItemLogicalHeightBeforeLayout, set via
scopedResetFlexItemLogicalHeightBeforeLayout() around the stretch relayout and 
read
back through shouldResetFlexItemLogicalHeightBeforeLayout().

That flag is redundant now that RenderFlexibleBox tracks a FlexLayoutState 
phase: the
stretch relayout runs during the CrossAxisItemSizing phase, which the container
already exposes as isInCrossAxisStretchLayout(). So drop the flag and have
RenderBox::shouldResetLogicalHeightBeforeLayout() consult the container's phase
directly. The reset still happens inside the item's own layout (keeping 204380's
minimal repaint); only the signal changes from a bespoke bool to the phase we 
already
maintain.

The phase spans the whole cross-axis item-sizing step, slightly broader than 
the flag
(which was scoped to the block-axis stretch relayout), so a few additional 
cross-axis
relayouts now reset the height too -- harmless: those relayouts recompute the 
height
regardless, and the reset stays within the item's LayoutRepainter scope, so 
repaint is
unchanged (fast/repaint/align-items-change.html).

Also rename stretchFlexItemLogicalHeight to 
applyStretchedLogicalHeightToFlexItem: it
applies an already-resolved height (the caller's min/max-clamped stretch 
target) as an
overriding border-box height and relays the item out if needed; it does not 
stretch.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::FlexFormattingContext::applyStretchAlignmentToFlexItem):
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::shouldResetLogicalHeightBeforeLayout const):
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::applyStretchedLogicalHeightToFlexItem):
(WebCore::RenderFlexibleBox::stretchFlexItemLogicalHeight): Deleted.
* Source/WebCore/rendering/RenderFlexibleBox.h:
(WebCore::RenderFlexibleBox::shouldResetFlexItemLogicalHeightBeforeLayout 
const): Deleted.
(WebCore::RenderFlexibleBox::scopedResetFlexItemLogicalHeightBeforeLayout): 
Deleted.

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



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

Reply via email to