SVG pair properties must be detached from their owner before it's deleted
authorsaid@apple.com <said@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Nov 2019 00:14:40 +0000 (00:14 +0000)
committersaid@apple.com <said@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Nov 2019 00:14:40 +0000 (00:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=203545

Reviewed by Simon Fraser.

Source/WebCore:

SVGAnimatedPropertyPairAccessor needs to override its detach() method so
each of its pair properties detaches itself from the owner.
SVGPointerMemberAccessor does the same thing but for a single property
which covers all the list properties as well.

Test: svg/custom/pair-properties-detach.html

* svg/properties/SVGAnimatedPropertyPairAccessor.h:

LayoutTests:

* svg/custom/pair-properties-detach-expected.txt: Added.
* svg/custom/pair-properties-detach.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/svg/custom/pair-properties-detach-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/pair-properties-detach.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/svg/properties/SVGAnimatedPropertyPairAccessor.h

index 6a6d11e..625083b 100644 (file)
@@ -1,3 +1,13 @@
+2019-11-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        SVG pair properties must be detached from their owner before it's deleted
+        https://bugs.webkit.org/show_bug.cgi?id=203545
+
+        Reviewed by Simon Fraser.
+
+        * svg/custom/pair-properties-detach-expected.txt: Added.
+        * svg/custom/pair-properties-detach.html: Added.
+
 2019-11-01  Eric Carlson  <eric.carlson@apple.com>
 
         Add experimental TextTrackCue API
diff --git a/LayoutTests/svg/custom/pair-properties-detach-expected.txt b/LayoutTests/svg/custom/pair-properties-detach-expected.txt
new file mode 100644 (file)
index 0000000..32711d4
--- /dev/null
@@ -0,0 +1,13 @@
+This test checks detaching the SVG pair properties from the owner element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS angle.baseVal.value = 100 is 100
+PASS type.baseVal = SVGMarkerElement.SVG_MARKER_ORIENT_AUTO is SVGMarkerElement.SVG_MARKER_ORIENT_AUTO
+PASS radiusX.baseVal = 100 is 100
+PASS orderX.baseVal = 100 is 100
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/custom/pair-properties-detach.html b/LayoutTests/svg/custom/pair-properties-detach.html
new file mode 100644 (file)
index 0000000..c0afa1f
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("This test checks detaching the SVG pair properties from the owner element.");
+
+if (window.testRunner) {
+    gc = function() { window.GCController.collect() };
+} else if (!window.gc)
+    gc = function() { };
+
+var angle = document.createElementNS("http://www.w3.org/2000/svg", "marker").orientAngle;
+var type = document.createElementNS("http://www.w3.org/2000/svg", "marker").orientType;
+var radiusX = document.createElementNS("http://www.w3.org/2000/svg", "feMorphology").radiusX;
+var orderX = document.createElementNS("http://www.w3.org/2000/svg", "feConvolveMatrix").orderX;
+
+gc();
+
+shouldBe("angle.baseVal.value = 100", "100");
+shouldBe("type.baseVal = SVGMarkerElement.SVG_MARKER_ORIENT_AUTO", "SVGMarkerElement.SVG_MARKER_ORIENT_AUTO");
+shouldBe("radiusX.baseVal = 100", "100");
+shouldBe("orderX.baseVal = 100", "100");
+
+successfullyParsed = true;
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
index 8ff9668..ae37080 100644 (file)
@@ -1,3 +1,19 @@
+2019-11-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        SVG pair properties must be detached from their owner before it's deleted
+        https://bugs.webkit.org/show_bug.cgi?id=203545
+
+        Reviewed by Simon Fraser.
+
+        SVGAnimatedPropertyPairAccessor needs to override its detach() method so
+        each of its pair properties detaches itself from the owner.
+        SVGPointerMemberAccessor does the same thing but for a single property
+        which covers all the list properties as well.
+
+        Test: svg/custom/pair-properties-detach.html
+
+        * svg/properties/SVGAnimatedPropertyPairAccessor.h:
+
 2019-11-01  Benjamin Nham  <nham@apple.com>
 
         Mark VeryLow priority requests using a request dictionary key
index 9010d8d..146e4bf 100644 (file)
@@ -58,6 +58,12 @@ protected:
     Ref<AnimatedPropertyType2>& property2(OwnerType& owner) const { return m_accessor2.property(owner); }
     const Ref<AnimatedPropertyType2>& property2(const OwnerType& owner) const { return m_accessor2.property(owner); }
 
+    void detach(const OwnerType& owner) const override
+    {
+        property1(owner)->detach();
+        property2(owner)->detach();
+    }
+
     bool matches(const OwnerType& owner, const SVGAnimatedProperty& animatedProperty) const override
     {
         return m_accessor1.matches(owner, animatedProperty) || m_accessor2.matches(owner, animatedProperty);