[LFC][Floating] Use displayBox.rectWithMargin().bottom instead of displayBox.bottom...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Aug 2018 20:07:43 +0000 (20:07 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Aug 2018 20:07:43 +0000 (20:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188274

Reviewed by Antti Koivisto.

Float placement uses the margin box.

* layout/FloatingContext.cpp:
(WebCore::Layout::FloatingPair::bottom const):
(WebCore::Layout::Iterator::operator++):
(WebCore::Layout::Iterator::set):

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

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

index feb5953..17a65c8 100644 (file)
@@ -1,5 +1,19 @@
 2018-08-02  Zalan Bujtas  <zalan@apple.com>
 
+        [LFC][Floating] Use displayBox.rectWithMargin().bottom instead of displayBox.bottom() to where applicable.
+        https://bugs.webkit.org/show_bug.cgi?id=188274
+
+        Reviewed by Antti Koivisto.
+
+        Float placement uses the margin box.
+
+        * layout/FloatingContext.cpp:
+        (WebCore::Layout::FloatingPair::bottom const):
+        (WebCore::Layout::Iterator::operator++):
+        (WebCore::Layout::Iterator::set):
+
+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
 
index 9ef047b..604bb27 100644 (file)
@@ -297,8 +297,8 @@ LayoutUnit FloatingPair::bottom() const
     auto* right = this->right();
     ASSERT(left || right);
 
-    auto leftBottom = left ? std::optional<LayoutUnit>(left->bottom()) : std::nullopt;
-    auto rightBottom = right ? std::optional<LayoutUnit>(right->bottom()) : std::nullopt;
+    auto leftBottom = left ? std::optional<LayoutUnit>(left->rectWithMargin().bottom()) : std::nullopt;
+    auto rightBottom = right ? std::optional<LayoutUnit>(right->rectWithMargin().bottom()) : std::nullopt;
 
     if (leftBottom && rightBottom)
         return std::max(*leftBottom, *rightBottom);
@@ -346,7 +346,7 @@ Iterator& Iterator::operator++()
         if (!currentIndex)
             return { };
 
-        auto currentBottom = m_floats[currentIndex].displayBox().bottom();
+        auto currentBottom = m_floats[currentIndex].displayBox().rectWithMargin().bottom();
 
         std::optional<unsigned> index = currentIndex;
         while (true) {
@@ -354,7 +354,7 @@ Iterator& Iterator::operator++()
             if (!index)
                 return { };
 
-            if (m_floats[*index].displayBox().bottom() > currentBottom)
+            if (m_floats[*index].displayBox().rectWithMargin().bottom() > currentBottom)
                 return index;
         }
 
@@ -418,7 +418,7 @@ void Iterator::set(LayoutUnit verticalPosition)
             if (!index)
                 return { };
 
-            auto bottom = m_floats[*index].displayBox().bottom();
+            auto bottom = m_floats[*index].displayBox().rectWithMargin().bottom();
             // Is this floating intrusive on this position?
             if (bottom > verticalPosition)
                 return index;