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
23 #include "core/SVGNames.h"
24 #include "core/svg/SVGTextContentElement.h"
25 #include "core/svg/SVGURIReference.h"
29 enum SVGTextPathMethodType {
30 SVGTextPathMethodUnknown = 0,
31 SVGTextPathMethodAlign,
32 SVGTextPathMethodStretch
35 enum SVGTextPathSpacingType {
36 SVGTextPathSpacingUnknown = 0,
37 SVGTextPathSpacingAuto,
38 SVGTextPathSpacingExact
41 template<> const SVGEnumerationStringEntries& getStaticStringEntries<SVGTextPathMethodType>();
42 template<> const SVGEnumerationStringEntries& getStaticStringEntries<SVGTextPathSpacingType>();
44 class SVGTextPathElement FINAL : public SVGTextContentElement,
45 public SVGURIReference {
46 DEFINE_WRAPPERTYPEINFO();
48 // Forward declare enumerations in the W3C naming scheme, for IDL generation.
50 TEXTPATH_METHODTYPE_UNKNOWN = SVGTextPathMethodUnknown,
51 TEXTPATH_METHODTYPE_ALIGN = SVGTextPathMethodAlign,
52 TEXTPATH_METHODTYPE_STRETCH = SVGTextPathMethodStretch,
53 TEXTPATH_SPACINGTYPE_UNKNOWN = SVGTextPathSpacingUnknown,
54 TEXTPATH_SPACINGTYPE_AUTO = SVGTextPathSpacingAuto,
55 TEXTPATH_SPACINGTYPE_EXACT = SVGTextPathSpacingExact
58 DECLARE_NODE_FACTORY(SVGTextPathElement);
60 SVGAnimatedLength* startOffset() const { return m_startOffset.get(); }
61 SVGAnimatedEnumeration<SVGTextPathMethodType>* method() { return m_method.get(); }
62 SVGAnimatedEnumeration<SVGTextPathSpacingType>* spacing() { return m_spacing.get(); }
65 explicit SVGTextPathElement(Document&);
67 virtual ~SVGTextPathElement();
69 void clearResourceReferences();
71 virtual void buildPendingResource() OVERRIDE;
72 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
73 virtual void removedFrom(ContainerNode*) OVERRIDE;
75 bool isSupportedAttribute(const QualifiedName&);
76 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
77 virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
79 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
80 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE;
82 virtual bool selfHasRelativeLengths() const OVERRIDE;
84 RefPtr<SVGAnimatedLength> m_startOffset;
85 RefPtr<SVGAnimatedEnumeration<SVGTextPathMethodType> > m_method;
86 RefPtr<SVGAnimatedEnumeration<SVGTextPathSpacingType> > m_spacing;
91 #endif // SVGTextPathElement_h