Title: [227963] trunk/Source/WebCore
Revision
227963
Author
[email protected]
Date
2018-02-01 07:52:33 -0800 (Thu, 01 Feb 2018)

Log Message

[RenderTreeBuilder] Move RenderTableRow::collapseAndDestroyAnonymousSiblingRows to RenderTreeBuilder
https://bugs.webkit.org/show_bug.cgi?id=182374
<rdar://problem/37102005>

Reviewed by Antti Koivisto.

It's only called from RenderTreeBuilder.

No change in functionality.

* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::collapseAndDestroyAnonymousSiblingRows): Deleted.
* rendering/RenderTableRow.h:
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
* rendering/updating/RenderTreeBuilderTable.cpp:
(WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
* rendering/updating/RenderTreeBuilderTable.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (227962 => 227963)


--- trunk/Source/WebCore/ChangeLog	2018-02-01 14:03:45 UTC (rev 227962)
+++ trunk/Source/WebCore/ChangeLog	2018-02-01 15:52:33 UTC (rev 227963)
@@ -1,3 +1,24 @@
+2018-02-01  Zalan Bujtas  <[email protected]>
+
+        [RenderTreeBuilder] Move RenderTableRow::collapseAndDestroyAnonymousSiblingRows to RenderTreeBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=182374
+        <rdar://problem/37102005>
+
+        Reviewed by Antti Koivisto.
+
+        It's only called from RenderTreeBuilder.
+
+        No change in functionality.
+
+        * rendering/RenderTableRow.cpp:
+        (WebCore::RenderTableRow::collapseAndDestroyAnonymousSiblingRows): Deleted.
+        * rendering/RenderTableRow.h:
+        * rendering/updating/RenderTreeBuilder.cpp:
+        (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
+        * rendering/updating/RenderTreeBuilderTable.cpp:
+        (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
+        * rendering/updating/RenderTreeBuilderTable.h:
+
 2018-02-01  Chris Dumez  <[email protected]>
 
         Queue a microtask when a waitUntil() promise is settled

Modified: trunk/Source/WebCore/rendering/RenderTableRow.cpp (227962 => 227963)


--- trunk/Source/WebCore/rendering/RenderTableRow.cpp	2018-02-01 14:03:45 UTC (rev 227962)
+++ trunk/Source/WebCore/rendering/RenderTableRow.cpp	2018-02-01 15:52:33 UTC (rev 227963)
@@ -240,38 +240,4 @@
     return RenderTableRow::createTableRowWithStyle(parent.document(), parent.style());
 }
 
-void RenderTableRow::collapseAndDestroyAnonymousSiblingRows()
-{
-    auto* section = this->section();
-    if (!section)
-        return;
-
-    // All siblings generated?
-    for (auto* current = section->firstRow(); current; current = current->nextRow()) {
-        if (current == this)
-            continue;
-        if (!current->isAnonymous())
-            return;
-    }
-
-    RenderTableRow* rowToInsertInto = nullptr;
-    auto* currentRow = section->firstRow();
-    while (currentRow) {
-        if (currentRow == this) {
-            currentRow = currentRow->nextRow();
-            continue;
-        }
-        if (!rowToInsertInto) {
-            rowToInsertInto = currentRow;
-            currentRow = currentRow->nextRow();
-            continue;
-        }
-        currentRow->moveAllChildrenTo(rowToInsertInto, RenderBoxModelObject::NormalizeAfterInsertion::No);
-        auto toDestroy = section->takeChild(*currentRow);
-        currentRow = currentRow->nextRow();
-    }
-    if (rowToInsertInto)
-        rowToInsertInto->setNeedsLayout();
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderTableRow.h (227962 => 227963)


--- trunk/Source/WebCore/rendering/RenderTableRow.h	2018-02-01 14:03:45 UTC (rev 227962)
+++ trunk/Source/WebCore/rendering/RenderTableRow.h	2018-02-01 15:52:33 UTC (rev 227963)
@@ -63,7 +63,7 @@
 
     bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override;
 
-    void collapseAndDestroyAnonymousSiblingRows();
+    RenderTableSection* section() const { return downcast<RenderTableSection>(parent()); }
 
 private:
     static RenderPtr<RenderTableRow> createTableRowWithStyle(Document&, const RenderStyle&);
@@ -86,8 +86,6 @@
 
     void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
 
-    RenderTableSection* section() const { return downcast<RenderTableSection>(parent()); }
-
     void firstChild() const = delete;
     void lastChild() const = delete;
     void nextSibling() const = delete;

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (227962 => 227963)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2018-02-01 14:03:45 UTC (rev 227962)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2018-02-01 15:52:33 UTC (rev 227963)
@@ -355,7 +355,7 @@
         downcast<RenderBox>(child).removeFloatingOrPositionedChildFromBlockLists();
     auto& destroyRoot = findDestroyRootIncludingAnonymous(child);
     if (is<RenderTableRow>(destroyRoot))
-        downcast<RenderTableRow>(destroyRoot).collapseAndDestroyAnonymousSiblingRows();
+        tableBuilder().collapseAndDestroyAnonymousSiblingRows(downcast<RenderTableRow>(destroyRoot));
 
     auto& destroyRootParent = *destroyRoot.parent();
     destroyRootParent.removeAndDestroyChild(destroyRoot);

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderTable.cpp (227962 => 227963)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderTable.cpp	2018-02-01 14:03:45 UTC (rev 227962)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderTable.cpp	2018-02-01 15:52:33 UTC (rev 227963)
@@ -209,4 +209,38 @@
     return false;
 }
 
+void RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows(RenderTableRow& row)
+{
+    auto* section = row.section();
+    if (!section)
+        return;
+
+    // All siblings generated?
+    for (auto* current = section->firstRow(); current; current = current->nextRow()) {
+        if (current == &row)
+            continue;
+        if (!current->isAnonymous())
+            return;
+    }
+
+    RenderTableRow* rowToInsertInto = nullptr;
+    auto* currentRow = section->firstRow();
+    while (currentRow) {
+        if (currentRow == &row) {
+            currentRow = currentRow->nextRow();
+            continue;
+        }
+        if (!rowToInsertInto) {
+            rowToInsertInto = currentRow;
+            currentRow = currentRow->nextRow();
+            continue;
+        }
+        currentRow->moveAllChildrenTo(rowToInsertInto, RenderBoxModelObject::NormalizeAfterInsertion::No);
+        auto toDestroy = section->takeChild(*currentRow);
+        currentRow = currentRow->nextRow();
+    }
+    if (rowToInsertInto)
+        rowToInsertInto->setNeedsLayout();
 }
+
+}

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderTable.h (227962 => 227963)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderTable.h	2018-02-01 14:03:45 UTC (rev 227962)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderTable.h	2018-02-01 15:52:33 UTC (rev 227963)
@@ -50,6 +50,8 @@
 
     bool childRequiresTable(const RenderElement& parent, const RenderObject& child);
 
+    void collapseAndDestroyAnonymousSiblingRows(RenderTableRow&);
+
 private:
     RenderTreeBuilder& m_builder;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to