Title: [246460] trunk/Source/WebCore
Revision
246460
Author
[email protected]
Date
2019-06-15 07:09:16 -0700 (Sat, 15 Jun 2019)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (246459 => 246460)


--- trunk/Source/WebCore/ChangeLog	2019-06-15 14:06:57 UTC (rev 246459)
+++ trunk/Source/WebCore/ChangeLog	2019-06-15 14:09:16 UTC (rev 246460)
@@ -1,5 +1,18 @@
 2019-06-15  Zalan Bujtas  <[email protected]>
 
+        [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):
+
+2019-06-15  Zalan Bujtas  <[email protected]>
+
         [LFC] Fix over-constrained logic for out-of-flow non-replaced horizontal geometry.
         https://bugs.webkit.org/show_bug.cgi?id=198879
         <rdar://problem/51772995>

Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (246459 => 246460)


--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2019-06-15 14:06:57 UTC (rev 246459)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2019-06-15 14:09:16 UTC (rev 246460)
@@ -484,7 +484,10 @@
 
     if (!left && !width && right) {
         // #1
-        width = shrinkToFitWidth(layoutState, layoutBox, usedValues);
+        // Calculate the available width by solving for 'width' after setting 'left' (in case 1) to 0
+        left = LayoutUnit { 0 };
+        auto availableWidth = containingBlockWidth - (*left + usedHorizontalMargin.start + borderLeft + paddingLeft + paddingRight + borderRight + usedHorizontalMargin.end + *right);
+        width = shrinkToFitWidth(layoutState, layoutBox, UsedHorizontalValues { availableWidth, usedValues.width, usedValues.margin });
         left = containingBlockWidth - (usedHorizontalMargin.start + borderLeft + paddingLeft + *width + paddingRight  + borderRight + usedHorizontalMargin.end + *right);
     } else if (!left && !right && width) {
         // #2
@@ -498,7 +501,10 @@
         }
     } else if (!width && !right && left) {
         // #3
-        width = shrinkToFitWidth(layoutState, layoutBox, usedValues);
+        // Calculate the available width by solving for 'width' after setting 'right' (in case 3) to 0
+        right = LayoutUnit { 0 };
+        auto availableWidth = containingBlockWidth - (*left + usedHorizontalMargin.start + borderLeft + paddingLeft + paddingRight + borderRight + usedHorizontalMargin.end + *right);
+        width = shrinkToFitWidth(layoutState, layoutBox, UsedHorizontalValues { availableWidth, usedValues.width, usedValues.margin });
         right = containingBlockWidth - (*left + usedHorizontalMargin.start + borderLeft + paddingLeft + *width + paddingRight + borderRight + usedHorizontalMargin.end);
     } else if (!left && width && right) {
         // #4
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to