WebKit Bugzilla
Attachment 343793 Details for
Bug 187135
: [LFC] The margin bottom of the document element does not collapse with its last inflow child's bottom margin.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-187135-20180627221523.patch (text/plain), 5.61 KB, created by
zalan
on 2018-06-27 22:15:24 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-06-27 22:15:24 PDT
Size:
5.61 KB
patch
obsolete
>Subversion Revision: 233298 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0c9239c9e3c8cf101cd30fa04f5550130ad3253b..d8271db187086278c6ac46ee750fc16fbe34f5d9 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2018-06-27 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] The margin bottom of the document element does not collapse with its last inflow child's bottom margin. >+ https://bugs.webkit.org/show_bug.cgi?id=187135 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * layout/blockformatting/BlockFormattingContext.h: >+ * layout/blockformatting/BlockFormattingContextGeometry.cpp: >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): >+ * layout/blockformatting/BlockMarginCollapse.cpp: >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild): >+ > 2018-06-27 Zalan Bujtas <zalan@apple.com> > > [LFC] Compute both the collapsed and the non-collapsed margin values. >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >index 8dc5d508cf71254310ea1860efc886753e954813..062fc0975fdf8362b6fd0550c4fee1dcbc6d92ee 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >@@ -83,7 +83,7 @@ private: > static LayoutUnit marginTop(const LayoutContext&, const Box&); > static LayoutUnit marginBottom(const LayoutContext&, const Box&); > >- static bool isMarginBottomCollapsedWithParent(const Box&); >+ static bool isMarginBottomCollapsedWithParent(const LayoutContext&, const Box&); > static bool isMarginTopCollapsedWithParentMarginBottom(const Box&); > > private: >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >index 7edd2cdb1041dacfb954082a102fc7e044d367a7..aabbf6713b6c5bdad90a92343f64eb77cb164c41 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >@@ -99,7 +99,7 @@ FormattingContext::Geometry::HeightAndMargin BlockFormattingContext::Geometry::i > // 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 (!MarginCollapse::isMarginBottomCollapsedWithParent(*lastInFlowChild)) { >+ if (!MarginCollapse::isMarginBottomCollapsedWithParent(layoutContext, *lastInFlowChild)) { > auto* lastInFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*lastInFlowChild); > ASSERT(lastInFlowDisplayBox); > return { lastInFlowDisplayBox->bottom() + lastInFlowDisplayBox->marginBottom() - borderAndPaddingTop, nonCollapsedMargin, collapsedMargin }; >diff --git a/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp b/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >index ea6caa87e75653c042e8a5526d6591168a6b5616..52d3ca3ebdcd768252f88116b97b4b1fb589db31 100644 >--- a/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >@@ -186,7 +186,7 @@ LayoutUnit BlockFormattingContext::MarginCollapse::marginBottom(const LayoutCont > return 0; > > // TODO: take _hasAdjoiningMarginTopAndBottom() into account. >- if (BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent(layoutBox)) >+ if (BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent(layoutContext, layoutBox)) > return 0; > > // Floats and out of flow positioned boxes do not collapse their margins. >@@ -200,7 +200,7 @@ LayoutUnit BlockFormattingContext::MarginCollapse::marginBottom(const LayoutCont > return nonCollapsedMarginBottom(layoutContext, layoutBox); > } > >-bool BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent(const Box& layoutBox) >+bool BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent(const LayoutContext& layoutContext, const Box& layoutBox) > { > // last inflow box to parent. > // https://www.w3.org/TR/CSS21/box.html#collapsing-margins >@@ -221,13 +221,14 @@ bool BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent(c > return false; > > // Margins of the root element's box do not collapse. >- if (parent.isInitialContainingBlock()) >+ if (parent.isDocumentBox() || parent.isInitialContainingBlock()) > return false; > >- if (!parent.style().borderTop().nonZero()) >+ auto& parentDisplayBox = *layoutContext.displayBoxForLayoutBox(parent); >+ if (parentDisplayBox.borderTop()) > return false; > >- if (!parent.style().paddingTop().isZero()) >+ if (parentDisplayBox.paddingTop()) > return false; > > if (!parent.style().height().isAuto()) >@@ -248,7 +249,7 @@ LayoutUnit BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLast > return 0; > > auto& lastInFlowChild = *downcast<Container>(layoutBox).lastInFlowChild(); >- if (!isMarginBottomCollapsedWithParent(lastInFlowChild)) >+ if (!isMarginBottomCollapsedWithParent(layoutContext, lastInFlowChild)) > return 0; > > // Collect collapsed margin bottom recursively.
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+
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 187135
: 343793 |
343798