Upstream version 11.39.266.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / svg / SVGAltGlyphItemElement.cpp
index abe9e8d..3551601 100644 (file)
 #if ENABLE(SVG_FONTS)
 #include "core/svg/SVGAltGlyphItemElement.h"
 
+#include "core/dom/ElementTraversal.h"
 #include "core/svg/SVGGlyphRefElement.h"
 
-namespace WebCore {
+namespace blink {
 
 inline SVGAltGlyphItemElement::SVGAltGlyphItemElement(Document& document)
     : SVGElement(SVGNames::altGlyphItemTag, document)
 {
-    ScriptWrappable::init(this);
 }
 
-PassRefPtr<SVGAltGlyphItemElement> SVGAltGlyphItemElement::create(Document& document)
-{
-    return adoptRef(new SVGAltGlyphItemElement(document));
-}
+DEFINE_NODE_FACTORY(SVGAltGlyphItemElement)
 
 bool SVGAltGlyphItemElement::hasValidGlyphElements(Vector<AtomicString>& glyphNames) const
 {
@@ -47,15 +44,13 @@ bool SVGAltGlyphItemElement::hasValidGlyphElements(Vector<AtomicString>& glyphNa
     //
     // Here we fill glyphNames and return true only if all referenced glyphs are valid and
     // there is at least one glyph.
-    for (Node* child = firstChild(); child; child = child->nextSibling()) {
-        if (child->hasTagName(SVGNames::glyphRefTag)) {
-            AtomicString referredGlyphName;
-            if (toSVGGlyphRefElement(child)->hasValidGlyphElement(referredGlyphName))
-                glyphNames.append(referredGlyphName);
-            else {
-                glyphNames.clear();
-                return false;
-            }
+    for (SVGGlyphRefElement* glyph = Traversal<SVGGlyphRefElement>::firstChild(*this); glyph; glyph = Traversal<SVGGlyphRefElement>::nextSibling(*glyph)) {
+        AtomicString referredGlyphName;
+        if (glyph->hasValidGlyphElement(referredGlyphName)) {
+            glyphNames.append(referredGlyphName);
+        } else {
+            glyphNames.clear();
+            return false;
         }
     }
     return !glyphNames.isEmpty();