blob: d9da3f6386b4dffe573102e18fed348b3a86aca6 [file] [log] [blame]
mjs@apple.com283503e2008-03-24 05:36:30 +00001/*
2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 Copyright (C) 2008 Apple Computer, Inc.
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21
22#include "config.h"
23
hausmann@webkit.orgaf1cc002008-03-27 21:37:33 +000024#if ENABLE(SVG_FONTS)
mjs@apple.com283503e2008-03-24 05:36:30 +000025#include "SVGAltGlyphElement.h"
26
27#include "ExceptionCode.h"
28#include "RenderInline.h"
29#include "RenderSVGTSpan.h"
hyatt@apple.com2669fd62008-03-27 01:52:55 +000030#include "SVGGlyphElement.h"
mjs@apple.com283503e2008-03-24 05:36:30 +000031#include "SVGNames.h"
hyatt@apple.com2669fd62008-03-27 01:52:55 +000032#include "XLinkNames.h"
mjs@apple.com283503e2008-03-24 05:36:30 +000033
34namespace WebCore {
35
36SVGAltGlyphElement::SVGAltGlyphElement(const QualifiedName& tagName, Document* doc)
37 : SVGTextPositioningElement(tagName, doc)
38{
39}
40
41SVGAltGlyphElement::~SVGAltGlyphElement()
42{
43}
44
darin@apple.com98a7ac62009-01-05 17:26:53 +000045void SVGAltGlyphElement::setGlyphRef(const AtomicString&, ExceptionCode& ec)
mjs@apple.com283503e2008-03-24 05:36:30 +000046{
47 ec = NO_MODIFICATION_ALLOWED_ERR;
48}
49
50const AtomicString& SVGAltGlyphElement::glyphRef() const
51{
52 return getAttribute(SVGNames::glyphRefAttr);
53}
54
darin@apple.com98a7ac62009-01-05 17:26:53 +000055void SVGAltGlyphElement::setFormat(const AtomicString&, ExceptionCode& ec)
mjs@apple.com283503e2008-03-24 05:36:30 +000056{
57 ec = NO_MODIFICATION_ALLOWED_ERR;
58}
59
60const AtomicString& SVGAltGlyphElement::format() const
61{
62 return getAttribute(SVGNames::formatAttr);
63}
64
65bool SVGAltGlyphElement::childShouldCreateRenderer(Node* child) const
66{
67 if (child->isTextNode())
68 return true;
mjs@apple.com283503e2008-03-24 05:36:30 +000069 return false;
70}
71
72RenderObject* SVGAltGlyphElement::createRenderer(RenderArena* arena, RenderStyle*)
73{
74 return new (arena) RenderSVGTSpan(this);
75}
76
hyatt@apple.com2669fd62008-03-27 01:52:55 +000077SVGGlyphElement* SVGAltGlyphElement::glyphElement() const
78{
79 Element* elt = document()->getElementById(getTarget(getAttribute(XLinkNames::hrefAttr)));
80 if (!elt || !elt->hasTagName(SVGNames::glyphTag))
81 return 0;
82 return static_cast<SVGGlyphElement*>(elt);
83}
84
mjs@apple.com283503e2008-03-24 05:36:30 +000085}
86
87#endif // ENABLE(SVG)
88
89// vim:ts=4:noet