WebKit Bugzilla
Attachment 357535 Details for
Bug 192801
: [LFC][BFC][MarginCollapsing] Implement marginBeforeCollapsesWithParentMarginAfter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
Patch.txt (text/plain), 4.41 KB, created by
zalan
on 2018-12-17 21:42:01 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-12-17 21:42:01 PST
Size:
4.41 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 6c8b5337875..f5456a16a58 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,16 @@ >+2018-12-17 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC][BFC][MarginCollapsing] Implement marginBeforeCollapsesWithParentMarginAfter >+ https://bugs.webkit.org/show_bug.cgi?id=192801 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * layout/blockformatting/BlockFormattingContext.h: >+ * layout/blockformatting/BlockFormattingContextGeometry.cpp: >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): >+ * layout/blockformatting/BlockMarginCollapse.cpp: >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter): >+ > 2018-12-17 Zalan Bujtas <zalan@apple.com> > > [LFC][BFC][MarginCollapsing] Implement marginAfterCollapsesWithSiblingMarginBeforeWithClearance >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >index c3087ab494b..0bb19457829 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >@@ -89,7 +89,7 @@ private: > static LayoutUnit marginBefore(const LayoutState&, const Box&); > static LayoutUnit marginAfter(const LayoutState&, const Box&); > >- static bool marginBeforeCollapsesWithParentMarginAfter(const Box&); >+ static bool marginBeforeCollapsesWithParentMarginAfter(const LayoutState&, const Box&); > static bool marginAfterCollapsesWithParentMarginAfter(const LayoutState&, const Box&); > > private: >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >index dfbd839b21d..11fbeeb1594 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >@@ -91,7 +91,7 @@ HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMarg > > // 3. the bottom border edge of the last in-flow child whose top margin doesn't collapse with the element's bottom margin > auto* inFlowChild = lastInFlowChild; >- while (inFlowChild && MarginCollapse::marginBeforeCollapsesWithParentMarginAfter(*inFlowChild)) >+ while (inFlowChild && MarginCollapse::marginBeforeCollapsesWithParentMarginAfter(layoutState, *inFlowChild)) > inFlowChild = inFlowChild->previousInFlowSibling(); > if (inFlowChild) { > auto& inFlowDisplayBox = layoutState.displayBoxForLayoutBox(*inFlowChild); >diff --git a/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp b/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >index 582259a65fa..56770874539 100644 >--- a/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >@@ -174,8 +174,21 @@ LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginAfte > return marginValue(computedNonCollapsedMarginAfter(layoutState, lastInFlowChild), collapsedMarginAfterFromLastChild(layoutState, lastInFlowChild)); > } > >-bool BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter(const Box&) >+bool BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter(const LayoutState& layoutState, const Box& layoutBox) > { >+ // 1. This is the last in-flow child and its margins collapse through and the margin after collapses with parent's margin after or >+ // 2. This box's margin after collapses with the next sibling's margin before and that sibling collapses through and >+ // we can get to the last in-flow child like that. >+ auto* lastInFlowChild = layoutBox.parent()->lastInFlowChild(); >+ for (auto* currentBox = &layoutBox; currentBox; currentBox = currentBox->nextInFlowSibling()) { >+ if (!marginsCollapseThrough(layoutState, *currentBox)) >+ return false; >+ if (currentBox == lastInFlowChild) >+ return marginAfterCollapsesWithParentMarginAfter(layoutState, *currentBox); >+ if (!marginAfterCollapsesWithNextSibling(*currentBox)) >+ return false; >+ } >+ ASSERT_NOT_REACHED(); > return false; > } >
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 192801
: 357535