1 /* 2 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann (at) kde.org> 3 * 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. 8 * 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. 13 * 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. 18 */ 19 20 #ifndef SVGTextPathElement_h 21 #define SVGTextPathElement_h 22 23 #include "core/SVGNames.h" 24 #include "core/svg/SVGTextContentElement.h" 25 #include "core/svg/SVGURIReference.h" 26 27 namespace WebCore { 28 29 enum SVGTextPathMethodType { 30 SVGTextPathMethodUnknown = 0, 31 SVGTextPathMethodAlign, 32 SVGTextPathMethodStretch 33 }; 34 35 enum SVGTextPathSpacingType { 36 SVGTextPathSpacingUnknown = 0, 37 SVGTextPathSpacingAuto, 38 SVGTextPathSpacingExact 39 }; 40 41 template<> const SVGEnumerationStringEntries& getStaticStringEntries<SVGTextPathMethodType>(); 42 template<> const SVGEnumerationStringEntries& getStaticStringEntries<SVGTextPathSpacingType>(); 43 44 class SVGTextPathElement FINAL : public SVGTextContentElement, 45 public SVGURIReference { 46 public: 47 // Forward declare enumerations in the W3C naming scheme, for IDL generation. 48 enum { 49 TEXTPATH_METHODTYPE_UNKNOWN = SVGTextPathMethodUnknown, 50 TEXTPATH_METHODTYPE_ALIGN = SVGTextPathMethodAlign, 51 TEXTPATH_METHODTYPE_STRETCH = SVGTextPathMethodStretch, 52 TEXTPATH_SPACINGTYPE_UNKNOWN = SVGTextPathSpacingUnknown, 53 TEXTPATH_SPACINGTYPE_AUTO = SVGTextPathSpacingAuto, 54 TEXTPATH_SPACINGTYPE_EXACT = SVGTextPathSpacingExact 55 }; 56 57 DECLARE_NODE_FACTORY(SVGTextPathElement); 58 59 SVGAnimatedLength* startOffset() const { return m_startOffset.get(); } 60 SVGAnimatedEnumeration<SVGTextPathMethodType>* method() { return m_method.get(); } 61 SVGAnimatedEnumeration<SVGTextPathSpacingType>* spacing() { return m_spacing.get(); } 62 63 private: 64 explicit SVGTextPathElement(Document&); 65 66 virtual ~SVGTextPathElement(); 67 68 void clearResourceReferences(); 69 70 virtual void buildPendingResource() OVERRIDE; 71 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; 72 virtual void removedFrom(ContainerNode*) OVERRIDE; 73 74 bool isSupportedAttribute(const QualifiedName&); 75 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; 76 virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE; 77 78 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; 79 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE; 80 81 virtual bool selfHasRelativeLengths() const OVERRIDE; 82 83 RefPtr<SVGAnimatedLength> m_startOffset; 84 RefPtr<SVGAnimatedEnumeration<SVGTextPathMethodType> > m_method; 85 RefPtr<SVGAnimatedEnumeration<SVGTextPathSpacingType> > m_spacing; 86 }; 87 88 } // namespace WebCore 89 90 #endif 91