REOPENED 279033
Refactor `computePositionedLogicalWidthUsing` to use shrink-to-fit in one step
https://bugs.webkit.org/show_bug.cgi?id=279033
Summary Refactor `computePositionedLogicalWidthUsing` to use shrink-to-fit in one step
Ahmad Saleem
Reported 2024-09-02 13:13:45 PDT
Hi Team, This is just refactoring in `computePositionedLogicalWidthUsing` by reduce reuse of variables: auto shrinkToFitLogicalWidth = [this](LayoutUnit availableLogicalWidth, LayoutUnit bordersPlusPadding) -> LayoutUnit { LayoutUnit preferredLogicalWidth = maxPreferredLogicalWidth() - bordersPlusPadding; LayoutUnit preferredMinLogicalWidth = minPreferredLogicalWidth() - bordersPlusPadding; return std::min(std::max(preferredMinLogicalWidth, availableLogicalWidth), preferredLogicalWidth); }; and then changing from: computedValues.m_extent = std::min(std::max(preferredMinWidth, availableWidth), preferredWidth); to: computedValues.m_extent = shrinkToFitLogicalWidth(availableSpace - logicalLeftValue, bordersPlusPadding); ___ It is here: https://github.com/WebKit/WebKit/blob/12aaa71a5803d48572e89111e28771be7969119b/Source/WebCore/rendering/RenderBox.cpp#L4284 Thanks!
Attachments
Ahmad Saleem
Comment 1 2024-09-02 13:15:02 PDT
We can even use std:clamp here - return std::clamp(availableLogicalWidth, preferredMinLogicalWidth, preferredLogicalWidth);
Radar WebKit Bug Importer
Comment 2 2024-09-02 14:08:39 PDT
Ahmad Saleem
Comment 3 2024-09-02 14:11:42 PDT
EWS
Comment 4 2024-09-02 17:57:09 PDT
Committed 283073@main (6b0b9db9aa93): <https://commits.webkit.org/283073@main> Reviewed commits have been landed. Closing PR #33042 and removing active labels.
WebKit Commit Bot
Comment 5 2024-10-28 16:52:30 PDT
Re-opened since this is blocked by bug 282213
Note You need to log in before you can comment on or make changes to this bug.