Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / svg / animation / SVGSMILElement.cpp
index 2d8f9c4..aaa39d9 100644 (file)
 #include "config.h"
 #include "core/svg/animation/SVGSMILElement.h"
 
-#include "bindings/v8/ExceptionStatePlaceholder.h"
-#include "bindings/v8/ScriptEventListener.h"
+#include "bindings/core/v8/ExceptionStatePlaceholder.h"
+#include "bindings/core/v8/ScriptEventListener.h"
 #include "core/XLinkNames.h"
 #include "core/dom/Document.h"
+#include "core/events/Event.h"
 #include "core/events/EventListener.h"
 #include "core/events/EventSender.h"
+#include "core/frame/UseCounter.h"
 #include "core/svg/SVGDocumentExtensions.h"
 #include "core/svg/SVGSVGElement.h"
 #include "core/svg/SVGURIReference.h"
@@ -41,7 +43,7 @@
 #include "wtf/StdLibExtras.h"
 #include "wtf/Vector.h"
 
-namespace WebCore {
+namespace blink {
 
 class RepeatEvent FINAL : public Event {
 public:
@@ -169,6 +171,7 @@ SVGSMILElement::Condition::Condition(Type type, BeginOrEnd beginOrEnd, const Str
 
 SVGSMILElement::SVGSMILElement(const QualifiedName& tagName, Document& doc)
     : SVGElement(tagName, doc)
+    , SVGTests(this)
     , m_attributeName(anyQName())
     , m_targetElement(nullptr)
     , m_syncBaseConditionsConnected(false)
@@ -209,7 +212,7 @@ SVGSMILElement::~SVGSMILElement()
 
 void SVGSMILElement::clearResourceAndEventBaseReferences()
 {
-    document().accessSVGExtensions().removeAllTargetReferencesForElement(this);
+    removeAllOutgoingReferences();
 }
 
 void SVGSMILElement::clearConditions()
@@ -256,7 +259,7 @@ void SVGSMILElement::buildPendingResource()
     } else {
         // Register us with the target in the dependencies map. Any change of hrefElement
         // that leads to relayout/repainting now informs us, so we can react to it.
-        document().accessSVGExtensions().addElementReferencingTarget(this, svgTarget);
+        addReferenceTo(svgTarget);
     }
     connectEventBaseConditions();
 }
@@ -311,6 +314,8 @@ Node::InsertionNotificationRequest SVGSMILElement::insertedInto(ContainerNode* r
     if (!rootParent->inDocument())
         return InsertionDone;
 
+    UseCounter::count(document(), UseCounter::SVGSMILElementInDocument);
+
     setAttributeName(constructQualifiedName(this, fastGetAttribute(SVGNames::attributeNameAttr)));
     SVGSVGElement* owner = ownerSVGElement();
     if (!owner)
@@ -369,7 +374,7 @@ SMILTime SVGSMILElement::parseOffsetValue(const String& data)
         result = parse.left(parse.length() - 1).toDouble(&ok);
     else
         result = parse.toDouble(&ok);
-    if (!ok)
+    if (!ok || !SMILTime(result).isFinite())
         return SMILTime::unresolved();
     return result;
 }
@@ -405,7 +410,7 @@ SMILTime SVGSMILElement::parseClockValue(const String& data)
     } else
         return parseOffsetValue(parse);
 
-    if (!ok)
+    if (!ok || !SMILTime(result).isFinite())
         return SMILTime::unresolved();
     return result;
 }
@@ -504,6 +509,7 @@ bool SVGSMILElement::isSupportedAttribute(const QualifiedName& attrName)
 {
     DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
     if (supportedAttributes.isEmpty()) {
+        SVGTests::addSupportedAttributes(supportedAttributes);
         supportedAttributes.add(SVGNames::beginAttr);
         supportedAttributes.add(SVGNames::endAttr);
         supportedAttributes.add(SVGNames::durAttr);
@@ -541,8 +547,9 @@ void SVGSMILElement::parseAttribute(const QualifiedName& name, const AtomicStrin
         setAttributeEventListener(EventTypeNames::endEvent, createAttributeEventListener(this, name, value, eventParameterName()));
     } else if (name == SVGNames::onrepeatAttr) {
         setAttributeEventListener(EventTypeNames::repeatEvent, createAttributeEventListener(this, name, value, eventParameterName()));
-    } else
-        SVGElement::parseAttribute(name, value);
+    } else {
+        SVGElement::parseAttributeNew(name, value);
+    }
 }
 
 void SVGSMILElement::svgAttributeChanged(const QualifiedName& attrName)
@@ -639,7 +646,7 @@ void SVGSMILElement::connectEventBaseConditions()
             ASSERT(!condition->eventListener());
             condition->setEventListener(ConditionEventListener::create(this, condition));
             eventBase->addEventListener(AtomicString(condition->name()), condition->eventListener(), false);
-            document().accessSVGExtensions().addElementReferencingTarget(this, eventBase);
+            addReferenceTo(eventBase);
         }
     }
 }
@@ -1342,10 +1349,12 @@ void SVGSMILElement::Condition::trace(Visitor* visitor)
 
 void SVGSMILElement::trace(Visitor* visitor)
 {
+#if ENABLE(OILPAN)
     visitor->trace(m_targetElement);
     visitor->trace(m_timeContainer);
     visitor->trace(m_conditions);
     visitor->trace(m_syncBaseDependents);
+#endif
     SVGElement::trace(visitor);
 }