Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / svg / SVGTitleElement.cpp
index acb2fd1..bb52dbf 100644 (file)
 #include "config.h"
 #include "core/svg/SVGTitleElement.h"
 
-#include "SVGNames.h"
+#include "core/SVGNames.h"
 #include "core/dom/Document.h"
 
-namespace WebCore {
+namespace blink {
 
-inline SVGTitleElement::SVGTitleElement(const QualifiedName& tagName, Document& document)
-    : SVGElement(tagName, document)
+inline SVGTitleElement::SVGTitleElement(Document& document)
+    : SVGElement(SVGNames::titleTag, document)
 {
-    ASSERT(hasTagName(SVGNames::titleTag));
     ScriptWrappable::init(this);
 }
 
-PassRefPtr<SVGTitleElement> SVGTitleElement::create(const QualifiedName& tagName, Document& document)
-{
-    return adoptRef(new SVGTitleElement(tagName, document));
-}
+DEFINE_NODE_FACTORY(SVGTitleElement)
 
 Node::InsertionNotificationRequest SVGTitleElement::insertedInto(ContainerNode* rootParent)
 {
     SVGElement::insertedInto(rootParent);
     if (!rootParent->inDocument())
         return InsertionDone;
-    // FIXME: It's possible to register SVGTitleElement to an HTMLDocument.
-    if (firstChild())
-        document().setTitleElement(textContent(), this);
+    if (hasChildren() && document().isSVGDocument())
+        document().setTitleElement(this);
     return InsertionDone;
 }
 
 void SVGTitleElement::removedFrom(ContainerNode* rootParent)
 {
     SVGElement::removedFrom(rootParent);
-    if (rootParent->inDocument())
+    if (rootParent->inDocument() && document().isSVGDocument())
         document().removeTitle(this);
 }
 
-void SVGTitleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
+void SVGTitleElement::childrenChanged(const ChildrenChange& change)
 {
-    SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
-    if (inDocument())
-        document().setTitleElement(textContent(), this);
+    SVGElement::childrenChanged(change);
+    if (inDocument() && document().isSVGDocument())
+        document().setTitleElement(this);
 }
 
 }