[LFC][BFC] ComputeFloat* methods should take a const FloatingContext&
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Sep 2018 04:06:14 +0000 (04:06 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Sep 2018 04:06:14 +0000 (04:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189333

Reviewed by Antti Koivisto.

Only layoutFormattingContextRoot() needs a non-const FloatingContext& object (to add the floating box to the floating state).

* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
(WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
(WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
* layout/blockformatting/BlockFormattingContext.h:

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

Source/WebCore/ChangeLog
Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp
Source/WebCore/layout/blockformatting/BlockFormattingContext.h

index a9ba98f..90b6832 100644 (file)
@@ -1,3 +1,18 @@
+2018-09-05  Zalan Bujtas  <zalan@apple.com>
+
+        [LFC][BFC] ComputeFloat* methods should take a const FloatingContext&
+        https://bugs.webkit.org/show_bug.cgi?id=189333
+
+        Reviewed by Antti Koivisto.
+
+        Only layoutFormattingContextRoot() needs a non-const FloatingContext& object (to add the floating box to the floating state).
+
+        * layout/blockformatting/BlockFormattingContext.cpp:
+        (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
+        (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
+        (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
+        * layout/blockformatting/BlockFormattingContext.h:
+
 2018-09-05  Youenn Fablet  <youenn@apple.com>
 
         Introduce a backend for RTCRtpTransceiver
index d28b9f7..9f0bd58 100644 (file)
@@ -142,8 +142,10 @@ void BlockFormattingContext::layoutFormattingContextRoot(LayoutContext& layoutCo
     computeHeightAndMargin(layoutContext, layoutBox);
 
     // Float related final positioning.
-    if (layoutBox.isFloatingPositioned())
+    if (layoutBox.isFloatingPositioned()) {
         computeFloatingPosition(layoutContext, floatingContext, layoutBox);
+        floatingContext.floatingState().append(layoutBox);
+    }
     else if (layoutBox.hasFloatClear())
         computeVerticalPositionForFloatClear(layoutContext, floatingContext, layoutBox);
     else
@@ -192,7 +194,7 @@ void BlockFormattingContext::computeEstimatedMarginTopForAncestors(const LayoutC
     }
 }
 
-void BlockFormattingContext::computeFloatingPosition(const LayoutContext& layoutContext, FloatingContext& floatingContext, const Box& layoutBox) const
+void BlockFormattingContext::computeFloatingPosition(const LayoutContext& layoutContext, const FloatingContext& floatingContext, const Box& layoutBox) const
 {
     ASSERT(layoutBox.isFloatingPositioned());
     auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
@@ -205,10 +207,9 @@ void BlockFormattingContext::computeFloatingPosition(const LayoutContext& layout
     }
     computeEstimatedMarginTopForAncestors(layoutContext, layoutBox);
     displayBox.setTopLeft(floatingContext.positionForFloat(layoutBox));
-    floatingContext.floatingState().append(layoutBox);
 }
 
-void BlockFormattingContext::computePositionToAvoidFloats(const LayoutContext& layoutContext, FloatingContext& floatingContext, const Box& layoutBox) const
+void BlockFormattingContext::computePositionToAvoidFloats(const LayoutContext& layoutContext, const FloatingContext& floatingContext, const Box& layoutBox) const
 {
     // Formatting context roots avoid floats.
     ASSERT(layoutBox.establishesBlockFormattingContext());
index 8d54216..7d2773a 100644 (file)
@@ -56,8 +56,8 @@ private:
     void computeHeightAndMargin(const LayoutContext&, const Box&) const;
 
     void computeStaticPosition(const LayoutContext&, const Box&) const override;
-    void computeFloatingPosition(const LayoutContext&, FloatingContext&, const Box&) const;
-    void computePositionToAvoidFloats(const LayoutContext&, FloatingContext&, const Box&) const;
+    void computeFloatingPosition(const LayoutContext&, const FloatingContext&, const Box&) const;
+    void computePositionToAvoidFloats(const LayoutContext&, const FloatingContext&, const Box&) const;
     void computeVerticalPositionForFloatClear(const LayoutContext&, const FloatingContext&, const Box&) const;
 
     void computeInFlowPositionedPosition(const LayoutContext&, const Box&) const override;