Title: [293981] trunk/Source/WebCore
Revision
293981
Author
[email protected]
Date
2022-05-09 10:44:14 -0700 (Mon, 09 May 2022)

Log Message

ASSERT in WebCore::RenderTreeUpdater::updateRenderTree
https://bugs.webkit.org/show_bug.cgi?id=240237

Reviewed by Antti Koivisto.

There are instances where calling findRenderingRoots() in RenderTreeUpdater::commit will
returns two rendering roots, with one of them being an ancestor of the other.

Calling updateRenderTree on the ancestor rendering root could end up removing
the renderer of the descendant rendering root.

This patch  merges findRenderingRoots() to RenderTreeUpdater::commit() which, and now we will
ignore the nested root if there is no longer a renderer when it is being processed.

* rendering/updating/RenderTreeUpdater.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (293980 => 293981)


--- trunk/Source/WebCore/ChangeLog	2022-05-09 17:32:36 UTC (rev 293980)
+++ trunk/Source/WebCore/ChangeLog	2022-05-09 17:44:14 UTC (rev 293981)
@@ -1,3 +1,21 @@
+2022-05-09  Gabriel Nava Marino  <[email protected]>
+
+        ASSERT in WebCore::RenderTreeUpdater::updateRenderTree
+        https://bugs.webkit.org/show_bug.cgi?id=240237
+
+        Reviewed by Antti Koivisto.
+
+        There are instances where calling findRenderingRoots() in RenderTreeUpdater::commit will
+        returns two rendering roots, with one of them being an ancestor of the other.
+
+        Calling updateRenderTree on the ancestor rendering root could end up removing
+        the renderer of the descendant rendering root.
+
+        This patch  merges findRenderingRoots() to RenderTreeUpdater::commit() which, and now we will
+        ignore the nested root if there is no longer a renderer when it is being processed.
+
+        * rendering/updating/RenderTreeUpdater.cpp:
+
 2022-05-09  Tyler Wilcock  <[email protected]>
 
         AXLogger::streamAXCoreObject is missing a null check for AccessibilityObject dynamicDowncast

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp (293980 => 293981)


--- trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2022-05-09 17:32:36 UTC (rev 293980)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2022-05-09 17:44:14 UTC (rev 293981)
@@ -99,18 +99,6 @@
     return nullptr;
 }
 
-static ListHashSet<ContainerNode*> findRenderingRoots(const Style::Update& update)
-{
-    ListHashSet<ContainerNode*> renderingRoots;
-    for (auto& root : update.roots()) {
-        auto* renderingRoot = findRenderingRoot(*root);
-        if (!renderingRoot)
-            continue;
-        renderingRoots.add(renderingRoot);
-    }
-    return renderingRoots;
-}
-
 void RenderTreeUpdater::commit(std::unique_ptr<const Style::Update> styleUpdate)
 {
     ASSERT(&m_document == &styleUpdate->document());
@@ -122,8 +110,12 @@
 
     m_styleUpdate = WTFMove(styleUpdate);
 
-    for (auto* root : findRenderingRoots(*m_styleUpdate))
-        updateRenderTree(*root);
+    for (auto& root : m_styleUpdate->roots()) {
+        auto* renderingRoot = findRenderingRoot(*root);
+        if (!renderingRoot)
+            continue;
+        updateRenderTree(*renderingRoot);
+    }
 
     generatedContent().updateRemainingQuotes();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to