mjs@apple.com | 283503e | 2008-03-24 05:36:30 +0000 | [diff] [blame] | 1 | /* |
| 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.org | af1cc00 | 2008-03-27 21:37:33 +0000 | [diff] [blame] | 24 | #if ENABLE(SVG_FONTS) |
mjs@apple.com | 283503e | 2008-03-24 05:36:30 +0000 | [diff] [blame] | 25 | #include "SVGAltGlyphElement.h" |
| 26 | |
| 27 | #include "ExceptionCode.h" |
| 28 | #include "RenderInline.h" |
| 29 | #include "RenderSVGTSpan.h" |
hyatt@apple.com | 2669fd6 | 2008-03-27 01:52:55 +0000 | [diff] [blame] | 30 | #include "SVGGlyphElement.h" |
mjs@apple.com | 283503e | 2008-03-24 05:36:30 +0000 | [diff] [blame] | 31 | #include "SVGNames.h" |
hyatt@apple.com | 2669fd6 | 2008-03-27 01:52:55 +0000 | [diff] [blame] | 32 | #include "XLinkNames.h" |
mjs@apple.com | 283503e | 2008-03-24 05:36:30 +0000 | [diff] [blame] | 33 | |
| 34 | namespace WebCore { |
| 35 | |
| 36 | SVGAltGlyphElement::SVGAltGlyphElement(const QualifiedName& tagName, Document* doc) |
| 37 | : SVGTextPositioningElement(tagName, doc) |
| 38 | { |
| 39 | } |
| 40 | |
| 41 | SVGAltGlyphElement::~SVGAltGlyphElement() |
| 42 | { |
| 43 | } |
| 44 | |
darin@apple.com | 98a7ac6 | 2009-01-05 17:26:53 +0000 | [diff] [blame] | 45 | void SVGAltGlyphElement::setGlyphRef(const AtomicString&, ExceptionCode& ec) |
mjs@apple.com | 283503e | 2008-03-24 05:36:30 +0000 | [diff] [blame] | 46 | { |
| 47 | ec = NO_MODIFICATION_ALLOWED_ERR; |
| 48 | } |
| 49 | |
| 50 | const AtomicString& SVGAltGlyphElement::glyphRef() const |
| 51 | { |
| 52 | return getAttribute(SVGNames::glyphRefAttr); |
| 53 | } |
| 54 | |
darin@apple.com | 98a7ac6 | 2009-01-05 17:26:53 +0000 | [diff] [blame] | 55 | void SVGAltGlyphElement::setFormat(const AtomicString&, ExceptionCode& ec) |
mjs@apple.com | 283503e | 2008-03-24 05:36:30 +0000 | [diff] [blame] | 56 | { |
| 57 | ec = NO_MODIFICATION_ALLOWED_ERR; |
| 58 | } |
| 59 | |
| 60 | const AtomicString& SVGAltGlyphElement::format() const |
| 61 | { |
| 62 | return getAttribute(SVGNames::formatAttr); |
| 63 | } |
| 64 | |
| 65 | bool SVGAltGlyphElement::childShouldCreateRenderer(Node* child) const |
| 66 | { |
| 67 | if (child->isTextNode()) |
| 68 | return true; |
mjs@apple.com | 283503e | 2008-03-24 05:36:30 +0000 | [diff] [blame] | 69 | return false; |
| 70 | } |
| 71 | |
| 72 | RenderObject* SVGAltGlyphElement::createRenderer(RenderArena* arena, RenderStyle*) |
| 73 | { |
| 74 | return new (arena) RenderSVGTSpan(this); |
| 75 | } |
| 76 | |
hyatt@apple.com | 2669fd6 | 2008-03-27 01:52:55 +0000 | [diff] [blame] | 77 | SVGGlyphElement* 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.com | 283503e | 2008-03-24 05:36:30 +0000 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | #endif // ENABLE(SVG) |
| 88 | |
| 89 | // vim:ts=4:noet |