2 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef SVGTextPathElement_h
21 #define SVGTextPathElement_h
24 #include "SVGTextContentElement.h"
26 #include "SVGURIReference.h"
30 enum SVGTextPathMethodType {
31 SVGTextPathMethodUnknown = 0,
32 SVGTextPathMethodAlign,
33 SVGTextPathMethodStretch
36 enum SVGTextPathSpacingType {
37 SVGTextPathSpacingUnknown = 0,
38 SVGTextPathSpacingAuto,
39 SVGTextPathSpacingExact
43 struct SVGPropertyTraits<SVGTextPathMethodType> {
44 static SVGTextPathMethodType highestEnumValue() { return SVGTextPathMethodStretch; }
46 static String toString(SVGTextPathMethodType type)
49 case SVGTextPathMethodUnknown:
51 case SVGTextPathMethodAlign:
53 case SVGTextPathMethodStretch:
61 static SVGTextPathMethodType fromString(const String& value)
64 return SVGTextPathMethodAlign;
65 if (value == "stretch")
66 return SVGTextPathMethodStretch;
67 return SVGTextPathMethodUnknown;
72 struct SVGPropertyTraits<SVGTextPathSpacingType> {
73 static SVGTextPathSpacingType highestEnumValue() { return SVGTextPathSpacingExact; }
75 static String toString(SVGTextPathSpacingType type)
78 case SVGTextPathSpacingUnknown:
80 case SVGTextPathSpacingAuto:
82 case SVGTextPathSpacingExact:
90 static SVGTextPathSpacingType fromString(const String& value)
93 return SVGTextPathSpacingAuto;
95 return SVGTextPathSpacingExact;
96 return SVGTextPathSpacingUnknown;
100 class SVGTextPathElement : public SVGTextContentElement,
101 public SVGURIReference {
103 // Forward declare enumerations in the W3C naming scheme, for IDL generation.
105 TEXTPATH_METHODTYPE_UNKNOWN = SVGTextPathMethodUnknown,
106 TEXTPATH_METHODTYPE_ALIGN = SVGTextPathMethodAlign,
107 TEXTPATH_METHODTYPE_STRETCH = SVGTextPathMethodStretch,
108 TEXTPATH_SPACINGTYPE_UNKNOWN = SVGTextPathSpacingUnknown,
109 TEXTPATH_SPACINGTYPE_AUTO = SVGTextPathSpacingAuto,
110 TEXTPATH_SPACINGTYPE_EXACT = SVGTextPathSpacingExact
113 static PassRefPtr<SVGTextPathElement> create(const QualifiedName&, Document*);
116 SVGTextPathElement(const QualifiedName&, Document*);
118 virtual void insertedIntoDocument();
120 bool isSupportedAttribute(const QualifiedName&);
121 virtual void parseMappedAttribute(Attribute*);
122 virtual void svgAttributeChanged(const QualifiedName&);
124 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
125 virtual bool childShouldCreateRenderer(Node*) const;
126 virtual bool rendererIsNeeded(const NodeRenderingContext&);
128 virtual bool selfHasRelativeLengths() const;
130 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextPathElement)
131 DECLARE_ANIMATED_LENGTH(StartOffset, startOffset)
132 DECLARE_ANIMATED_ENUMERATION(Method, method, SVGTextPathMethodType)
133 DECLARE_ANIMATED_ENUMERATION(Spacing, spacing, SVGTextPathSpacingType)
134 DECLARE_ANIMATED_STRING(Href, href)
135 END_DECLARE_ANIMATED_PROPERTIES
138 } // namespace WebCore
140 #endif // ENABLE(SVG)