[LFC][Floating] Right aligned float's horizontal candidate position is miscomputed.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Aug 2018 19:56:46 +0000 (19:56 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Aug 2018 19:56:46 +0000 (19:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188273

Reviewed by Antti Koivisto.

rightAlignedBoxLeft is already shifted with the size of the margin box.

* layout/FloatingContext.cpp:
(WebCore::Layout::FloatingContext::alignWithFloatings const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234510 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/layout/FloatingContext.cpp

index 8461acb..feb5953 100644 (file)
@@ -1,5 +1,17 @@
 2018-08-02  Zalan Bujtas  <zalan@apple.com>
 
+        [LFC][Floating] Right aligned float's horizontal candidate position is miscomputed.
+        https://bugs.webkit.org/show_bug.cgi?id=188273
+
+        Reviewed by Antti Koivisto.
+
+        rightAlignedBoxLeft is already shifted with the size of the margin box.
+
+        * layout/FloatingContext.cpp:
+        (WebCore::Layout::FloatingContext::alignWithFloatings const):
+
+2018-08-02  Zalan Bujtas  <zalan@apple.com>
+
         [LFC] Display:Box::rectWithMargin()'s width and height don't include margin left/top.
         https://bugs.webkit.org/show_bug.cgi?id=188272
 
index 036cc1b..9ef047b 100644 (file)
@@ -216,7 +216,7 @@ LayoutUnit FloatingContext::alignWithFloatings(const FloatingPair& floatingPair,
 
     if (auto* rightDisplayBox = floatingPair.right()) {
         auto rightFloatingBoxLeft = rightDisplayBox->rectWithMargin().left();
-        return std::max(std::min(rightAlignedBoxLeft, rightFloatingBoxLeft) - marginBoxWidth, leftAlignedBoxLeft);
+        return std::max(std::min(rightAlignedBoxLeft, rightFloatingBoxLeft - marginBoxWidth), leftAlignedBoxLeft);
     }
 
     return rightAlignedBoxLeft;