Title: [256160] releases/WebKitGTK/webkit-2.28/Source/WebCore
Revision
256160
Author
carlo...@webkit.org
Date
2020-02-10 05:27:05 -0800 (Mon, 10 Feb 2020)

Log Message

Merge r256106 - [LFC][BFC] Move updatePositiveNegativeMarginValues out of MarginCollapse class
https://bugs.webkit.org/show_bug.cgi?id=207445
<rdar://problem/59297879>

Reviewed by Antti Koivisto.

MarginCollapse::updatePositiveNegativeMarginValues is just a static helper.
Let's split this function so that it can be just a regular member function (move the state updating to the BlockFormattingContext caller).

* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
* layout/blockformatting/BlockFormattingContext.h:
* layout/blockformatting/BlockMarginCollapse.cpp:
(WebCore::Layout::BlockFormattingContext::MarginCollapse::resolvedPositiveNegativeMarginValues):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::updatePositiveNegativeMarginValues): Deleted.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.28/Source/WebCore/ChangeLog (256159 => 256160)


--- releases/WebKitGTK/webkit-2.28/Source/WebCore/ChangeLog	2020-02-10 13:27:01 UTC (rev 256159)
+++ releases/WebKitGTK/webkit-2.28/Source/WebCore/ChangeLog	2020-02-10 13:27:05 UTC (rev 256160)
@@ -1,3 +1,21 @@
+2020-02-09  Zalan Bujtas  <za...@apple.com>
+
+        [LFC][BFC] Move updatePositiveNegativeMarginValues out of MarginCollapse class
+        https://bugs.webkit.org/show_bug.cgi?id=207445
+        <rdar://problem/59297879>
+
+        Reviewed by Antti Koivisto.
+
+        MarginCollapse::updatePositiveNegativeMarginValues is just a static helper.
+        Let's split this function so that it can be just a regular member function (move the state updating to the BlockFormattingContext caller).
+
+        * layout/blockformatting/BlockFormattingContext.cpp:
+        (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
+        * layout/blockformatting/BlockFormattingContext.h:
+        * layout/blockformatting/BlockMarginCollapse.cpp:
+        (WebCore::Layout::BlockFormattingContext::MarginCollapse::resolvedPositiveNegativeMarginValues):
+        (WebCore::Layout::BlockFormattingContext::MarginCollapse::updatePositiveNegativeMarginValues): Deleted.
+
 2020-02-08  Simon Fraser  <simon.fra...@apple.com>
 
         Optimize Style::determineChange()

Modified: releases/WebKitGTK/webkit-2.28/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (256159 => 256160)


--- releases/WebKitGTK/webkit-2.28/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2020-02-10 13:27:01 UTC (rev 256159)
+++ releases/WebKitGTK/webkit-2.28/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2020-02-10 13:27:05 UTC (rev 256160)
@@ -432,7 +432,7 @@
     displayBox.setVerticalMargin(verticalMargin);
 
     auto marginCollapse = this->marginCollapse();
-    MarginCollapse::updatePositiveNegativeMarginValues(*this, marginCollapse, layoutBox);
+    formattingState().setPositiveAndNegativeVerticalMargin(layoutBox, marginCollapse.resolvedPositiveNegativeMarginValues(layoutBox, contentHeightAndMargin.nonCollapsedMargin));
     // Adjust the previous sibling's margin bottom now that this box's vertical margin is computed.
     MarginCollapse::updateMarginAfterForPreviousSibling(*this, marginCollapse, layoutBox);
 }

Modified: releases/WebKitGTK/webkit-2.28/Source/WebCore/layout/blockformatting/BlockFormattingContext.h (256159 => 256160)


--- releases/WebKitGTK/webkit-2.28/Source/WebCore/layout/blockformatting/BlockFormattingContext.h	2020-02-10 13:27:01 UTC (rev 256159)
+++ releases/WebKitGTK/webkit-2.28/Source/WebCore/layout/blockformatting/BlockFormattingContext.h	2020-02-10 13:27:05 UTC (rev 256160)
@@ -107,7 +107,7 @@
         PrecomputedMarginBefore precomputedMarginBefore(const Box&, UsedVerticalMargin::NonCollapsedValues);
         LayoutUnit marginBeforeIgnoringCollapsingThrough(const Box&, UsedVerticalMargin::NonCollapsedValues);
         static void updateMarginAfterForPreviousSibling(BlockFormattingContext&, const MarginCollapse&, const Box&);
-        static void updatePositiveNegativeMarginValues(BlockFormattingContext&, const MarginCollapse&, const Box&);
+        PositiveAndNegativeVerticalMargin resolvedPositiveNegativeMarginValues(const Box&, const UsedVerticalMargin::NonCollapsedValues&);
 
         bool marginBeforeCollapsesWithParentMarginBefore(const Box&) const;
         bool marginBeforeCollapsesWithFirstInFlowChildMarginBefore(const Box&) const;

Modified: releases/WebKitGTK/webkit-2.28/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp (256159 => 256160)


--- releases/WebKitGTK/webkit-2.28/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2020-02-10 13:27:01 UTC (rev 256159)
+++ releases/WebKitGTK/webkit-2.28/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2020-02-10 13:27:05 UTC (rev 256160)
@@ -593,19 +593,17 @@
     return marginValue(positiveNegativeMarginBefore(layoutBox, nonCollapsedValues)).valueOr(nonCollapsedValues.before);
 }
 
-void BlockFormattingContext::MarginCollapse::updatePositiveNegativeMarginValues(BlockFormattingContext& blockFormattingContext, const MarginCollapse& marginCollapse, const Box& layoutBox)
+PositiveAndNegativeVerticalMargin BlockFormattingContext::MarginCollapse::resolvedPositiveNegativeMarginValues(const Box& layoutBox, const UsedVerticalMargin::NonCollapsedValues& nonCollapsedValues)
 {
     ASSERT(layoutBox.isBlockLevelBox());
-    auto nonCollapsedValues = blockFormattingContext.geometryForBox(layoutBox).verticalMargin().nonCollapsedValues();
+    auto positiveNegativeMarginBefore = this->positiveNegativeMarginBefore(layoutBox, nonCollapsedValues);
+    auto positiveNegativeMarginAfter = this->positiveNegativeMarginAfter(layoutBox, nonCollapsedValues);
 
-    auto positiveNegativeMarginBefore = marginCollapse.positiveNegativeMarginBefore(layoutBox, nonCollapsedValues);
-    auto positiveNegativeMarginAfter = marginCollapse.positiveNegativeMarginAfter(layoutBox, nonCollapsedValues);
-
-    if (marginCollapse.marginsCollapseThrough(layoutBox)) {
+    if (marginsCollapseThrough(layoutBox)) {
         positiveNegativeMarginBefore = computedPositiveAndNegativeMargin(positiveNegativeMarginBefore, positiveNegativeMarginAfter);
         positiveNegativeMarginAfter = positiveNegativeMarginBefore;
     }
-    blockFormattingContext.formattingState().setPositiveAndNegativeVerticalMargin(layoutBox, { positiveNegativeMarginBefore, positiveNegativeMarginAfter });
+    return { positiveNegativeMarginBefore, positiveNegativeMarginAfter };
 }
 
 UsedVerticalMargin::CollapsedValues BlockFormattingContext::MarginCollapse::collapsedVerticalValues(const Box& layoutBox, UsedVerticalMargin::NonCollapsedValues nonCollapsedValues)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to