Home | History | Annotate | Download | only in svg
      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 #if ENABLE(SVG)
     24 #include "SVGTextContentElement.h"
     25 
     26 #include "SVGURIReference.h"
     27 
     28 namespace WebCore {
     29 
     30 enum SVGTextPathMethodType {
     31     SVG_TEXTPATH_METHODTYPE_UNKNOWN = 0,
     32     SVG_TEXTPATH_METHODTYPE_ALIGN = 1,
     33     SVG_TEXTPATH_METHODTYPE_STRETCH = 2
     34 };
     35 
     36 enum SVGTextPathSpacingType {
     37     SVG_TEXTPATH_SPACINGTYPE_UNKNOWN = 0,
     38     SVG_TEXTPATH_SPACINGTYPE_AUTO = 1,
     39     SVG_TEXTPATH_SPACINGTYPE_EXACT = 2
     40 };
     41 
     42 class SVGTextPathElement : public SVGTextContentElement,
     43                            public SVGURIReference {
     44 public:
     45     // Forward declare these enums in the w3c naming scheme, for IDL generation
     46     enum {
     47         TEXTPATH_METHODTYPE_UNKNOWN = SVG_TEXTPATH_METHODTYPE_UNKNOWN,
     48         TEXTPATH_METHODTYPE_ALIGN = SVG_TEXTPATH_METHODTYPE_ALIGN,
     49         TEXTPATH_METHODTYPE_STRETCH = SVG_TEXTPATH_METHODTYPE_STRETCH,
     50         TEXTPATH_SPACINGTYPE_UNKNOWN = SVG_TEXTPATH_SPACINGTYPE_UNKNOWN,
     51         TEXTPATH_SPACINGTYPE_AUTO = SVG_TEXTPATH_SPACINGTYPE_AUTO,
     52         TEXTPATH_SPACINGTYPE_EXACT = SVG_TEXTPATH_SPACINGTYPE_EXACT
     53     };
     54 
     55     static PassRefPtr<SVGTextPathElement> create(const QualifiedName&, Document*);
     56 
     57 private:
     58     SVGTextPathElement(const QualifiedName&, Document*);
     59 
     60     virtual void insertedIntoDocument();
     61 
     62     virtual void parseMappedAttribute(Attribute*);
     63     virtual void svgAttributeChanged(const QualifiedName&);
     64     virtual void synchronizeProperty(const QualifiedName&);
     65     virtual void fillAttributeToPropertyTypeMap();
     66     virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
     67 
     68     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
     69     virtual bool childShouldCreateRenderer(Node*) const;
     70     virtual bool rendererIsNeeded(RenderStyle*);
     71 
     72     virtual bool selfHasRelativeLengths() const;
     73 
     74     // Animated property declarations
     75     DECLARE_ANIMATED_LENGTH(StartOffset, startOffset)
     76     DECLARE_ANIMATED_ENUMERATION(Method, method)
     77     DECLARE_ANIMATED_ENUMERATION(Spacing, spacing)
     78 
     79     // SVGURIReference
     80     DECLARE_ANIMATED_STRING(Href, href)
     81 };
     82 
     83 } // namespace WebCore
     84 
     85 #endif // ENABLE(SVG)
     86 #endif
     87