Title: [275705] branches/safari-611-branch/Source/WebCore
Revision
275705
Author
repst...@apple.com
Date
2021-04-08 16:57:12 -0700 (Thu, 08 Apr 2021)

Log Message

Cherry-pick r273938. rdar://problem/76411908

    Deploy Ref<T> in SVGUseElement.cpp
    https://bugs.webkit.org/show_bug.cgi?id=222637

    Patch by Julian Gonzalez <julian_a_gonza...@apple.com> on 2021-03-04
    Reviewed by Ryosuke Niwa.

    Remove usage of raw pointers in a few functions here
    that showed issues in 222397.

    Thanks to Darin Adler for the initial version of this patch
    and Ryosuke Niwa for refinements.

    * svg/SVGUseElement.cpp:
    (WebCore::disassociateAndRemoveClones):
    (WebCore::removeDisallowedElementsFromSubtree):
    (WebCore::removeSymbolElementsFromSubtree):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273938 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-611-branch/Source/WebCore/ChangeLog (275704 => 275705)


--- branches/safari-611-branch/Source/WebCore/ChangeLog	2021-04-08 23:57:09 UTC (rev 275704)
+++ branches/safari-611-branch/Source/WebCore/ChangeLog	2021-04-08 23:57:12 UTC (rev 275705)
@@ -1,5 +1,46 @@
 2021-04-08  Russell Epstein  <repst...@apple.com>
 
+        Cherry-pick r273938. rdar://problem/76411908
+
+    Deploy Ref<T> in SVGUseElement.cpp
+    https://bugs.webkit.org/show_bug.cgi?id=222637
+    
+    Patch by Julian Gonzalez <julian_a_gonza...@apple.com> on 2021-03-04
+    Reviewed by Ryosuke Niwa.
+    
+    Remove usage of raw pointers in a few functions here
+    that showed issues in 222397.
+    
+    Thanks to Darin Adler for the initial version of this patch
+    and Ryosuke Niwa for refinements.
+    
+    * svg/SVGUseElement.cpp:
+    (WebCore::disassociateAndRemoveClones):
+    (WebCore::removeDisallowedElementsFromSubtree):
+    (WebCore::removeSymbolElementsFromSubtree):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273938 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-03-04  Julian Gonzalez  <julian_a_gonza...@apple.com>
+
+            Deploy Ref<T> in SVGUseElement.cpp
+            https://bugs.webkit.org/show_bug.cgi?id=222637
+
+            Reviewed by Ryosuke Niwa.
+
+            Remove usage of raw pointers in a few functions here
+            that showed issues in 222397.
+
+            Thanks to Darin Adler for the initial version of this patch
+            and Ryosuke Niwa for refinements.
+
+            * svg/SVGUseElement.cpp:
+            (WebCore::disassociateAndRemoveClones):
+            (WebCore::removeDisallowedElementsFromSubtree):
+            (WebCore::removeSymbolElementsFromSubtree):
+
+2021-04-08  Russell Epstein  <repst...@apple.com>
+
         Cherry-pick r273935. rdar://problem/76373961
 
     "precustomized" state of custom elements can become HTMLUnknownElement

Modified: branches/safari-611-branch/Source/WebCore/svg/SVGUseElement.cpp (275704 => 275705)


--- branches/safari-611-branch/Source/WebCore/svg/SVGUseElement.cpp	2021-04-08 23:57:09 UTC (rev 275704)
+++ branches/safari-611-branch/Source/WebCore/svg/SVGUseElement.cpp	2021-04-08 23:57:12 UTC (rev 275705)
@@ -309,14 +309,14 @@
     return targetClone->renderer();
 }
 
-static inline void disassociateAndRemoveClones(const Vector<Element*>& clones)
+static inline void disassociateAndRemoveClones(const Vector<Ref<Element>>& clones)
 {
     for (auto& clone : clones) {
-        for (auto& descendant : descendantsOfType<SVGElement>(*clone))
+        for (auto& descendant : descendantsOfType<SVGElement>(clone.get()))
             descendant.setCorrespondingElement(nullptr);
         if (is<SVGElement>(clone))
-            downcast<SVGElement>(*clone).setCorrespondingElement(nullptr);
-        clone->parentNode()->removeChild(*clone);
+            downcast<SVGElement>(clone.get()).setCorrespondingElement(nullptr);
+        clone->remove();
     }
 }
 
@@ -330,10 +330,10 @@
     // Assert that it's not in a document to make sure callers are still using it this way.
     ASSERT(!subtree.isConnected());
 
-    Vector<Element*> disallowedElements;
+    Vector<Ref<Element>> disallowedElements;
     for (auto it = descendantsOfType<Element>(subtree).begin(); it; ) {
         if (isDisallowedElement(*it)) {
-            disallowedElements.append(&*it);
+            disallowedElements.append(*it);
             it.traverseNextSkippingChildren();
             continue;
         }
@@ -349,10 +349,10 @@
     // don't need to be cloned to get correct rendering. 2) expandSymbolElementsInShadowTree will turn them
     // into <svg> elements, which is correct for symbol elements directly referenced by use elements,
     // but incorrect for ones that just happen to be in a subtree.
-    Vector<Element*> symbolElements;
+    Vector<Ref<Element>> symbolElements;
     for (auto it = descendantsOfType<Element>(subtree).begin(); it; ) {
         if (is<SVGSymbolElement>(*it)) {
-            symbolElements.append(&*it);
+            symbolElements.append(*it);
             it.traverseNextSkippingChildren();
             continue;
         }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to