WebKit Bugzilla
Attachment 360079 Details for
Bug 193812
: [LFC][BFC][MarginCollapsing] Move positive/negative margin value updating to a dedicated function
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193812-20190124210547.patch (text/plain), 5.94 KB, created by
zalan
on 2019-01-24 21:05:56 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2019-01-24 21:05:56 PST
Size:
5.94 KB
patch
obsolete
>Subversion Revision: 240467 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 38a6769e4ea7ddf5e3e3f307f13f170876c21223..d158b70c90abbf9464cb213e3ca3b5c2f7a0076c 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2019-01-24 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC][BFC][MarginCollapsing] Move positive/negative margin value updating to a dedicated function >+ https://bugs.webkit.org/show_bug.cgi?id=193812 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Move update logic to BlockFormattingContext::MarginCollapse::updatePositiveNegativeMarginValues(). >+ >+ * layout/blockformatting/BlockFormattingContext.cpp: >+ (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const): >+ * layout/blockformatting/BlockFormattingContext.h: >+ * layout/blockformatting/BlockMarginCollapse.cpp: >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::updatePositiveNegativeMarginValues): >+ (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedVerticalValues): >+ * page/FrameViewLayoutContext.cpp: >+ (WebCore::layoutUsingFormattingContext): >+ > 2019-01-24 Zalan Bujtas <zalan@apple.com> > > [LFC][BFC][MarginCollapsing] Refactor MarginCollapse::updateCollapsedMarginAfter >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >index 341f0509d59b65e66470b721260330e434e9af8e..7fc4ebc358d82e9b8ecd904b4bfdd58916206837 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >@@ -431,6 +431,8 @@ void BlockFormattingContext::computeHeightAndMargin(const Box& layoutBox) const > displayBox.setTop(adjustedVerticalPositionAfterMarginCollapsing(layoutBox, verticalMargin)); > displayBox.setContentBoxHeight(heightAndMargin.height); > displayBox.setVerticalMargin(verticalMargin); >+ >+ MarginCollapse::updatePositiveNegativeMarginValues(layoutState, layoutBox); > // Adjust the previous sibling's margin bottom now that this box's vertical margin is computed. > MarginCollapse::updateMarginAfterForPreviousSibling(layoutState, layoutBox); > } >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >index e0543d14891e8db4b7c67849e01d70af2c2880c8..382b2a2e2eabd38a287dc497e68e489b54e2c8d7 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >@@ -97,6 +97,7 @@ private: > static EstimatedMarginBefore estimatedMarginBefore(const LayoutState&, const Box&); > static LayoutUnit marginBeforeIgnoringCollapsingThrough(const LayoutState&, const Box&, const UsedVerticalMargin::NonCollapsedValues&); > static void updateMarginAfterForPreviousSibling(const LayoutState&, const Box&); >+ static void updatePositiveNegativeMarginValues(const LayoutState&, const Box&); > > static bool marginBeforeCollapsesWithParentMarginBefore(const LayoutState&, const Box&); > static bool marginBeforeCollapsesWithFirstInFlowChildMarginBefore(const LayoutState&, const Box&); >diff --git a/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp b/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >index 3ca1c0bfc986571eb88e7e7b6d3bc8c342ba2769..d41405c34dc776f609e1d129ddd17bb13c08545b 100644 >--- a/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp >@@ -606,6 +606,22 @@ LayoutUnit BlockFormattingContext::MarginCollapse::marginBeforeIgnoringCollapsin > return marginValue(positiveNegativeMarginBefore(layoutState, layoutBox, nonCollapsedValues)).valueOr(nonCollapsedValues.before); > } > >+void BlockFormattingContext::MarginCollapse::updatePositiveNegativeMarginValues(const LayoutState& layoutState, const Box& layoutBox) >+{ >+ ASSERT(layoutBox.isBlockLevelBox()); >+ auto nonCollapsedValues = layoutState.displayBoxForLayoutBox(layoutBox).verticalMargin().nonCollapsedValues(); >+ >+ auto positiveNegativeMarginBefore = MarginCollapse::positiveNegativeMarginBefore(layoutState, layoutBox, nonCollapsedValues); >+ auto positiveNegativeMarginAfter = MarginCollapse::positiveNegativeMarginAfter(layoutState, layoutBox, nonCollapsedValues); >+ >+ if (MarginCollapse::marginsCollapseThrough(layoutState, layoutBox)) { >+ positiveNegativeMarginBefore = computedPositiveAndNegativeMargin(positiveNegativeMarginBefore, positiveNegativeMarginAfter); >+ positiveNegativeMarginAfter = positiveNegativeMarginBefore; >+ } >+ auto& blockFormattingState = downcast<BlockFormattingState>(layoutState.formattingStateForBox(layoutBox)); >+ blockFormattingState.setPositiveAndNegativeVerticalMargin(layoutBox, { positiveNegativeMarginBefore, positiveNegativeMarginAfter }); >+} >+ > UsedVerticalMargin::CollapsedValues BlockFormattingContext::MarginCollapse::collapsedVerticalValues(const LayoutState& layoutState, const Box& layoutBox, const UsedVerticalMargin::NonCollapsedValues& nonCollapsedValues) > { > if (layoutBox.isAnonymous()) >@@ -625,10 +641,6 @@ UsedVerticalMargin::CollapsedValues BlockFormattingContext::MarginCollapse::coll > positiveNegativeMarginAfter = positiveNegativeMarginBefore; > } > >- // FIXME: Move state saving out of this function. >- auto& blockFormattingState = downcast<BlockFormattingState>(layoutState.formattingStateForBox(layoutBox)); >- blockFormattingState.setPositiveAndNegativeVerticalMargin(layoutBox, { positiveNegativeMarginBefore, positiveNegativeMarginAfter }); >- > auto beforeMarginIsCollapsedValue = marginBeforeCollapsesWithFirstInFlowChildMarginBefore(layoutState, layoutBox) || marginBeforeCollapsesWithPreviousSiblingMarginAfter(layoutState, layoutBox); > auto afterMarginIsCollapsedValue = marginAfterCollapsesWithLastInFlowChildMarginAfter(layoutState, layoutBox); >
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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193812
: 360079