WebKit Bugzilla
Attachment 358468 Details for
Bug 193181
: [LFC][BFC] Move MarginCollapse from BlockFormattingContext::Geometry to BlockFormattingContext
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193181-20190106164502.patch (text/plain), 18.06 KB, created by
zalan
on 2019-01-06 16:45:11 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2019-01-06 16:45:11 PST
Size:
18.06 KB
patch
obsolete
>Subversion Revision: 239660 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 55b71dc9deb21074a32e10417dfd9dbcea258561..3d455e56c4ec43edc8048c437f4a6cde0a73d167 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,50 @@ >+2019-01-06 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC][BFC] Move MarginCollapse from BlockFormattingContext::Geometry to BlockFormattingContext >+ https://bugs.webkit.org/show_bug.cgi?id=193181 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This is in preparation to share margin collapsing across all boxes in block formatting context. >+ >+ * layout/blockformatting/BlockFormattingContext.h: >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin): >+ * layout/blockformatting/BlockMarginCollapse.cpp: >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBefore): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginAfter): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBefore): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginAfter): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBeforeFromFirstChild): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginAfterFromLastChild): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginBefore): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginAfter): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSibling): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithNextSibling): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBefore): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfter): >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBefore): Deleted. >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginAfter): Deleted. >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBefore): Deleted. >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginAfter): Deleted. >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBeforeFromFirstChild): Deleted. >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginAfterFromLastChild): Deleted. >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter): Deleted. >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore): Deleted. >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance): Deleted. >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginBefore): Deleted. >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginAfter): Deleted. >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithPreviousSibling): Deleted. >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithNextSibling): Deleted. >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginsCollapseThrough): Deleted. >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBefore): Deleted. >+ (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfter): Deleted. >+ > 2019-01-05 Youenn Fablet <youenn@apple.com> > > Service Worker fetch should obey its referrer policy >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >index 68041d4908567fb889340d6b53b7e3f2082ec180..21de3b49234e269c8ad54531277f1792a3345daf 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >@@ -83,37 +83,37 @@ private: > static LayoutUnit estimatedMarginAfter(const LayoutState&, const Box&); > > private: >- // This class implements margin collapsing for block formatting context. >- class MarginCollapse { >- public: >- static LayoutUnit marginBefore(const LayoutState&, const Box&); >- static LayoutUnit marginAfter(const LayoutState&, const Box&); >+ static HeightAndMargin inFlowNonReplacedHeightAndMargin(const LayoutState&, const Box&, Optional<LayoutUnit> usedHeight = { }); >+ static WidthAndMargin inFlowNonReplacedWidthAndMargin(const LayoutState&, const Box&, Optional<LayoutUnit> usedWidth = { }); >+ static WidthAndMargin inFlowReplacedWidthAndMargin(const LayoutState&, const Box&, Optional<LayoutUnit> usedWidth = { }); >+ static Point staticPositionForOutOfFlowPositioned(const LayoutState&, const Box&); >+ }; > >- static bool marginBeforeCollapsesWithParentMarginAfter(const LayoutState&, const Box&); >- static bool marginAfterCollapsesWithParentMarginAfter(const LayoutState&, const Box&); >+ // This class implements margin collapsing for block formatting context. >+ class MarginCollapse { >+ public: >+ static LayoutUnit marginBefore(const LayoutState&, const Box&); >+ static LayoutUnit marginAfter(const LayoutState&, const Box&); > >- private: >- static LayoutUnit collapsedMarginAfterFromLastChild(const LayoutState&, const Box&); >- static LayoutUnit nonCollapsedMarginAfter(const LayoutState&, const Box&); >+ static bool marginBeforeCollapsesWithParentMarginAfter(const LayoutState&, const Box&); >+ static bool marginAfterCollapsesWithParentMarginAfter(const LayoutState&, const Box&); > >- static LayoutUnit computedNonCollapsedMarginBefore(const LayoutState&, const Box&); >- static LayoutUnit computedNonCollapsedMarginAfter(const LayoutState&, const Box&); >+ private: >+ static LayoutUnit collapsedMarginAfterFromLastChild(const LayoutState&, const Box&); >+ static LayoutUnit nonCollapsedMarginAfter(const LayoutState&, const Box&); > >- static LayoutUnit collapsedMarginBeforeFromFirstChild(const LayoutState&, const Box&); >- static LayoutUnit nonCollapsedMarginBefore(const LayoutState&, const Box&); >+ static LayoutUnit computedNonCollapsedMarginBefore(const LayoutState&, const Box&); >+ static LayoutUnit computedNonCollapsedMarginAfter(const LayoutState&, const Box&); > >- static bool marginBeforeCollapsesWithParentMarginBefore(const LayoutState&, const Box&); >- static bool marginBeforeCollapsesWithPreviousSibling(const Box&); >- static bool marginAfterCollapsesWithNextSibling(const Box&); >- static bool marginAfterCollapsesWithSiblingMarginBeforeWithClearance(const LayoutState&, const Box&); >- static bool marginAfterCollapsesWithParentMarginBefore(const LayoutState&, const Box&); >- static bool marginsCollapseThrough(const LayoutState&, const Box&); >- }; >+ static LayoutUnit collapsedMarginBeforeFromFirstChild(const LayoutState&, const Box&); >+ static LayoutUnit nonCollapsedMarginBefore(const LayoutState&, const Box&); > >- static HeightAndMargin inFlowNonReplacedHeightAndMargin(const LayoutState&, const Box&, Optional<LayoutUnit> usedHeight = { }); >- static WidthAndMargin inFlowNonReplacedWidthAndMargin(const LayoutState&, const Box&, Optional<LayoutUnit> usedWidth = { }); >- static WidthAndMargin inFlowReplacedWidthAndMargin(const LayoutState&, const Box&, Optional<LayoutUnit> usedWidth = { }); >- static Point staticPositionForOutOfFlowPositioned(const LayoutState&, const Box&); >+ static bool marginBeforeCollapsesWithParentMarginBefore(const LayoutState&, const Box&); >+ static bool marginBeforeCollapsesWithPreviousSibling(const Box&); >+ static bool marginAfterCollapsesWithNextSibling(const Box&); >+ static bool marginAfterCollapsesWithSiblingMarginBeforeWithClearance(const LayoutState&, const Box&); >+ static bool marginAfterCollapsesWithParentMarginBefore(const LayoutState&, const Box&); >+ static bool marginsCollapseThrough(const LayoutState&, const Box&); > }; > > class Quirks { >diff --git a/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp b/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >index f798af3ded84bb72242b5825c8294448da691812..c71d39260a75588aa0ee8f261f24ae2194ee87b4 100644 >--- a/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >@@ -103,21 +103,21 @@ static LayoutUnit marginValue(LayoutUnit currentMarginValue, LayoutUnit candidat > return currentMarginValue + candidateMarginValue; > } > >-LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBefore(const LayoutState& layoutState, const Box& layoutBox) >+LayoutUnit BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBefore(const LayoutState& layoutState, const Box& layoutBox) > { > ASSERT(layoutBox.isBlockLevelBox()); > >- return computedVerticalMargin(layoutState, layoutBox).before.valueOr(0); >+ return Geometry::computedVerticalMargin(layoutState, layoutBox).before.valueOr(0); > } > >-LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginAfter(const LayoutState& layoutState, const Box& layoutBox) >+LayoutUnit BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginAfter(const LayoutState& layoutState, const Box& layoutBox) > { > ASSERT(layoutBox.isBlockLevelBox()); > >- return computedVerticalMargin(layoutState, layoutBox).after.valueOr(0); >+ return Geometry::computedVerticalMargin(layoutState, layoutBox).after.valueOr(0); > } > >-LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBefore(const LayoutState& layoutState, const Box& layoutBox) >+LayoutUnit BlockFormattingContext::MarginCollapse::nonCollapsedMarginBefore(const LayoutState& layoutState, const Box& layoutBox) > { > ASSERT(layoutBox.isBlockLevelBox()); > >@@ -125,7 +125,7 @@ LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginB > return marginValue(computedNonCollapsedMarginBefore(layoutState, layoutBox), collapsedMarginBeforeFromFirstChild(layoutState, layoutBox)); > } > >-LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginAfter(const LayoutState& layoutState, const Box& layoutBox) >+LayoutUnit BlockFormattingContext::MarginCollapse::nonCollapsedMarginAfter(const LayoutState& layoutState, const Box& layoutBox) > { > ASSERT(layoutBox.isBlockLevelBox()); > >@@ -133,7 +133,7 @@ LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginA > return marginValue(computedNonCollapsedMarginAfter(layoutState, layoutBox), collapsedMarginAfterFromLastChild(layoutState, layoutBox)); > } > >-LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBeforeFromFirstChild(const LayoutState& layoutState, const Box& layoutBox) >+LayoutUnit BlockFormattingContext::MarginCollapse::collapsedMarginBeforeFromFirstChild(const LayoutState& layoutState, const Box& layoutBox) > { > ASSERT(layoutBox.isBlockLevelBox()); > >@@ -153,7 +153,7 @@ LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBefo > return marginValue(computedNonCollapsedMarginBefore(layoutState, firstInFlowChild), collapsedMarginBeforeFromFirstChild(layoutState, firstInFlowChild)); > } > >-LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginAfterFromLastChild(const LayoutState& layoutState, const Box& layoutBox) >+LayoutUnit BlockFormattingContext::MarginCollapse::collapsedMarginAfterFromLastChild(const LayoutState& layoutState, const Box& layoutBox) > { > ASSERT(layoutBox.isBlockLevelBox()); > >@@ -174,7 +174,7 @@ LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginAfte > return marginValue(computedNonCollapsedMarginAfter(layoutState, lastInFlowChild), collapsedMarginAfterFromLastChild(layoutState, lastInFlowChild)); > } > >-bool BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter(const LayoutState& layoutState, const Box& layoutBox) >+bool BlockFormattingContext::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 >@@ -192,7 +192,7 @@ bool BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWith > return false; > } > >-bool BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore(const LayoutState& layoutState, const Box& layoutBox) >+bool BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore(const LayoutState& layoutState, const Box& layoutBox) > { > // The first inflow child could propagate its top margin to parent. > // https://www.w3.org/TR/CSS21/box.html#collapsing-margins >@@ -238,7 +238,7 @@ bool BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWith > return true; > } > >-bool BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance(const LayoutState& layoutState, const Box& layoutBox) >+bool BlockFormattingContext::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. >@@ -254,7 +254,7 @@ bool BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithS > return false; > } > >-bool BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginBefore(const LayoutState& layoutState, const Box& layoutBox) >+bool BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginBefore(const LayoutState& layoutState, const Box& layoutBox) > { > // 1. This is the first in-flow child and its margins collapse through and the margin before collapses with parent's margin before or > // 2. This box's margin before collapses with the previous sibling's margin after and that sibling collapses through and >@@ -272,7 +272,7 @@ bool BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithP > return false; > } > >-bool BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginAfter(const LayoutState& layoutState, const Box& layoutBox) >+bool BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginAfter(const LayoutState& layoutState, const Box& layoutBox) > { > if (layoutBox.isAnonymous()) > return false; >@@ -324,7 +324,7 @@ bool BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithP > return true; > } > >-bool BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithPreviousSibling(const Box& layoutBox) >+bool BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSibling(const Box& layoutBox) > { > ASSERT(layoutBox.isBlockLevelBox()); > >@@ -354,7 +354,7 @@ bool BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWith > return true; > } > >-bool BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithNextSibling(const Box& layoutBox) >+bool BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithNextSibling(const Box& layoutBox) > { > ASSERT(layoutBox.isBlockLevelBox()); > >@@ -364,7 +364,7 @@ bool BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithN > return marginBeforeCollapsesWithPreviousSibling(*layoutBox.nextInFlowSibling()); > } > >-bool BlockFormattingContext::Geometry::MarginCollapse::marginsCollapseThrough(const LayoutState& layoutState, const Box& layoutBox) >+bool BlockFormattingContext::MarginCollapse::marginsCollapseThrough(const LayoutState& layoutState, const Box& layoutBox) > { > ASSERT(layoutBox.isBlockLevelBox()); > >@@ -400,7 +400,7 @@ bool BlockFormattingContext::Geometry::MarginCollapse::marginsCollapseThrough(co > return true; > } > >-LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::marginBefore(const LayoutState& layoutState, const Box& layoutBox) >+LayoutUnit BlockFormattingContext::MarginCollapse::marginBefore(const LayoutState& layoutState, const Box& layoutBox) > { > if (layoutBox.isAnonymous()) > return 0; >@@ -435,7 +435,7 @@ LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::marginBefore(const > return marginValue(marginBefore, previousSiblingMarginAfter); > } > >-LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::marginAfter(const LayoutState& layoutState, const Box& layoutBox) >+LayoutUnit BlockFormattingContext::MarginCollapse::marginAfter(const LayoutState& layoutState, const Box& layoutBox) > { > if (layoutBox.isAnonymous()) > return 0;
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 193181
: 358468