Title: [160544] trunk
Revision
160544
Author
rwlb...@webkit.org
Date
2013-12-13 06:13:26 -0800 (Fri, 13 Dec 2013)

Log Message

Clean up SVGScriptElement
https://bugs.webkit.org/show_bug.cgi?id=125527

Reviewed by Darin Adler.

Source/WebCore:

>From the Blink port of this bug it becomes clear that svg/dom/SVGScriptElement/script-set-href.svg and
svg/dom/svg-element-attribute-js-null.xhtml still hit an assert in Debug because SVGNames::typeAttr can't
be used with fastGetAttribute in all cases, because it can be animatable. However for SVGScriptElement
it is not animatable, so make isAnimatableAttribute virtual (note Debug only method) and allow typeAttr
in the SVGScriptElement case to be useable for fastGetAttribute.

Test: svg/dom/SVGScriptElement/script-type-attribute.svg

* svg/SVGElement.h:
* svg/SVGScriptElement.cpp:
(WebCore::SVGScriptElement::isAnimatableAttribute):
* svg/SVGScriptElement.h:

LayoutTests:

Add test to verify the new type getter/setter behavior on SVScriptElement.
Specifically, the old behavior was setting the JS type property did not reflect in
the actual content attribute being set, the new behavior is to do set the content
attribute when setting the JS type property.

* svg/dom/SVGScriptElement/script-type-attribute-expected.txt: Added.
* svg/dom/SVGScriptElement/script-type-attribute.svg: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (160543 => 160544)


--- trunk/LayoutTests/ChangeLog	2013-12-13 12:40:06 UTC (rev 160543)
+++ trunk/LayoutTests/ChangeLog	2013-12-13 14:13:26 UTC (rev 160544)
@@ -1,3 +1,18 @@
+2013-12-13  Rob Buis  <rob.b...@samsung.com>
+
+        Clean up SVGScriptElement
+        https://bugs.webkit.org/show_bug.cgi?id=125527
+
+        Reviewed by Darin Adler.
+
+        Add test to verify the new type getter/setter behavior on SVScriptElement.
+        Specifically, the old behavior was setting the JS type property did not reflect in
+        the actual content attribute being set, the new behavior is to do set the content
+        attribute when setting the JS type property.
+
+        * svg/dom/SVGScriptElement/script-type-attribute-expected.txt: Added.
+        * svg/dom/SVGScriptElement/script-type-attribute.svg: Added.
+
 2013-12-13  Michał Pakuła vel Rutka  <m.pak...@samsung.com>
 
         Unreviewed EFL gardening

Added: trunk/LayoutTests/svg/dom/SVGScriptElement/script-type-attribute-expected.txt (0 => 160544)


--- trunk/LayoutTests/svg/dom/SVGScriptElement/script-type-attribute-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/dom/SVGScriptElement/script-type-attribute-expected.txt	2013-12-13 14:13:26 UTC (rev 160544)
@@ -0,0 +1,3 @@
+Test that getting/setting the type JS property on SVGScriptElement keeps sync with the type content attribute.
+
+PASS

Added: trunk/LayoutTests/svg/dom/SVGScriptElement/script-type-attribute.svg (0 => 160544)


--- trunk/LayoutTests/svg/dom/SVGScriptElement/script-type-attribute.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/dom/SVGScriptElement/script-type-attribute.svg	2013-12-13 14:13:26 UTC (rev 160544)
@@ -0,0 +1,24 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xhtml="http://www.w3.org/1999/xhtml" _onload_="test()">
+<script type="text/_javascript_">
+function test() {
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+    }
+
+    var script = document.createElementNS("http://www.w3.org/2000/svg", "svg:script");
+    script.type = "text/_javascript_";
+    if (script.type != "text/_javascript_" || script.getAttribute("type") != "text/_javascript_") {
+        document.getElementById("p0").innerHTML = "FAIL";
+        return;
+    }
+
+    script.setAttribute("type", "text/fooscript");
+    if (script.type != "text/fooscript" || script.getAttribute("type") != "text/fooscript")
+        document.getElementById("p0").innerHTML = "FAIL";
+}
+</script>
+<foreignObject>
+<xhtml:p>Test that getting/setting the type JS property on SVGScriptElement keeps sync with the type content attribute.</xhtml:p>
+<xhtml:span id="p0">PASS</xhtml:span>
+</foreignObject>
+</svg>

Modified: trunk/Source/WebCore/ChangeLog (160543 => 160544)


--- trunk/Source/WebCore/ChangeLog	2013-12-13 12:40:06 UTC (rev 160543)
+++ trunk/Source/WebCore/ChangeLog	2013-12-13 14:13:26 UTC (rev 160544)
@@ -1,3 +1,23 @@
+2013-12-13  Rob Buis  <rob.b...@samsung.com>
+
+        Clean up SVGScriptElement
+        https://bugs.webkit.org/show_bug.cgi?id=125527
+
+        Reviewed by Darin Adler.
+
+        From the Blink port of this bug it becomes clear that svg/dom/SVGScriptElement/script-set-href.svg and
+        svg/dom/svg-element-attribute-js-null.xhtml still hit an assert in Debug because SVGNames::typeAttr can't
+        be used with fastGetAttribute in all cases, because it can be animatable. However for SVGScriptElement
+        it is not animatable, so make isAnimatableAttribute virtual (note Debug only method) and allow typeAttr
+        in the SVGScriptElement case to be useable for fastGetAttribute.
+
+        Test: svg/dom/SVGScriptElement/script-type-attribute.svg
+
+        * svg/SVGElement.h:
+        * svg/SVGScriptElement.cpp:
+        (WebCore::SVGScriptElement::isAnimatableAttribute):
+        * svg/SVGScriptElement.h:
+
 2013-12-13  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] Expose also webkit_dom_document_get_url

Modified: trunk/Source/WebCore/svg/SVGElement.h (160543 => 160544)


--- trunk/Source/WebCore/svg/SVGElement.h	2013-12-13 12:40:06 UTC (rev 160543)
+++ trunk/Source/WebCore/svg/SVGElement.h	2013-12-13 14:13:26 UTC (rev 160544)
@@ -123,7 +123,7 @@
     virtual void synchronizeSystemLanguage() { }
 
 #ifndef NDEBUG
-    bool isAnimatableAttribute(const QualifiedName&) const;
+    virtual bool isAnimatableAttribute(const QualifiedName&) const;
 #endif
 
     MutableStyleProperties* animatedSMILStyleProperties() const;

Modified: trunk/Source/WebCore/svg/SVGScriptElement.cpp (160543 => 160544)


--- trunk/Source/WebCore/svg/SVGScriptElement.cpp	2013-12-13 12:40:06 UTC (rev 160543)
+++ trunk/Source/WebCore/svg/SVGScriptElement.cpp	2013-12-13 14:13:26 UTC (rev 160544)
@@ -198,6 +198,16 @@
     return adoptRef(new SVGScriptElement(tagQName(), document(), false, alreadyStarted()));
 }
 
+#ifndef NDEBUG
+bool SVGScriptElement::isAnimatableAttribute(const QualifiedName& name) const
+{
+    if (name == SVGNames::typeAttr)
+        return false;
+
+    return SVGElement::isAnimatableAttribute(name);
 }
+#endif
 
+}
+
 #endif // ENABLE(SVG)

Modified: trunk/Source/WebCore/svg/SVGScriptElement.h (160543 => 160544)


--- trunk/Source/WebCore/svg/SVGScriptElement.h	2013-12-13 12:40:06 UTC (rev 160543)
+++ trunk/Source/WebCore/svg/SVGScriptElement.h	2013-12-13 14:13:26 UTC (rev 160544)
@@ -38,6 +38,9 @@
 public:
     static PassRefPtr<SVGScriptElement> create(const QualifiedName&, Document&, bool wasInsertedByParser);
 
+#ifndef NDEBUG
+    virtual bool isAnimatableAttribute(const QualifiedName&) const;
+#endif
 
 private:
     SVGScriptElement(const QualifiedName&, Document&, bool wasInsertedByParser, bool alreadyStarted);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to