#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
{
//
// 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();