Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 27adc3faee68dd039a3a19654c0cc4d79629eb7e
      
https://github.com/WebKit/WebKit/commit/27adc3faee68dd039a3a19654c0cc4d79629eb7e
  Author: Alan Baradlay <[email protected]>
  Date:   2026-05-28 (Thu, 28 May 2026)

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

  Log Message:
  -----------
  [cleanup] Fold computeChildPreferredLogicalWidths and the virtual 
computeChildIntrinsicLogicalWidths into one non-virtual function
https://bugs.webkit.org/show_bug.cgi?id=315662

Reviewed by Antti Koivisto.

computeChildPreferredLogicalWidths and the virtual 
computeChildIntrinsicLogicalWidths
sat next to each other on RenderBlock, with overlapping names and overlapping 
purposes: both
"compute" the child's "logical widths", and both are really computing intrinsic 
(min-content / max-content) sizes, not the spec's preferred sizes.
>From outside, you could not tell which one to call. The truth was that they 
>were not peers but two layers of the same computation:
the non-virtual function handled the spec adjustments (orthogonal flow + the 
explicit min-content / max-content keyword collapse from
css-sizing-3 #block-intrinsic), and called the virtual function as a sub-step 
to read the child's preferred widths.
The only override was RenderFlexibleBox::computeChildIntrinsicLogicalWidths, 
whose entire job was to wrap the read in ScopedCrossAxisOverrideForFlexItem so 
the
child saw the flex line's cross size in scope. One layered concept, two 
functions, and the names did not give the reader a way to keep them apart.

Folded the virtual into the renamed computeChildIntrinsicLogicalWidths 
(returning std::pair, replacing
bool + out-params for symmetry with intrinsicLogicalMarginStartAndEnd and the 
recently-renamed computeBlockIntrinsicLogicalWidths
and computeIntrinsicLogicalWidthsForFieldsetLegend).

No behavior change.

* Source/WebCore/rendering/RenderBlock.h:
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeBlockIntrinsicLogicalWidths):
(WebCore::RenderBlock::computeChildIntrinsicLogicalWidths):
(WebCore::RenderBlock::computeIntrinsicLogicalWidthsForFieldsetLegend):
* Source/WebCore/rendering/RenderBlockFlow.cpp:
* Source/WebCore/rendering/RenderFlexibleBox.h:
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::OverridingSizesScope::OverridingSizesScope):
(WebCore::RenderFlexibleBox::OverridingSizesScope::~OverridingSizesScope):
(WebCore::RenderFlexibleBox::ScopedCrossAxisOverrideForFlexItem::ScopedCrossAxisOverrideForFlexItem):
(WebCore::RenderFlexibleBox::ScopedCrossAxisOverrideForFlexItem::~ScopedCrossAxisOverrideForFlexItem):
(WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths):

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



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

Reply via email to