WebKit Bugzilla
Attachment 356355 Details for
Bug 192297
: [LFC][BFC][MarginCollapsing] Add MarginCollapse::establishesBlockFormattingContext
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192297-20181202214137.patch (text/plain), 3.65 KB, created by
zalan
on 2018-12-02 21:41:45 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-12-02 21:41:45 PST
Size:
3.65 KB
patch
obsolete
>Subversion Revision: 238791 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index d1ac56ff4ac01acd15196428b65162054f0bb8b9..6d9eef69724465118477c3369876cf3091cc39a5 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2018-12-02 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC][BFC][MarginCollapsing] Add MarginCollapse::establishesBlockFormattingContext >+ https://bugs.webkit.org/show_bug.cgi?id=192297 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ WebKit treats the document element renderer as a block formatting context root. >+ >+ * layout/blockformatting/BlockMarginCollapse.cpp: >+ (WebCore::Layout::establishesBlockFormattingContext): >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginTopCollapsedWithParent): >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBottomCollapsedWithParent): >+ > 2018-12-02 Zalan Bujtas <zalan@apple.com> > > Add a runtime feature flag for LayoutFormattingContext. >diff --git a/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp b/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >index eb793b3cd4f06dbee597da8b445b67903d407c21..bf1a08ccb659e5735937c76e822e87dba889e486 100644 >--- a/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >@@ -69,6 +69,15 @@ static bool hasPaddingAfter(const Box& layoutBox) > return hasPadding(layoutBox.style().paddingAfter()); > } > >+static bool establishesBlockFormattingContext(const Box& layoutBox) >+{ >+ // WebKit treats the document element renderer as a block formatting context root. It probably only impacts margin collapsing, so let's not do >+ // a layout wide quirk on this for now. >+ if (layoutBox.isDocumentBox()) >+ return true; >+ return layoutBox.establishesBlockFormattingContext(); >+} >+ > static LayoutUnit marginValue(LayoutUnit currentMarginValue, LayoutUnit candidateMarginValue) > { > if (!candidateMarginValue) >@@ -131,14 +140,9 @@ bool BlockFormattingContext::Geometry::MarginCollapse::isMarginTopCollapsedWithP > if (layoutBox.previousInFlowSibling()) > return false; > >- // We never margin collapse the initial containing block. >- ASSERT(layoutBox.parent()); > auto& parent = *layoutBox.parent(); >- if (parent.establishesBlockFormattingContext()) >- return false; >- >- // Margins of the root element's box do not collapse. >- if (parent.isDocumentBox() || parent.isInitialContainingBlock()) >+ // Margins of elements that establish new block formatting contexts do not collapse with their in-flow children >+ if (establishesBlockFormattingContext(parent)) > return false; > > if (hasBorderBefore(parent)) >@@ -308,18 +312,13 @@ bool BlockFormattingContext::Geometry::MarginCollapse::isMarginBottomCollapsedWi > if (isMarginBottomCollapsedThrough(layoutBox)) > return false; > >- // We never margin collapse the initial containing block. >- ASSERT(layoutBox.parent()); >- auto& parent = *layoutBox.parent(); > // Only the last inlflow child collapses with parent. > if (layoutBox.nextInFlowSibling()) > return false; > >- if (parent.establishesBlockFormattingContext()) >- return false; >- >- // Margins of the root element's box do not collapse. >- if (parent.isDocumentBox() || parent.isInitialContainingBlock()) >+ auto& parent = *layoutBox.parent(); >+ // Margins of elements that establish new block formatting contexts do not collapse with their in-flow children >+ if (establishesBlockFormattingContext(parent)) > return false; > > if (hasBorderBefore(parent))
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 192297
: 356355