⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 246460 in webkit


Ignore:
Timestamp:
Jun 15, 2019, 7:09:16 AM (7 years ago)
Author:
Alan Bujtas
Message:

[LFC] Fix available width for shrink-to-fit (for out-of-flow non-replaced box)
https://bugs.webkit.org/show_bug.cgi?id=198880
<rdar://problem/51773118>

Reviewed by Antti Koivisto.

This patch fixes the cases when the available width for the out-of-flow positioned box is not the same as the containing block's (padding)width.

  • layout/FormattingContextGeometry.cpp:

(WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r246459 r246460  
     12019-06-15  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC] Fix available width for shrink-to-fit (for out-of-flow non-replaced box)
     4        https://bugs.webkit.org/show_bug.cgi?id=198880
     5        <rdar://problem/51773118>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        This patch fixes the cases when the available width for the out-of-flow positioned box is not the same as the containing block's (padding)width. 
     10
     11        * layout/FormattingContextGeometry.cpp:
     12        (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
     13
    1142019-06-15  Zalan Bujtas  <zalan@apple.com>
    215
  • trunk/Source/WebCore/layout/FormattingContextGeometry.cpp

    r246459 r246460  
    485485    if (!left && !width && right) {
    486486        // #1
    487         width = shrinkToFitWidth(layoutState, layoutBox, usedValues);
     487        // Calculate the available width by solving for 'width' after setting 'left' (in case 1) to 0
     488        left = LayoutUnit { 0 };
     489        auto availableWidth = containingBlockWidth - (*left + usedHorizontalMargin.start + borderLeft + paddingLeft + paddingRight + borderRight + usedHorizontalMargin.end + *right);
     490        width = shrinkToFitWidth(layoutState, layoutBox, UsedHorizontalValues { availableWidth, usedValues.width, usedValues.margin });
    488491        left = containingBlockWidth - (usedHorizontalMargin.start + borderLeft + paddingLeft + *width + paddingRight  + borderRight + usedHorizontalMargin.end + *right);
    489492    } else if (!left && !right && width) {
     
    499502    } else if (!width && !right && left) {
    500503        // #3
    501         width = shrinkToFitWidth(layoutState, layoutBox, usedValues);
     504        // Calculate the available width by solving for 'width' after setting 'right' (in case 3) to 0
     505        right = LayoutUnit { 0 };
     506        auto availableWidth = containingBlockWidth - (*left + usedHorizontalMargin.start + borderLeft + paddingLeft + paddingRight + borderRight + usedHorizontalMargin.end + *right);
     507        width = shrinkToFitWidth(layoutState, layoutBox, UsedHorizontalValues { availableWidth, usedValues.width, usedValues.margin });
    502508        right = containingBlockWidth - (*left + usedHorizontalMargin.start + borderLeft + paddingLeft + *width + paddingRight + borderRight + usedHorizontalMargin.end);
    503509    } else if (!left && width && right) {
Note: See TracChangeset for help on using the changeset viewer.