[LFC][Floating] Do not confuse clear with clearance.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Aug 2018 01:47:32 +0000 (01:47 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Aug 2018 01:47:32 +0000 (01:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188541

Reviewed by Simon Fraser.

clear -> CSS property.
clearance -> the offset required to avoid floats when clear is present.

* layout/FloatingContext.cpp:
(WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::layout const):
(WebCore::Layout::BlockFormattingContext::computeVerticalPositionForClear const):
(WebCore::Layout::BlockFormattingContext::computeVerticalPositionWithClearance const): Deleted.
* layout/blockformatting/BlockFormattingContext.h:
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::hasClear const):
(WebCore::Layout::Box::hasClearance const): Deleted.
* layout/layouttree/LayoutBox.h:

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

Source/WebCore/ChangeLog
Source/WebCore/layout/FloatingContext.cpp
Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp
Source/WebCore/layout/blockformatting/BlockFormattingContext.h
Source/WebCore/layout/layouttree/LayoutBox.cpp
Source/WebCore/layout/layouttree/LayoutBox.h

index a9f396d..c769900 100644 (file)
@@ -1,3 +1,25 @@
+2018-08-13  Zalan Bujtas  <zalan@apple.com>
+
+        [LFC][Floating] Do not confuse clear with clearance.
+        https://bugs.webkit.org/show_bug.cgi?id=188541
+
+        Reviewed by Simon Fraser.
+
+        clear -> CSS property.
+        clearance -> the offset required to avoid floats when clear is present.
+
+        * layout/FloatingContext.cpp:
+        (WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
+        * layout/blockformatting/BlockFormattingContext.cpp:
+        (WebCore::Layout::BlockFormattingContext::layout const):
+        (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForClear const):
+        (WebCore::Layout::BlockFormattingContext::computeVerticalPositionWithClearance const): Deleted.
+        * layout/blockformatting/BlockFormattingContext.h:
+        * layout/layouttree/LayoutBox.cpp:
+        (WebCore::Layout::Box::hasClear const):
+        (WebCore::Layout::Box::hasClearance const): Deleted.
+        * layout/layouttree/LayoutBox.h:
+
 2018-08-13  James Savage  <james.savage@apple.com>
 
         [iOS] Crash at -[UIViewController _presentViewController:withAnimationController:completion:]
index 390b858..340a7e1 100644 (file)
@@ -133,7 +133,7 @@ Position FloatingContext::positionForFloat(const Box& layoutBox) const
 
 std::optional<LayoutUnit> FloatingContext::verticalPositionWithClearance(const Box& layoutBox) const
 {
-    ASSERT(layoutBox.hasClearance());
+    ASSERT(layoutBox.hasFloatClear());
     ASSERT(layoutBox.isBlockLevelBox());
 
     if (m_floatingState.isEmpty())
index b82ec05..0eeab9f 100644 (file)
@@ -112,8 +112,8 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat
             ASSERT(!layoutBox.establishesFormattingContext());
             computeHeightAndMargin(layoutContext, layoutBox, displayBox);
             // Finalize position with clearance.
-            if (layoutBox.hasClearance())
-                computeVerticalPositionWithClearance(floatingContext, layoutBox, displayBox);
+            if (layoutBox.hasFloatClear())
+                computeVerticalPositionForFloatClear(floatingContext, layoutBox, displayBox);
             if (!is<Container>(layoutBox))
                 continue;
             auto& container = downcast<Container>(layoutBox);
@@ -163,9 +163,9 @@ void BlockFormattingContext::computeFloatingPosition(FloatingContext& floatingCo
     floatingContext.floatingState().append(layoutBox);
 }
 
-void BlockFormattingContext::computeVerticalPositionWithClearance(const FloatingContext& floatingContext, const Box& layoutBox, Display::Box& displayBox) const
+void BlockFormattingContext::computeVerticalPositionForFloatClear(const FloatingContext& floatingContext, const Box& layoutBox, Display::Box& displayBox) const
 {
-    ASSERT(layoutBox.hasClearance());
+    ASSERT(layoutBox.hasFloatClear());
     if (auto verticalPositionWithClearance = floatingContext.verticalPositionWithClearance(layoutBox))
         displayBox.setTop(*verticalPositionWithClearance);
 }
index 41af118..255f4db 100644 (file)
@@ -57,7 +57,7 @@ private:
 
     void computeStaticPosition(LayoutContext&, const Box&, Display::Box&) const override;
     void computeFloatingPosition(FloatingContext&, const Box&, Display::Box&) const;
-    void computeVerticalPositionWithClearance(const FloatingContext&, const Box&, Display::Box&) const;
+    void computeVerticalPositionForFloatClear(const FloatingContext&, const Box&, Display::Box&) const;
     void computeInFlowPositionedPosition(LayoutContext&, const Box&, Display::Box&) const override;
     void computeInFlowWidthAndMargin(LayoutContext&, const Box&, Display::Box&) const;
     void computeInFlowHeightAndMargin(LayoutContext&, const Box&, Display::Box&) const;
index 3bd0328..f8f447c 100644 (file)
@@ -114,7 +114,7 @@ bool Box::isRightFloatingPositioned() const
     return m_style.floating() == Float::Right;
 }
 
-bool Box::hasClearance() const
+bool Box::hasFloatClear() const
 {
     return m_style.clear() != Clear::None;
 }
index 21dc657..bcfc086 100644 (file)
@@ -62,7 +62,7 @@ public:
     bool isFloatingPositioned() const;
     bool isLeftFloatingPositioned() const;
     bool isRightFloatingPositioned() const;
-    bool hasClearance() const;
+    bool hasFloatClear() const;
 
     bool isFloatingOrOutOfFlowPositioned() const { return isFloatingPositioned() || isOutOfFlowPositioned(); }