Title: [239335] trunk/Source/WebCore
- Revision
- 239335
- Author
- [email protected]
- Date
- 2018-12-18 07:28:47 -0800 (Tue, 18 Dec 2018)
Log Message
[LFC][BFC][MarginCollapsing] Implement marginAfterCollapsesWithSiblingMarginBeforeWithClearance
https://bugs.webkit.org/show_bug.cgi?id=192799
Reviewed by Antti Koivisto.
* layout/blockformatting/BlockFormattingContext.h:
* layout/blockformatting/BlockMarginCollapse.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginAfter):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (239334 => 239335)
--- trunk/Source/WebCore/ChangeLog 2018-12-18 15:27:09 UTC (rev 239334)
+++ trunk/Source/WebCore/ChangeLog 2018-12-18 15:28:47 UTC (rev 239335)
@@ -1,5 +1,17 @@
2018-12-18 Zalan Bujtas <[email protected]>
+ [LFC][BFC][MarginCollapsing] Implement marginAfterCollapsesWithSiblingMarginBeforeWithClearance
+ https://bugs.webkit.org/show_bug.cgi?id=192799
+
+ Reviewed by Antti Koivisto.
+
+ * layout/blockformatting/BlockFormattingContext.h:
+ * layout/blockformatting/BlockMarginCollapse.cpp:
+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance):
+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginAfter):
+
+2018-12-18 Zalan Bujtas <[email protected]>
+
[LFC][BFC][MarginCollapsing] Implement marginAfterCollapsesWithParentMarginBefore
https://bugs.webkit.org/show_bug.cgi?id=192798
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h (239334 => 239335)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h 2018-12-18 15:27:09 UTC (rev 239334)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h 2018-12-18 15:28:47 UTC (rev 239335)
@@ -105,7 +105,7 @@
static bool marginBeforeCollapsesWithParentMarginBefore(const LayoutState&, const Box&);
static bool marginBeforeCollapsesWithPreviousSibling(const Box&);
static bool marginAfterCollapsesWithNextSibling(const Box&);
- static bool marginAfterCollapsesWithSiblingMarginBeforeWithClearance(const Box&);
+ static bool marginAfterCollapsesWithSiblingMarginBeforeWithClearance(const LayoutState&, const Box&);
static bool marginAfterCollapsesWithParentMarginBefore(const LayoutState&, const Box&);
static bool marginsCollapseThrough(const LayoutState&, const Box&);
};
Modified: trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp (239334 => 239335)
--- trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp 2018-12-18 15:27:09 UTC (rev 239334)
+++ trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp 2018-12-18 15:28:47 UTC (rev 239335)
@@ -225,8 +225,19 @@
return true;
}
-bool BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance(const Box&)
+bool BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance(const LayoutState& layoutState, const Box& layoutBox)
{
+ // If the top and bottom margins of an element with clearance are adjoining, its margins collapse with the adjoining margins
+ // of following siblings but that resulting margin does not collapse with the bottom margin of the parent block.
+ if (!marginsCollapseThrough(layoutState, layoutBox))
+ return false;
+
+ for (auto* previousSibling = layoutBox.previousInFlowSibling(); previousSibling; previousSibling = previousSibling->previousInFlowSibling()) {
+ if (!marginsCollapseThrough(layoutState, *previousSibling))
+ return false;
+ if (hasClearance(*previousSibling))
+ return true;
+ }
return false;
}
@@ -289,7 +300,7 @@
return false;
// the child's bottom margin neither collapses with a top margin that has clearance...
- if (marginAfterCollapsesWithSiblingMarginBeforeWithClearance(layoutBox))
+ if (marginAfterCollapsesWithSiblingMarginBeforeWithClearance(layoutState, layoutBox))
return false;
// nor (if the box's min-height is non-zero) with the box's top margin.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes