Changeset 244276 in webkit


Ignore:
Timestamp:
Apr 15, 2019 11:54:21 AM (5 years ago)
Author:
Said Abou-Hallawa
Message:

ASSERT fires when removing a disallowed clone from the shadow tree without reseting its corresponding element
https://bugs.webkit.org/show_bug.cgi?id=196895

Reviewed by Darin Adler.

Source/WebCore:

When cloning elements to the shadow tree of an SVGUseElement, the
corresponding element links are set from the clones to the originals.
Later some of the elements may be disallowed to exist in the shadow tree.
For example the SVGPatternElement is disallowed and has to be removed
even after cloning. The problem is the corresponding elements are not
reset to null. Usually this is not a problem because the removed elements
will be deleted and the destructor of SVGElement will reset the corresponding
element links. However in some cases, the cloned element is referenced
from another SVGElement, for example the target of a SVGTRefElement. In
this case the clone won't be deleted but it will be linked to the original
and the event listeners won't be copied from the original. When the
original is deleted, its event listeners have to be removed. The event
listeners of the clones also ave to be removed. But because the event
listeners of the original were not copied when cloning, the assertion in
SVGElement::removeEventListener() fires.

Test: svg/custom/use-disallowed-element-clear-corresponding-element.html

  • svg/SVGUseElement.cpp:

(WebCore::disassociateAndRemoveClones):

LayoutTests:

  • svg/custom/use-disallowed-element-clear-corresponding-element-expected.txt: Added.
  • svg/custom/use-disallowed-element-clear-corresponding-element.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r244269 r244276  
     12019-04-15  Said Abou-Hallawa  <said@apple.com>
     2
     3        ASSERT fires when removing a disallowed clone from the shadow tree without reseting its corresponding element
     4        https://bugs.webkit.org/show_bug.cgi?id=196895
     5
     6        Reviewed by Darin Adler.
     7
     8        * svg/custom/use-disallowed-element-clear-corresponding-element-expected.txt: Added.
     9        * svg/custom/use-disallowed-element-clear-corresponding-element.html: Added.
     10
    1112019-04-15  Devin Rousso  <drousso@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r244269 r244276  
     12019-04-15  Said Abou-Hallawa  <said@apple.com>
     2
     3        ASSERT fires when removing a disallowed clone from the shadow tree without reseting its corresponding element
     4        https://bugs.webkit.org/show_bug.cgi?id=196895
     5
     6        Reviewed by Darin Adler.
     7
     8        When cloning elements to the shadow tree of an SVGUseElement, the
     9        corresponding element links are set from the clones to the originals.
     10        Later some of the elements may be disallowed to exist in the shadow tree.
     11        For example the SVGPatternElement is disallowed and has to be removed
     12        even after cloning. The problem is the corresponding elements are not
     13        reset to null. Usually this is not a problem because the removed elements
     14        will be deleted and the destructor of SVGElement will reset the corresponding
     15        element links. However in some cases, the cloned element is referenced
     16        from another SVGElement, for example the target of a SVGTRefElement. In
     17        this case the clone won't be deleted but it will be linked to the original
     18        and the event listeners won't be copied from the original. When the
     19        original is deleted, its event listeners have to be removed. The event
     20        listeners of the clones also ave to be removed. But because the event
     21        listeners of the original were not copied when cloning, the assertion in
     22        SVGElement::removeEventListener() fires.
     23
     24        Test: svg/custom/use-disallowed-element-clear-corresponding-element.html
     25
     26        * svg/SVGUseElement.cpp:
     27        (WebCore::disassociateAndRemoveClones):
     28
    1292019-04-15  Devin Rousso  <drousso@apple.com>
    230
  • trunk/Source/WebCore/svg/SVGUseElement.cpp

    r243515 r244276  
    322322        for (auto& descendant : descendantsOfType<SVGElement>(*clone))
    323323            descendant.setCorrespondingElement(nullptr);
     324        if (is<SVGElement>(clone))
     325            downcast<SVGElement>(*clone).setCorrespondingElement(nullptr);
    324326        clone->parentNode()->removeChild(*clone);
    325327    }
Note: See TracChangeset for help on using the changeset viewer.