WebKit Bugzilla
Attachment 348891 Details for
Bug 189296
: [LFC][BFC] Move MarginCollapse class under BlockFormattingContext::Geometry
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
Patch.txt (text/plain), 14.61 KB, created by
zalan
on 2018-09-04 21:28:28 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-09-04 21:28:28 PDT
Size:
14.61 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index ecb3bb0d01b..1103d0a464d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,40 @@ >+2018-09-04 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC][BFC] Move MarginCollapse class under BlockFormattingContext::Geometry >+ https://bugs.webkit.org/show_bug.cgi?id=189296 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Margin collapsing is part of geometry after all. >+ >+ * layout/blockformatting/BlockFormattingContext.cpp: >+ (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTop const): >+ * layout/blockformatting/BlockFormattingContext.h: >+ * layout/blockformatting/BlockFormattingContextGeometry.cpp: >+ (WebCore::Layout::BlockFormattingContext::Geometry::estimatedMarginTop): >+ * layout/blockformatting/BlockMarginCollapse.cpp: >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginTopFromFirstChild): >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginTop): >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginTop): >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBottom): >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginTop): >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBottom): >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBottomCollapsedWithParent): >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginTopCollapsedWithParentMarginBottom): >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBottomFromLastChild): >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBottom): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild): Deleted. >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginTop): Deleted. >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginTop): Deleted. >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBottom): Deleted. >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop): Deleted. >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom): Deleted. >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent): Deleted. >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginTopCollapsedWithParentMarginBottom): Deleted. >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild): Deleted. >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBottom): Deleted. >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginTop): Deleted. >+ > 2018-09-04 Zalan Bujtas <zalan@apple.com> > > [LFC] Make BlockFormattingContext::Geometry a subclass of FormattingContext::Geometry >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >index 172145b149f..b9640e8cb5e 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >@@ -165,7 +165,7 @@ void BlockFormattingContext::computeStaticPosition(LayoutContext& layoutContext, > > void BlockFormattingContext::computeEstimatedMarginTop(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const > { >- auto estimatedMarginTop = MarginCollapse::estimatedMarginTop(layoutContext, layoutBox); >+ auto estimatedMarginTop = Geometry::estimatedMarginTop(layoutContext, layoutBox); > displayBox.setEstimatedMarginTop(estimatedMarginTop); > displayBox.moveVertically(estimatedMarginTop); > } >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >index 2f42060981f..a1ae7e29360 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >@@ -78,32 +78,33 @@ private: > static bool instrinsicWidthConstraintsNeedChildrenWidth(const Box&); > static InstrinsicWidthConstraints instrinsicWidthConstraints(LayoutContext&, const Box&); > >- private: >- static HeightAndMargin inFlowNonReplacedHeightAndMargin(LayoutContext&, const Box&); >- static WidthAndMargin inFlowNonReplacedWidthAndMargin(LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedWidth = std::nullopt); >- static WidthAndMargin inFlowReplacedWidthAndMargin(LayoutContext&, const Box&); >- static Position staticPositionForOutOfFlowPositioned(const LayoutContext&, const Box&); >- }; >- >- // This class implements margin collapsing for block formatting context. >- class MarginCollapse { >- public: >- static LayoutUnit marginTop(const LayoutContext&, const Box&); > static LayoutUnit estimatedMarginTop(const LayoutContext&, const Box&); >- static LayoutUnit marginBottom(const LayoutContext&, const Box&); > >- static bool isMarginBottomCollapsedWithParent(const LayoutContext&, const Box&); >- static bool isMarginTopCollapsedWithParentMarginBottom(const Box&); >- > private: >- static LayoutUnit collapsedMarginBottomFromLastChild(const LayoutContext&, const Box&); >- static LayoutUnit nonCollapsedMarginBottom(const LayoutContext&, const Box&); >+ // This class implements margin collapsing for block formatting context. >+ class MarginCollapse { >+ public: >+ static LayoutUnit marginTop(const LayoutContext&, const Box&); >+ static LayoutUnit marginBottom(const LayoutContext&, const Box&); > >- static LayoutUnit computedNonCollapsedMarginTop(const LayoutContext&, const Box&); >- static LayoutUnit computedNonCollapsedMarginBottom(const LayoutContext&, const Box&); >+ static bool isMarginBottomCollapsedWithParent(const LayoutContext&, const Box&); >+ static bool isMarginTopCollapsedWithParentMarginBottom(const Box&); > >- static LayoutUnit collapsedMarginTopFromFirstChild(const LayoutContext&, const Box&); >- static LayoutUnit nonCollapsedMarginTop(const LayoutContext&, const Box&); >+ private: >+ static LayoutUnit collapsedMarginBottomFromLastChild(const LayoutContext&, const Box&); >+ static LayoutUnit nonCollapsedMarginBottom(const LayoutContext&, const Box&); >+ >+ static LayoutUnit computedNonCollapsedMarginTop(const LayoutContext&, const Box&); >+ static LayoutUnit computedNonCollapsedMarginBottom(const LayoutContext&, const Box&); >+ >+ static LayoutUnit collapsedMarginTopFromFirstChild(const LayoutContext&, const Box&); >+ static LayoutUnit nonCollapsedMarginTop(const LayoutContext&, const Box&); >+ }; >+ >+ static HeightAndMargin inFlowNonReplacedHeightAndMargin(LayoutContext&, const Box&); >+ static WidthAndMargin inFlowNonReplacedWidthAndMargin(LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedWidth = std::nullopt); >+ static WidthAndMargin inFlowReplacedWidthAndMargin(LayoutContext&, const Box&); >+ static Position staticPositionForOutOfFlowPositioned(const LayoutContext&, const Box&); > }; > }; > >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >index 433734241f8..cf3678f46f9 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >@@ -454,6 +454,19 @@ FormattingContext::InstrinsicWidthConstraints BlockFormattingContext::Geometry:: > return { minimumIntrinsicWidth, maximumIntrinsicWidth }; > } > >+LayoutUnit BlockFormattingContext::Geometry::estimatedMarginTop(const LayoutContext& layoutContext, const Box& layoutBox) >+{ >+ ASSERT(layoutBox.isBlockLevelBox()); >+ // Can't estimate vertical margins for out of flow boxes (and we shouldn't need to do it for float boxes). >+ ASSERT(layoutBox.isInFlow()); >+ // Can't cross block formatting context boundary. >+ ASSERT(!layoutBox.establishesBlockFormattingContext()); >+ >+ // Let's just use the normal path for now. >+ return MarginCollapse::marginTop(layoutContext, layoutBox); >+} >+ >+ > } > } > >diff --git a/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp b/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >index d2dd6ca7f9d..5faa71115a3 100644 >--- a/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >@@ -144,7 +144,7 @@ static bool isMarginBottomCollapsedThrough(const LayoutContext& layoutContext, c > return true; > } > >-LayoutUnit BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild(const LayoutContext& layoutContext, const Box& layoutBox) >+LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginTopFromFirstChild(const LayoutContext& layoutContext, const Box& layoutBox) > { > ASSERT(layoutBox.isBlockLevelBox()); > >@@ -164,7 +164,7 @@ LayoutUnit BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstCh > return marginValue(computedNonCollapsedMarginTop(layoutContext, firstInFlowChild), collapsedMarginTopFromFirstChild(layoutContext, firstInFlowChild)); > } > >-LayoutUnit BlockFormattingContext::MarginCollapse::nonCollapsedMarginTop(const LayoutContext& layoutContext, const Box& layoutBox) >+LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginTop(const LayoutContext& layoutContext, const Box& layoutBox) > { > ASSERT(layoutBox.isBlockLevelBox()); > >@@ -186,21 +186,21 @@ LayoutUnit BlockFormattingContext::MarginCollapse::nonCollapsedMarginTop(const L > // A collapsed margin is considered adjoining to another margin if any of its component margins is adjoining to that margin. > return false; > }*/ >-LayoutUnit BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginTop(const LayoutContext& layoutContext, const Box& layoutBox) >+LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginTop(const LayoutContext& layoutContext, const Box& layoutBox) > { > ASSERT(layoutBox.isBlockLevelBox()); > >- return FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue(layoutContext, layoutBox).top; >+ return computedNonCollapsedVerticalMarginValue(layoutContext, layoutBox).top; > } > >-LayoutUnit BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBottom(const LayoutContext& layoutContext, const Box& layoutBox) >+LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBottom(const LayoutContext& layoutContext, const Box& layoutBox) > { > ASSERT(layoutBox.isBlockLevelBox()); > >- return FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue(layoutContext, layoutBox).bottom; >+ return computedNonCollapsedVerticalMarginValue(layoutContext, layoutBox).bottom; > } > >-LayoutUnit BlockFormattingContext::MarginCollapse::marginTop(const LayoutContext& layoutContext, const Box& layoutBox) >+LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::marginTop(const LayoutContext& layoutContext, const Box& layoutBox) > { > if (layoutBox.isAnonymous()) > return 0; >@@ -231,7 +231,7 @@ LayoutUnit BlockFormattingContext::MarginCollapse::marginTop(const LayoutContext > return marginValue(marginTop, previousSiblingMarginBottom); > } > >-LayoutUnit BlockFormattingContext::MarginCollapse::marginBottom(const LayoutContext& layoutContext, const Box& layoutBox) >+LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::marginBottom(const LayoutContext& layoutContext, const Box& layoutBox) > { > if (layoutBox.isAnonymous()) > return 0; >@@ -256,7 +256,7 @@ LayoutUnit BlockFormattingContext::MarginCollapse::marginBottom(const LayoutCont > return nonCollapsedMarginBottom(layoutContext, layoutBox); > } > >-bool BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent(const LayoutContext& layoutContext, const Box& layoutBox) >+bool BlockFormattingContext::Geometry::MarginCollapse::isMarginBottomCollapsedWithParent(const LayoutContext& layoutContext, const Box& layoutBox) > { > // last inflow box to parent. > // https://www.w3.org/TR/CSS21/box.html#collapsing-margins >@@ -298,12 +298,12 @@ bool BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent(c > return true; > } > >-bool BlockFormattingContext::MarginCollapse::isMarginTopCollapsedWithParentMarginBottom(const Box&) >+bool BlockFormattingContext::Geometry::MarginCollapse::isMarginTopCollapsedWithParentMarginBottom(const Box&) > { > return false; > } > >-LayoutUnit BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild(const LayoutContext& layoutContext, const Box& layoutBox) >+LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBottomFromLastChild(const LayoutContext& layoutContext, const Box& layoutBox) > { > ASSERT(layoutBox.isBlockLevelBox()); > >@@ -324,7 +324,7 @@ LayoutUnit BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLast > return marginValue(computedNonCollapsedMarginBottom(layoutContext, lastInFlowChild), collapsedMarginBottomFromLastChild(layoutContext, lastInFlowChild)); > } > >-LayoutUnit BlockFormattingContext::MarginCollapse::nonCollapsedMarginBottom(const LayoutContext& layoutContext, const Box& layoutBox) >+LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBottom(const LayoutContext& layoutContext, const Box& layoutBox) > { > ASSERT(layoutBox.isBlockLevelBox()); > >@@ -332,18 +332,6 @@ LayoutUnit BlockFormattingContext::MarginCollapse::nonCollapsedMarginBottom(cons > return marginValue(computedNonCollapsedMarginBottom(layoutContext, layoutBox), collapsedMarginBottomFromLastChild(layoutContext, layoutBox)); > } > >-LayoutUnit BlockFormattingContext::MarginCollapse::estimatedMarginTop(const LayoutContext& layoutContext, const Box& layoutBox) >-{ >- ASSERT(layoutBox.isBlockLevelBox()); >- // Can't estimate vertical margins for out of flow boxes (and we shouldn't need to do it for float boxes). >- ASSERT(layoutBox.isInFlow()); >- // Can't cross block formatting context boundary. >- ASSERT(!layoutBox.establishesBlockFormattingContext()); >- >- // Let's just use the normal path for now. >- return marginTop(layoutContext, layoutBox); >-} >- > } > } > #endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
koivisto
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189296
:
348890
| 348891