WebKit Bugzilla
Attachment 343743 Details for
Bug 187114
: [LFC] Do not collapse margin with the parent when element has border/padding.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-187114-20180627130331.patch (text/plain), 4.24 KB, created by
zalan
on 2018-06-27 13:03:33 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-06-27 13:03:33 PDT
Size:
4.24 KB
patch
obsolete
>Subversion Revision: 233272 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index ec6c4072f3b0b819e7a8c78918f2172808463e0c..134835be205ccc5835f3ca88b19e05f8fdbf7c52 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2018-06-27 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Do not collapse margin with the parent when element has border/padding. >+ https://bugs.webkit.org/show_bug.cgi?id=187114 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * layout/blockformatting/BlockFormattingContext.cpp: >+ (WebCore::Layout::BlockFormattingContext::layout const): >+ * layout/blockformatting/BlockMarginCollapse.cpp: >+ (WebCore::Layout::isMarginTopCollapsedWithParent): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop): >+ > 2018-06-27 Zalan Bujtas <zalan@apple.com> > > [LFC] Out-of-flow positioned element's height depends on its containing block's height. >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >index f9dc7c62f3448ef5c1da79eba7c85735465bc8a1..1d342bbcf22fee31a2fd3540b1b18476a29d6ea9 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >@@ -84,7 +84,7 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat > // Since this box is a formatting context root, it takes care of its entire subtree. > break; > } >- >+ > LOG_WITH_STREAM(FormattingContextLayout, stream << "[Compute] -> [Position][Border][Padding][Width][Margin] -> for layoutBox(" << &layoutBox << ")"); > computeStaticPosition(layoutContext, layoutBox, displayBox); > computeBorderAndPadding(layoutContext, layoutBox, displayBox); >diff --git a/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp b/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >index 1db8ee1d71ceb6977542a09ee397d8c826288329..42a9eb8e3404b7b70da6feef15a83aa00109c4a1 100644 >--- a/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >@@ -78,7 +78,7 @@ static bool isMarginBottomCollapsedWithSibling(const Box& layoutBox) > return layoutBox.style().bottom().isAuto(); > } > >-static bool isMarginTopCollapsedWithParent(const Box& layoutBox) >+static bool isMarginTopCollapsedWithParent(const Box& layoutBox, const Display::Box& displayBox) > { > // The first inflow child could propagate its top margin to parent. > // https://www.w3.org/TR/CSS21/box.html#collapsing-margins >@@ -99,13 +99,13 @@ static bool isMarginTopCollapsedWithParent(const Box& layoutBox) > return false; > > // Margins of the root element's box do not collapse. >- if (parent.isInitialContainingBlock()) >+ if (layoutBox.isInitialContainingBlock()) > return false; > >- if (!parent.style().borderTop().nonZero()) >+ if (displayBox.borderTop()) > return false; > >- if (!parent.style().paddingTop().isZero()) >+ if (!displayBox.paddingTop()) > return false; > > return true; >@@ -118,7 +118,8 @@ LayoutUnit BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstCh > return 0; > > auto& firstInFlowChild = *downcast<Container>(layoutBox).firstInFlowChild(); >- if (!isMarginTopCollapsedWithParent(firstInFlowChild)) >+ auto& fistInflowDisplayBox = *layoutContext.displayBoxForLayoutBox(firstInFlowChild); >+ if (!isMarginTopCollapsedWithParent(firstInFlowChild, fistInflowDisplayBox)) > return 0; > > // Collect collapsed margin top recursively. >@@ -161,7 +162,8 @@ LayoutUnit BlockFormattingContext::MarginCollapse::marginTop(const LayoutContext > return 0; > > // TODO: take _hasAdjoiningMarginTopAndBottom() into account. >- if (isMarginTopCollapsedWithParent(layoutBox)) >+ auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ if (isMarginTopCollapsedWithParent(layoutBox, displayBox)) > return 0; > > // Floats and out of flow positioned boxes do not collapse their margins.
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 187114
: 343743