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

  Changed paths:
    M Source/WebCore/rendering/RenderBlock.cpp
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderBox.h
    M Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
    M Source/WebCore/rendering/RenderFileUploadControl.cpp
    M Source/WebCore/rendering/RenderFragmentContainer.cpp
    M Source/WebCore/rendering/RenderListBox.cpp
    M Source/WebCore/rendering/RenderMenuList.cpp
    M Source/WebCore/rendering/RenderReplaced.cpp
    M Source/WebCore/rendering/RenderSlider.cpp
    M Source/WebCore/rendering/RenderTextControl.cpp

  Log Message:
  -----------
  [cleanup] Rename computePreferredLogicalWidths helper to 
constrainPreferredLogicalWidthsByMinMax and simplify its signature
https://bugs.webkit.org/show_bug.cgi?id=314561

Reviewed by Antti Koivisto.

RenderBox had two functions both called computePreferredLogicalWidths:

1. The virtual no-arg version - the entry point that computes preferred widths 
from scratch.
2. A 3-arg helper that takes min-width, max-width, and border+padding - this
   one does not compute anything from scratch, it just clamps already-computed
   preferred widths by min/max and adds border+padding.

The second one was confusingly named because it sounds like it computes 
preferred widths,
but it only constrains them. Rename it to 
constrainPreferredLogicalWidthsByMinMax to make its role clear.

Also simplify its signature: drop all three parameters.
- min-width and max-width: every caller passed style().logicalMinWidth() and
  style().logicalMaxWidth() (except RenderDeprecatedFlexibleBox which
  incorrectly used physical minWidth()/maxWidth() -- a bug). The function now
  reads them from style() directly.
- borderAndPaddingLogicalWidth: every caller passed either
  borderAndPaddingLogicalWidth() or a manual isHorizontal() ternary that
  computes the same value. The function now calls borderAndPaddingLogicalWidth()
  internally.

The two in/out parameters (minPreferredLogicalWidth, maxPreferredLogicalWidth)
are kept explicit so the data flow is visible - the function transforms these
values rather than silently mutating member state.

* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computePreferredLogicalWidths):
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::computePreferredLogicalWidths):
(WebCore::RenderBox::constrainPreferredLogicalWidthsByMinMax):
* Source/WebCore/rendering/RenderBox.h:
* Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::RenderDeprecatedFlexibleBox::computePreferredLogicalWidths):
* Source/WebCore/rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::computePreferredLogicalWidths):
* Source/WebCore/rendering/RenderFragmentContainer.cpp:
(WebCore::RenderFragmentContainer::computePreferredLogicalWidths):
* Source/WebCore/rendering/RenderListBox.cpp:
(WebCore::RenderListBox::computePreferredLogicalWidths):
* Source/WebCore/rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::computePreferredLogicalWidths):
* Source/WebCore/rendering/RenderSlider.cpp:
(WebCore::RenderSlider::computePreferredLogicalWidths):
* Source/WebCore/rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::computePreferredLogicalWidths):

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



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

Reply via email to