Title: [259181] trunk/Source/WebCore
Revision
259181
Author
[email protected]
Date
2020-03-29 10:29:59 -0700 (Sun, 29 Mar 2020)

Log Message

[LFC] Replace parent() calls with containingBlock() where applicable.
https://bugs.webkit.org/show_bug.cgi?id=209717

Reviewed by Antti Koivisto.

While they both return the same layout box (parent), it's more correct to call continingBlock().

* layout/blockformatting/BlockMarginCollapse.cpp:
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter const):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore const):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginBefore const):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginAfter const):
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::isOverflowVisible const):
* layout/tableformatting/TableGrid.cpp:
(WebCore::Layout::TableGrid::appendCell):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (259180 => 259181)


--- trunk/Source/WebCore/ChangeLog	2020-03-29 14:50:22 UTC (rev 259180)
+++ trunk/Source/WebCore/ChangeLog	2020-03-29 17:29:59 UTC (rev 259181)
@@ -1,5 +1,24 @@
 2020-03-29  Zalan Bujtas  <[email protected]>
 
+        [LFC] Replace parent() calls with containingBlock() where applicable.
+        https://bugs.webkit.org/show_bug.cgi?id=209717
+
+        Reviewed by Antti Koivisto.
+
+        While they both return the same layout box (parent), it's more correct to call continingBlock().
+
+        * layout/blockformatting/BlockMarginCollapse.cpp:
+        (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter const):
+        (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore const):
+        (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginBefore const):
+        (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginAfter const):
+        * layout/layouttree/LayoutBox.cpp:
+        (WebCore::Layout::Box::isOverflowVisible const):
+        * layout/tableformatting/TableGrid.cpp:
+        (WebCore::Layout::TableGrid::appendCell):
+
+2020-03-29  Zalan Bujtas  <[email protected]>
+
         [LFC] Layout::Box::parent() should return const ContainerBox&
         https://bugs.webkit.org/show_bug.cgi?id=209400
         <rdar://problem/60742432>

Modified: trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp (259180 => 259181)


--- trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2020-03-29 14:50:22 UTC (rev 259180)
+++ trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2020-03-29 17:29:59 UTC (rev 259181)
@@ -97,7 +97,7 @@
     // 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();
+    auto* lastInFlowChild = layoutBox.containingBlock().lastInFlowChild();
     for (auto* currentBox = &layoutBox; currentBox; currentBox = currentBox->nextInFlowSibling()) {
         if (!marginsCollapseThrough(*currentBox))
             return false;
@@ -132,15 +132,15 @@
     if (layoutBox.previousInFlowSibling())
         return false;
 
-    auto& parent = layoutBox.parent();
+    auto& containingBlock = layoutBox.containingBlock();
     // Margins of elements that establish new block formatting contexts do not collapse with their in-flow children
-    if (establishesBlockFormattingContext(parent))
+    if (establishesBlockFormattingContext(containingBlock))
         return false;
 
-    if (hasBorderBefore(parent))
+    if (hasBorderBefore(containingBlock))
         return false;
 
-    if (hasPaddingBefore(parent))
+    if (hasPaddingBefore(containingBlock))
         return false;
 
     // ...and the child has no clearance.
@@ -234,7 +234,7 @@
     // 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
     // we can get to the first in-flow child like that.
-    auto* firstInFlowChild = layoutBox.parent().firstInFlowChild();
+    auto* firstInFlowChild = layoutBox.containingBlock().firstInFlowChild();
     for (auto* currentBox = &layoutBox; currentBox; currentBox = currentBox->previousInFlowSibling()) {
         if (!marginsCollapseThrough(*currentBox))
             return false;
@@ -267,21 +267,21 @@
     if (layoutBox.nextInFlowSibling())
         return false;
 
-    auto& parent = layoutBox.parent();
+    auto& containingBlock = layoutBox.containingBlock();
     // Margins of elements that establish new block formatting contexts do not collapse with their in-flow children.
-    if (establishesBlockFormattingContext(parent))
+    if (establishesBlockFormattingContext(containingBlock))
         return false;
 
     // The bottom margin of an in-flow block box with a 'height' of 'auto' collapses with its last in-flow block-level child's bottom margin, if:
-    if (!parent.style().height().isAuto())
+    if (!containingBlock.style().height().isAuto())
         return false;
 
     // the box has no bottom padding, and
-    if (hasPaddingAfter(parent))
+    if (hasPaddingAfter(containingBlock))
         return false;
 
     // the box has no bottom border, and
-    if (hasBorderAfter(parent))
+    if (hasBorderAfter(containingBlock))
         return false;
 
     // the child's bottom margin neither collapses with a top margin that has clearance...
@@ -289,7 +289,7 @@
         return false;
 
     // nor (if the box's min-height is non-zero) with the box's top margin.
-    auto computedMinHeight = parent.style().logicalMinHeight();
+    auto computedMinHeight = containingBlock.style().logicalMinHeight();
     if (!computedMinHeight.isAuto() && computedMinHeight.value() && marginAfterCollapsesWithParentMarginBefore(layoutBox))
         return false;
 

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp (259180 => 259181)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2020-03-29 14:50:22 UTC (rev 259180)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2020-03-29 17:29:59 UTC (rev 259181)
@@ -352,7 +352,7 @@
     // if the value on the root element is 'visible'. The 'visible' value when used for the viewport must be interpreted as 'auto'.
     // The element from which the value is propagated must have a used value for 'overflow' of 'visible'.
     if (isBodyBox()) {
-        auto& documentBox = parent();
+        auto& documentBox = containingBlock();
         if (!documentBox.isDocumentBox())
             return isOverflowVisible;
         if (!documentBox.isOverflowVisible())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to