⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 280830 in webkit


Ignore:
Timestamp:
Aug 10, 2021, 2:20:44 AM (5 years ago)
Author:
Adrian Perez de Castro
Message:

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

Patch by Julian Gonzalez <julian_a_gonzalez@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):

Location:
releases/WebKitGTK/webkit-2.32/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog

    r280829 r280830  
     12021-03-04  Julian Gonzalez  <julian_a_gonzalez@apple.com>
     2
     3        Deploy Ref<T> in SVGUseElement.cpp
     4        https://bugs.webkit.org/show_bug.cgi?id=222637
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Remove usage of raw pointers in a few functions here
     9        that showed issues in 222397.
     10
     11        Thanks to Darin Adler for the initial version of this patch
     12        and Ryosuke Niwa for refinements.
     13
     14        * svg/SVGUseElement.cpp:
     15        (WebCore::disassociateAndRemoveClones):
     16        (WebCore::removeDisallowedElementsFromSubtree):
     17        (WebCore::removeSymbolElementsFromSubtree):
     18
    1192021-03-04  Ryosuke Niwa  <rniwa@webkit.org>
    220
  • releases/WebKitGTK/webkit-2.32/Source/WebCore/svg/SVGUseElement.cpp

    r280804 r280830  
    310310}
    311311
    312 static inline void disassociateAndRemoveClones(const Vector<Element*>& clones)
     312static inline void disassociateAndRemoveClones(const Vector<Ref<Element>>& clones)
    313313{
    314314    for (auto& clone : clones) {
    315         for (auto& descendant : descendantsOfType<SVGElement>(*clone))
     315        for (auto& descendant : descendantsOfType<SVGElement>(clone.get()))
    316316            descendant.setCorrespondingElement(nullptr);
    317317        if (is<SVGElement>(clone))
    318             downcast<SVGElement>(*clone).setCorrespondingElement(nullptr);
    319         clone->parentNode()->removeChild(*clone);
     318            downcast<SVGElement>(clone.get()).setCorrespondingElement(nullptr);
     319        clone->remove();
    320320    }
    321321}
     
    331331    ASSERT(!subtree.isConnected());
    332332
    333     Vector<Element*> disallowedElements;
     333    Vector<Ref<Element>> disallowedElements;
    334334    for (auto it = descendantsOfType<Element>(subtree).begin(); it; ) {
    335335        if (isDisallowedElement(*it)) {
    336             disallowedElements.append(&*it);
     336            disallowedElements.append(*it);
    337337            it.traverseNextSkippingChildren();
    338338            continue;
     
    350350    // into <svg> elements, which is correct for symbol elements directly referenced by use elements,
    351351    // but incorrect for ones that just happen to be in a subtree.
    352     Vector<Element*> symbolElements;
     352    Vector<Ref<Element>> symbolElements;
    353353    for (auto it = descendantsOfType<Element>(subtree).begin(); it; ) {
    354354        if (is<SVGSymbolElement>(*it)) {
    355             symbolElements.append(&*it);
     355            symbolElements.append(*it);
    356356            it.traverseNextSkippingChildren();
    357357            continue;
Note: See TracChangeset for help on using the changeset viewer.