[LFC] Implement margin computation
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 26 May 2018 15:26:03 +0000 (15:26 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 26 May 2018 15:26:03 +0000 (15:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186008

Reviewed by Antti Koivisto.

* WebCore.xcodeproj/project.pbxproj:
* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::computeMargin const):
(WebCore::Layout::FormattingContext::marginTop const): Deleted.
(WebCore::Layout::FormattingContext::marginLeft const): Deleted.
(WebCore::Layout::FormattingContext::marginBottom const): Deleted.
(WebCore::Layout::FormattingContext::marginRight const): Deleted.
* layout/FormattingContext.h:
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::layout const):
(WebCore::Layout::BlockFormattingContext::computeMargin const):
(WebCore::Layout::BlockFormattingContext::marginTop const): Deleted.
(WebCore::Layout::BlockFormattingContext::marginBottom const): Deleted.
* layout/blockformatting/BlockFormattingContext.h:
* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeight):
(WebCore::Layout::BlockFormattingContext::Geometry::computedMargin):
* layout/blockformatting/BlockMarginCollapse.cpp:
(WebCore::Layout::_isMarginBottomCollapsedWithParent):
(WebCore::Layout::collapsedMarginBottomFromLastChild):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginTopCollapsedWithParentMarginBottom):
(WebCore::Layout::BlockMarginCollapse::marginTop): Deleted.
(WebCore::Layout::BlockMarginCollapse::marginBottom): Deleted.
(WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithParent): Deleted.
(WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithParentMarginBottom): Deleted.
* layout/blockformatting/BlockMarginCollapse.h: Removed.

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

Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/layout/FormattingContext.cpp
Source/WebCore/layout/FormattingContext.h
Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp
Source/WebCore/layout/blockformatting/BlockFormattingContext.h
Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp
Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp
Source/WebCore/layout/blockformatting/BlockMarginCollapse.h [deleted file]

index a244858..6b088b9 100644 (file)
@@ -1,3 +1,40 @@
+2018-05-26  Zalan Bujtas  <zalan@apple.com>
+
+        [LFC] Implement margin computation
+        https://bugs.webkit.org/show_bug.cgi?id=186008
+
+        Reviewed by Antti Koivisto.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * layout/FormattingContext.cpp:
+        (WebCore::Layout::FormattingContext::computeMargin const):
+        (WebCore::Layout::FormattingContext::marginTop const): Deleted.
+        (WebCore::Layout::FormattingContext::marginLeft const): Deleted.
+        (WebCore::Layout::FormattingContext::marginBottom const): Deleted.
+        (WebCore::Layout::FormattingContext::marginRight const): Deleted.
+        * layout/FormattingContext.h:
+        * layout/blockformatting/BlockFormattingContext.cpp:
+        (WebCore::Layout::BlockFormattingContext::layout const):
+        (WebCore::Layout::BlockFormattingContext::computeMargin const):
+        (WebCore::Layout::BlockFormattingContext::marginTop const): Deleted.
+        (WebCore::Layout::BlockFormattingContext::marginBottom const): Deleted.
+        * layout/blockformatting/BlockFormattingContext.h:
+        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeight):
+        (WebCore::Layout::BlockFormattingContext::Geometry::computedMargin):
+        * layout/blockformatting/BlockMarginCollapse.cpp:
+        (WebCore::Layout::_isMarginBottomCollapsedWithParent):
+        (WebCore::Layout::collapsedMarginBottomFromLastChild):
+        (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop):
+        (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom):
+        (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
+        (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginTopCollapsedWithParentMarginBottom):
+        (WebCore::Layout::BlockMarginCollapse::marginTop): Deleted.
+        (WebCore::Layout::BlockMarginCollapse::marginBottom): Deleted.
+        (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithParent): Deleted.
+        (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithParentMarginBottom): Deleted.
+        * layout/blockformatting/BlockMarginCollapse.h: Removed.
+
 2018-05-25  Myles C. Maxfield  <mmaxfield@apple.com>
 
         [Cocoa] Delete unnecessary WebCascadeList in ComplexTextController
index 2fb724c..d373e99 100644 (file)
                115CFA7E208B8E10001E6991 /* InlineFormattingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 115CFA7C208B8E10001E6991 /* InlineFormattingState.h */; };
                115CFA82208B8EDA001E6991 /* FloatingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 115CFA80208B8EDA001E6991 /* FloatingState.h */; };
                115CFA86208B9066001E6991 /* FloatingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 115CFA84208B9066001E6991 /* FloatingContext.h */; };
-               115CFA8A208B921A001E6991 /* BlockMarginCollapse.h in Headers */ = {isa = PBXBuildFile; fileRef = 115CFA88208B921A001E6991 /* BlockMarginCollapse.h */; };
                115CFA97208B952B001E6991 /* LayoutBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 115CFA95208B952B001E6991 /* LayoutBox.h */; };
                119340791FE8B92300935F1E /* RenderTreeBuilderTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 119340771FE8B92300935F1E /* RenderTreeBuilderTable.h */; };
                1193408A1FEB355D00935F1E /* RenderTreeBuilderRuby.h in Headers */ = {isa = PBXBuildFile; fileRef = 119340881FEB355D00935F1E /* RenderTreeBuilderRuby.h */; };
                115CFA81208B8EDA001E6991 /* FloatingState.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FloatingState.cpp; sourceTree = "<group>"; };
                115CFA84208B9066001E6991 /* FloatingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FloatingContext.h; sourceTree = "<group>"; };
                115CFA85208B9066001E6991 /* FloatingContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FloatingContext.cpp; sourceTree = "<group>"; };
-               115CFA88208B921A001E6991 /* BlockMarginCollapse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BlockMarginCollapse.h; sourceTree = "<group>"; };
                115CFA89208B921A001E6991 /* BlockMarginCollapse.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = BlockMarginCollapse.cpp; sourceTree = "<group>"; };
                115CFA95208B952B001E6991 /* LayoutBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutBox.h; sourceTree = "<group>"; };
                115CFA96208B952B001E6991 /* LayoutBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutBox.cpp; sourceTree = "<group>"; };
                                1123AFDA209ABB2000736ACC /* BlockInvalidation.cpp */,
                                1123AFD9209ABB2000736ACC /* BlockInvalidation.h */,
                                115CFA89208B921A001E6991 /* BlockMarginCollapse.cpp */,
-                               115CFA88208B921A001E6991 /* BlockMarginCollapse.h */,
                        );
                        path = blockformatting;
                        sourceTree = "<group>";
                                976D6C7F122B8A3D001FD1F7 /* BlobURL.h in Headers */,
                                115CFA6E208AFAB7001E6991 /* BlockFormattingContext.h in Headers */,
                                115CFA7A208B8D9D001E6991 /* BlockFormattingState.h in Headers */,
-                               115CFA8A208B921A001E6991 /* BlockMarginCollapse.h in Headers */,
                                BC5EB5E10E81BE8700B25965 /* BorderData.h in Headers */,
                                589556ED18D4A44000764B03 /* BorderEdge.h in Headers */,
                                BC5EB5DB0E81B7EA00B25965 /* BorderValue.h in Headers */,
index 65dd98a..e235a33 100644 (file)
@@ -135,24 +135,9 @@ void FormattingContext::computeFloatingHeight(LayoutContext& layoutContext, cons
     displayBox.setHeight(computedHeight);
 }
 
-LayoutUnit FormattingContext::marginTop(const Box&) const
+void FormattingContext::computeMargin(LayoutContext&, const Box&, Display::Box& displayBox) const
 {
-    return 0;
-}
-
-LayoutUnit FormattingContext::marginLeft(const Box&) const
-{
-    return 0;
-}
-
-LayoutUnit FormattingContext::marginBottom(const Box&) const
-{
-    return 0;
-}
-
-LayoutUnit FormattingContext::marginRight(const Box&) const
-{
-    return 0;
+    displayBox.setMargin({ 0, 0, 0, 0 });
 }
 
 void FormattingContext::computeBorderAndPadding(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const
index c586857..143292b 100644 (file)
@@ -78,11 +78,7 @@ protected:
     virtual void computeFloatingHeight(LayoutContext&, const Box&, Display::Box&) const;
     virtual void computeInFlowHeight(LayoutContext&, const Box&, Display::Box&) const = 0;
 
-    virtual LayoutUnit marginTop(const Box&) const;
-    virtual LayoutUnit marginLeft(const Box&) const;
-    virtual LayoutUnit marginBottom(const Box&) const;
-    virtual LayoutUnit marginRight(const Box&) const;
-
+    virtual void computeMargin(LayoutContext&, const Box&, Display::Box&) const;
     void computeBorderAndPadding(LayoutContext&, const Box&, Display::Box&) const;
 
     void placeInFlowPositionedChildren(LayoutContext&, const Container&) const;
index 1526820..bdea3ab 100644 (file)
@@ -29,7 +29,6 @@
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 
 #include "BlockFormattingState.h"
-#include "BlockMarginCollapse.h"
 #include "DisplayBox.h"
 #include "FloatingContext.h"
 #include "FloatingState.h"
@@ -75,6 +74,7 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat
             auto& displayBox = layoutPair.displayBox;
             
             computeWidth(layoutContext, layoutBox, displayBox);
+            computeMargin(layoutContext, layoutBox, displayBox);
             computeBorderAndPadding(layoutContext, layoutBox, displayBox);
             computeStaticPosition(layoutContext, layoutBox, displayBox);
             if (layoutBox.establishesFormattingContext()) {
@@ -169,14 +169,9 @@ void BlockFormattingContext::computeInFlowWidth(LayoutContext& layoutContext, co
     displayBox.setWidth(computedWidth);
 }
 
-LayoutUnit BlockFormattingContext::marginTop(const Box& layoutBox) const
+void BlockFormattingContext::computeMargin(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const
 {
-    return BlockMarginCollapse::marginTop(layoutBox);
-}
-
-LayoutUnit BlockFormattingContext::marginBottom(const Box& layoutBox) const
-{
-    return BlockMarginCollapse::marginBottom(layoutBox);
+    displayBox.setMargin(Geometry::computedMargin(layoutContext, layoutBox));
 }
 
 }
index 397828c..7111d26 100644 (file)
@@ -55,10 +55,8 @@ private:
     void computeInFlowPositionedPosition(LayoutContext&, const Box&, Display::Box&) const override;
     void computeInFlowWidth(LayoutContext&, const Box&, Display::Box&) const override;
     void computeInFlowHeight(LayoutContext&, const Box&, Display::Box&) const override;
+    void computeMargin(LayoutContext&, const Box&, Display::Box&) const override;
 
-    LayoutUnit marginTop(const Box&) const override;
-    LayoutUnit marginBottom(const Box&) const override;
-    
     // This class implements positioning and sizing for boxes participating in a block formatting context.
     class Geometry {
     public:
@@ -67,6 +65,22 @@ private:
 
         static LayoutPoint staticPosition(LayoutContext&, const Box&);
         static LayoutPoint inFlowPositionedPosition(LayoutContext&, const Box&);
+
+        static Display::Box::Edges computedMargin(LayoutContext&, const Box&);
+    };
+    
+    // This class implements margin collapsing for block formatting context.
+    class MarginCollapse {
+    public:
+        static LayoutUnit marginTop(const Box&);
+        static LayoutUnit marginBottom(const Box&);
+
+        static bool isMarginBottomCollapsedWithParent(const Box&);
+        static bool isMarginTopCollapsedWithParentMarginBottom(const Box&);
+    
+    private:
+        static LayoutUnit collapsedMarginBottomFromLastChild(const Box&);
+        static LayoutUnit nonCollapsedMarginBottom(const Box&);
     };
 };
 
index c671c66..d5be6dd 100644 (file)
@@ -64,7 +64,7 @@ LayoutUnit BlockFormattingContext::Geometry::inFlowNonReplacedHeight(LayoutConte
     // 2. the bottom edge of the bottom (possibly collapsed) margin of its last in-flow child, if the child's bottom margin...
     auto* lastInFlowChild = downcast<Container>(layoutBox).lastInFlowChild();
     ASSERT(lastInFlowChild);
-    if (!BlockMarginCollapse::isMarginBottomCollapsedWithParent(*lastInFlowChild)) {
+    if (!BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent(*lastInFlowChild)) {
         auto* lastInFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*lastInFlowChild);
         ASSERT(lastInFlowDisplayBox);
         return lastInFlowDisplayBox->bottom() + lastInFlowDisplayBox->marginBottom();
@@ -72,7 +72,7 @@ LayoutUnit BlockFormattingContext::Geometry::inFlowNonReplacedHeight(LayoutConte
 
     // 3. the bottom border edge of the last in-flow child whose top margin doesn't collapse with the element's bottom margin
     auto* inFlowChild = lastInFlowChild;
-    while (inFlowChild && BlockMarginCollapse::isMarginTopCollapsedWithParentMarginBottom(*inFlowChild))
+    while (inFlowChild && BlockFormattingContext::MarginCollapse::isMarginTopCollapsedWithParentMarginBottom(*inFlowChild))
         inFlowChild = inFlowChild->previousInFlowSibling();
     if (inFlowChild) {
         auto* inFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*inFlowChild);
@@ -199,6 +199,19 @@ LayoutPoint BlockFormattingContext::Geometry::inFlowPositionedPosition(LayoutCon
     return { displayBox.left() + leftDelta, displayBox.top() + topDelta };
 }
 
+Display::Box::Edges BlockFormattingContext::Geometry::computedMargin(LayoutContext& layoutContext, const Box& layoutBox)
+{
+    auto& style = layoutBox.style();
+    auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->width();
+
+    return Display::Box::Edges(
+        BlockFormattingContext::MarginCollapse::marginTop(layoutBox),
+        valueForLength(style.marginLeft(), containingBlockWidth),
+        BlockFormattingContext::MarginCollapse::marginBottom(layoutBox),
+        valueForLength(style.marginRight(), containingBlockWidth)
+    );
+}
+
 }
 }
 
index 584f43a..acf5a9e 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "BlockMarginCollapse.h"
+#include "BlockFormattingContext.h"
 
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 
 #include "LayoutContainer.h"
 #include "LayoutUnit.h"
 #include "RenderStyle.h"
-#include <wtf/IsoMallocInlines.h>
 
 namespace WebCore {
 namespace Layout {
 
-WTF_MAKE_ISO_ALLOCATED_IMPL(BlockMarginCollapse);
-
 static LayoutUnit marginValue(LayoutUnit currentMarginValue, LayoutUnit candidateMarginValue)
 {
     if (!candidateMarginValue)
@@ -128,32 +125,12 @@ static LayoutUnit collapsedMarginTopFromFirstChild(const Box& layoutBox)
     return marginValue(firstInFlowChild.style().marginTop().value(), collapsedMarginTopFromFirstChild(firstInFlowChild));
 }
 
-static LayoutUnit collapsedMarginBottomFromLastChild(const Box& layoutBox)
-{
-    // Check if the last child propagates its margin bottom.
-    if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowChild())
-        return 0;
-
-    auto& lastInFlowChild = *downcast<Container>(layoutBox).lastInFlowChild();
-    if (!BlockMarginCollapse::isMarginBottomCollapsedWithParent(lastInFlowChild))
-        return 0;
-
-    // Collect collapsed margin bottom recursively.
-    return marginValue(lastInFlowChild.style().marginBottom().value(), collapsedMarginBottomFromLastChild(lastInFlowChild));
-}
-
 static LayoutUnit nonCollapsedMarginTop(const Box& layoutBox)
 {
     // Non collapsed margin top includes collapsed margin from inflow first child.
     return marginValue(layoutBox.style().marginTop().value(), collapsedMarginTopFromFirstChild(layoutBox));
 }
 
-static LayoutUnit nonCollapsedMarginBottom(const Box& layoutBox)
-{
-    // Non collapsed margin bottom includes collapsed margin from inflow last child.
-    return marginValue(layoutBox.style().marginBottom().value(), collapsedMarginBottomFromLastChild(layoutBox));
-}
-
 /*static bool hasAdjoiningMarginTopAndBottom(const Box&)
 {
     // Two margins are adjoining if and only if:
@@ -169,7 +146,7 @@ static LayoutUnit nonCollapsedMarginBottom(const Box& layoutBox)
     return false;
 }*/
 
-LayoutUnit BlockMarginCollapse::marginTop(const Box& layoutBox)
+LayoutUnit BlockFormattingContext::MarginCollapse::marginTop(const Box& layoutBox)
 {
     if (layoutBox.isAnonymous())
         return 0;
@@ -193,13 +170,13 @@ LayoutUnit BlockMarginCollapse::marginTop(const Box& layoutBox)
     return marginValue(marginTop, previousSiblingMarginBottom);
 }
 
-LayoutUnit BlockMarginCollapse::marginBottom(const Box& layoutBox)
+LayoutUnit BlockFormattingContext::MarginCollapse::marginBottom(const Box& layoutBox)
 {
     if (layoutBox.isAnonymous())
         return 0;
 
     // TODO: take _hasAdjoiningMarginTopAndBottom() into account.
-    if (isMarginBottomCollapsedWithParent(layoutBox))
+    if (BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent(layoutBox))
         return 0;
 
     // Floats and out of flow positioned boxes do not collapse their margins.
@@ -213,7 +190,7 @@ LayoutUnit BlockMarginCollapse::marginBottom(const Box& layoutBox)
     return nonCollapsedMarginBottom(layoutBox);
 }
 
-bool BlockMarginCollapse::isMarginBottomCollapsedWithParent(const Box& layoutBox)
+bool BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent(const Box& layoutBox)
 {
     // last inflow box to parent.
     // https://www.w3.org/TR/CSS21/box.html#collapsing-margins
@@ -249,11 +226,31 @@ bool BlockMarginCollapse::isMarginBottomCollapsedWithParent(const Box& layoutBox
     return true;
 }
 
-bool BlockMarginCollapse::isMarginTopCollapsedWithParentMarginBottom(const Box&)
+bool BlockFormattingContext::MarginCollapse::isMarginTopCollapsedWithParentMarginBottom(const Box&)
 {
     return false;
 }
 
+LayoutUnit BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild(const Box& layoutBox)
+{
+    // Check if the last child propagates its margin bottom.
+    if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowChild())
+        return 0;
+
+    auto& lastInFlowChild = *downcast<Container>(layoutBox).lastInFlowChild();
+    if (!isMarginBottomCollapsedWithParent(lastInFlowChild))
+        return 0;
+
+    // Collect collapsed margin bottom recursively.
+    return marginValue(lastInFlowChild.style().marginBottom().value(), collapsedMarginBottomFromLastChild(lastInFlowChild));
+}
+
+LayoutUnit BlockFormattingContext::MarginCollapse::nonCollapsedMarginBottom(const Box& layoutBox)
+{
+    // Non collapsed margin bottom includes collapsed margin from inflow last child.
+    return marginValue(layoutBox.style().marginBottom().value(), collapsedMarginBottomFromLastChild(layoutBox));
+}
+
 }
 }
 #endif
diff --git a/Source/WebCore/layout/blockformatting/BlockMarginCollapse.h b/Source/WebCore/layout/blockformatting/BlockMarginCollapse.h
deleted file mode 100644 (file)
index 9de8b2d..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-
-#include "LayoutUnit.h"
-#include <wtf/IsoMalloc.h>
-
-namespace WebCore {
-
-namespace Layout {
-
-class Box;
-
-// This class implements margin collapsing for block formatting context.
-class BlockMarginCollapse {
-    WTF_MAKE_ISO_ALLOCATED(BlockMarginCollapse);
-public:
-    static LayoutUnit marginTop(const Box&);
-    static LayoutUnit marginBottom(const Box&);
-
-    static bool isMarginBottomCollapsedWithParent(const Box&);
-    static bool isMarginTopCollapsedWithParentMarginBottom(const Box&);
-};
-
-}
-}
-#endif