Changeset 90560 in webkit


Ignore:
Timestamp:
Jul 7, 2011 7:18:01 AM (13 years ago)
Author:
Nikolas Zimmermann
Message:

2011-07-07 Nikolas Zimmermann <nzimmermann@rim.com>

Move remaining enums out of SVG*Element classes
https://bugs.webkit.org/show_bug.cgi?id=64075

Reviewed by Dirk Schulze.

Move remaining enums out of SVG*Element classes. This is a preparation patch for bug 63797.
Also move the SVGPropertyTraits template specializations for enum types before the class
definition in the header, otherwhise we can't use SVGPropertyTraits<FooType>::fromString/toString
in the DECLARE_ANIMATED* macros, which is needed soon.

No new tests, just refactoring.

  • rendering/svg/RenderSVGResourceGradient.cpp: (WebCore::RenderSVGResourceGradient::applyResource):
  • rendering/svg/RenderSVGResourceGradient.h:
  • rendering/svg/RenderSVGResourceMarker.cpp: (WebCore::RenderSVGResourceMarker::angle): (WebCore::RenderSVGResourceMarker::markerTransformation):
  • rendering/svg/RenderSVGResourceMarker.h: (WebCore::RenderSVGResourceMarker::markerUnits):
  • rendering/svg/RenderSVGTextPath.cpp: (WebCore::RenderSVGTextPath::RenderSVGTextPath): (WebCore::RenderSVGTextPath::exactAlignment): (WebCore::RenderSVGTextPath::stretchMethod):
  • rendering/svg/SVGRenderTreeAsText.cpp: (WebCore::operator<<): (WebCore::writeCommonGradientProperties):
  • rendering/svg/SVGTextChunkBuilder.cpp: (WebCore::SVGTextChunkBuilder::addTextChunk):
  • rendering/svg/SVGTextLayoutEngine.cpp: (WebCore::SVGTextLayoutEngine::parentDefinesTextLength): (WebCore::SVGTextLayoutEngine::beginTextPathLayout):
  • svg/GradientAttributes.h: (WebCore::GradientAttributes::GradientAttributes): (WebCore::GradientAttributes::spreadMethod): (WebCore::GradientAttributes::setSpreadMethod):
  • svg/SVGComponentTransferFunctionElement.h:
  • svg/SVGFEBlendElement.h:
  • svg/SVGFEColorMatrixElement.h:
  • svg/SVGFECompositeElement.h:
  • svg/SVGFEConvolveMatrixElement.h:
  • svg/SVGFEDisplacementMapElement.h:
  • svg/SVGFEMorphologyElement.h:
  • svg/SVGFETurbulenceElement.h:
  • svg/SVGGradientElement.cpp: (WebCore::SVGGradientElement::SVGGradientElement):
  • svg/SVGGradientElement.h:
  • svg/SVGMarkerElement.cpp: (WebCore::SVGMarkerElement::SVGMarkerElement): (WebCore::SVGMarkerElement::parseMappedAttribute): (WebCore::SVGMarkerElement::setOrientToAuto): (WebCore::SVGMarkerElement::setOrientToAngle): (WebCore::SVGMarkerElement::synchronizeOrientType): (WebCore::SVGMarkerElement::orientTypeAnimated):
  • svg/SVGMarkerElement.h:
  • svg/SVGTextContentElement.cpp: (WebCore::SVGTextContentElement::SVGTextContentElement):
  • svg/SVGTextContentElement.h:
  • svg/SVGTextPathElement.cpp: (WebCore::SVGTextPathElement::SVGTextPathElement):
  • svg/SVGTextPathElement.h:
Location:
trunk/Source/WebCore
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90558 r90560  
     12011-07-07  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Move remaining enums out of SVG*Element classes
     4        https://bugs.webkit.org/show_bug.cgi?id=64075
     5
     6        Reviewed by Dirk Schulze.
     7
     8        Move remaining enums out of SVG*Element classes. This is a preparation patch for bug 63797.
     9        Also move the SVGPropertyTraits template specializations for enum types before the class
     10        definition in the header, otherwhise we can't use SVGPropertyTraits<FooType>::fromString/toString
     11        in the DECLARE_ANIMATED* macros, which is needed soon.
     12
     13        No new tests, just refactoring.
     14
     15        * rendering/svg/RenderSVGResourceGradient.cpp:
     16        (WebCore::RenderSVGResourceGradient::applyResource):
     17        * rendering/svg/RenderSVGResourceGradient.h:
     18        * rendering/svg/RenderSVGResourceMarker.cpp:
     19        (WebCore::RenderSVGResourceMarker::angle):
     20        (WebCore::RenderSVGResourceMarker::markerTransformation):
     21        * rendering/svg/RenderSVGResourceMarker.h:
     22        (WebCore::RenderSVGResourceMarker::markerUnits):
     23        * rendering/svg/RenderSVGTextPath.cpp:
     24        (WebCore::RenderSVGTextPath::RenderSVGTextPath):
     25        (WebCore::RenderSVGTextPath::exactAlignment):
     26        (WebCore::RenderSVGTextPath::stretchMethod):
     27        * rendering/svg/SVGRenderTreeAsText.cpp:
     28        (WebCore::operator<<):
     29        (WebCore::writeCommonGradientProperties):
     30        * rendering/svg/SVGTextChunkBuilder.cpp:
     31        (WebCore::SVGTextChunkBuilder::addTextChunk):
     32        * rendering/svg/SVGTextLayoutEngine.cpp:
     33        (WebCore::SVGTextLayoutEngine::parentDefinesTextLength):
     34        (WebCore::SVGTextLayoutEngine::beginTextPathLayout):
     35        * svg/GradientAttributes.h:
     36        (WebCore::GradientAttributes::GradientAttributes):
     37        (WebCore::GradientAttributes::spreadMethod):
     38        (WebCore::GradientAttributes::setSpreadMethod):
     39        * svg/SVGComponentTransferFunctionElement.h:
     40        * svg/SVGFEBlendElement.h:
     41        * svg/SVGFEColorMatrixElement.h:
     42        * svg/SVGFECompositeElement.h:
     43        * svg/SVGFEConvolveMatrixElement.h:
     44        * svg/SVGFEDisplacementMapElement.h:
     45        * svg/SVGFEMorphologyElement.h:
     46        * svg/SVGFETurbulenceElement.h:
     47        * svg/SVGGradientElement.cpp:
     48        (WebCore::SVGGradientElement::SVGGradientElement):
     49        * svg/SVGGradientElement.h:
     50        * svg/SVGMarkerElement.cpp:
     51        (WebCore::SVGMarkerElement::SVGMarkerElement):
     52        (WebCore::SVGMarkerElement::parseMappedAttribute):
     53        (WebCore::SVGMarkerElement::setOrientToAuto):
     54        (WebCore::SVGMarkerElement::setOrientToAngle):
     55        (WebCore::SVGMarkerElement::synchronizeOrientType):
     56        (WebCore::SVGMarkerElement::orientTypeAnimated):
     57        * svg/SVGMarkerElement.h:
     58        * svg/SVGTextContentElement.cpp:
     59        (WebCore::SVGTextContentElement::SVGTextContentElement):
     60        * svg/SVGTextContentElement.h:
     61        * svg/SVGTextPathElement.cpp:
     62        (WebCore::SVGTextPathElement::SVGTextPathElement):
     63        * svg/SVGTextPathElement.h:
     64
    1652011-07-07  Ilya Tikhonovsky  <loislo@chromium.org>
    266
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp

    r89550 r90560  
    279279}
    280280
    281 GradientSpreadMethod RenderSVGResourceGradient::platformSpreadMethodFromSVGType(SVGGradientElement::SVGSpreadMethodType method) const
     281GradientSpreadMethod RenderSVGResourceGradient::platformSpreadMethodFromSVGType(SVGSpreadMethodType method) const
    282282{
    283283    switch (method) {
    284     case SVGGradientElement::SVG_SPREADMETHOD_UNKNOWN:
    285     case SVGGradientElement::SVG_SPREADMETHOD_PAD:
     284    case SVGSpreadMethodUnknown:
     285    case SVGSpreadMethodPad:
    286286        return SpreadMethodPad;
    287     case SVGGradientElement::SVG_SPREADMETHOD_REFLECT:
     287    case SVGSpreadMethodReflect:
    288288        return SpreadMethodReflect;
    289     case SVGGradientElement::SVG_SPREADMETHOD_REPEAT:
     289    case SVGSpreadMethodRepeat:
    290290        return SpreadMethodRepeat;
    291291    }
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h

    r89550 r90560  
    6262    virtual void buildGradient(GradientData*, SVGGradientElement*) const = 0;
    6363
    64     GradientSpreadMethod platformSpreadMethodFromSVGType(SVGGradientElement::SVGSpreadMethodType) const;
     64    GradientSpreadMethod platformSpreadMethodFromSVGType(SVGSpreadMethodType) const;
    6565
    6666private:
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceMarker.cpp

    r88250 r90560  
    107107
    108108    float angle = -1;
    109     if (marker->orientType() == SVGMarkerElement::SVG_MARKER_ORIENT_ANGLE)
     109    if (marker->orientType() == SVGMarkerOrientAngle)
    110110        angle = marker->orientAngle().value();
    111111
     
    119119
    120120    float markerAngle = angle();
    121     bool useStrokeWidth = (marker->markerUnits() == SVGMarkerElement::SVG_MARKERUNITS_STROKEWIDTH);
     121    bool useStrokeWidth = marker->markerUnits() == SVGMarkerUnitsStrokeWidth;
    122122
    123123    AffineTransform transform;
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceMarker.h

    r86765 r90560  
    6161    FloatPoint referencePoint() const;
    6262    float angle() const;
    63     SVGMarkerElement::SVGMarkerUnitsType markerUnits() const { return static_cast<SVGMarkerElement*>(node())->markerUnits(); }
     63    SVGMarkerUnitsType markerUnits() const { return static_cast<SVGMarkerElement*>(node())->markerUnits(); }
    6464
    6565    virtual RenderSVGResourceType resourceType() const { return s_resourceType; }
  • trunk/Source/WebCore/rendering/svg/RenderSVGTextPath.cpp

    r85617 r90560  
    3636RenderSVGTextPath::RenderSVGTextPath(Node* n)
    3737    : RenderSVGInline(n)
    38     , m_startOffset(0.0f)
     38    , m_startOffset(0)
    3939    , m_exactAlignment(true)
    4040    , m_stretchMethod(false)
     
    7070bool RenderSVGTextPath::exactAlignment() const
    7171{
    72     return static_cast<SVGTextPathElement*>(node())->spacing() == SVG_TEXTPATH_SPACINGTYPE_EXACT;
     72    return static_cast<SVGTextPathElement*>(node())->spacing() == SVGTextPathSpacingExact;
    7373}
    7474
    7575bool RenderSVGTextPath::stretchMethod() const
    7676{
    77     return static_cast<SVGTextPathElement*>(node())->method() == SVG_TEXTPATH_METHODTYPE_STRETCH;
     77    return static_cast<SVGTextPathElement*>(node())->method() == SVGTextPathMethodStretch;
    7878}
    7979
  • trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp

    r87121 r90560  
    193193}
    194194
    195 static TextStream& operator<<(TextStream& ts, const SVGMarkerElement::SVGMarkerUnitsType& markerUnit)
    196 {
    197     ts << SVGPropertyTraits<SVGMarkerElement::SVGMarkerUnitsType>::toString(markerUnit);
     195static TextStream& operator<<(TextStream& ts, const SVGMarkerUnitsType& markerUnit)
     196{
     197    ts << SVGPropertyTraits<SVGMarkerUnitsType>::toString(markerUnit);
    198198    return ts;
    199199}
     
    252252}
    253253
    254 static TextStream& operator<<(TextStream& ts, const SVGGradientElement::SVGSpreadMethodType& type)
    255 {
    256     ts << SVGPropertyTraits<SVGGradientElement::SVGSpreadMethodType>::toString(type).upper();
     254static TextStream& operator<<(TextStream& ts, const SVGSpreadMethodType& type)
     255{
     256    ts << SVGPropertyTraits<SVGSpreadMethodType>::toString(type).upper();
    257257    return ts;
    258258}
     
    501501}
    502502
    503 static inline void writeCommonGradientProperties(TextStream& ts, SVGGradientElement::SVGSpreadMethodType spreadMethod, const AffineTransform& gradientTransform, bool boundingBoxMode)
     503static inline void writeCommonGradientProperties(TextStream& ts, SVGSpreadMethodType spreadMethod, const AffineTransform& gradientTransform, bool boundingBoxMode)
    504504{
    505505    writeNameValuePair(ts, "gradientUnits", boundingBoxModeString(boundingBoxMode));
    506506
    507     if (spreadMethod != SVGGradientElement::SVG_SPREADMETHOD_PAD)
     507    if (spreadMethod != SVGSpreadMethodPad)
    508508        ts << " [spreadMethod=" << spreadMethod << "]";
    509509
  • trunk/Source/WebCore/rendering/svg/SVGTextChunkBuilder.cpp

    r86765 r90560  
    131131
    132132        switch (textContentElement->lengthAdjust()) {
    133         case SVGTextContentElement::LENGTHADJUST_UNKNOWN:
     133        case SVGLengthAdjustUnknown:
    134134            break;
    135         case SVGTextContentElement::LENGTHADJUST_SPACING:
     135        case SVGLengthAdjustSpacing:
    136136            chunkStyle |= SVGTextChunk::LengthAdjustSpacing;
    137137            break;
    138         case SVGTextContentElement::LENGTHADJUST_SPACINGANDGLYPHS:
     138        case SVGLengthAdjustSpacingAndGlyphs:
    139139            chunkStyle |= SVGTextChunk::LengthAdjustSpacingAndGlyphs;
    140140            break;
  • trunk/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp

    r86765 r90560  
    155155    RenderObject* currentParent = parent;
    156156    while (currentParent) {
    157         SVGTextContentElement* textContentElement = SVGTextContentElement::elementFromRenderer(currentParent);
    158         if (textContentElement) {
    159             SVGTextContentElement::SVGLengthAdjustType lengthAdjust = textContentElement->lengthAdjust();
    160             if (lengthAdjust == SVGTextContentElement::LENGTHADJUST_SPACING && textContentElement->specifiedTextLength().value(textContentElement) > 0)
     157        if (SVGTextContentElement* textContentElement = SVGTextContentElement::elementFromRenderer(currentParent)) {
     158            if (textContentElement->lengthAdjust() == SVGLengthAdjustSpacing && textContentElement->specifiedTextLength().value(textContentElement) > 0)
    161159                return true;
    162160        }
     
    209207
    210208    // Eventually handle textLength adjustments.
    211     SVGTextContentElement::SVGLengthAdjustType lengthAdjust = SVGTextContentElement::LENGTHADJUST_UNKNOWN;
     209    SVGLengthAdjustType lengthAdjust = SVGLengthAdjustUnknown;
    212210    float desiredTextLength = 0;
    213211
     
    220218        return;
    221219
    222     if (lengthAdjust == SVGTextContentElement::LENGTHADJUST_SPACING)
     220    if (lengthAdjust == SVGLengthAdjustSpacing)
    223221        m_textPathSpacing = (desiredTextLength - totalLength) / totalCharacters;
    224222    else
  • trunk/Source/WebCore/svg/GradientAttributes.h

    r86765 r90560  
    2929struct GradientAttributes {
    3030    GradientAttributes()
    31         : m_spreadMethod(SVGGradientElement::SVG_SPREADMETHOD_PAD)
     31        : m_spreadMethod(SVGSpreadMethodPad)
    3232        , m_boundingBoxMode(true)
    3333        , m_spreadMethodSet(false)
     
    3838    }
    3939
    40     SVGGradientElement::SVGSpreadMethodType spreadMethod() const { return m_spreadMethod; }
     40    SVGSpreadMethodType spreadMethod() const { return m_spreadMethod; }
    4141    bool boundingBoxMode() const { return m_boundingBoxMode; }
    4242    AffineTransform gradientTransform() const { return m_gradientTransform; }
    4343    const Vector<Gradient::ColorStop>& stops() const { return m_stops; }
    4444
    45     void setSpreadMethod(SVGGradientElement::SVGSpreadMethodType value)
     45    void setSpreadMethod(SVGSpreadMethodType value)
    4646    {
    4747        m_spreadMethod = value;
     
    7474private:
    7575    // Properties
    76     SVGGradientElement::SVGSpreadMethodType m_spreadMethod;
     76    SVGSpreadMethodType m_spreadMethod;
    7777    bool m_boundingBoxMode;
    7878    AffineTransform m_gradientTransform;
  • trunk/Source/WebCore/svg/SVGComponentTransferFunctionElement.h

    r87010 r90560  
    2929
    3030namespace WebCore {
    31 
    32 class SVGComponentTransferFunctionElement : public SVGElement {
    33 public:
    34     ComponentTransferFunction transferFunction() const;
    35 
    36 protected:
    37     SVGComponentTransferFunctionElement(const QualifiedName&, Document*);
    38 
    39     // FIXME: svgAttributeChanged missing.
    40     bool isSupportedAttribute(const QualifiedName&);
    41     virtual void parseMappedAttribute(Attribute*);
    42     virtual void synchronizeProperty(const QualifiedName&);
    43     virtual void fillAttributeToPropertyTypeMap();
    44     virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
    45    
    46 private:
    47     // Animated property declarations
    48     DECLARE_ANIMATED_ENUMERATION(Type, type, ComponentTransferType)
    49     DECLARE_ANIMATED_NUMBER_LIST(TableValues, tableValues)
    50     DECLARE_ANIMATED_NUMBER(Slope, slope)
    51     DECLARE_ANIMATED_NUMBER(Intercept, intercept)
    52     DECLARE_ANIMATED_NUMBER(Amplitude, amplitude)
    53     DECLARE_ANIMATED_NUMBER(Exponent, exponent)
    54     DECLARE_ANIMATED_NUMBER(Offset, offset)
    55 };
    5631
    5732template<>
     
    9671};
    9772
     73class SVGComponentTransferFunctionElement : public SVGElement {
     74public:
     75    ComponentTransferFunction transferFunction() const;
     76
     77protected:
     78    SVGComponentTransferFunctionElement(const QualifiedName&, Document*);
     79
     80    // FIXME: svgAttributeChanged missing.
     81    bool isSupportedAttribute(const QualifiedName&);
     82    virtual void parseMappedAttribute(Attribute*);
     83    virtual void synchronizeProperty(const QualifiedName&);
     84    virtual void fillAttributeToPropertyTypeMap();
     85    virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
     86   
     87private:
     88    // Animated property declarations
     89    DECLARE_ANIMATED_ENUMERATION(Type, type, ComponentTransferType)
     90    DECLARE_ANIMATED_NUMBER_LIST(TableValues, tableValues)
     91    DECLARE_ANIMATED_NUMBER(Slope, slope)
     92    DECLARE_ANIMATED_NUMBER(Intercept, intercept)
     93    DECLARE_ANIMATED_NUMBER(Amplitude, amplitude)
     94    DECLARE_ANIMATED_NUMBER(Exponent, exponent)
     95    DECLARE_ANIMATED_NUMBER(Offset, offset)
     96};
     97
    9898} // namespace WebCore
    9999
  • trunk/Source/WebCore/svg/SVGFEBlendElement.h

    r87010 r90560  
    2828
    2929namespace WebCore {
    30 
    31 class SVGFEBlendElement : public SVGFilterPrimitiveStandardAttributes {
    32 public:
    33     static PassRefPtr<SVGFEBlendElement> create(const QualifiedName&, Document*);
    34 
    35 private:
    36     SVGFEBlendElement(const QualifiedName&, Document*);
    37 
    38     bool isSupportedAttribute(const QualifiedName&);
    39     virtual void parseMappedAttribute(Attribute*);
    40     virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName);
    41     virtual void svgAttributeChanged(const QualifiedName&);
    42     virtual void synchronizeProperty(const QualifiedName&);
    43     virtual void fillAttributeToPropertyTypeMap();
    44     virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
    45     virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
    46 
    47     // Animated property declarations
    48     DECLARE_ANIMATED_STRING(In1, in1)
    49     DECLARE_ANIMATED_STRING(In2, in2)
    50     DECLARE_ANIMATED_ENUMERATION(Mode, mode, BlendModeType)
    51 };
    5230
    5331template<>
     
    9270};
    9371
     72class SVGFEBlendElement : public SVGFilterPrimitiveStandardAttributes {
     73public:
     74    static PassRefPtr<SVGFEBlendElement> create(const QualifiedName&, Document*);
     75
     76private:
     77    SVGFEBlendElement(const QualifiedName&, Document*);
     78
     79    bool isSupportedAttribute(const QualifiedName&);
     80    virtual void parseMappedAttribute(Attribute*);
     81    virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName);
     82    virtual void svgAttributeChanged(const QualifiedName&);
     83    virtual void synchronizeProperty(const QualifiedName&);
     84    virtual void fillAttributeToPropertyTypeMap();
     85    virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
     86    virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
     87
     88    // Animated property declarations
     89    DECLARE_ANIMATED_STRING(In1, in1)
     90    DECLARE_ANIMATED_STRING(In2, in2)
     91    DECLARE_ANIMATED_ENUMERATION(Mode, mode, BlendModeType)
     92};
     93
    9494} // namespace WebCore
    9595
  • trunk/Source/WebCore/svg/SVGFEColorMatrixElement.h

    r87010 r90560  
    2929
    3030namespace WebCore {
    31 
    32 class SVGFEColorMatrixElement : public SVGFilterPrimitiveStandardAttributes {
    33 public:
    34     static PassRefPtr<SVGFEColorMatrixElement> create(const QualifiedName&, Document*);
    35 
    36 private:
    37     SVGFEColorMatrixElement(const QualifiedName&, Document*);
    38 
    39     bool isSupportedAttribute(const QualifiedName&);
    40     virtual void parseMappedAttribute(Attribute*);
    41     virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
    42     virtual void svgAttributeChanged(const QualifiedName&);
    43     virtual void synchronizeProperty(const QualifiedName&);
    44     virtual void fillAttributeToPropertyTypeMap();
    45     virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
    46     virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
    47 
    48     // Animated property declarations
    49     DECLARE_ANIMATED_STRING(In1, in1)
    50     DECLARE_ANIMATED_ENUMERATION(Type, type, ColorMatrixType)
    51     DECLARE_ANIMATED_NUMBER_LIST(Values, values)
    52 };
    5331
    5432template<>
     
    8967};
    9068
     69class SVGFEColorMatrixElement : public SVGFilterPrimitiveStandardAttributes {
     70public:
     71    static PassRefPtr<SVGFEColorMatrixElement> create(const QualifiedName&, Document*);
     72
     73private:
     74    SVGFEColorMatrixElement(const QualifiedName&, Document*);
     75
     76    bool isSupportedAttribute(const QualifiedName&);
     77    virtual void parseMappedAttribute(Attribute*);
     78    virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
     79    virtual void svgAttributeChanged(const QualifiedName&);
     80    virtual void synchronizeProperty(const QualifiedName&);
     81    virtual void fillAttributeToPropertyTypeMap();
     82    virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
     83    virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
     84
     85    // Animated property declarations
     86    DECLARE_ANIMATED_STRING(In1, in1)
     87    DECLARE_ANIMATED_ENUMERATION(Type, type, ColorMatrixType)
     88    DECLARE_ANIMATED_NUMBER_LIST(Values, values)
     89};
     90
    9191} // namespace WebCore
    9292
  • trunk/Source/WebCore/svg/SVGFECompositeElement.h

    r87010 r90560  
    2929
    3030namespace WebCore {
    31 
    32 class SVGFECompositeElement : public SVGFilterPrimitiveStandardAttributes {
    33 public:
    34     static PassRefPtr<SVGFECompositeElement> create(const QualifiedName&, Document*);
    35 
    36 private:
    37     SVGFECompositeElement(const QualifiedName&, Document*);
    38 
    39     bool isSupportedAttribute(const QualifiedName&);
    40     virtual void parseMappedAttribute(Attribute*);
    41     virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
    42     virtual void svgAttributeChanged(const QualifiedName&);
    43     virtual void synchronizeProperty(const QualifiedName&);
    44     virtual void fillAttributeToPropertyTypeMap();
    45     virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
    46     virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
    47 
    48     // Animated property declarations
    49     DECLARE_ANIMATED_STRING(In1, in1)
    50     DECLARE_ANIMATED_STRING(In2, in2)
    51     DECLARE_ANIMATED_ENUMERATION(_operator, _operator, CompositeOperationType)
    52     DECLARE_ANIMATED_NUMBER(K1, k1)
    53     DECLARE_ANIMATED_NUMBER(K2, k2)
    54     DECLARE_ANIMATED_NUMBER(K3, k3)
    55     DECLARE_ANIMATED_NUMBER(K4, k4)
    56 };
    5731
    5832template<>
     
    10175};
    10276
     77class SVGFECompositeElement : public SVGFilterPrimitiveStandardAttributes {
     78public:
     79    static PassRefPtr<SVGFECompositeElement> create(const QualifiedName&, Document*);
     80
     81private:
     82    SVGFECompositeElement(const QualifiedName&, Document*);
     83
     84    bool isSupportedAttribute(const QualifiedName&);
     85    virtual void parseMappedAttribute(Attribute*);
     86    virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
     87    virtual void svgAttributeChanged(const QualifiedName&);
     88    virtual void synchronizeProperty(const QualifiedName&);
     89    virtual void fillAttributeToPropertyTypeMap();
     90    virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
     91    virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
     92
     93    // Animated property declarations
     94    DECLARE_ANIMATED_STRING(In1, in1)
     95    DECLARE_ANIMATED_STRING(In2, in2)
     96    DECLARE_ANIMATED_ENUMERATION(_operator, _operator, CompositeOperationType)
     97    DECLARE_ANIMATED_NUMBER(K1, k1)
     98    DECLARE_ANIMATED_NUMBER(K2, k2)
     99    DECLARE_ANIMATED_NUMBER(K3, k3)
     100    DECLARE_ANIMATED_NUMBER(K4, k4)
     101};
     102
    103103} // namespace WebCore
    104104
  • trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.h

    r87010 r90560  
    3131
    3232namespace WebCore {
     33
     34template<>
     35struct SVGPropertyTraits<EdgeModeType> {
     36    static EdgeModeType highestEnumValue() { return EDGEMODE_NONE; }
     37
     38    static String toString(EdgeModeType type)
     39    {
     40        switch (type) {
     41        case EDGEMODE_UNKNOWN:
     42            return emptyString();
     43        case EDGEMODE_DUPLICATE:
     44            return "duplicate";
     45        case EDGEMODE_WRAP:
     46            return "wrap";
     47        case EDGEMODE_NONE:
     48            return "none";
     49        }
     50
     51        ASSERT_NOT_REACHED();
     52        return emptyString();
     53    }
     54
     55    static EdgeModeType fromString(const String& value)
     56    {
     57        if (value == "duplicate")
     58            return EDGEMODE_DUPLICATE;
     59        if (value == "wrap")
     60            return EDGEMODE_WRAP;
     61        if (value == "none")
     62            return EDGEMODE_NONE;
     63        return EDGEMODE_UNKNOWN;
     64    }
     65};
    3366
    3467class SVGFEConvolveMatrixElement : public SVGFilterPrimitiveStandardAttributes {
     
    71104};
    72105
    73 template<>
    74 struct SVGPropertyTraits<EdgeModeType> {
    75     static EdgeModeType highestEnumValue() { return EDGEMODE_NONE; }
    76 
    77     static String toString(EdgeModeType type)
    78     {
    79         switch (type) {
    80         case EDGEMODE_UNKNOWN:
    81             return emptyString();
    82         case EDGEMODE_DUPLICATE:
    83             return "duplicate";
    84         case EDGEMODE_WRAP:
    85             return "wrap";
    86         case EDGEMODE_NONE:
    87             return "none";
    88         }
    89 
    90         ASSERT_NOT_REACHED();
    91         return emptyString();
    92     }
    93 
    94     static EdgeModeType fromString(const String& value)
    95     {
    96         if (value == "duplicate")
    97             return EDGEMODE_DUPLICATE;
    98         if (value == "wrap")
    99             return EDGEMODE_WRAP;
    100         if (value == "none")
    101             return EDGEMODE_NONE;
    102         return EDGEMODE_UNKNOWN;
    103     }
    104 };
    105 
    106106} // namespace WebCore
    107107
  • trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.h

    r87010 r90560  
    2828
    2929namespace WebCore {
    30    
    31 class SVGFEDisplacementMapElement : public SVGFilterPrimitiveStandardAttributes {
    32 public:
    33     static PassRefPtr<SVGFEDisplacementMapElement> create(const QualifiedName&, Document*);
    34 
    35     static ChannelSelectorType stringToChannel(const String&);
    36    
    37 private:
    38     SVGFEDisplacementMapElement(const QualifiedName& tagName, Document*);
    39    
    40     bool isSupportedAttribute(const QualifiedName&);
    41     virtual void parseMappedAttribute(Attribute*);
    42     virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName);
    43     virtual void svgAttributeChanged(const QualifiedName&);
    44     virtual void synchronizeProperty(const QualifiedName&);
    45     virtual void fillAttributeToPropertyTypeMap();
    46     virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
    47     virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
    48 
    49     // Animated property declarations
    50     DECLARE_ANIMATED_STRING(In1, in1)
    51     DECLARE_ANIMATED_STRING(In2, in2)
    52     DECLARE_ANIMATED_ENUMERATION(XChannelSelector, xChannelSelector, ChannelSelectorType)
    53     DECLARE_ANIMATED_ENUMERATION(YChannelSelector, yChannelSelector, ChannelSelectorType)
    54     DECLARE_ANIMATED_NUMBER(Scale, scale)
    55 };
    56 
     30 
    5731template<>
    5832struct SVGPropertyTraits<ChannelSelectorType> {
     
    9266};
    9367
     68class SVGFEDisplacementMapElement : public SVGFilterPrimitiveStandardAttributes {
     69public:
     70    static PassRefPtr<SVGFEDisplacementMapElement> create(const QualifiedName&, Document*);
     71
     72    static ChannelSelectorType stringToChannel(const String&);
     73   
     74private:
     75    SVGFEDisplacementMapElement(const QualifiedName& tagName, Document*);
     76   
     77    bool isSupportedAttribute(const QualifiedName&);
     78    virtual void parseMappedAttribute(Attribute*);
     79    virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName);
     80    virtual void svgAttributeChanged(const QualifiedName&);
     81    virtual void synchronizeProperty(const QualifiedName&);
     82    virtual void fillAttributeToPropertyTypeMap();
     83    virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
     84    virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
     85
     86    // Animated property declarations
     87    DECLARE_ANIMATED_STRING(In1, in1)
     88    DECLARE_ANIMATED_STRING(In2, in2)
     89    DECLARE_ANIMATED_ENUMERATION(XChannelSelector, xChannelSelector, ChannelSelectorType)
     90    DECLARE_ANIMATED_ENUMERATION(YChannelSelector, yChannelSelector, ChannelSelectorType)
     91    DECLARE_ANIMATED_NUMBER(Scale, scale)
     92};
     93
    9494} // namespace WebCore
    9595
  • trunk/Source/WebCore/svg/SVGFEMorphologyElement.h

    r87010 r90560  
    2929namespace WebCore {
    3030
    31 class SVGFEMorphologyElement : public SVGFilterPrimitiveStandardAttributes {
    32 public:
    33     static PassRefPtr<SVGFEMorphologyElement> create(const QualifiedName&, Document*);
    34 
    35     void setRadius(float radiusX, float radiusY);
    36 
    37 private:
    38     SVGFEMorphologyElement(const QualifiedName&, Document*);
    39 
    40     bool isSupportedAttribute(const QualifiedName&);
    41     virtual void parseMappedAttribute(Attribute*);
    42     virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
    43     virtual void svgAttributeChanged(const QualifiedName&);
    44     virtual void synchronizeProperty(const QualifiedName&);
    45     virtual void fillAttributeToPropertyTypeMap();
    46     virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
    47     virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
    48 
    49     static const AtomicString& radiusXIdentifier();
    50     static const AtomicString& radiusYIdentifier();
    51 
    52     // Animated property declarations
    53     DECLARE_ANIMATED_STRING(In1, in1)
    54     DECLARE_ANIMATED_ENUMERATION(_operator, _operator, MorphologyOperatorType)
    55     DECLARE_ANIMATED_NUMBER(RadiusX, radiusX)
    56     DECLARE_ANIMATED_NUMBER(RadiusY, radiusY)
    57 };
    58 
    5931template<>
    6032struct SVGPropertyTraits<MorphologyOperatorType> {
     
    8658};
    8759
     60class SVGFEMorphologyElement : public SVGFilterPrimitiveStandardAttributes {
     61public:
     62    static PassRefPtr<SVGFEMorphologyElement> create(const QualifiedName&, Document*);
     63
     64    void setRadius(float radiusX, float radiusY);
     65
     66private:
     67    SVGFEMorphologyElement(const QualifiedName&, Document*);
     68
     69    bool isSupportedAttribute(const QualifiedName&);
     70    virtual void parseMappedAttribute(Attribute*);
     71    virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
     72    virtual void svgAttributeChanged(const QualifiedName&);
     73    virtual void synchronizeProperty(const QualifiedName&);
     74    virtual void fillAttributeToPropertyTypeMap();
     75    virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
     76    virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
     77
     78    static const AtomicString& radiusXIdentifier();
     79    static const AtomicString& radiusYIdentifier();
     80
     81    // Animated property declarations
     82    DECLARE_ANIMATED_STRING(In1, in1)
     83    DECLARE_ANIMATED_ENUMERATION(_operator, _operator, MorphologyOperatorType)
     84    DECLARE_ANIMATED_NUMBER(RadiusX, radiusX)
     85    DECLARE_ANIMATED_NUMBER(RadiusY, radiusY)
     86};
     87
    8888} // namespace WebCore
    8989
  • trunk/Source/WebCore/svg/SVGFETurbulenceElement.h

    r87010 r90560  
    3535    SVG_STITCHTYPE_STITCH   = 1,
    3636    SVG_STITCHTYPE_NOSTITCH = 2
    37 };
    38 
    39 class SVGFETurbulenceElement : public SVGFilterPrimitiveStandardAttributes {
    40 public:
    41     static PassRefPtr<SVGFETurbulenceElement> create(const QualifiedName&, Document*);
    42 
    43 private:
    44     SVGFETurbulenceElement(const QualifiedName&, Document*);
    45 
    46     bool isSupportedAttribute(const QualifiedName&);
    47     virtual void parseMappedAttribute(Attribute*);
    48     virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName);
    49     virtual void svgAttributeChanged(const QualifiedName&);
    50     virtual void synchronizeProperty(const QualifiedName&);
    51     virtual void fillAttributeToPropertyTypeMap();
    52     virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
    53     virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
    54 
    55     static const AtomicString& baseFrequencyXIdentifier();
    56     static const AtomicString& baseFrequencyYIdentifier();
    57 
    58     // Animated property declarations
    59     DECLARE_ANIMATED_NUMBER(BaseFrequencyX, baseFrequencyX)
    60     DECLARE_ANIMATED_NUMBER(BaseFrequencyY, baseFrequencyY)
    61     DECLARE_ANIMATED_INTEGER(NumOctaves, numOctaves)
    62     DECLARE_ANIMATED_NUMBER(Seed, seed)
    63     DECLARE_ANIMATED_ENUMERATION(StitchTiles, stitchTiles, SVGStitchOptions)
    64     DECLARE_ANIMATED_ENUMERATION(Type, type, TurbulenceType)
    6537};
    6638
     
    12395};
    12496
     97class SVGFETurbulenceElement : public SVGFilterPrimitiveStandardAttributes {
     98public:
     99    static PassRefPtr<SVGFETurbulenceElement> create(const QualifiedName&, Document*);
     100
     101private:
     102    SVGFETurbulenceElement(const QualifiedName&, Document*);
     103
     104    bool isSupportedAttribute(const QualifiedName&);
     105    virtual void parseMappedAttribute(Attribute*);
     106    virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName);
     107    virtual void svgAttributeChanged(const QualifiedName&);
     108    virtual void synchronizeProperty(const QualifiedName&);
     109    virtual void fillAttributeToPropertyTypeMap();
     110    virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
     111    virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
     112
     113    static const AtomicString& baseFrequencyXIdentifier();
     114    static const AtomicString& baseFrequencyYIdentifier();
     115
     116    // Animated property declarations
     117    DECLARE_ANIMATED_NUMBER(BaseFrequencyX, baseFrequencyX)
     118    DECLARE_ANIMATED_NUMBER(BaseFrequencyY, baseFrequencyY)
     119    DECLARE_ANIMATED_INTEGER(NumOctaves, numOctaves)
     120    DECLARE_ANIMATED_NUMBER(Seed, seed)
     121    DECLARE_ANIMATED_ENUMERATION(StitchTiles, stitchTiles, SVGStitchOptions)
     122    DECLARE_ANIMATED_ENUMERATION(Type, type, TurbulenceType)
     123};
     124
    125125} // namespace WebCore
    126126
  • trunk/Source/WebCore/svg/SVGGradientElement.cpp

    r87010 r90560  
    4040
    4141// Animated property definitions
    42 DEFINE_ANIMATED_ENUMERATION(SVGGradientElement, SVGNames::spreadMethodAttr, SpreadMethod, spreadMethod, SVGGradientElement::SVGSpreadMethodType)
     42DEFINE_ANIMATED_ENUMERATION(SVGGradientElement, SVGNames::spreadMethodAttr, SpreadMethod, spreadMethod, SVGSpreadMethodType)
    4343DEFINE_ANIMATED_ENUMERATION(SVGGradientElement, SVGNames::gradientUnitsAttr, GradientUnits, gradientUnits, SVGUnitTypes::SVGUnitType)
    4444DEFINE_ANIMATED_TRANSFORM_LIST(SVGGradientElement, SVGNames::gradientTransformAttr, GradientTransform, gradientTransform)
     
    4848SVGGradientElement::SVGGradientElement(const QualifiedName& tagName, Document* document)
    4949    : SVGStyledElement(tagName, document)
    50     , m_spreadMethod(SVG_SPREADMETHOD_PAD)
     50    , m_spreadMethod(SVGSpreadMethodPad)
    5151    , m_gradientUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
    5252{
  • trunk/Source/WebCore/svg/SVGGradientElement.h

    r87010 r90560  
    3434namespace WebCore {
    3535
     36enum SVGSpreadMethodType {
     37    SVGSpreadMethodUnknown = 0,
     38    SVGSpreadMethodPad,
     39    SVGSpreadMethodReflect,
     40    SVGSpreadMethodRepeat
     41};
     42
     43template<>
     44struct SVGPropertyTraits<SVGSpreadMethodType> {
     45    static SVGSpreadMethodType highestEnumValue() { return SVGSpreadMethodRepeat; }
     46
     47    static String toString(SVGSpreadMethodType type)
     48    {
     49        switch (type) {
     50        case SVGSpreadMethodUnknown:
     51            return emptyString();
     52        case SVGSpreadMethodPad:
     53            return "pad";
     54        case SVGSpreadMethodReflect:
     55            return "reflect";
     56        case SVGSpreadMethodRepeat:
     57            return "repeat";
     58        }
     59
     60        ASSERT_NOT_REACHED();
     61        return emptyString();
     62    }
     63
     64    static SVGSpreadMethodType fromString(const String& value)
     65    {
     66        if (value == "pad")
     67            return SVGSpreadMethodPad;
     68        if (value == "reflect")
     69            return SVGSpreadMethodReflect;
     70        if (value == "repeat")
     71            return SVGSpreadMethodRepeat;
     72        return SVGSpreadMethodUnknown;
     73    }
     74};
     75
     76
    3677class SVGGradientElement : public SVGStyledElement,
    3778                           public SVGURIReference,
    3879                           public SVGExternalResourcesRequired {
    3980public:
    40     enum SVGSpreadMethodType {
    41         SVG_SPREADMETHOD_UNKNOWN = 0,
    42         SVG_SPREADMETHOD_PAD     = 1,
    43         SVG_SPREADMETHOD_REFLECT = 2,
    44         SVG_SPREADMETHOD_REPEAT  = 3
     81    enum {
     82        SVG_SPREADMETHOD_UNKNOWN = SVGSpreadMethodUnknown,
     83        SVG_SPREADMETHOD_PAD = SVGSpreadMethodReflect,
     84        SVG_SPREADMETHOD_REFLECT = SVGSpreadMethodRepeat,
     85        SVG_SPREADMETHOD_REPEAT = SVGSpreadMethodUnknown
    4586    };
    4687
     
    73114};
    74115
    75 template<>
    76 struct SVGPropertyTraits<SVGGradientElement::SVGSpreadMethodType> {
    77     static SVGGradientElement::SVGSpreadMethodType highestEnumValue() { return SVGGradientElement::SVG_SPREADMETHOD_REPEAT; }
    78 
    79     static String toString(SVGGradientElement::SVGSpreadMethodType type)
    80     {
    81         switch (type) {
    82         case SVGGradientElement::SVG_SPREADMETHOD_UNKNOWN:
    83             return emptyString();
    84         case SVGGradientElement::SVG_SPREADMETHOD_PAD:
    85             return "pad";
    86         case SVGGradientElement::SVG_SPREADMETHOD_REFLECT:
    87             return "reflect";
    88         case SVGGradientElement::SVG_SPREADMETHOD_REPEAT:
    89             return "repeat";
    90         }
    91 
    92         ASSERT_NOT_REACHED();
    93         return emptyString();
    94     }
    95 
    96     static SVGGradientElement::SVGSpreadMethodType fromString(const String& value)
    97     {
    98         if (value == "pad")
    99             return SVGGradientElement::SVG_SPREADMETHOD_PAD;
    100         if (value == "reflect")
    101             return SVGGradientElement::SVG_SPREADMETHOD_REFLECT;
    102         if (value == "repeat")
    103             return SVGGradientElement::SVG_SPREADMETHOD_REPEAT;
    104         return SVGGradientElement::SVG_SPREADMETHOD_UNKNOWN;
    105     }
    106 };
    107 
    108116} // namespace WebCore
    109117
  • trunk/Source/WebCore/svg/SVGMarkerElement.cpp

    r87010 r90560  
    3939DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::markerWidthAttr, MarkerWidth, markerWidth)
    4040DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::markerHeightAttr, MarkerHeight, markerHeight)
    41 DEFINE_ANIMATED_ENUMERATION(SVGMarkerElement, SVGNames::markerUnitsAttr, MarkerUnits, markerUnits, SVGMarkerElement::SVGMarkerUnitsType)
     41DEFINE_ANIMATED_ENUMERATION(SVGMarkerElement, SVGNames::markerUnitsAttr, MarkerUnits, markerUnits, SVGMarkerUnitsType)
    4242DEFINE_ANIMATED_ANGLE_MULTIPLE_WRAPPERS(SVGMarkerElement, SVGNames::orientAttr, orientAngleIdentifier(), OrientAngle, orientAngle)
    4343DEFINE_ANIMATED_BOOLEAN(SVGMarkerElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
     
    5151    , m_markerWidth(LengthModeWidth, "3")
    5252    , m_markerHeight(LengthModeHeight, "3")
    53     , m_markerUnits(SVG_MARKERUNITS_STROKEWIDTH)
    54     , m_orientType(SVG_MARKER_ORIENT_ANGLE)
     53    , m_markerUnits(SVGMarkerUnitsStrokeWidth)
     54    , m_orientType(SVGMarkerOrientAngle)
    5555{
    5656    // Spec: If the markerWidth/markerHeight attribute is not specified, the effect is as if a value of "3" were specified.
     
    137137        if (orientType > 0)
    138138            setOrientTypeBaseValue(orientType);
    139         if (orientType == SVG_MARKER_ORIENT_ANGLE)
     139        if (orientType == SVGMarkerOrientAngle)
    140140            setOrientAngleBaseValue(angle);
    141141        return;
     
    269269void SVGMarkerElement::setOrientToAuto()
    270270{
    271     setOrientTypeBaseValue(SVG_MARKER_ORIENT_AUTO);
     271    setOrientTypeBaseValue(SVGMarkerOrientAuto);
    272272    setOrientAngleBaseValue(SVGAngle());
    273273
     
    278278void SVGMarkerElement::setOrientToAngle(const SVGAngle& angle)
    279279{
    280     setOrientTypeBaseValue(SVG_MARKER_ORIENT_ANGLE);
     280    setOrientTypeBaseValue(SVGMarkerOrientAngle);
    281281    setOrientAngleBaseValue(angle);
    282282
     
    304304   
    305305    AtomicString value;
    306     if (m_orientType.value == SVG_MARKER_ORIENT_AUTO)
     306    if (m_orientType.value == SVGMarkerOrientAuto)
    307307        value = "auto";
    308     else if (m_orientType.value == SVG_MARKER_ORIENT_ANGLE)
     308    else if (m_orientType.value == SVGMarkerOrientAngle)
    309309        value = orientAngle().valueAsString();
    310310
     
    312312}
    313313
    314 PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerElement::SVGMarkerOrientType> > SVGMarkerElement::orientTypeAnimated()
     314PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType> > SVGMarkerElement::orientTypeAnimated()
    315315{
    316316    m_orientType.shouldSynchronize = true;
  • trunk/Source/WebCore/svg/SVGMarkerElement.h

    r87125 r90560  
    3636namespace WebCore {
    3737
     38enum SVGMarkerUnitsType {
     39    SVGMarkerUnitsUnknown = 0,
     40    SVGMarkerUnitsUserSpaceOnUse,
     41    SVGMarkerUnitsStrokeWidth
     42};
     43
     44enum SVGMarkerOrientType {
     45    SVGMarkerOrientUnknown = 0,
     46    SVGMarkerOrientAuto,
     47    SVGMarkerOrientAngle
     48};
     49
     50template<>
     51struct SVGPropertyTraits<SVGMarkerUnitsType> {
     52    static SVGMarkerUnitsType highestEnumValue() { return SVGMarkerUnitsStrokeWidth; }
     53
     54    static String toString(SVGMarkerUnitsType type)
     55    {
     56        switch (type) {
     57        case SVGMarkerUnitsUnknown:
     58            return emptyString();
     59        case SVGMarkerUnitsUserSpaceOnUse:
     60            return "userSpaceOnUse";
     61        case SVGMarkerUnitsStrokeWidth:
     62            return "strokeWidth";
     63        }
     64
     65        ASSERT_NOT_REACHED();
     66        return emptyString();
     67    }
     68
     69    static SVGMarkerUnitsType fromString(const String& value)
     70    {
     71        if (value == "userSpaceOnUse")
     72            return SVGMarkerUnitsUserSpaceOnUse;
     73        if (value == "strokeWidth")
     74            return SVGMarkerUnitsStrokeWidth;
     75        return SVGMarkerUnitsUnknown;
     76    }
     77};
     78
     79template<>
     80struct SVGPropertyTraits<SVGMarkerOrientType> {
     81    static SVGMarkerOrientType highestEnumValue() { return SVGMarkerOrientAngle; }
     82
     83    // toString is not needed, synchronizeOrientType() handles this on its own.
     84
     85    static SVGMarkerOrientType fromString(const String& value, SVGAngle& angle)
     86    {
     87        if (value == "auto")
     88            return SVGMarkerOrientAuto;
     89
     90        ExceptionCode ec = 0;
     91        angle.setValueAsString(value, ec);
     92        if (!ec)
     93            return SVGMarkerOrientAngle;
     94        return SVGMarkerOrientUnknown;
     95    }
     96};
     97
    3898class SVGMarkerElement : public SVGStyledElement,
    3999                         public SVGLangSpace,
     
    41101                         public SVGFitToViewBox {
    42102public:
    43     enum SVGMarkerUnitsType {
    44         SVG_MARKERUNITS_UNKNOWN           = 0,
    45         SVG_MARKERUNITS_USERSPACEONUSE    = 1,
    46         SVG_MARKERUNITS_STROKEWIDTH       = 2
     103    // Forward declare enumerations in the W3C naming scheme, for IDL generation.
     104    enum {
     105        SVG_MARKERUNITS_UNKNOWN = SVGMarkerUnitsUnknown,
     106        SVG_MARKERUNITS_USERSPACEONUSE = SVGMarkerUnitsUserSpaceOnUse,
     107        SVG_MARKERUNITS_STROKEWIDTH = SVGMarkerUnitsStrokeWidth
    47108    };
    48109
    49     enum SVGMarkerOrientType {
    50         SVG_MARKER_ORIENT_UNKNOWN    = 0,
    51         SVG_MARKER_ORIENT_AUTO       = 1,
    52         SVG_MARKER_ORIENT_ANGLE      = 2
     110    enum {
     111        SVG_MARKER_ORIENT_UNKNOWN = SVGMarkerOrientUnknown,
     112        SVG_MARKER_ORIENT_AUTO = SVGMarkerOrientAuto,
     113        SVG_MARKER_ORIENT_ANGLE = SVGMarkerOrientAngle
    53114    };
    54115
     
    108169};
    109170
    110 template<>
    111 struct SVGPropertyTraits<SVGMarkerElement::SVGMarkerUnitsType> {
    112     static SVGMarkerElement::SVGMarkerUnitsType highestEnumValue() { return SVGMarkerElement::SVG_MARKERUNITS_STROKEWIDTH; }
    113 
    114     static String toString(SVGMarkerElement::SVGMarkerUnitsType type)
    115     {
    116         switch (type) {
    117         case SVGMarkerElement::SVG_MARKERUNITS_UNKNOWN:
    118             return emptyString();
    119         case SVGMarkerElement::SVG_MARKERUNITS_USERSPACEONUSE:
    120             return "userSpaceOnUse";
    121         case SVGMarkerElement::SVG_MARKERUNITS_STROKEWIDTH:
    122             return "strokeWidth";
    123         }
    124 
    125         ASSERT_NOT_REACHED();
    126         return emptyString();
    127     }
    128 
    129     static SVGMarkerElement::SVGMarkerUnitsType fromString(const String& value)
    130     {
    131         if (value == "userSpaceOnUse")
    132             return SVGMarkerElement::SVG_MARKERUNITS_USERSPACEONUSE;
    133         if (value == "strokeWidth")
    134             return SVGMarkerElement::SVG_MARKERUNITS_STROKEWIDTH;
    135         return SVGMarkerElement::SVG_MARKERUNITS_UNKNOWN;
    136     }
    137 };
    138 
    139 template<>
    140 struct SVGPropertyTraits<SVGMarkerElement::SVGMarkerOrientType> {
    141     static SVGMarkerElement::SVGMarkerOrientType highestEnumValue() { return SVGMarkerElement::SVG_MARKER_ORIENT_ANGLE; }
    142 
    143     // toString is not needed, synchronizeOrientType() handles this on its own.
    144 
    145     static SVGMarkerElement::SVGMarkerOrientType fromString(const String& value, SVGAngle& angle)
    146     {
    147         if (value == "auto")
    148             return SVGMarkerElement::SVG_MARKER_ORIENT_AUTO;
    149 
    150         ExceptionCode ec = 0;
    151         angle.setValueAsString(value, ec);
    152         if (!ec)
    153             return SVGMarkerElement::SVG_MARKER_ORIENT_ANGLE;
    154         return SVGMarkerElement::SVG_MARKER_ORIENT_UNKNOWN;
    155     }
    156 };
    157 
    158171}
    159172
  • trunk/Source/WebCore/svg/SVGTextContentElement.cpp

    r90156 r90560  
    4040
    4141// Animated property definitions
    42 DEFINE_ANIMATED_ENUMERATION(SVGTextContentElement, SVGNames::lengthAdjustAttr, LengthAdjust, lengthAdjust, SVGTextContentElement::SVGLengthAdjustType)
     42DEFINE_ANIMATED_ENUMERATION(SVGTextContentElement, SVGNames::lengthAdjustAttr, LengthAdjust, lengthAdjust, SVGLengthAdjustType)
    4343DEFINE_ANIMATED_BOOLEAN(SVGTextContentElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    4444
     
    4747    , m_specifiedTextLength(LengthModeOther)
    4848    , m_textLength(LengthModeOther)
    49     , m_lengthAdjust(LENGTHADJUST_SPACING)
     49    , m_lengthAdjust(SVGLengthAdjustSpacing)
    5050{
    5151}
  • trunk/Source/WebCore/svg/SVGTextContentElement.h

    r90156 r90560  
    3333namespace WebCore {
    3434
     35enum SVGLengthAdjustType {
     36    SVGLengthAdjustUnknown,
     37    SVGLengthAdjustSpacing,
     38    SVGLengthAdjustSpacingAndGlyphs
     39};
     40
     41template<>
     42struct SVGPropertyTraits<SVGLengthAdjustType> {
     43    static SVGLengthAdjustType highestEnumValue() { return SVGLengthAdjustSpacingAndGlyphs; }
     44
     45    static String toString(SVGLengthAdjustType type)
     46    {
     47        switch (type) {
     48        case SVGLengthAdjustUnknown:
     49            return emptyString();
     50        case SVGLengthAdjustSpacing:
     51            return "spacing";
     52        case SVGLengthAdjustSpacingAndGlyphs:
     53            return "spacingAndGlyphs";
     54        }
     55
     56        ASSERT_NOT_REACHED();
     57        return emptyString();
     58    }
     59
     60    static SVGLengthAdjustType fromString(const String& value)
     61    {
     62        if (value == "spacingAndGlyphs")
     63            return SVGLengthAdjustSpacingAndGlyphs;
     64        if (value == "spacing")
     65            return SVGLengthAdjustSpacing;
     66        return SVGLengthAdjustUnknown;
     67    }
     68};
     69
    3570class SVGTextContentElement : public SVGStyledElement,
    3671                              public SVGTests,
     
    3873                              public SVGExternalResourcesRequired {
    3974public:
    40     enum SVGLengthAdjustType {
    41         LENGTHADJUST_UNKNOWN            = 0,
    42         LENGTHADJUST_SPACING            = 1,
    43         LENGTHADJUST_SPACINGANDGLYPHS   = 2
     75    // Forward declare enumerations in the W3C naming scheme, for IDL generation.
     76    enum {
     77        LENGTHADJUST_UNKNOWN = SVGLengthAdjustUnknown,
     78        LENGTHADJUST_SPACING = SVGLengthAdjustSpacing,
     79        LENGTHADJUST_SPACINGANDGLYPHS = SVGLengthAdjustSpacingAndGlyphs
    4480    };
    4581
     
    88124};
    89125
    90 template<>
    91 struct SVGPropertyTraits<SVGTextContentElement::SVGLengthAdjustType> {
    92     static SVGTextContentElement::SVGLengthAdjustType highestEnumValue() { return SVGTextContentElement::LENGTHADJUST_SPACINGANDGLYPHS; }
    93 
    94     static String toString(SVGTextContentElement::SVGLengthAdjustType type)
    95     {
    96         switch (type) {
    97         case SVGTextContentElement::LENGTHADJUST_UNKNOWN:
    98             return emptyString();
    99         case SVGTextContentElement::LENGTHADJUST_SPACING:
    100             return "spacing";
    101         case SVGTextContentElement::LENGTHADJUST_SPACINGANDGLYPHS:
    102             return "spacingAndGlyphs";
    103         }
    104 
    105         ASSERT_NOT_REACHED();
    106         return emptyString();
    107     }
    108 
    109     static SVGTextContentElement::SVGLengthAdjustType fromString(const String& value)
    110     {
    111         if (value == "spacingAndGlyphs")
    112             return SVGTextContentElement::LENGTHADJUST_SPACINGANDGLYPHS;
    113         if (value == "spacing")
    114             return SVGTextContentElement::LENGTHADJUST_SPACING;
    115         return SVGTextContentElement::LENGTHADJUST_UNKNOWN;
    116     }
    117 };
    118 
    119126} // namespace WebCore
    120127
  • trunk/Source/WebCore/svg/SVGTextPathElement.cpp

    r87125 r90560  
    4141    : SVGTextContentElement(tagName, document)
    4242    , m_startOffset(LengthModeOther)
    43     , m_method(SVG_TEXTPATH_METHODTYPE_ALIGN)
    44     , m_spacing(SVG_TEXTPATH_SPACINGTYPE_EXACT)
     43    , m_method(SVGTextPathMethodAlign)
     44    , m_spacing(SVGTextPathSpacingExact)
    4545{
    4646    ASSERT(hasTagName(SVGNames::textPathTag));
  • trunk/Source/WebCore/svg/SVGTextPathElement.h

    r87125 r90560  
    2929
    3030enum SVGTextPathMethodType {
    31     SVG_TEXTPATH_METHODTYPE_UNKNOWN = 0,
    32     SVG_TEXTPATH_METHODTYPE_ALIGN = 1,
    33     SVG_TEXTPATH_METHODTYPE_STRETCH = 2
     31    SVGTextPathMethodUnknown = 0,
     32    SVGTextPathMethodAlign,
     33    SVGTextPathMethodStretch
    3434};
    3535
    3636enum SVGTextPathSpacingType {
    37     SVG_TEXTPATH_SPACINGTYPE_UNKNOWN = 0,
    38     SVG_TEXTPATH_SPACINGTYPE_AUTO = 1,
    39     SVG_TEXTPATH_SPACINGTYPE_EXACT = 2
     37    SVGTextPathSpacingUnknown = 0,
     38    SVGTextPathSpacingAuto,
     39    SVGTextPathSpacingExact
    4040};
    4141
     
    4343                           public SVGURIReference {
    4444public:
    45     // Forward declare these enums in the w3c naming scheme, for IDL generation
     45    // Forward declare enumerations in the W3C naming scheme, for IDL generation.
    4646    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
     47        TEXTPATH_METHODTYPE_UNKNOWN = SVGTextPathMethodUnknown,
     48        TEXTPATH_METHODTYPE_ALIGN = SVGTextPathMethodAlign,
     49        TEXTPATH_METHODTYPE_STRETCH = SVGTextPathMethodStretch,
     50        TEXTPATH_SPACINGTYPE_UNKNOWN = SVGTextPathSpacingUnknown,
     51        TEXTPATH_SPACINGTYPE_AUTO = SVGTextPathSpacingAuto,
     52        TEXTPATH_SPACINGTYPE_EXACT = SVGTextPathSpacingExact
    5353    };
    5454
     
    8484template<>
    8585struct SVGPropertyTraits<SVGTextPathMethodType> {
    86     static SVGTextPathMethodType highestEnumValue() { return SVG_TEXTPATH_METHODTYPE_STRETCH; }
     86    static SVGTextPathMethodType highestEnumValue() { return SVGTextPathMethodStretch; }
    8787
    8888    static String toString(SVGTextPathMethodType type)
    8989    {
    9090        switch (type) {
    91         case SVG_TEXTPATH_METHODTYPE_UNKNOWN:
     91        case SVGTextPathMethodUnknown:
    9292            return emptyString();
    93         case SVG_TEXTPATH_METHODTYPE_ALIGN:
     93        case SVGTextPathMethodAlign:
    9494            return "align";
    95         case SVG_TEXTPATH_METHODTYPE_STRETCH:
     95        case SVGTextPathMethodStretch:
    9696            return "stretch";
    9797        }
     
    104104    {
    105105        if (value == "align")
    106             return SVG_TEXTPATH_METHODTYPE_ALIGN;
     106            return SVGTextPathMethodAlign;
    107107        if (value == "stretch")
    108             return SVG_TEXTPATH_METHODTYPE_STRETCH;
    109         return SVG_TEXTPATH_METHODTYPE_UNKNOWN;
     108            return SVGTextPathMethodStretch;
     109        return SVGTextPathMethodUnknown;
    110110    }
    111111};
     
    113113template<>
    114114struct SVGPropertyTraits<SVGTextPathSpacingType> {
    115     static SVGTextPathSpacingType highestEnumValue() { return SVG_TEXTPATH_SPACINGTYPE_EXACT; }
     115    static SVGTextPathSpacingType highestEnumValue() { return SVGTextPathSpacingExact; }
    116116
    117117    static String toString(SVGTextPathSpacingType type)
    118118    {
    119119        switch (type) {
    120         case SVG_TEXTPATH_SPACINGTYPE_UNKNOWN:
     120        case SVGTextPathSpacingUnknown:
    121121            return emptyString();
    122         case SVG_TEXTPATH_SPACINGTYPE_AUTO:
     122        case SVGTextPathSpacingAuto:
    123123            return "auto";
    124         case SVG_TEXTPATH_SPACINGTYPE_EXACT:
     124        case SVGTextPathSpacingExact:
    125125            return "exact";
    126126        }
     
    133133    {
    134134        if (value == "auto")
    135             return SVG_TEXTPATH_SPACINGTYPE_AUTO;
     135            return SVGTextPathSpacingAuto;
    136136        if (value == "exact")
    137             return SVG_TEXTPATH_SPACINGTYPE_EXACT;
    138         return SVG_TEXTPATH_SPACINGTYPE_UNKNOWN;
     137            return SVGTextPathSpacingExact;
     138        return SVGTextPathSpacingUnknown;
    139139    }
    140140};
Note: See TracChangeset for help on using the changeset viewer.