[Webkit-unassigned] [Bug 279033] New: Refactor `computePositionedLogicalWidthUsing` to use shrink-to-fit in one step

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 2 13:13:45 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=279033

            Bug ID: 279033
           Summary: Refactor `computePositionedLogicalWidthUsing` to use
                    shrink-to-fit in one step
           Product: WebKit
           Version: Safari Technology Preview
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Layout and Rendering
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ahmad.saleem792 at gmail.com
                CC: bfulgham at webkit.org, simon.fraser at apple.com,
                    zalan at apple.com

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!

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240902/bc1ee1c7/attachment.htm>


More information about the webkit-unassigned mailing list