Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / svg / SVGScriptElement.cpp
index 5563f09..5d121fa 100644 (file)
 namespace WebCore {
 
 // Animated property definitions
-DEFINE_ANIMATED_STRING(SVGScriptElement, XLinkNames::hrefAttr, Href, href)
 
 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGScriptElement)
-    REGISTER_LOCAL_ANIMATED_PROPERTY(href)
 END_REGISTER_ANIMATED_PROPERTIES
 
 inline SVGScriptElement::SVGScriptElement(Document& document, bool wasInsertedByParser, bool alreadyStarted)
     : SVGElement(SVGNames::scriptTag, document)
+    , SVGURIReference(this)
     , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired)
     , m_loader(ScriptLoader::create(this, wasInsertedByParser, alreadyStarted))
 {
@@ -73,20 +72,18 @@ void SVGScriptElement::parseAttribute(const QualifiedName& name, const AtomicStr
         return;
     }
 
-    if (name == SVGNames::typeAttr) {
-        setType(value);
+    SVGParsingError parseError = NoError;
+    if (name == SVGNames::typeAttr)
         return;
-    }
 
     if (name == HTMLNames::onerrorAttr) {
         setAttributeEventListener(EventTypeNames::error, createAttributeEventListener(this, name, value));
-        return;
+    } else if (SVGURIReference::parseAttribute(name, value, parseError)) {
+    } else {
+        ASSERT_NOT_REACHED();
     }
 
-    if (SVGURIReference::parseAttribute(name, value))
-        return;
-
-    ASSERT_NOT_REACHED();
+    reportAttributeParsingError(parseError, name, value);
 }
 
 void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName)
@@ -102,7 +99,7 @@ void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName)
         return;
 
     if (SVGURIReference::isKnownAttribute(attrName)) {
-        m_loader->handleSourceAttribute(hrefCurrentValue());
+        m_loader->handleSourceAttribute(hrefString());
         return;
     }
 
@@ -142,16 +139,6 @@ void SVGScriptElement::finishParsingChildren()
     m_loader->setHaveFiredLoadEvent(true);
 }
 
-String SVGScriptElement::type() const
-{
-    return m_type;
-}
-
-void SVGScriptElement::setType(const String& type)
-{
-    m_type = type;
-}
-
 bool SVGScriptElement::haveLoadedRequiredResources()
 {
     return m_loader->haveFiredLoadEvent();
@@ -159,7 +146,7 @@ bool SVGScriptElement::haveLoadedRequiredResources()
 
 String SVGScriptElement::sourceAttributeValue() const
 {
-    return hrefCurrentValue();
+    return hrefString();
 }
 
 String SVGScriptElement::charsetAttributeValue() const
@@ -169,7 +156,7 @@ String SVGScriptElement::charsetAttributeValue() const
 
 String SVGScriptElement::typeAttributeValue() const
 {
-    return type();
+    return getAttribute(SVGNames::typeAttr).string();
 }
 
 String SVGScriptElement::languageAttributeValue() const
@@ -199,7 +186,7 @@ bool SVGScriptElement::deferAttributeValue() const
 
 bool SVGScriptElement::hasSourceAttribute() const
 {
-    return hasAttribute(XLinkNames::hrefAttr);
+    return href()->isSpecified();
 }
 
 PassRefPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren()
@@ -212,4 +199,14 @@ void SVGScriptElement::dispatchLoadEvent()
     dispatchEvent(Event::create(EventTypeNames::load));
 }
 
+#ifndef NDEBUG
+bool SVGScriptElement::isAnimatableAttribute(const QualifiedName& name) const
+{
+    if (name == SVGNames::typeAttr)
+        return false;
+
+    return SVGElement::isAnimatableAttribute(name);
+}
+#endif
+
 }