diff options
author | Ben Murdoch <benm@google.com> | 2011-05-05 14:36:32 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-10 15:38:30 +0100 |
commit | f05b935882198ccf7d81675736e3aeb089c5113a (patch) | |
tree | 4ea0ca838d9ef1b15cf17ddb3928efb427c7e5a1 /WebCore/svg | |
parent | 60fbdcc62bced8db2cb1fd233cc4d1e4ea17db1b (diff) | |
download | external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.zip external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.gz external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.bz2 |
Merge WebKit at r74534: Initial merge by git.
Change-Id: I6ccd1154fa1b19c2ec2a66878eb675738735f1eb
Diffstat (limited to 'WebCore/svg')
208 files changed, 3014 insertions, 2481 deletions
diff --git a/WebCore/svg/ColorDistance.cpp b/WebCore/svg/ColorDistance.cpp index c2fd1a6..bb682b9 100644 --- a/WebCore/svg/ColorDistance.cpp +++ b/WebCore/svg/ColorDistance.cpp @@ -20,6 +20,7 @@ #include "config.h" #if ENABLE(SVG) #include "ColorDistance.h" + #include "Color.h" #include <wtf/MathExtras.h> @@ -78,7 +79,7 @@ Color ColorDistance::addToColorAndClamp(const Color& color) const bool ColorDistance::isZero() const { - return (m_redDiff == 0 && m_blueDiff == 0 && m_greenDiff == 0); + return !m_redDiff && !m_blueDiff && !m_greenDiff; } float ColorDistance::distance() const diff --git a/WebCore/svg/ColorDistance.h b/WebCore/svg/ColorDistance.h index de52df3..2c142b7 100644 --- a/WebCore/svg/ColorDistance.h +++ b/WebCore/svg/ColorDistance.h @@ -23,28 +23,28 @@ namespace WebCore { - class Color; +class Color; + +class ColorDistance { +public: + ColorDistance(); + ColorDistance(const Color& fromColor, const Color& toColor); + ColorDistance(int redDiff, int blueDiff, int greenDiff); - class ColorDistance { - public: - ColorDistance(); - ColorDistance(const Color& fromColor, const Color& toColor); - ColorDistance(int redDiff, int blueDiff, int greenDiff); - - ColorDistance scaledDistance(float scaleFactor) const; - Color addToColorAndClamp(const Color&) const; + ColorDistance scaledDistance(float scaleFactor) const; + Color addToColorAndClamp(const Color&) const; - static Color addColorsAndClamp(const Color&, const Color&); + static Color addColorsAndClamp(const Color&, const Color&); - bool isZero() const; - - float distance() const; + bool isZero() const; + + float distance() const; - private: - short m_redDiff; - short m_greenDiff; - short m_blueDiff; - }; +private: + short m_redDiff; + short m_greenDiff; + short m_blueDiff; +}; } #endif // ENABLE(SVG) diff --git a/WebCore/svg/ElementTimeControl.h b/WebCore/svg/ElementTimeControl.h index c0b4fdb..101d8d0 100644 --- a/WebCore/svg/ElementTimeControl.h +++ b/WebCore/svg/ElementTimeControl.h @@ -33,14 +33,14 @@ namespace WebCore { - class ElementTimeControl { - public: - virtual ~ElementTimeControl() {} - virtual void beginElement() = 0; - virtual void beginElementAt(float offset) = 0; - virtual void endElement() = 0; - virtual void endElementAt(float offset) = 0; - }; +class ElementTimeControl { +public: + virtual ~ElementTimeControl() {} + virtual void beginElement() = 0; + virtual void beginElementAt(float offset) = 0; + virtual void endElement() = 0; + virtual void endElementAt(float offset) = 0; +}; } diff --git a/WebCore/svg/LinearGradientAttributes.h b/WebCore/svg/LinearGradientAttributes.h index 9f37860..6ff28f1 100644 --- a/WebCore/svg/LinearGradientAttributes.h +++ b/WebCore/svg/LinearGradientAttributes.h @@ -24,47 +24,47 @@ #include "GradientAttributes.h" namespace WebCore { - struct LinearGradientAttributes : GradientAttributes { - LinearGradientAttributes() - : m_x1() - , m_y1() - , m_x2(LengthModeWidth, "100%") - , m_y2() - , m_x1Set(false) - , m_y1Set(false) - , m_x2Set(false) - , m_y2Set(false) - { - } +struct LinearGradientAttributes : GradientAttributes { + LinearGradientAttributes() + : m_x1() + , m_y1() + , m_x2(LengthModeWidth, "100%") + , m_y2() + , m_x1Set(false) + , m_y1Set(false) + , m_x2Set(false) + , m_y2Set(false) + { + } - SVGLength x1() const { return m_x1; } - SVGLength y1() const { return m_y1; } - SVGLength x2() const { return m_x2; } - SVGLength y2() const { return m_y2; } + SVGLength x1() const { return m_x1; } + SVGLength y1() const { return m_y1; } + SVGLength x2() const { return m_x2; } + SVGLength y2() const { return m_y2; } - void setX1(const SVGLength& value) { m_x1 = value; m_x1Set = true; } - void setY1(const SVGLength& value) { m_y1 = value; m_y1Set = true; } - void setX2(const SVGLength& value) { m_x2 = value; m_x2Set = true; } - void setY2(const SVGLength& value) { m_y2 = value; m_y2Set = true; } + void setX1(const SVGLength& value) { m_x1 = value; m_x1Set = true; } + void setY1(const SVGLength& value) { m_y1 = value; m_y1Set = true; } + void setX2(const SVGLength& value) { m_x2 = value; m_x2Set = true; } + void setY2(const SVGLength& value) { m_y2 = value; m_y2Set = true; } - bool hasX1() const { return m_x1Set; } - bool hasY1() const { return m_y1Set; } - bool hasX2() const { return m_x2Set; } - bool hasY2() const { return m_y2Set; } + bool hasX1() const { return m_x1Set; } + bool hasY1() const { return m_y1Set; } + bool hasX2() const { return m_x2Set; } + bool hasY2() const { return m_y2Set; } - private: - // Properties - SVGLength m_x1; - SVGLength m_y1; - SVGLength m_x2; - SVGLength m_y2; +private: + // Properties + SVGLength m_x1; + SVGLength m_y1; + SVGLength m_x2; + SVGLength m_y2; - // Property states - bool m_x1Set : 1; - bool m_y1Set : 1; - bool m_x2Set : 1; - bool m_y2Set : 1; - }; + // Property states + bool m_x1Set : 1; + bool m_y1Set : 1; + bool m_x2Set : 1; + bool m_y2Set : 1; +}; } // namespace WebCore diff --git a/WebCore/svg/RadialGradientAttributes.h b/WebCore/svg/RadialGradientAttributes.h index 7e2875b..5fb06e9 100644 --- a/WebCore/svg/RadialGradientAttributes.h +++ b/WebCore/svg/RadialGradientAttributes.h @@ -24,54 +24,54 @@ #include "GradientAttributes.h" namespace WebCore { - struct RadialGradientAttributes : GradientAttributes { - RadialGradientAttributes() - : m_cx(LengthModeWidth, "50%") - , m_cy(LengthModeWidth, "50%") - , m_r(LengthModeWidth, "50%") - , m_fx() - , m_fy() - , m_cxSet(false) - , m_cySet(false) - , m_rSet(false) - , m_fxSet(false) - , m_fySet(false) - { - } +struct RadialGradientAttributes : GradientAttributes { + RadialGradientAttributes() + : m_cx(LengthModeWidth, "50%") + , m_cy(LengthModeWidth, "50%") + , m_r(LengthModeWidth, "50%") + , m_fx() + , m_fy() + , m_cxSet(false) + , m_cySet(false) + , m_rSet(false) + , m_fxSet(false) + , m_fySet(false) + { + } - SVGLength cx() const { return m_cx; } - SVGLength cy() const { return m_cy; } - SVGLength r() const { return m_r; } - SVGLength fx() const { return m_fx; } - SVGLength fy() const { return m_fy; } + SVGLength cx() const { return m_cx; } + SVGLength cy() const { return m_cy; } + SVGLength r() const { return m_r; } + SVGLength fx() const { return m_fx; } + SVGLength fy() const { return m_fy; } - void setCx(const SVGLength& value) { m_cx = value; m_cxSet = true; } - void setCy(const SVGLength& value) { m_cy = value; m_cySet = true; } - void setR(const SVGLength& value) { m_r = value; m_rSet = true; } - void setFx(const SVGLength& value) { m_fx = value; m_fxSet = true; } - void setFy(const SVGLength& value) { m_fy = value; m_fySet = true; } + void setCx(const SVGLength& value) { m_cx = value; m_cxSet = true; } + void setCy(const SVGLength& value) { m_cy = value; m_cySet = true; } + void setR(const SVGLength& value) { m_r = value; m_rSet = true; } + void setFx(const SVGLength& value) { m_fx = value; m_fxSet = true; } + void setFy(const SVGLength& value) { m_fy = value; m_fySet = true; } - bool hasCx() const { return m_cxSet; } - bool hasCy() const { return m_cySet; } - bool hasR() const { return m_rSet; } - bool hasFx() const { return m_fxSet; } - bool hasFy() const { return m_fySet; } + bool hasCx() const { return m_cxSet; } + bool hasCy() const { return m_cySet; } + bool hasR() const { return m_rSet; } + bool hasFx() const { return m_fxSet; } + bool hasFy() const { return m_fySet; } - private: - // Properties - SVGLength m_cx; - SVGLength m_cy; - SVGLength m_r; - SVGLength m_fx; - SVGLength m_fy; +private: + // Properties + SVGLength m_cx; + SVGLength m_cy; + SVGLength m_r; + SVGLength m_fx; + SVGLength m_fy; - // Property states - bool m_cxSet : 1; - bool m_cySet : 1; - bool m_rSet : 1; - bool m_fxSet : 1; - bool m_fySet : 1; - }; + // Property states + bool m_cxSet : 1; + bool m_cySet : 1; + bool m_rSet : 1; + bool m_fxSet : 1; + bool m_fySet : 1; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGAElement.cpp b/WebCore/svg/SVGAElement.cpp index 811d5f7..8fbfc01 100644 --- a/WebCore/svg/SVGAElement.cpp +++ b/WebCore/svg/SVGAElement.cpp @@ -47,6 +47,11 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_STRING(SVGAElement, SVGNames::targetAttr, SVGTarget, svgTarget) +DEFINE_ANIMATED_STRING(SVGAElement, XLinkNames::hrefAttr, Href, href) +DEFINE_ANIMATED_BOOLEAN(SVGAElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + inline SVGAElement::SVGAElement(const QualifiedName& tagName, Document* document) : SVGStyledTransformableElement(tagName, document) { diff --git a/WebCore/svg/SVGAElement.h b/WebCore/svg/SVGAElement.h index f919a6e..20a4e07 100644 --- a/WebCore/svg/SVGAElement.h +++ b/WebCore/svg/SVGAElement.h @@ -23,7 +23,7 @@ #define SVGAElement_h #if ENABLE(SVG) -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedBoolean.h" #include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" #include "SVGStyledTransformableElement.h" @@ -32,51 +32,51 @@ namespace WebCore { - class SVGAElement : public SVGStyledTransformableElement, - public SVGURIReference, - public SVGTests, - public SVGLangSpace, - public SVGExternalResourcesRequired { - public: - static PassRefPtr<SVGAElement> create(const QualifiedName&, Document*); +class SVGAElement : public SVGStyledTransformableElement, + public SVGURIReference, + public SVGTests, + public SVGLangSpace, + public SVGExternalResourcesRequired { +public: + static PassRefPtr<SVGAElement> create(const QualifiedName&, Document*); - private: - SVGAElement(const QualifiedName&, Document*); +private: + SVGAElement(const QualifiedName&, Document*); - virtual bool isValid() const { return SVGTests::isValid(); } - - virtual String title() const; - virtual String target() const { return svgTarget(); } + virtual bool isValid() const { return SVGTests::isValid(); } + + virtual String title() const; + virtual String target() const { return svgTarget(); } - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual void defaultEventHandler(Event*); - - virtual bool supportsFocus() const; - virtual bool isMouseFocusable() const; - virtual bool isKeyboardFocusable(KeyboardEvent*) const; - virtual bool isFocusable() const; + virtual void defaultEventHandler(Event*); + + virtual bool supportsFocus() const; + virtual bool isMouseFocusable() const; + virtual bool isKeyboardFocusable(KeyboardEvent*) const; + virtual bool isFocusable() const; - virtual bool childShouldCreateRenderer(Node*) const; + virtual bool childShouldCreateRenderer(Node*) const; - // This defines a non-virtual "String& target() const" method before, that would clash with "virtual String target() const" - // in Element. That's why it's now named "String& svgTarget() const", to avoid the clash. The CodeGenerators take care - // of calling svgTargetAnimated() instead of targetAnimated(), see CodeGenerator.pm. - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGAElement, SVGNames::targetAttr, String, SVGTarget, svgTarget) + // Animated property declarations - // SVGURIReference - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGAElement, XLinkNames::hrefAttr, String, Href, href) + // This declaration used to define a non-virtual "String& target() const" method, that clashes with "virtual String Element::target() const". + // That's why it has been renamed to "svgTarget", the CodeGenerators take care of calling svgTargetAnimated() instead of targetAnimated(), see CodeGenerator.pm. + DECLARE_ANIMATED_STRING(SVGTarget, svgTarget) - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGAElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) - }; + // SVGURIReference + DECLARE_ANIMATED_STRING(Href, href) + + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) +}; } // namespace WebCore #endif // ENABLE(SVG) - #endif // SVGAElement_h diff --git a/WebCore/svg/SVGAltGlyphElement.cpp b/WebCore/svg/SVGAltGlyphElement.cpp index 2280d90..ca13740 100644 --- a/WebCore/svg/SVGAltGlyphElement.cpp +++ b/WebCore/svg/SVGAltGlyphElement.cpp @@ -33,6 +33,9 @@ namespace WebCore { +// Animated property declarations +DEFINE_ANIMATED_STRING(SVGAltGlyphElement, XLinkNames::hrefAttr, Href, href) + inline SVGAltGlyphElement::SVGAltGlyphElement(const QualifiedName& tagName, Document* document) : SVGTextPositioningElement(tagName, document) { diff --git a/WebCore/svg/SVGAltGlyphElement.h b/WebCore/svg/SVGAltGlyphElement.h index b9d0bc0..0cbee79 100644 --- a/WebCore/svg/SVGAltGlyphElement.h +++ b/WebCore/svg/SVGAltGlyphElement.h @@ -25,35 +25,36 @@ #if ENABLE(SVG_FONTS) #include "SVGTextPositioningElement.h" #include "SVGURIReference.h" -#include <wtf/text/AtomicString.h> namespace WebCore { - class SVGGlyphElement; +class SVGGlyphElement; - class SVGAltGlyphElement : public SVGTextPositioningElement, - public SVGURIReference { - public: - static PassRefPtr<SVGAltGlyphElement> create(const QualifiedName&, Document*); +class SVGAltGlyphElement : public SVGTextPositioningElement, + public SVGURIReference { +public: + static PassRefPtr<SVGAltGlyphElement> create(const QualifiedName&, Document*); - const AtomicString& glyphRef() const; - void setGlyphRef(const AtomicString&, ExceptionCode&); - const AtomicString& format() const; - void setFormat(const AtomicString&, ExceptionCode&); - - SVGGlyphElement* glyphElement() const; + const AtomicString& glyphRef() const; + void setGlyphRef(const AtomicString&, ExceptionCode&); + const AtomicString& format() const; + void setFormat(const AtomicString&, ExceptionCode&); - private: - SVGAltGlyphElement(const QualifiedName&, Document*); + SVGGlyphElement* glyphElement() const; - virtual void synchronizeProperty(const QualifiedName&); +private: + SVGAltGlyphElement(const QualifiedName&, Document*); - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual bool childShouldCreateRenderer(Node*) const; + virtual void synchronizeProperty(const QualifiedName&); - // SVGURIReference - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGAltGlyphElement, XLinkNames::hrefAttr, String, Href, href) - }; + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual bool childShouldCreateRenderer(Node*) const; + + // Animated property declarations + + // SVGURIReference + DECLARE_ANIMATED_STRING(Href, href) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGAngle.cpp b/WebCore/svg/SVGAngle.cpp index 6475064..37cb73a 100644 --- a/WebCore/svg/SVGAngle.cpp +++ b/WebCore/svg/SVGAngle.cpp @@ -25,8 +25,8 @@ #include "SVGAngle.h" #include "SVGParserUtilities.h" -#include <wtf/text/StringConcatenate.h> #include <wtf/MathExtras.h> +#include <wtf/text/StringConcatenate.h> namespace WebCore { diff --git a/WebCore/svg/SVGAngle.h b/WebCore/svg/SVGAngle.h index 4afaa4b..6fadabb 100644 --- a/WebCore/svg/SVGAngle.h +++ b/WebCore/svg/SVGAngle.h @@ -24,7 +24,7 @@ #if ENABLE(SVG) #include "ExceptionCode.h" -#include <wtf/text/WTFString.h> +#include "SVGPropertyTraits.h" namespace WebCore { @@ -59,6 +59,12 @@ private: float m_valueInSpecifiedUnits; }; +template<> +struct SVGPropertyTraits<SVGAngle> { + static SVGAngle initialValue() { return SVGAngle(); } + static String toString(const SVGAngle& type) { return type.valueAsString(); } +}; + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGAnimateColorElement.h b/WebCore/svg/SVGAnimateColorElement.h index d36c8de..140c55f 100644 --- a/WebCore/svg/SVGAnimateColorElement.h +++ b/WebCore/svg/SVGAnimateColorElement.h @@ -27,14 +27,14 @@ namespace WebCore { - // SVGAnimateElement implements superset of the functionality. - class SVGAnimateColorElement : public SVGAnimateElement { - public: - static PassRefPtr<SVGAnimateColorElement> create(const QualifiedName&, Document*); - - private: - SVGAnimateColorElement(const QualifiedName&, Document*); - }; +// SVGAnimateElement implements superset of the functionality. +class SVGAnimateColorElement : public SVGAnimateElement { +public: + static PassRefPtr<SVGAnimateColorElement> create(const QualifiedName&, Document*); + +private: + SVGAnimateColorElement(const QualifiedName&, Document*); +}; } // namespace WebCore diff --git a/WebCore/svg/SVGAnimateElement.cpp b/WebCore/svg/SVGAnimateElement.cpp index 152b342..7fe4c87 100644 --- a/WebCore/svg/SVGAnimateElement.cpp +++ b/WebCore/svg/SVGAnimateElement.cpp @@ -20,17 +20,18 @@ */ #include "config.h" + #if ENABLE(SVG) && ENABLE(SVG_ANIMATION) #include "SVGAnimateElement.h" #include "ColorDistance.h" #include "FloatConversion.h" #include "SVGColor.h" +#include "SVGNames.h" #include "SVGParserUtilities.h" #include "SVGPathParserFactory.h" #include "SVGPathSegList.h" #include "SVGPointList.h" -#include <math.h> using namespace std; @@ -164,8 +165,9 @@ void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeat } } return; - } else if (m_propertyType == PointsProperty) { - if (percentage == 0) + } + if (m_propertyType == PointsProperty) { + if (!percentage) results->m_animatedPoints = m_fromPoints; else if (percentage == 1.f) results->m_animatedPoints = m_toPoints; @@ -317,7 +319,8 @@ float SVGAnimateElement::calculateDistance(const String& fromString, const Strin if (!parseNumberValueAndUnit(toString, to, unit)) return -1.f; return narrowPrecisionToFloat(fabs(to - from)); - } else if (m_propertyType == ColorProperty) { + } + if (m_propertyType == ColorProperty) { Color from = SVGColor::colorFromRGBColorString(fromString); if (!from.isValid()) return -1.f; diff --git a/WebCore/svg/SVGAnimateElement.h b/WebCore/svg/SVGAnimateElement.h index e478cf8..3217c4a 100644 --- a/WebCore/svg/SVGAnimateElement.h +++ b/WebCore/svg/SVGAnimateElement.h @@ -32,47 +32,47 @@ namespace WebCore { - class SVGPathSegList; +class SVGPathSegList; - class SVGAnimateElement : public SVGAnimationElement { - public: - static PassRefPtr<SVGAnimateElement> create(const QualifiedName&, Document*); +class SVGAnimateElement : public SVGAnimationElement { +public: + static PassRefPtr<SVGAnimateElement> create(const QualifiedName&, Document*); - virtual ~SVGAnimateElement(); + virtual ~SVGAnimateElement(); - protected: - SVGAnimateElement(const QualifiedName&, Document*); - - virtual void resetToBaseValue(const String&); - virtual bool calculateFromAndToValues(const String& fromString, const String& toString); - virtual bool calculateFromAndByValues(const String& fromString, const String& byString); - virtual void calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement); - virtual void applyResultsToTarget(); - virtual float calculateDistance(const String& fromString, const String& toString); +protected: + SVGAnimateElement(const QualifiedName&, Document*); - private: - enum PropertyType { NumberProperty, ColorProperty, StringProperty, PathProperty, PointsProperty }; - PropertyType determinePropertyType(const String& attribute) const; - PropertyType m_propertyType; - - double m_fromNumber; - double m_toNumber; - double m_animatedNumber; - String m_numberUnit; - Color m_fromColor; - Color m_toColor; - Color m_animatedColor; - String m_fromString; - String m_toString; - String m_animatedString; - OwnPtr<SVGPathByteStream> m_fromPath; - OwnPtr<SVGPathByteStream> m_toPath; - OwnPtr<SVGPathByteStream> m_animatedPath; - SVGPathByteStream* m_animatedPathPointer; - SVGPointList m_fromPoints; - SVGPointList m_toPoints; - SVGPointList m_animatedPoints; - }; + virtual void resetToBaseValue(const String&); + virtual bool calculateFromAndToValues(const String& fromString, const String& toString); + virtual bool calculateFromAndByValues(const String& fromString, const String& byString); + virtual void calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement); + virtual void applyResultsToTarget(); + virtual float calculateDistance(const String& fromString, const String& toString); + +private: + enum PropertyType { NumberProperty, ColorProperty, StringProperty, PathProperty, PointsProperty }; + PropertyType determinePropertyType(const String& attribute) const; + PropertyType m_propertyType; + + double m_fromNumber; + double m_toNumber; + double m_animatedNumber; + String m_numberUnit; + Color m_fromColor; + Color m_toColor; + Color m_animatedColor; + String m_fromString; + String m_toString; + String m_animatedString; + OwnPtr<SVGPathByteStream> m_fromPath; + OwnPtr<SVGPathByteStream> m_toPath; + OwnPtr<SVGPathByteStream> m_animatedPath; + SVGPathByteStream* m_animatedPathPointer; + SVGPointList m_fromPoints; + SVGPointList m_toPoints; + SVGPointList m_animatedPoints; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGAnimateMotionElement.cpp b/WebCore/svg/SVGAnimateMotionElement.cpp index 26151ed..ec51548 100644 --- a/WebCore/svg/SVGAnimateMotionElement.cpp +++ b/WebCore/svg/SVGAnimateMotionElement.cpp @@ -29,11 +29,12 @@ #include "RenderSVGResource.h" #include "SVGElementInstance.h" #include "SVGMPathElement.h" +#include "SVGNames.h" #include "SVGParserUtilities.h" -#include "SVGPathParserFactory.h" #include "SVGPathElement.h" +#include "SVGPathParserFactory.h" #include "SVGTransformList.h" -#include <math.h> +#include <wtf/MathExtras.h> #include <wtf/StdLibExtras.h> namespace WebCore { diff --git a/WebCore/svg/SVGAnimateMotionElement.h b/WebCore/svg/SVGAnimateMotionElement.h index 225a076..7e168c3 100644 --- a/WebCore/svg/SVGAnimateMotionElement.h +++ b/WebCore/svg/SVGAnimateMotionElement.h @@ -27,47 +27,47 @@ namespace WebCore { - class SVGAnimateMotionElement : public SVGAnimationElement { - public: - static PassRefPtr<SVGAnimateMotionElement> create(const QualifiedName&, Document*); +class SVGAnimateMotionElement : public SVGAnimationElement { +public: + static PassRefPtr<SVGAnimateMotionElement> create(const QualifiedName&, Document*); - private: - SVGAnimateMotionElement(const QualifiedName&, Document*); +private: + SVGAnimateMotionElement(const QualifiedName&, Document*); - virtual bool hasValidTarget() const; + virtual bool hasValidTarget() const; - virtual void parseMappedAttribute(Attribute*); - - virtual void resetToBaseValue(const String&); - virtual bool calculateFromAndToValues(const String& fromString, const String& toString); - virtual bool calculateFromAndByValues(const String& fromString, const String& byString); - virtual void calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement); - virtual void applyResultsToTarget(); - virtual float calculateDistance(const String& fromString, const String& toString); - virtual Path animationPath() const; - - enum RotateMode { - RotateAngle, - RotateAuto, - RotateAutoReverse - }; - RotateMode rotateMode() const; + virtual void parseMappedAttribute(Attribute*); - FloatSize m_animatedTranslation; - float m_animatedAngle; + virtual void resetToBaseValue(const String&); + virtual bool calculateFromAndToValues(const String& fromString, const String& toString); + virtual bool calculateFromAndByValues(const String& fromString, const String& byString); + virtual void calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement); + virtual void applyResultsToTarget(); + virtual float calculateDistance(const String& fromString, const String& toString); + virtual Path animationPath() const; - // Note: we do not support percentage values for to/from coords as the spec implies we should (opera doesn't either) - FloatPoint m_fromPoint; - float m_fromAngle; - FloatPoint m_toPoint; - float m_toAngle; + enum RotateMode { + RotateAngle, + RotateAuto, + RotateAutoReverse + }; + RotateMode rotateMode() const; - unsigned m_baseIndexInTransformList; + FloatSize m_animatedTranslation; + float m_animatedAngle; - Path m_path; - Vector<float> m_keyPoints; - float m_angle; - }; + // Note: we do not support percentage values for to/from coords as the spec implies we should (opera doesn't either) + FloatPoint m_fromPoint; + float m_fromAngle; + FloatPoint m_toPoint; + float m_toAngle; + + unsigned m_baseIndexInTransformList; + + Path m_path; + Vector<float> m_keyPoints; + float m_angle; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGAnimateTransformElement.cpp b/WebCore/svg/SVGAnimateTransformElement.cpp index f5d5aa8..bdcab38 100644 --- a/WebCore/svg/SVGAnimateTransformElement.cpp +++ b/WebCore/svg/SVGAnimateTransformElement.cpp @@ -32,6 +32,7 @@ #include "SVGAngle.h" #include "SVGElementInstance.h" #include "SVGGradientElement.h" +#include "SVGNames.h" #include "SVGParserUtilities.h" #include "SVGSVGElement.h" #include "SVGStyledTransformableElement.h" diff --git a/WebCore/svg/SVGAnimatedAngle.h b/WebCore/svg/SVGAnimatedAngle.h index bda7a36..a4ded8f 100644 --- a/WebCore/svg/SVGAnimatedAngle.h +++ b/WebCore/svg/SVGAnimatedAngle.h @@ -28,6 +28,13 @@ namespace WebCore { typedef SVGAnimatedPropertyTearOff<SVGAngle> SVGAnimatedAngle; +// Helper macros to declare/define a SVGAnimatedAngle object +#define DECLARE_ANIMATED_ANGLE(UpperProperty, LowerProperty) \ +DECLARE_ANIMATED_PROPERTY(SVGAnimatedAngle, SVGAngle, UpperProperty, LowerProperty) + +#define DEFINE_ANIMATED_ANGLE_MULTIPLE_WRAPPERS(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \ +DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, SVGAnimatedAngle, SVGAngle, UpperProperty, LowerProperty) + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGAnimatedBoolean.h b/WebCore/svg/SVGAnimatedBoolean.h index b316e21..93ba9cc 100644 --- a/WebCore/svg/SVGAnimatedBoolean.h +++ b/WebCore/svg/SVGAnimatedBoolean.h @@ -27,6 +27,13 @@ namespace WebCore { typedef SVGAnimatedStaticPropertyTearOff<bool> SVGAnimatedBoolean; +// Helper macros to declare/define a SVGAnimatedBoolean object +#define DECLARE_ANIMATED_BOOLEAN(UpperProperty, LowerProperty) \ +DECLARE_ANIMATED_PROPERTY(SVGAnimatedBoolean, bool, UpperProperty, LowerProperty) + +#define DEFINE_ANIMATED_BOOLEAN(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ +DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedBoolean, bool, UpperProperty, LowerProperty) + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGAnimatedEnumeration.h b/WebCore/svg/SVGAnimatedEnumeration.h index 4e5f073..354a935 100644 --- a/WebCore/svg/SVGAnimatedEnumeration.h +++ b/WebCore/svg/SVGAnimatedEnumeration.h @@ -21,12 +21,23 @@ #define SVGAnimatedEnumeration_h #if ENABLE(SVG) +#include "SVGAnimatedPropertyMacros.h" #include "SVGAnimatedStaticPropertyTearOff.h" namespace WebCore { typedef SVGAnimatedStaticPropertyTearOff<int> SVGAnimatedEnumeration; +// Helper macros to declare/define a SVGAnimatedEnumeration object +#define DECLARE_ANIMATED_ENUMERATION(UpperProperty, LowerProperty) \ +DECLARE_ANIMATED_PROPERTY(SVGAnimatedEnumeration, int, UpperProperty, LowerProperty) + +#define DEFINE_ANIMATED_ENUMERATION(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ +DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedEnumeration, int, UpperProperty, LowerProperty) + +#define DEFINE_ANIMATED_ENUMERATION_MULTIPLE_WRAPPERS(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \ +DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, SVGAnimatedEnumeration, int, UpperProperty, LowerProperty) + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGAnimatedInteger.h b/WebCore/svg/SVGAnimatedInteger.h index 6d1c85d..6f83475 100644 --- a/WebCore/svg/SVGAnimatedInteger.h +++ b/WebCore/svg/SVGAnimatedInteger.h @@ -21,12 +21,23 @@ #define SVGAnimatedInteger_h #if ENABLE(SVG) +#include "SVGAnimatedPropertyMacros.h" #include "SVGAnimatedStaticPropertyTearOff.h" namespace WebCore { typedef SVGAnimatedStaticPropertyTearOff<long> SVGAnimatedInteger; +// Helper macros to declare/define a SVGAnimatedInteger object +#define DECLARE_ANIMATED_INTEGER(UpperProperty, LowerProperty) \ +DECLARE_ANIMATED_PROPERTY(SVGAnimatedInteger, long, UpperProperty, LowerProperty) + +#define DEFINE_ANIMATED_INTEGER(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ +DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedInteger, long, UpperProperty, LowerProperty) + +#define DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \ +DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, SVGAnimatedInteger, long, UpperProperty, LowerProperty) + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGAnimatedLength.h b/WebCore/svg/SVGAnimatedLength.h index 0504fd7..570b2a0 100644 --- a/WebCore/svg/SVGAnimatedLength.h +++ b/WebCore/svg/SVGAnimatedLength.h @@ -28,6 +28,13 @@ namespace WebCore { typedef SVGAnimatedPropertyTearOff<SVGLength> SVGAnimatedLength; +// Helper macros to declare/define a SVGAnimatedLength object +#define DECLARE_ANIMATED_LENGTH(UpperProperty, LowerProperty) \ +DECLARE_ANIMATED_PROPERTY(SVGAnimatedLength, SVGLength, UpperProperty, LowerProperty) + +#define DEFINE_ANIMATED_LENGTH(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ +DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedLength, SVGLength, UpperProperty, LowerProperty) + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGAnimatedLengthList.h b/WebCore/svg/SVGAnimatedLengthList.h index fcd8197..a0217fa 100644 --- a/WebCore/svg/SVGAnimatedLengthList.h +++ b/WebCore/svg/SVGAnimatedLengthList.h @@ -28,6 +28,13 @@ namespace WebCore { typedef SVGAnimatedListPropertyTearOff<SVGLengthList> SVGAnimatedLengthList; +// Helper macros to declare/define a SVGAnimatedLengthList object +#define DECLARE_ANIMATED_LENGTH_LIST(UpperProperty, LowerProperty) \ +DECLARE_ANIMATED_LIST_PROPERTY(SVGAnimatedLengthList, SVGLengthList, UpperProperty, LowerProperty) + +#define DEFINE_ANIMATED_LENGTH_LIST(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ +DEFINE_ANIMATED_LIST_PROPERTY(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedLengthList, SVGLengthList, UpperProperty, LowerProperty) + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGAnimatedNumber.h b/WebCore/svg/SVGAnimatedNumber.h index 6897aad..b59deac 100644 --- a/WebCore/svg/SVGAnimatedNumber.h +++ b/WebCore/svg/SVGAnimatedNumber.h @@ -21,12 +21,23 @@ #define SVGAnimatedNumber_h #if ENABLE(SVG) +#include "SVGAnimatedPropertyMacros.h" #include "SVGAnimatedStaticPropertyTearOff.h" namespace WebCore { typedef SVGAnimatedStaticPropertyTearOff<float> SVGAnimatedNumber; +// Helper macros to declare/define a SVGAnimatedNumber object +#define DECLARE_ANIMATED_NUMBER(UpperProperty, LowerProperty) \ +DECLARE_ANIMATED_PROPERTY(SVGAnimatedNumber, float, UpperProperty, LowerProperty) + +#define DEFINE_ANIMATED_NUMBER(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ +DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedNumber, float, UpperProperty, LowerProperty) + +#define DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \ +DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, SVGAnimatedNumber, float, UpperProperty, LowerProperty) + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGAnimatedNumberList.h b/WebCore/svg/SVGAnimatedNumberList.h index f86b3c2..8beabaa 100644 --- a/WebCore/svg/SVGAnimatedNumberList.h +++ b/WebCore/svg/SVGAnimatedNumberList.h @@ -28,6 +28,13 @@ namespace WebCore { typedef SVGAnimatedListPropertyTearOff<SVGNumberList> SVGAnimatedNumberList; +// Helper macros to declare/define a SVGAnimatedNumberList object +#define DECLARE_ANIMATED_NUMBER_LIST(UpperProperty, LowerProperty) \ +DECLARE_ANIMATED_LIST_PROPERTY(SVGAnimatedNumberList, SVGNumberList, UpperProperty, LowerProperty) + +#define DEFINE_ANIMATED_NUMBER_LIST(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ +DEFINE_ANIMATED_LIST_PROPERTY(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedNumberList, SVGNumberList, UpperProperty, LowerProperty) + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGAnimatedPreserveAspectRatio.h b/WebCore/svg/SVGAnimatedPreserveAspectRatio.h index 57d8621..01afc95 100644 --- a/WebCore/svg/SVGAnimatedPreserveAspectRatio.h +++ b/WebCore/svg/SVGAnimatedPreserveAspectRatio.h @@ -28,6 +28,13 @@ namespace WebCore { typedef SVGAnimatedPropertyTearOff<SVGPreserveAspectRatio> SVGAnimatedPreserveAspectRatio; +// Helper macros to declare/define a SVGAnimatedPreserveAspectRatio object +#define DECLARE_ANIMATED_PRESERVEASPECTRATIO(UpperProperty, LowerProperty) \ +DECLARE_ANIMATED_PROPERTY(SVGAnimatedPreserveAspectRatio, SVGPreserveAspectRatio, UpperProperty, LowerProperty) + +#define DEFINE_ANIMATED_PRESERVEASPECTRATIO(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ +DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedPreserveAspectRatio, SVGPreserveAspectRatio, UpperProperty, LowerProperty) + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGAnimatedRect.h b/WebCore/svg/SVGAnimatedRect.h index ee94352..af9f94b 100644 --- a/WebCore/svg/SVGAnimatedRect.h +++ b/WebCore/svg/SVGAnimatedRect.h @@ -21,13 +21,21 @@ #define SVGAnimatedRect_h #if ENABLE(SVG) -#include "FloatRect.h" +#include "SVGAnimatedPropertyMacros.h" #include "SVGAnimatedPropertyTearOff.h" +#include "SVGRect.h" namespace WebCore { typedef SVGAnimatedPropertyTearOff<FloatRect> SVGAnimatedRect; +// Helper macros to declare/define a SVGAnimatedRect object +#define DECLARE_ANIMATED_RECT(UpperProperty, LowerProperty) \ +DECLARE_ANIMATED_PROPERTY(SVGAnimatedRect, FloatRect, UpperProperty, LowerProperty) + +#define DEFINE_ANIMATED_RECT(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ +DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedRect, FloatRect, UpperProperty, LowerProperty) + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGAnimatedString.h b/WebCore/svg/SVGAnimatedString.h index c8b842f..57600fd 100644 --- a/WebCore/svg/SVGAnimatedString.h +++ b/WebCore/svg/SVGAnimatedString.h @@ -21,13 +21,20 @@ #define SVGAnimatedString_h #if ENABLE(SVG) +#include "SVGAnimatedPropertyMacros.h" #include "SVGAnimatedStaticPropertyTearOff.h" -#include <wtf/text/WTFString.h> namespace WebCore { typedef SVGAnimatedStaticPropertyTearOff<String> SVGAnimatedString; +// Helper macros to declare/define a SVGAnimatedString object +#define DECLARE_ANIMATED_STRING(UpperProperty, LowerProperty) \ +DECLARE_ANIMATED_PROPERTY(SVGAnimatedString, String, UpperProperty, LowerProperty) + +#define DEFINE_ANIMATED_STRING(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ +DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedString, String, UpperProperty, LowerProperty) + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGAnimatedTransformList.h b/WebCore/svg/SVGAnimatedTransformList.h index dcf87dd..8caee3c 100644 --- a/WebCore/svg/SVGAnimatedTransformList.h +++ b/WebCore/svg/SVGAnimatedTransformList.h @@ -27,6 +27,13 @@ namespace WebCore { typedef SVGAnimatedTransformListPropertyTearOff SVGAnimatedTransformList; +// Helper macros to declare/define a SVGAnimatedTransformList object +#define DECLARE_ANIMATED_TRANSFORM_LIST(UpperProperty, LowerProperty) \ +DECLARE_ANIMATED_LIST_PROPERTY(SVGAnimatedTransformList, SVGTransformList, UpperProperty, LowerProperty) + +#define DEFINE_ANIMATED_TRANSFORM_LIST(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ +DEFINE_ANIMATED_LIST_PROPERTY(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedTransformList, SVGTransformList, UpperProperty, LowerProperty) + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGAnimationElement.cpp b/WebCore/svg/SVGAnimationElement.cpp index c3b6f0c..2acb085 100644 --- a/WebCore/svg/SVGAnimationElement.cpp +++ b/WebCore/svg/SVGAnimationElement.cpp @@ -45,13 +45,15 @@ #include "SVGURIReference.h" #include "SVGUseElement.h" #include "XLinkNames.h" -#include <math.h> #include <wtf/StdLibExtras.h> using namespace std; namespace WebCore { - + +// Animated property definitions +DEFINE_ANIMATED_BOOLEAN(SVGAnimationElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + SVGAnimationElement::SVGAnimationElement(const QualifiedName& tagName, Document* document) : SVGSMILElement(tagName, document) , m_animationValid(false) @@ -71,7 +73,7 @@ static void parseKeyTimes(const String& parse, Vector<float>& result, bool verif goto fail; if (verifyOrder) { if (!n) { - if (time != 0) + if (time) goto fail; } else if (time < result.last()) goto fail; @@ -461,7 +463,7 @@ void SVGAnimationElement::currentValuesForValuesAnimation(float percent, float& unsigned keyTimesCount = m_keyTimes.size(); ASSERT(!keyTimesCount || valuesCount == keyTimesCount); - ASSERT(!keyTimesCount || (keyTimesCount > 1 && m_keyTimes[0] == 0)); + ASSERT(!keyTimesCount || (keyTimesCount > 1 && !m_keyTimes[0])); unsigned index = calculateKeyTimesIndex(percent); if (calcMode == CalcModeDiscrete) { @@ -570,7 +572,7 @@ void SVGAnimationElement::updateAnimation(float percent, unsigned repeat, SVGSMI String from; String to; currentValuesForValuesAnimation(percent, effectivePercent, from, to); - if (from != m_lastValuesAnimationFrom || to != m_lastValuesAnimationTo ) { + if (from != m_lastValuesAnimationFrom || to != m_lastValuesAnimationTo) { m_animationValid = calculateFromAndToValues(from, to); if (!m_animationValid) return; diff --git a/WebCore/svg/SVGAnimationElement.h b/WebCore/svg/SVGAnimationElement.h index 367e63f..59d7f9e 100644 --- a/WebCore/svg/SVGAnimationElement.h +++ b/WebCore/svg/SVGAnimationElement.h @@ -23,101 +23,104 @@ #ifndef SVGAnimationElement_h #define SVGAnimationElement_h + #if ENABLE(SVG_ANIMATION) #include "ElementTimeControl.h" #include "Path.h" #include "SMILTime.h" -#include "SVGAnimatedPropertyMacros.h" -#include "SVGSMILElement.h" +#include "SVGAnimatedBoolean.h" #include "SVGExternalResourcesRequired.h" +#include "SVGSMILElement.h" #include "SVGStringList.h" #include "SVGTests.h" #include "UnitBezier.h" namespace WebCore { - class ConditionEventListener; - class TimeContainer; - - class SVGAnimationElement : public SVGSMILElement, - public SVGTests, - public SVGExternalResourcesRequired, - public ElementTimeControl { - public: - // SVGAnimationElement - float getStartTime() const; - float getCurrentTime() const; - float getSimpleDuration(ExceptionCode&) const; - - // ElementTimeControl - virtual void beginElement(); - virtual void beginElementAt(float offset); - virtual void endElement(); - virtual void endElementAt(float offset); - - static bool attributeIsCSS(const String& attributeName); - - protected: - SVGAnimationElement(const QualifiedName&, Document*); - - virtual void parseMappedAttribute(Attribute*); - - enum CalcMode { CalcModeDiscrete, CalcModeLinear, CalcModePaced, CalcModeSpline }; - CalcMode calcMode() const; - - enum AttributeType { AttributeTypeCSS, AttributeTypeXML, AttributeTypeAuto }; - AttributeType attributeType() const; - - String toValue() const; - String byValue() const; - String fromValue() const; - - enum AnimationMode { NoAnimation, ToAnimation, ByAnimation, ValuesAnimation, FromToAnimation, FromByAnimation, PathAnimation }; - AnimationMode animationMode() const; - - virtual bool hasValidTarget() const; - - String targetAttributeBaseValue() const; - void setTargetAttributeAnimatedValue(const String&); - bool targetAttributeIsCSS() const; - - bool isAdditive() const; - bool isAccumulated() const; +class ConditionEventListener; +class TimeContainer; + +class SVGAnimationElement : public SVGSMILElement, + public SVGTests, + public SVGExternalResourcesRequired, + public ElementTimeControl { +public: + // SVGAnimationElement + float getStartTime() const; + float getCurrentTime() const; + float getSimpleDuration(ExceptionCode&) const; + + // ElementTimeControl + virtual void beginElement(); + virtual void beginElementAt(float offset); + virtual void endElement(); + virtual void endElementAt(float offset); + + static bool attributeIsCSS(const String& attributeName); + +protected: + SVGAnimationElement(const QualifiedName&, Document*); + + virtual void parseMappedAttribute(Attribute*); + + enum CalcMode { CalcModeDiscrete, CalcModeLinear, CalcModePaced, CalcModeSpline }; + CalcMode calcMode() const; + + enum AttributeType { AttributeTypeCSS, AttributeTypeXML, AttributeTypeAuto }; + AttributeType attributeType() const; + + String toValue() const; + String byValue() const; + String fromValue() const; - // from SVGSMILElement - virtual void startedActiveInterval(); - virtual void updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement); - virtual void endedActiveInterval(); - - private: - virtual void attributeChanged(Attribute*, bool preserveDecls); - virtual void synchronizeProperty(const QualifiedName&); - - virtual bool calculateFromAndToValues(const String& fromString, const String& toString) = 0; - virtual bool calculateFromAndByValues(const String& fromString, const String& byString) = 0; - virtual void calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement) = 0; - virtual float calculateDistance(const String& /*fromString*/, const String& /*toString*/) { return -1.f; } - virtual Path animationPath() const { return Path(); } - - void currentValuesForValuesAnimation(float percent, float& effectivePercent, String& from, String& to) const; - void calculateKeyTimesForCalcModePaced(); - float calculatePercentFromKeyPoints(float percent) const; - void currentValuesFromKeyPoints(float percent, float& effectivePercent, String& from, String& to) const; - float calculatePercentForSpline(float percent, unsigned splineIndex) const; - unsigned calculateKeyTimesIndex(float percent) const; - - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGAnimationElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) - - bool m_animationValid; - - Vector<String> m_values; - Vector<float> m_keyTimes; - Vector<float> m_keyPoints; - Vector<UnitBezier> m_keySplines; - String m_lastValuesAnimationFrom; - String m_lastValuesAnimationTo; - }; + enum AnimationMode { NoAnimation, ToAnimation, ByAnimation, ValuesAnimation, FromToAnimation, FromByAnimation, PathAnimation }; + AnimationMode animationMode() const; + + virtual bool hasValidTarget() const; + + String targetAttributeBaseValue() const; + void setTargetAttributeAnimatedValue(const String&); + bool targetAttributeIsCSS() const; + + bool isAdditive() const; + bool isAccumulated() const; + + // from SVGSMILElement + virtual void startedActiveInterval(); + virtual void updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement); + virtual void endedActiveInterval(); + +private: + virtual void attributeChanged(Attribute*, bool preserveDecls); + virtual void synchronizeProperty(const QualifiedName&); + + virtual bool calculateFromAndToValues(const String& fromString, const String& toString) = 0; + virtual bool calculateFromAndByValues(const String& fromString, const String& byString) = 0; + virtual void calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement) = 0; + virtual float calculateDistance(const String& /*fromString*/, const String& /*toString*/) { return -1.f; } + virtual Path animationPath() const { return Path(); } + + void currentValuesForValuesAnimation(float percent, float& effectivePercent, String& from, String& to) const; + void calculateKeyTimesForCalcModePaced(); + float calculatePercentFromKeyPoints(float percent) const; + void currentValuesFromKeyPoints(float percent, float& effectivePercent, String& from, String& to) const; + float calculatePercentForSpline(float percent, unsigned splineIndex) const; + unsigned calculateKeyTimesIndex(float percent) const; + + // Animated property declarations + + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) + + bool m_animationValid; + + Vector<String> m_values; + Vector<float> m_keyTimes; + Vector<float> m_keyPoints; + Vector<UnitBezier> m_keySplines; + String m_lastValuesAnimationFrom; + String m_lastValuesAnimationTo; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGCircleElement.cpp b/WebCore/svg/SVGCircleElement.cpp index 2aa34b8..0ac4600 100644 --- a/WebCore/svg/SVGCircleElement.cpp +++ b/WebCore/svg/SVGCircleElement.cpp @@ -32,6 +32,12 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::cxAttr, Cx, cx) +DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::cyAttr, Cy, cy) +DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::rAttr, R, r) +DEFINE_ANIMATED_BOOLEAN(SVGCircleElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + inline SVGCircleElement::SVGCircleElement(const QualifiedName& tagName, Document* document) : SVGStyledTransformableElement(tagName, document) , m_cx(LengthModeWidth) diff --git a/WebCore/svg/SVGCircleElement.h b/WebCore/svg/SVGCircleElement.h index 5c3a62f..f6946dd 100644 --- a/WebCore/svg/SVGCircleElement.h +++ b/WebCore/svg/SVGCircleElement.h @@ -22,8 +22,8 @@ #define SVGCircleElement_h #if ENABLE(SVG) +#include "SVGAnimatedBoolean.h" #include "SVGAnimatedLength.h" -#include "SVGAnimatedPropertyMacros.h" #include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" #include "SVGStyledTransformableElement.h" @@ -31,33 +31,34 @@ namespace WebCore { - class SVGCircleElement : public SVGStyledTransformableElement, - public SVGTests, - public SVGLangSpace, - public SVGExternalResourcesRequired { - public: - static PassRefPtr<SVGCircleElement> create(const QualifiedName&, Document*); +class SVGCircleElement : public SVGStyledTransformableElement, + public SVGTests, + public SVGLangSpace, + public SVGExternalResourcesRequired { +public: + static PassRefPtr<SVGCircleElement> create(const QualifiedName&, Document*); - private: - SVGCircleElement(const QualifiedName&, Document*); +private: + SVGCircleElement(const QualifiedName&, Document*); - virtual bool isValid() const { return SVGTests::isValid(); } + virtual bool isValid() const { return SVGTests::isValid(); } - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual void toPathData(Path&) const; + virtual void toPathData(Path&) const; - virtual bool selfHasRelativeLengths() const; + virtual bool selfHasRelativeLengths() const; - DECLARE_ANIMATED_PROPERTY_NEW(SVGCircleElement, SVGNames::cxAttr, SVGLength, Cx, cx) - DECLARE_ANIMATED_PROPERTY_NEW(SVGCircleElement, SVGNames::cyAttr, SVGLength, Cy, cy) - DECLARE_ANIMATED_PROPERTY_NEW(SVGCircleElement, SVGNames::rAttr, SVGLength, R, r) + // Animated property declarations + DECLARE_ANIMATED_LENGTH(Cx, cx) + DECLARE_ANIMATED_LENGTH(Cy, cy) + DECLARE_ANIMATED_LENGTH(R, r) - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGCircleElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) - }; + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGClipPathElement.cpp b/WebCore/svg/SVGClipPathElement.cpp index bd4df19..d86370d 100644 --- a/WebCore/svg/SVGClipPathElement.cpp +++ b/WebCore/svg/SVGClipPathElement.cpp @@ -34,6 +34,10 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_ENUMERATION(SVGClipPathElement, SVGNames::clipPathUnitsAttr, ClipPathUnits, clipPathUnits) +DEFINE_ANIMATED_BOOLEAN(SVGClipPathElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + inline SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Document* document) : SVGStyledTransformableElement(tagName, document) , m_clipPathUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) @@ -71,11 +75,11 @@ void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) if (!object) return; - if (attrName == SVGNames::clipPathUnitsAttr || - SVGTests::isKnownAttribute(attrName) || - SVGLangSpace::isKnownAttribute(attrName) || - SVGExternalResourcesRequired::isKnownAttribute(attrName) || - SVGStyledTransformableElement::isKnownAttribute(attrName)) + if (attrName == SVGNames::clipPathUnitsAttr + || SVGTests::isKnownAttribute(attrName) + || SVGLangSpace::isKnownAttribute(attrName) + || SVGExternalResourcesRequired::isKnownAttribute(attrName) + || SVGStyledTransformableElement::isKnownAttribute(attrName)) object->setNeedsLayout(true); } diff --git a/WebCore/svg/SVGClipPathElement.h b/WebCore/svg/SVGClipPathElement.h index f28915a..23242e8 100644 --- a/WebCore/svg/SVGClipPathElement.h +++ b/WebCore/svg/SVGClipPathElement.h @@ -22,7 +22,8 @@ #define SVGClipPathElement_h #if ENABLE(SVG) -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedBoolean.h" +#include "SVGAnimatedEnumeration.h" #include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" #include "SVGStyledTransformableElement.h" @@ -52,10 +53,11 @@ private: virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGClipPathElement, SVGNames::clipPathUnitsAttr, int, ClipPathUnits, clipPathUnits) + // Animated property declarations + DECLARE_ANIMATED_ENUMERATION(ClipPathUnits, clipPathUnits) // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGClipPathElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) }; } diff --git a/WebCore/svg/SVGColor.h b/WebCore/svg/SVGColor.h index f8b55f0..6d8b94e 100644 --- a/WebCore/svg/SVGColor.h +++ b/WebCore/svg/SVGColor.h @@ -28,61 +28,61 @@ namespace WebCore { - class RGBColor; - - class SVGColor : public CSSValue { - public: - static PassRefPtr<SVGColor> create(const String& color) - { - return adoptRef(new SVGColor(color)); - } - static PassRefPtr<SVGColor> create(const Color& color) - { - return adoptRef(new SVGColor(color)); - } - static PassRefPtr<SVGColor> createCurrentColor() - { - return adoptRef(new SVGColor(SVG_COLORTYPE_CURRENTCOLOR)); - } - - enum SVGColorType { - SVG_COLORTYPE_UNKNOWN = 0, - SVG_COLORTYPE_RGBCOLOR = 1, - SVG_COLORTYPE_RGBCOLOR_ICCCOLOR = 2, - SVG_COLORTYPE_CURRENTCOLOR = 3 - }; +class RGBColor; + +class SVGColor : public CSSValue { +public: + static PassRefPtr<SVGColor> create(const String& color) + { + return adoptRef(new SVGColor(color)); + } + static PassRefPtr<SVGColor> create(const Color& color) + { + return adoptRef(new SVGColor(color)); + } + static PassRefPtr<SVGColor> createCurrentColor() + { + return adoptRef(new SVGColor(SVG_COLORTYPE_CURRENTCOLOR)); + } + + enum SVGColorType { + SVG_COLORTYPE_UNKNOWN = 0, + SVG_COLORTYPE_RGBCOLOR = 1, + SVG_COLORTYPE_RGBCOLOR_ICCCOLOR = 2, + SVG_COLORTYPE_CURRENTCOLOR = 3 + }; - // 'SVGColor' functions - unsigned short colorType() const { return m_colorType; } + // 'SVGColor' functions + unsigned short colorType() const { return m_colorType; } - PassRefPtr<RGBColor> rgbColor() const; + PassRefPtr<RGBColor> rgbColor() const; - static Color colorFromRGBColorString(const String&); + static Color colorFromRGBColorString(const String&); - void setRGBColor(const String& rgbColor) { ExceptionCode ignored = 0; setRGBColor(rgbColor, ignored); } - void setRGBColor(const String& rgbColor, ExceptionCode&); - void setRGBColorICCColor(const String& rgbColor, const String& iccColor, ExceptionCode&); - void setColor(unsigned short colorType, const String& rgbColor, const String& iccColor, ExceptionCode&); + void setRGBColor(const String& rgbColor) { ExceptionCode ignored = 0; setRGBColor(rgbColor, ignored); } + void setRGBColor(const String& rgbColor, ExceptionCode&); + void setRGBColorICCColor(const String& rgbColor, const String& iccColor, ExceptionCode&); + void setColor(unsigned short colorType, const String& rgbColor, const String& iccColor, ExceptionCode&); - const Color& color() const { return m_color; } + const Color& color() const { return m_color; } - protected: - SVGColor(); - SVGColor(const String& color); - SVGColor(const Color&); +protected: + SVGColor(); + SVGColor(const String& color); + SVGColor(const Color&); - virtual String cssText() const; + virtual String cssText() const; - private: - SVGColor(SVGColorType); +private: + SVGColor(SVGColorType); - static void create(int); // compile-time guard + static void create(int); // compile-time guard - virtual bool isSVGColor() const { return true; } + virtual bool isSVGColor() const { return true; } - Color m_color; - unsigned short m_colorType; - }; + Color m_color; + unsigned short m_colorType; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGComponentTransferFunctionElement.cpp b/WebCore/svg/SVGComponentTransferFunctionElement.cpp index dd7c9e4..142d82d 100644 --- a/WebCore/svg/SVGComponentTransferFunctionElement.cpp +++ b/WebCore/svg/SVGComponentTransferFunctionElement.cpp @@ -30,6 +30,15 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_ENUMERATION(SVGComponentTransferFunctionElement, SVGNames::typeAttr, Type, type) +DEFINE_ANIMATED_NUMBER_LIST(SVGComponentTransferFunctionElement, SVGNames::tableValuesAttr, TableValues, tableValues) +DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::slopeAttr, Slope, slope) +DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::interceptAttr, Intercept, intercept) +DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::amplitudeAttr, Amplitude, amplitude) +DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::exponentAttr, Exponent, exponent) +DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::offsetAttr, Offset, offset) + SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement(const QualifiedName& tagName, Document* document) : SVGElement(tagName, document) , m_type(FECOMPONENTTRANSFER_TYPE_UNKNOWN) diff --git a/WebCore/svg/SVGComponentTransferFunctionElement.h b/WebCore/svg/SVGComponentTransferFunctionElement.h index e02fc16..5f836f7 100644 --- a/WebCore/svg/SVGComponentTransferFunctionElement.h +++ b/WebCore/svg/SVGComponentTransferFunctionElement.h @@ -23,30 +23,32 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "FEComponentTransfer.h" -#include "SVGAnimatedPropertyMacros.h" -#include "SVGNumberList.h" +#include "SVGAnimatedEnumeration.h" +#include "SVGAnimatedNumber.h" +#include "SVGAnimatedNumberList.h" namespace WebCore { - class SVGComponentTransferFunctionElement : public SVGElement { - public: - ComponentTransferFunction transferFunction() const; - - protected: - SVGComponentTransferFunctionElement(const QualifiedName&, Document*); - - virtual void parseMappedAttribute(Attribute*); - virtual void synchronizeProperty(const QualifiedName&); - - private: - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGComponentTransferFunctionElement, SVGNames::typeAttr, int, Type, type) - DECLARE_ANIMATED_LIST_PROPERTY_NEW(SVGComponentTransferFunctionElement, SVGNames::tableValuesAttr, SVGNumberList, TableValues, tableValues) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGComponentTransferFunctionElement, SVGNames::slopeAttr, float, Slope, slope) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGComponentTransferFunctionElement, SVGNames::interceptAttr, float, Intercept, intercept) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGComponentTransferFunctionElement, SVGNames::amplitudeAttr, float, Amplitude, amplitude) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGComponentTransferFunctionElement, SVGNames::exponentAttr, float, Exponent, exponent) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGComponentTransferFunctionElement, SVGNames::offsetAttr, float, Offset, offset) - }; +class SVGComponentTransferFunctionElement : public SVGElement { +public: + ComponentTransferFunction transferFunction() const; + +protected: + SVGComponentTransferFunctionElement(const QualifiedName&, Document*); + + virtual void parseMappedAttribute(Attribute*); + virtual void synchronizeProperty(const QualifiedName&); + +private: + // Animated property declarations + DECLARE_ANIMATED_ENUMERATION(Type, type) + DECLARE_ANIMATED_NUMBER_LIST(TableValues, tableValues) + DECLARE_ANIMATED_NUMBER(Slope, slope) + DECLARE_ANIMATED_NUMBER(Intercept, intercept) + DECLARE_ANIMATED_NUMBER(Amplitude, amplitude) + DECLARE_ANIMATED_NUMBER(Exponent, exponent) + DECLARE_ANIMATED_NUMBER(Offset, offset) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGCursorElement.cpp b/WebCore/svg/SVGCursorElement.cpp index 681063d..0c6a5d9 100644 --- a/WebCore/svg/SVGCursorElement.cpp +++ b/WebCore/svg/SVGCursorElement.cpp @@ -25,11 +25,16 @@ #include "Attr.h" #include "Document.h" -#include "SVGLength.h" #include "SVGNames.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_LENGTH(SVGCursorElement, SVGNames::xAttr, X, x) +DEFINE_ANIMATED_LENGTH(SVGCursorElement, SVGNames::yAttr, Y, y) +DEFINE_ANIMATED_STRING(SVGCursorElement, XLinkNames::hrefAttr, Href, href) +DEFINE_ANIMATED_BOOLEAN(SVGCursorElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + inline SVGCursorElement::SVGCursorElement(const QualifiedName& tagName, Document* document) : SVGElement(tagName, document) , m_x(LengthModeWidth) @@ -88,10 +93,11 @@ void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName) { SVGElement::svgAttributeChanged(attrName); - if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || - SVGTests::isKnownAttribute(attrName) || - SVGExternalResourcesRequired::isKnownAttribute(attrName) || - SVGURIReference::isKnownAttribute(attrName)) { + if (attrName == SVGNames::xAttr + || attrName == SVGNames::yAttr + || SVGTests::isKnownAttribute(attrName) + || SVGExternalResourcesRequired::isKnownAttribute(attrName) + || SVGURIReference::isKnownAttribute(attrName)) { HashSet<SVGElement*>::const_iterator it = m_clients.begin(); HashSet<SVGElement*>::const_iterator end = m_clients.end(); diff --git a/WebCore/svg/SVGCursorElement.h b/WebCore/svg/SVGCursorElement.h index 9774440..cd4a44e 100644 --- a/WebCore/svg/SVGCursorElement.h +++ b/WebCore/svg/SVGCursorElement.h @@ -22,50 +22,52 @@ #define SVGCursorElement_h #if ENABLE(SVG) +#include "SVGAnimatedBoolean.h" #include "SVGAnimatedLength.h" -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedString.h" #include "SVGElement.h" +#include "SVGExternalResourcesRequired.h" #include "SVGTests.h" #include "SVGURIReference.h" -#include "SVGExternalResourcesRequired.h" namespace WebCore { - class SVGCursorElement : public SVGElement, - public SVGTests, - public SVGExternalResourcesRequired, - public SVGURIReference { - public: - static PassRefPtr<SVGCursorElement> create(const QualifiedName&, Document*); +class SVGCursorElement : public SVGElement, + public SVGTests, + public SVGExternalResourcesRequired, + public SVGURIReference { +public: + static PassRefPtr<SVGCursorElement> create(const QualifiedName&, Document*); - virtual ~SVGCursorElement(); + virtual ~SVGCursorElement(); - void addClient(SVGElement*); - void removeClient(SVGElement*); + void addClient(SVGElement*); + void removeClient(SVGElement*); void removeReferencedElement(SVGElement*); - private: - SVGCursorElement(const QualifiedName&, Document*); +private: + SVGCursorElement(const QualifiedName&, Document*); - virtual bool isValid() const { return SVGTests::isValid(); } + virtual bool isValid() const { return SVGTests::isValid(); } - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; + virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; - DECLARE_ANIMATED_PROPERTY_NEW(SVGCursorElement, SVGNames::xAttr, SVGLength, X, x) - DECLARE_ANIMATED_PROPERTY_NEW(SVGCursorElement, SVGNames::yAttr, SVGLength, Y, y) + // Animated property declarations + DECLARE_ANIMATED_LENGTH(X, x) + DECLARE_ANIMATED_LENGTH(Y, y) - // SVGURIReference - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGCursorElement, XLinkNames::hrefAttr, String, Href, href) + // SVGURIReference + DECLARE_ANIMATED_STRING(Href, href) - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGCursorElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) - HashSet<SVGElement*> m_clients; - }; + HashSet<SVGElement*> m_clients; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGDefsElement.cpp b/WebCore/svg/SVGDefsElement.cpp index 8525705..59c5415 100644 --- a/WebCore/svg/SVGDefsElement.cpp +++ b/WebCore/svg/SVGDefsElement.cpp @@ -24,9 +24,13 @@ #include "SVGDefsElement.h" #include "RenderSVGHiddenContainer.h" +#include "SVGNames.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_BOOLEAN(SVGDefsElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + inline SVGDefsElement::SVGDefsElement(const QualifiedName& tagName, Document* document) : SVGStyledTransformableElement(tagName, document) { diff --git a/WebCore/svg/SVGDefsElement.h b/WebCore/svg/SVGDefsElement.h index ecf2d69..70eca95 100644 --- a/WebCore/svg/SVGDefsElement.h +++ b/WebCore/svg/SVGDefsElement.h @@ -22,7 +22,7 @@ #define SVGDefsElement_h #if ENABLE(SVG) -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedBoolean.h" #include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" #include "SVGStyledTransformableElement.h" @@ -30,24 +30,26 @@ namespace WebCore { - class SVGDefsElement : public SVGStyledTransformableElement, - public SVGTests, - public SVGLangSpace, - public SVGExternalResourcesRequired { - public: - static PassRefPtr<SVGDefsElement> create(const QualifiedName&, Document*); +class SVGDefsElement : public SVGStyledTransformableElement, + public SVGTests, + public SVGLangSpace, + public SVGExternalResourcesRequired { +public: + static PassRefPtr<SVGDefsElement> create(const QualifiedName&, Document*); - private: - SVGDefsElement(const QualifiedName&, Document*); +private: + SVGDefsElement(const QualifiedName&, Document*); - virtual bool isValid() const; + virtual bool isValid() const; - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual void synchronizeProperty(const QualifiedName&); + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual void synchronizeProperty(const QualifiedName&); - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGDefsElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) - }; + // Animated property declarations + + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGDescElement.h b/WebCore/svg/SVGDescElement.h index 994007c..32a7ad0 100644 --- a/WebCore/svg/SVGDescElement.h +++ b/WebCore/svg/SVGDescElement.h @@ -27,18 +27,18 @@ namespace WebCore { - class SVGDescElement : public SVGStyledElement, - public SVGLangSpace { - public: - static PassRefPtr<SVGDescElement> create(const QualifiedName&, Document*); +class SVGDescElement : public SVGStyledElement, + public SVGLangSpace { +public: + static PassRefPtr<SVGDescElement> create(const QualifiedName&, Document*); - String description() const; + String description() const; - private: - SVGDescElement(const QualifiedName&, Document*); +private: + SVGDescElement(const QualifiedName&, Document*); - virtual bool rendererIsNeeded(RenderStyle*) { return false; } - }; + virtual bool rendererIsNeeded(RenderStyle*) { return false; } +}; } // namespace WebCore diff --git a/WebCore/svg/SVGDocument.cpp b/WebCore/svg/SVGDocument.cpp index e6d53a4..9b200b7 100644 --- a/WebCore/svg/SVGDocument.cpp +++ b/WebCore/svg/SVGDocument.cpp @@ -30,8 +30,8 @@ #include "SVGNames.h" #include "SVGSVGElement.h" #include "SVGViewSpec.h" -#include "SVGZoomEvent.h" #include "SVGZoomAndPan.h" +#include "SVGZoomEvent.h" namespace WebCore { diff --git a/WebCore/svg/SVGDocument.h b/WebCore/svg/SVGDocument.h index 58e3518..b934145 100644 --- a/WebCore/svg/SVGDocument.h +++ b/WebCore/svg/SVGDocument.h @@ -27,36 +27,36 @@ namespace WebCore { - class DOMImplementation; - class SVGElement; - class SVGSVGElement; +class DOMImplementation; +class SVGElement; +class SVGSVGElement; - class SVGDocument : public Document { - public: - static PassRefPtr<SVGDocument> create(Frame* frame, const KURL& url) - { - return adoptRef(new SVGDocument(frame, url)); - } +class SVGDocument : public Document { +public: + static PassRefPtr<SVGDocument> create(Frame* frame, const KURL& url) + { + return adoptRef(new SVGDocument(frame, url)); + } - SVGSVGElement* rootElement() const; - - void dispatchZoomEvent(float prevScale, float newScale); - void dispatchScrollEvent(); + SVGSVGElement* rootElement() const; - bool zoomAndPanEnabled() const; + void dispatchZoomEvent(float prevScale, float newScale); + void dispatchScrollEvent(); - void startPan(const FloatPoint& start); - void updatePan(const FloatPoint& pos) const; + bool zoomAndPanEnabled() const; - private: - SVGDocument(Frame*, const KURL&); + void startPan(const FloatPoint& start); + void updatePan(const FloatPoint& pos) const; - virtual bool isSVGDocument() const { return true; } +private: + SVGDocument(Frame*, const KURL&); - virtual bool childShouldCreateRenderer(Node*) const; + virtual bool isSVGDocument() const { return true; } - FloatPoint m_translate; - }; + virtual bool childShouldCreateRenderer(Node*) const; + + FloatPoint m_translate; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGDocumentExtensions.cpp b/WebCore/svg/SVGDocumentExtensions.cpp index 7f7ba67..3fd9761 100644 --- a/WebCore/svg/SVGDocumentExtensions.cpp +++ b/WebCore/svg/SVGDocumentExtensions.cpp @@ -93,12 +93,8 @@ void SVGDocumentExtensions::startAnimations() // FIXME: Eventually every "Time Container" will need a way to latch on to some global timer // starting animations for a document will do this "latching" #if ENABLE(SVG_ANIMATION) - // FIXME: We hold a ref pointers to prevent a shadow tree from getting removed out from underneath us. - // In the future we should refactor the use-element to avoid this. See https://webkit.org/b/53704 - Vector<RefPtr<SVGSVGElement> > timeContainers; - timeContainers.appendRange(m_timeContainers.begin(), m_timeContainers.end()); - Vector<RefPtr<SVGSVGElement> >::iterator end = timeContainers.end(); - for (Vector<RefPtr<SVGSVGElement> >::iterator itr = timeContainers.begin(); itr != end; ++itr) + HashSet<SVGSVGElement*>::iterator end = m_timeContainers.end(); + for (HashSet<SVGSVGElement*>::iterator itr = m_timeContainers.begin(); itr != end; ++itr) (*itr)->timeContainer()->begin(); #endif } diff --git a/WebCore/svg/SVGElement.cpp b/WebCore/svg/SVGElement.cpp index 09773d3..3889dfd 100644 --- a/WebCore/svg/SVGElement.cpp +++ b/WebCore/svg/SVGElement.cpp @@ -118,12 +118,12 @@ void SVGElement::setXmlbase(const String& value, ExceptionCode&) SVGSVGElement* SVGElement::ownerSVGElement() const { - ContainerNode* n = isShadowNode() ? const_cast<SVGElement*>(this)->shadowParentNode() : parentNode(); + ContainerNode* n = parentOrHostNode(); while (n) { if (n->hasTagName(SVGNames::svgTag)) return static_cast<SVGSVGElement*>(n); - n = n->isShadowNode() ? n->shadowParentNode() : n->parentNode(); + n = n->parentOrHostNode(); } return 0; @@ -133,12 +133,12 @@ SVGElement* SVGElement::viewportElement() const { // This function needs shadow tree support - as RenderSVGContainer uses this function // to determine the "overflow" property. <use> on <symbol> wouldn't work otherwhise. - ContainerNode* n = isShadowNode() ? const_cast<SVGElement*>(this)->shadowParentNode() : parentNode(); + ContainerNode* n = parentOrHostNode(); while (n) { if (n->hasTagName(SVGNames::svgTag) || n->hasTagName(SVGNames::imageTag) || n->hasTagName(SVGNames::symbolTag)) return static_cast<SVGElement*>(n); - n = n->isShadowNode() ? n->shadowParentNode() : n->parentNode(); + n = n->parentOrHostNode(); } return 0; @@ -222,7 +222,7 @@ void SVGElement::setCursorImageValue(CSSCursorImageValue* cursorImageValue) rareData->setCursorImageValue(cursorImageValue); } -void SVGElement::cursorImageValueRemoved() +void SVGElement::cursorImageElementRemoved() { ASSERT(hasRareSVGData()); rareSVGData()->setCursorImageValue(0); diff --git a/WebCore/svg/SVGElement.h b/WebCore/svg/SVGElement.h index 0471fcc..0fe9a4f 100644 --- a/WebCore/svg/SVGElement.h +++ b/WebCore/svg/SVGElement.h @@ -29,86 +29,86 @@ namespace WebCore { - class CSSCursorImageValue; - class Document; - class SVGCursorElement; - class SVGElementInstance; - class SVGElementRareData; - class SVGSVGElement; - class AffineTransform; +class CSSCursorImageValue; +class Document; +class SVGCursorElement; +class SVGElementInstance; +class SVGElementRareData; +class SVGSVGElement; +class AffineTransform; - class SVGElement : public StyledElement { - public: - static PassRefPtr<SVGElement> create(const QualifiedName&, Document*); - virtual ~SVGElement(); +class SVGElement : public StyledElement { +public: + static PassRefPtr<SVGElement> create(const QualifiedName&, Document*); + virtual ~SVGElement(); - String xmlbase() const; - void setXmlbase(const String&, ExceptionCode&); + String xmlbase() const; + void setXmlbase(const String&, ExceptionCode&); - SVGSVGElement* ownerSVGElement() const; - SVGElement* viewportElement() const; + SVGSVGElement* ownerSVGElement() const; + SVGElement* viewportElement() const; - SVGDocumentExtensions* accessDocumentSVGExtensions() const; + SVGDocumentExtensions* accessDocumentSVGExtensions() const; - virtual bool isStyled() const { return false; } - virtual bool isStyledTransformable() const { return false; } - virtual bool isStyledLocatable() const { return false; } - virtual bool isSVG() const { return false; } - virtual bool isFilterEffect() const { return false; } - virtual bool isGradientStop() const { return false; } - virtual bool isTextContent() const { return false; } + virtual bool isStyled() const { return false; } + virtual bool isStyledTransformable() const { return false; } + virtual bool isStyledLocatable() const { return false; } + virtual bool isSVG() const { return false; } + virtual bool isFilterEffect() const { return false; } + virtual bool isGradientStop() const { return false; } + virtual bool isTextContent() const { return false; } - // For SVGTests - virtual bool isValid() const { return true; } + // For SVGTests + virtual bool isValid() const { return true; } - virtual void svgAttributeChanged(const QualifiedName&) { } - virtual void synchronizeProperty(const QualifiedName&) { } + virtual void svgAttributeChanged(const QualifiedName&) { } + virtual void synchronizeProperty(const QualifiedName&) { } - void sendSVGLoadEventIfPossible(bool sendParentLoadEvents = false); - - virtual AffineTransform* supplementalTransform() { return 0; } + void sendSVGLoadEventIfPossible(bool sendParentLoadEvents = false); - void invalidateSVGAttributes() { clearAreSVGAttributesValid(); } + virtual AffineTransform* supplementalTransform() { return 0; } - const HashSet<SVGElementInstance*>& instancesForElement() const; + void invalidateSVGAttributes() { clearAreSVGAttributesValid(); } - bool boundingBox(FloatRect&, SVGLocatable::StyleUpdateStrategy = SVGLocatable::AllowStyleUpdate) const; + const HashSet<SVGElementInstance*>& instancesForElement() const; - void setCursorElement(SVGCursorElement*); - void cursorElementRemoved(); - void setCursorImageValue(CSSCursorImageValue*); - void cursorImageValueRemoved(); + bool boundingBox(FloatRect&, SVGLocatable::StyleUpdateStrategy = SVGLocatable::AllowStyleUpdate) const; - virtual void updateAnimatedSVGAttribute(const QualifiedName&) const; + void setCursorElement(SVGCursorElement*); + void cursorElementRemoved(); + void setCursorImageValue(CSSCursorImageValue*); + void cursorImageElementRemoved(); - protected: - SVGElement(const QualifiedName&, Document*); + virtual void updateAnimatedSVGAttribute(const QualifiedName&) const; - virtual void parseMappedAttribute(Attribute*); +protected: + SVGElement(const QualifiedName&, Document*); - virtual void finishParsingChildren(); - virtual void insertedIntoDocument(); - virtual void attributeChanged(Attribute*, bool preserveDecls = false); - virtual bool childShouldCreateRenderer(Node*) const; + virtual void parseMappedAttribute(Attribute*); - SVGElementRareData* rareSVGData() const; - SVGElementRareData* ensureRareSVGData(); + virtual void finishParsingChildren(); + virtual void insertedIntoDocument(); + virtual void attributeChanged(Attribute*, bool preserveDecls = false); + virtual bool childShouldCreateRenderer(Node*) const; - private: - friend class SVGElementInstance; + SVGElementRareData* rareSVGData() const; + SVGElementRareData* ensureRareSVGData(); - virtual bool rendererIsNeeded(RenderStyle*) { return false; } +private: + friend class SVGElementInstance; - virtual bool isSupported(StringImpl* feature, StringImpl* version) const; + virtual bool rendererIsNeeded(RenderStyle*) { return false; } - virtual bool needsPendingResourceHandling() const { return true; } - virtual void buildPendingResource() { } + virtual bool isSupported(StringImpl* feature, StringImpl* version) const; - void mapInstanceToElement(SVGElementInstance*); - void removeInstanceMapping(SVGElementInstance*); + virtual bool needsPendingResourceHandling() const { return true; } + virtual void buildPendingResource() { } - virtual bool haveLoadedRequiredResources(); - }; + void mapInstanceToElement(SVGElementInstance*); + void removeInstanceMapping(SVGElementInstance*); + + virtual bool haveLoadedRequiredResources(); +}; } diff --git a/WebCore/svg/SVGElementInstance.cpp b/WebCore/svg/SVGElementInstance.cpp index a873f0b..f2812dd 100644 --- a/WebCore/svg/SVGElementInstance.cpp +++ b/WebCore/svg/SVGElementInstance.cpp @@ -103,8 +103,7 @@ void SVGElementInstance::invalidateAllInstancesOfElement(SVGElement* element) const HashSet<SVGElementInstance*>::const_iterator end = set.end(); for (HashSet<SVGElementInstance*>::const_iterator it = set.begin(); it != end; ++it) { ASSERT((*it)->correspondingElement() == element); - if (SVGUseElement* element = (*it)->correspondingUseElement()) - element->invalidateShadowTree(); + (*it)->correspondingUseElement()->invalidateShadowTree(); } // Be sure to rebuild use trees, if needed diff --git a/WebCore/svg/SVGElementInstance.h b/WebCore/svg/SVGElementInstance.h index 160a366..3e05ee9 100644 --- a/WebCore/svg/SVGElementInstance.h +++ b/WebCore/svg/SVGElementInstance.h @@ -27,139 +27,138 @@ namespace WebCore { - namespace Private { - template<class GenericNode, class GenericNodeContainer> - void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer* container); - }; - - class SVGUseElement; - class SVGElementInstanceList; - - // SVGElementInstance mimics Node, but without providing all its functionality - class SVGElementInstance : public TreeShared<SVGElementInstance>, - public EventTarget { - public: - static PassRefPtr<SVGElementInstance> create(SVGUseElement* useElement, PassRefPtr<SVGElement> originalElement) - { - return adoptRef(new SVGElementInstance(useElement, originalElement)); - } - - virtual ~SVGElementInstance(); - - virtual ScriptExecutionContext* scriptExecutionContext() const; - - virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); - virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); - virtual void removeAllEventListeners(); - using EventTarget::dispatchEvent; - virtual bool dispatchEvent(PassRefPtr<Event>); - - SVGElement* correspondingElement() const { return m_element.get(); } - SVGUseElement* correspondingUseElement() const { return m_useElement; } - SVGElement* shadowTreeElement() const { return m_shadowTreeElement.get(); } - void clearUseElement() { m_useElement = 0; } - - SVGElementInstance* parentNode() const { return parent(); } - PassRefPtr<SVGElementInstanceList> childNodes(); - - SVGElementInstance* previousSibling() const { return m_previousSibling; } - SVGElementInstance* nextSibling() const { return m_nextSibling; } - - SVGElementInstance* firstChild() const { return m_firstChild; } - SVGElementInstance* lastChild() const { return m_lastChild; } - - Document* ownerDocument() const { return m_element ? m_element->ownerDocument() : 0; } - - static void invalidateAllInstancesOfElement(SVGElement*); - - using TreeShared<SVGElementInstance>::ref; - using TreeShared<SVGElementInstance>::deref; - - // EventTarget API - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), abort); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), blur); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), change); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), click); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), contextmenu); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dblclick); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), error); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), focus); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), input); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), keydown); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), keypress); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), keyup); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), load); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mousedown); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mousemove); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mouseout); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mouseover); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mouseup); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mousewheel); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), beforecut); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), cut); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), beforecopy); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), copy); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), beforepaste); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), paste); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragenter); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragover); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragleave); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), drop); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragstart); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), drag); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragend); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), reset); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), resize); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), scroll); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), search); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), select); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), selectstart); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), submit); - DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), unload); - - private: - friend class SVGUseElement; - - SVGElementInstance(SVGUseElement*, PassRefPtr<SVGElement> originalElement); - - virtual Node* toNode() { return shadowTreeElement(); } - virtual SVGElementInstance* toSVGElementInstance() { return this; } - - void appendChild(PassRefPtr<SVGElementInstance> child); - void setShadowTreeElement(SVGElement*); - - template<class GenericNode, class GenericNodeContainer> - friend void appendChildToContainer(GenericNode* child, GenericNodeContainer* container); - - template<class GenericNode, class GenericNodeContainer> - friend void removeAllChildrenInContainer(GenericNodeContainer* container); - - template<class GenericNode, class GenericNodeContainer> - friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer* container); - - bool hasChildNodes() const { return m_firstChild; } - - void setFirstChild(SVGElementInstance* child) { m_firstChild = child; } - void setLastChild(SVGElementInstance* child) { m_lastChild = child; } - - void setNextSibling(SVGElementInstance* sibling) { m_nextSibling = sibling; } - void setPreviousSibling(SVGElementInstance* sibling) { m_previousSibling = sibling; } - - virtual void refEventTarget() { ref(); } - virtual void derefEventTarget() { deref(); } - virtual EventTargetData* eventTargetData(); - virtual EventTargetData* ensureEventTargetData(); - - SVGUseElement* m_useElement; - RefPtr<SVGElement> m_element; - RefPtr<SVGElement> m_shadowTreeElement; - - SVGElementInstance* m_previousSibling; - SVGElementInstance* m_nextSibling; - - SVGElementInstance* m_firstChild; - SVGElementInstance* m_lastChild; - }; +namespace Private { +template<class GenericNode, class GenericNodeContainer> +void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer* container); +}; + +class SVGUseElement; +class SVGElementInstanceList; + +// SVGElementInstance mimics Node, but without providing all its functionality +class SVGElementInstance : public TreeShared<SVGElementInstance>, + public EventTarget { +public: + static PassRefPtr<SVGElementInstance> create(SVGUseElement* useElement, PassRefPtr<SVGElement> originalElement) + { + return adoptRef(new SVGElementInstance(useElement, originalElement)); + } + + virtual ~SVGElementInstance(); + + virtual ScriptExecutionContext* scriptExecutionContext() const; + + virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); + virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); + virtual void removeAllEventListeners(); + using EventTarget::dispatchEvent; + virtual bool dispatchEvent(PassRefPtr<Event>); + + SVGElement* correspondingElement() const { return m_element.get(); } + SVGUseElement* correspondingUseElement() const { return m_useElement; } + SVGElement* shadowTreeElement() const { return m_shadowTreeElement.get(); } + + SVGElementInstance* parentNode() const { return parent(); } + PassRefPtr<SVGElementInstanceList> childNodes(); + + SVGElementInstance* previousSibling() const { return m_previousSibling; } + SVGElementInstance* nextSibling() const { return m_nextSibling; } + + SVGElementInstance* firstChild() const { return m_firstChild; } + SVGElementInstance* lastChild() const { return m_lastChild; } + + Document* ownerDocument() const { return m_element ? m_element->ownerDocument() : 0; } + + static void invalidateAllInstancesOfElement(SVGElement*); + + using TreeShared<SVGElementInstance>::ref; + using TreeShared<SVGElementInstance>::deref; + + // EventTarget API + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), abort); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), blur); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), change); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), click); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), contextmenu); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dblclick); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), error); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), focus); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), input); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), keydown); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), keypress); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), keyup); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), load); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mousedown); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mousemove); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mouseout); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mouseover); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mouseup); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), mousewheel); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), beforecut); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), cut); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), beforecopy); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), copy); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), beforepaste); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), paste); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragenter); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragover); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragleave); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), drop); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragstart); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), drag); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), dragend); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), reset); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), resize); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), scroll); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), search); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), select); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), selectstart); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), submit); + DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), unload); + +private: + friend class SVGUseElement; + + SVGElementInstance(SVGUseElement*, PassRefPtr<SVGElement> originalElement); + + virtual Node* toNode() { return shadowTreeElement(); } + virtual SVGElementInstance* toSVGElementInstance() { return this; } + + void appendChild(PassRefPtr<SVGElementInstance> child); + void setShadowTreeElement(SVGElement*); + + template<class GenericNode, class GenericNodeContainer> + friend void appendChildToContainer(GenericNode* child, GenericNodeContainer* container); + + template<class GenericNode, class GenericNodeContainer> + friend void removeAllChildrenInContainer(GenericNodeContainer* container); + + template<class GenericNode, class GenericNodeContainer> + friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer* container); + + bool hasChildNodes() const { return m_firstChild; } + + void setFirstChild(SVGElementInstance* child) { m_firstChild = child; } + void setLastChild(SVGElementInstance* child) { m_lastChild = child; } + + void setNextSibling(SVGElementInstance* sibling) { m_nextSibling = sibling; } + void setPreviousSibling(SVGElementInstance* sibling) { m_previousSibling = sibling; } + + virtual void refEventTarget() { ref(); } + virtual void derefEventTarget() { deref(); } + virtual EventTargetData* eventTargetData(); + virtual EventTargetData* ensureEventTargetData(); + + SVGUseElement* m_useElement; + RefPtr<SVGElement> m_element; + RefPtr<SVGElement> m_shadowTreeElement; + + SVGElementInstance* m_previousSibling; + SVGElementInstance* m_nextSibling; + + SVGElementInstance* m_firstChild; + SVGElementInstance* m_lastChild; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGElementInstanceList.h b/WebCore/svg/SVGElementInstanceList.h index 87dffe1..643876a 100644 --- a/WebCore/svg/SVGElementInstanceList.h +++ b/WebCore/svg/SVGElementInstanceList.h @@ -22,24 +22,24 @@ #if ENABLE(SVG) -#include <wtf/RefCounted.h> #include "SVGElementInstance.h" +#include <wtf/RefCounted.h> namespace WebCore { - class SVGElementInstanceList : public RefCounted<SVGElementInstanceList> { - public: - static PassRefPtr<SVGElementInstanceList> create(PassRefPtr<SVGElementInstance> root) { return adoptRef(new SVGElementInstanceList(root)); } - virtual ~SVGElementInstanceList(); +class SVGElementInstanceList : public RefCounted<SVGElementInstanceList> { +public: + static PassRefPtr<SVGElementInstanceList> create(PassRefPtr<SVGElementInstance> root) { return adoptRef(new SVGElementInstanceList(root)); } + virtual ~SVGElementInstanceList(); - unsigned length() const; - SVGElementInstance* item(unsigned index); + unsigned length() const; + SVGElementInstance* item(unsigned index); - private: - SVGElementInstanceList(PassRefPtr<SVGElementInstance>); +private: + SVGElementInstanceList(PassRefPtr<SVGElementInstance>); - RefPtr<SVGElementInstance> m_rootInstance; - }; + RefPtr<SVGElementInstance> m_rootInstance; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGEllipseElement.cpp b/WebCore/svg/SVGEllipseElement.cpp index c945a9a..4a12aa7 100644 --- a/WebCore/svg/SVGEllipseElement.cpp +++ b/WebCore/svg/SVGEllipseElement.cpp @@ -32,6 +32,13 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::cxAttr, Cx, cx) +DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::cyAttr, Cy, cy) +DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::rxAttr, Rx, rx) +DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::ryAttr, Ry, ry) +DEFINE_ANIMATED_BOOLEAN(SVGEllipseElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + inline SVGEllipseElement::SVGEllipseElement(const QualifiedName& tagName, Document* document) : SVGStyledTransformableElement(tagName, document) , m_cx(LengthModeWidth) diff --git a/WebCore/svg/SVGEllipseElement.h b/WebCore/svg/SVGEllipseElement.h index 3bd7a50..7ba2085 100644 --- a/WebCore/svg/SVGEllipseElement.h +++ b/WebCore/svg/SVGEllipseElement.h @@ -22,8 +22,8 @@ #define SVGEllipseElement_h #if ENABLE(SVG) +#include "SVGAnimatedBoolean.h" #include "SVGAnimatedLength.h" -#include "SVGAnimatedPropertyMacros.h" #include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" #include "SVGStyledTransformableElement.h" @@ -31,34 +31,35 @@ namespace WebCore { - class SVGEllipseElement : public SVGStyledTransformableElement, - public SVGTests, - public SVGLangSpace, - public SVGExternalResourcesRequired { - public: - static PassRefPtr<SVGEllipseElement> create(const QualifiedName&, Document*); +class SVGEllipseElement : public SVGStyledTransformableElement, + public SVGTests, + public SVGLangSpace, + public SVGExternalResourcesRequired { +public: + static PassRefPtr<SVGEllipseElement> create(const QualifiedName&, Document*); - private: - SVGEllipseElement(const QualifiedName&, Document*); - - virtual bool isValid() const { return SVGTests::isValid(); } +private: + SVGEllipseElement(const QualifiedName&, Document*); + + virtual bool isValid() const { return SVGTests::isValid(); } - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual void toPathData(Path&) const; + virtual void toPathData(Path&) const; - virtual bool selfHasRelativeLengths() const; + virtual bool selfHasRelativeLengths() const; - DECLARE_ANIMATED_PROPERTY_NEW(SVGEllipseElement, SVGNames::cxAttr, SVGLength, Cx, cx) - DECLARE_ANIMATED_PROPERTY_NEW(SVGEllipseElement, SVGNames::cyAttr, SVGLength, Cy, cy) - DECLARE_ANIMATED_PROPERTY_NEW(SVGEllipseElement, SVGNames::rxAttr, SVGLength, Rx, rx) - DECLARE_ANIMATED_PROPERTY_NEW(SVGEllipseElement, SVGNames::ryAttr, SVGLength, Ry, ry) + // Animated property declarations + DECLARE_ANIMATED_LENGTH(Cx, cx) + DECLARE_ANIMATED_LENGTH(Cy, cy) + DECLARE_ANIMATED_LENGTH(Rx, rx) + DECLARE_ANIMATED_LENGTH(Ry, ry) - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGEllipseElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) - }; + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGException.h b/WebCore/svg/SVGException.h index ef54080..0193bac 100644 --- a/WebCore/svg/SVGException.h +++ b/WebCore/svg/SVGException.h @@ -27,29 +27,29 @@ namespace WebCore { - class SVGException : public ExceptionBase { - public: - static PassRefPtr<SVGException> create(const ExceptionCodeDescription& description) - { - return adoptRef(new SVGException(description)); - } - - static const int SVGExceptionOffset = 300; - static const int SVGExceptionMax = 399; - - enum SVGExceptionCode { - SVG_WRONG_TYPE_ERR = SVGExceptionOffset, - SVG_INVALID_VALUE_ERR = SVGExceptionOffset + 1, - SVG_MATRIX_NOT_INVERTABLE = SVGExceptionOffset + 2 - }; - - private: - SVGException(const ExceptionCodeDescription& description) - : ExceptionBase(description) - { - } +class SVGException : public ExceptionBase { +public: + static PassRefPtr<SVGException> create(const ExceptionCodeDescription& description) + { + return adoptRef(new SVGException(description)); + } + + static const int SVGExceptionOffset = 300; + static const int SVGExceptionMax = 399; + + enum SVGExceptionCode { + SVG_WRONG_TYPE_ERR = SVGExceptionOffset, + SVG_INVALID_VALUE_ERR = SVGExceptionOffset + 1, + SVG_MATRIX_NOT_INVERTABLE = SVGExceptionOffset + 2 }; +private: + SVGException(const ExceptionCodeDescription& description) + : ExceptionBase(description) + { + } +}; + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGFEBlendElement.cpp b/WebCore/svg/SVGFEBlendElement.cpp index 0e00627..86299fe 100644 --- a/WebCore/svg/SVGFEBlendElement.cpp +++ b/WebCore/svg/SVGFEBlendElement.cpp @@ -24,9 +24,15 @@ #include "SVGFEBlendElement.h" #include "Attribute.h" +#include "SVGNames.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_STRING(SVGFEBlendElement, SVGNames::inAttr, In1, in1) +DEFINE_ANIMATED_STRING(SVGFEBlendElement, SVGNames::in2Attr, In2, in2) +DEFINE_ANIMATED_ENUMERATION(SVGFEBlendElement, SVGNames::modeAttr, Mode, mode) + inline SVGFEBlendElement::SVGFEBlendElement(const QualifiedName& tagName, Document* document) : SVGFilterPrimitiveStandardAttributes(tagName, document) , m_mode(FEBLEND_MODE_NORMAL) diff --git a/WebCore/svg/SVGFEBlendElement.h b/WebCore/svg/SVGFEBlendElement.h index e203cd0..292f385 100644 --- a/WebCore/svg/SVGFEBlendElement.h +++ b/WebCore/svg/SVGFEBlendElement.h @@ -23,9 +23,11 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "FEBlend.h" +#include "SVGAnimatedEnumeration.h" #include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { + class SVGFEBlendElement : public SVGFilterPrimitiveStandardAttributes { public: static PassRefPtr<SVGFEBlendElement> create(const QualifiedName&, Document*); @@ -38,14 +40,13 @@ private: virtual void synchronizeProperty(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEBlendElement, SVGNames::inAttr, String, In1, in1) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEBlendElement, SVGNames::in2Attr, String, In2, in2) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEBlendElement, SVGNames::modeAttr, int, Mode, mode) + // Animated property declarations + DECLARE_ANIMATED_STRING(In1, in1) + DECLARE_ANIMATED_STRING(In2, in2) + DECLARE_ANIMATED_ENUMERATION(Mode, mode) }; } // namespace WebCore #endif // ENABLE(SVG) #endif - -// vim:ts=4:noet diff --git a/WebCore/svg/SVGFEColorMatrixElement.cpp b/WebCore/svg/SVGFEColorMatrixElement.cpp index f02f02e..79716fb 100644 --- a/WebCore/svg/SVGFEColorMatrixElement.cpp +++ b/WebCore/svg/SVGFEColorMatrixElement.cpp @@ -25,10 +25,14 @@ #include "Attribute.h" #include "SVGNames.h" -#include "SVGNumberList.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_STRING(SVGFEColorMatrixElement, SVGNames::inAttr, In1, in1) +DEFINE_ANIMATED_ENUMERATION(SVGFEColorMatrixElement, SVGNames::typeAttr, Type, type) +DEFINE_ANIMATED_NUMBER_LIST(SVGFEColorMatrixElement, SVGNames::valuesAttr, Values, values) + inline SVGFEColorMatrixElement::SVGFEColorMatrixElement(const QualifiedName& tagName, Document* document) : SVGFilterPrimitiveStandardAttributes(tagName, document) , m_type(FECOLORMATRIX_TYPE_UNKNOWN) @@ -52,8 +56,7 @@ void SVGFEColorMatrixElement::parseMappedAttribute(Attribute* attr) setTypeBaseValue(FECOLORMATRIX_TYPE_HUEROTATE); else if (value == "luminanceToAlpha") setTypeBaseValue(FECOLORMATRIX_TYPE_LUMINANCETOALPHA); - } - else if (attr->name() == SVGNames::inAttr) + } else if (attr->name() == SVGNames::inAttr) setIn1BaseValue(value); else if (attr->name() == SVGNames::valuesAttr) { SVGNumberList newList; @@ -135,6 +138,6 @@ PassRefPtr<FilterEffect> SVGFEColorMatrixElement::build(SVGFilterBuilder* filter return effect.release(); } -} //namespace WebCore +} // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGFEColorMatrixElement.h b/WebCore/svg/SVGFEColorMatrixElement.h index 1b51932..04a8966 100644 --- a/WebCore/svg/SVGFEColorMatrixElement.h +++ b/WebCore/svg/SVGFEColorMatrixElement.h @@ -23,8 +23,9 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "FEColorMatrix.h" +#include "SVGAnimatedEnumeration.h" +#include "SVGAnimatedNumberList.h" #include "SVGFilterPrimitiveStandardAttributes.h" -#include "SVGNumberList.h" namespace WebCore { @@ -40,9 +41,10 @@ private: virtual void synchronizeProperty(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEColorMatrixElement, SVGNames::inAttr, String, In1, in1) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEColorMatrixElement, SVGNames::typeAttr, int, Type, type) - DECLARE_ANIMATED_LIST_PROPERTY_NEW(SVGFEColorMatrixElement, SVGNames::valuesAttr, SVGNumberList, Values, values) + // Animated property declarations + DECLARE_ANIMATED_STRING(In1, in1) + DECLARE_ANIMATED_ENUMERATION(Type, type) + DECLARE_ANIMATED_NUMBER_LIST(Values, values) }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEComponentTransferElement.cpp b/WebCore/svg/SVGFEComponentTransferElement.cpp index 72cefac..0fa98a4 100644 --- a/WebCore/svg/SVGFEComponentTransferElement.cpp +++ b/WebCore/svg/SVGFEComponentTransferElement.cpp @@ -29,10 +29,12 @@ #include "SVGFEFuncGElement.h" #include "SVGFEFuncRElement.h" #include "SVGNames.h" -#include "SVGRenderStyle.h" namespace WebCore { +// Animated property declarations +DEFINE_ANIMATED_STRING(SVGFEComponentTransferElement, SVGNames::inAttr, In1, in1) + inline SVGFEComponentTransferElement::SVGFEComponentTransferElement(const QualifiedName& tagName, Document* document) : SVGFilterPrimitiveStandardAttributes(tagName, document) { @@ -72,15 +74,15 @@ PassRefPtr<FilterEffect> SVGFEComponentTransferElement::build(SVGFilterBuilder* ComponentTransferFunction blue; ComponentTransferFunction alpha; - for (Node* n = firstChild(); n != 0; n = n->nextSibling()) { - if (n->hasTagName(SVGNames::feFuncRTag)) - red = static_cast<SVGFEFuncRElement*>(n)->transferFunction(); - else if (n->hasTagName(SVGNames::feFuncGTag)) - green = static_cast<SVGFEFuncGElement*>(n)->transferFunction(); - else if (n->hasTagName(SVGNames::feFuncBTag)) - blue = static_cast<SVGFEFuncBElement*>(n)->transferFunction(); - else if (n->hasTagName(SVGNames::feFuncATag)) - alpha = static_cast<SVGFEFuncAElement*>(n)->transferFunction(); + for (Node* node = firstChild(); node; node = node->nextSibling()) { + if (node->hasTagName(SVGNames::feFuncRTag)) + red = static_cast<SVGFEFuncRElement*>(node)->transferFunction(); + else if (node->hasTagName(SVGNames::feFuncGTag)) + green = static_cast<SVGFEFuncGElement*>(node)->transferFunction(); + else if (node->hasTagName(SVGNames::feFuncBTag)) + blue = static_cast<SVGFEFuncBElement*>(node)->transferFunction(); + else if (node->hasTagName(SVGNames::feFuncATag)) + alpha = static_cast<SVGFEFuncAElement*>(node)->transferFunction(); } RefPtr<FilterEffect> effect = FEComponentTransfer::create(filter, red, green, blue, alpha); diff --git a/WebCore/svg/SVGFEComponentTransferElement.h b/WebCore/svg/SVGFEComponentTransferElement.h index e0ad03a..ea7f84d 100644 --- a/WebCore/svg/SVGFEComponentTransferElement.h +++ b/WebCore/svg/SVGFEComponentTransferElement.h @@ -22,8 +22,8 @@ #define SVGFEComponentTransferElement_h #if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGFilterPrimitiveStandardAttributes.h" #include "FEComponentTransfer.h" +#include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { @@ -38,7 +38,8 @@ private: virtual void synchronizeProperty(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEComponentTransferElement, SVGNames::inAttr, String, In1, in1) + // Animated property declarations + DECLARE_ANIMATED_STRING(In1, in1) }; } // namespace WebCore diff --git a/WebCore/svg/SVGFECompositeElement.cpp b/WebCore/svg/SVGFECompositeElement.cpp index 07c8aee..1433a78 100644 --- a/WebCore/svg/SVGFECompositeElement.cpp +++ b/WebCore/svg/SVGFECompositeElement.cpp @@ -28,6 +28,15 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::inAttr, In1, in1) +DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::in2Attr, In2, in2) +DEFINE_ANIMATED_ENUMERATION(SVGFECompositeElement, SVGNames::operatorAttr, _operator, _operator) +DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k1Attr, K1, k1) +DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k2Attr, K2, k2) +DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k3Attr, K3, k3) +DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k4Attr, K4, k4) + inline SVGFECompositeElement::SVGFECompositeElement(const QualifiedName& tagName, Document* document) : SVGFilterPrimitiveStandardAttributes(tagName, document) , m__operator(FECOMPOSITE_OPERATOR_OVER) diff --git a/WebCore/svg/SVGFECompositeElement.h b/WebCore/svg/SVGFECompositeElement.h index 52a1762..6892220 100644 --- a/WebCore/svg/SVGFECompositeElement.h +++ b/WebCore/svg/SVGFECompositeElement.h @@ -23,6 +23,8 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "FEComposite.h" +#include "SVGAnimatedEnumeration.h" +#include "SVGAnimatedNumber.h" #include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { @@ -39,13 +41,14 @@ private: virtual void synchronizeProperty(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFECompositeElement, SVGNames::inAttr, String, In1, in1) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFECompositeElement, SVGNames::in2Attr, String, In2, in2) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFECompositeElement, SVGNames::operatorAttr, int, _operator, _operator) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFECompositeElement, SVGNames::k1Attr, float, K1, k1) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFECompositeElement, SVGNames::k2Attr, float, K2, k2) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFECompositeElement, SVGNames::k3Attr, float, K3, k3) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFECompositeElement, SVGNames::k4Attr, float, K4, k4) + // Animated property declarations + DECLARE_ANIMATED_STRING(In1, in1) + DECLARE_ANIMATED_STRING(In2, in2) + DECLARE_ANIMATED_ENUMERATION(_operator, _operator) + DECLARE_ANIMATED_NUMBER(K1, k1) + DECLARE_ANIMATED_NUMBER(K2, k2) + DECLARE_ANIMATED_NUMBER(K3, k3) + DECLARE_ANIMATED_NUMBER(K4, k4) }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEConvolveMatrixElement.cpp b/WebCore/svg/SVGFEConvolveMatrixElement.cpp index 6c2c248..373d508 100644 --- a/WebCore/svg/SVGFEConvolveMatrixElement.cpp +++ b/WebCore/svg/SVGFEConvolveMatrixElement.cpp @@ -24,17 +24,27 @@ #include "Attr.h" #include "FloatPoint.h" -#include "FloatSize.h" #include "IntPoint.h" #include "IntSize.h" #include "SVGNames.h" -#include "SVGNumberList.h" #include "SVGParserUtilities.h" -#include <math.h> - namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_STRING(SVGFEConvolveMatrixElement, SVGNames::inAttr, In1, in1) +DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::orderAttr, orderXIdentifier(), OrderX, orderX) +DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::orderAttr, orderYIdentifier(), OrderY, orderY) +DEFINE_ANIMATED_NUMBER_LIST(SVGFEConvolveMatrixElement, SVGNames::kernelMatrixAttr, KernelMatrix, kernelMatrix) +DEFINE_ANIMATED_NUMBER(SVGFEConvolveMatrixElement, SVGNames::divisorAttr, Divisor, divisor) +DEFINE_ANIMATED_NUMBER(SVGFEConvolveMatrixElement, SVGNames::biasAttr, Bias, bias) +DEFINE_ANIMATED_INTEGER(SVGFEConvolveMatrixElement, SVGNames::targetXAttr, TargetX, targetX) +DEFINE_ANIMATED_INTEGER(SVGFEConvolveMatrixElement, SVGNames::targetYAttr, TargetY, targetY) +DEFINE_ANIMATED_ENUMERATION(SVGFEConvolveMatrixElement, SVGNames::operatorAttr, EdgeMode, edgeMode) +DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), KernelUnitLengthX, kernelUnitLengthX) +DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), KernelUnitLengthY, kernelUnitLengthY) +DEFINE_ANIMATED_BOOLEAN(SVGFEConvolveMatrixElement, SVGNames::preserveAlphaAttr, PreserveAlpha, preserveAlpha) + inline SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement(const QualifiedName& tagName, Document* document) : SVGFilterPrimitiveStandardAttributes(tagName, document) , m_edgeMode(EDGEMODE_DUPLICATE) diff --git a/WebCore/svg/SVGFEConvolveMatrixElement.h b/WebCore/svg/SVGFEConvolveMatrixElement.h index c9bc4d8..21826ec 100644 --- a/WebCore/svg/SVGFEConvolveMatrixElement.h +++ b/WebCore/svg/SVGFEConvolveMatrixElement.h @@ -22,8 +22,10 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "FEConvolveMatrix.h" +#include "SVGAnimatedEnumeration.h" +#include "SVGAnimatedNumber.h" +#include "SVGAnimatedNumberList.h" #include "SVGFilterPrimitiveStandardAttributes.h" -#include "SVGNumberList.h" namespace WebCore { @@ -40,24 +42,25 @@ private: virtual void parseMappedAttribute(Attribute*); virtual void svgAttributeChanged(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); + static const AtomicString& orderXIdentifier(); static const AtomicString& orderYIdentifier(); - static const AtomicString& kernelUnitLengthXIdentifier(); static const AtomicString& kernelUnitLengthYIdentifier(); - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::inAttr, String, In1, in1) - DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEConvolveMatrixElement, SVGNames::orderAttr, orderXIdentifier(), long, OrderX, orderX) - DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEConvolveMatrixElement, SVGNames::orderAttr, orderYIdentifier(), long, OrderY, orderY) - DECLARE_ANIMATED_LIST_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::kernelMatrixAttr, SVGNumberList, KernelMatrix, kernelMatrix) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::divisorAttr, float, Divisor, divisor) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::biasAttr, float, Bias, bias) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::targetXAttr, long, TargetX, targetX) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::targetYAttr, long, TargetY, targetY) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::operatorAttr, int, EdgeMode, edgeMode) - DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), float, KernelUnitLengthX, kernelUnitLengthX) - DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), float, KernelUnitLengthY, kernelUnitLengthY) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::preserveAlphaAttr, bool, PreserveAlpha, preserveAlpha) + // Animated property declarations + DECLARE_ANIMATED_STRING(In1, in1) + DECLARE_ANIMATED_INTEGER(OrderX, orderX) + DECLARE_ANIMATED_INTEGER(OrderY, orderY) + DECLARE_ANIMATED_NUMBER_LIST(KernelMatrix, kernelMatrix) + DECLARE_ANIMATED_NUMBER(Divisor, divisor) + DECLARE_ANIMATED_NUMBER(Bias, bias) + DECLARE_ANIMATED_INTEGER(TargetX, targetX) + DECLARE_ANIMATED_INTEGER(TargetY, targetY) + DECLARE_ANIMATED_ENUMERATION(EdgeMode, edgeMode) + DECLARE_ANIMATED_NUMBER(KernelUnitLengthX, kernelUnitLengthX) + DECLARE_ANIMATED_NUMBER(KernelUnitLengthY, kernelUnitLengthY) + DECLARE_ANIMATED_BOOLEAN(PreserveAlpha, preserveAlpha) }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEDiffuseLightingElement.cpp b/WebCore/svg/SVGFEDiffuseLightingElement.cpp index 1f044c0..873b831 100644 --- a/WebCore/svg/SVGFEDiffuseLightingElement.cpp +++ b/WebCore/svg/SVGFEDiffuseLightingElement.cpp @@ -24,14 +24,21 @@ #include "Attr.h" #include "FEDiffuseLighting.h" +#include "RenderStyle.h" #include "SVGColor.h" #include "SVGFELightElement.h" #include "SVGNames.h" #include "SVGParserUtilities.h" -#include "SVGRenderStyle.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_STRING(SVGFEDiffuseLightingElement, SVGNames::inAttr, In1, in1) +DEFINE_ANIMATED_NUMBER(SVGFEDiffuseLightingElement, SVGNames::diffuseConstantAttr, DiffuseConstant, diffuseConstant) +DEFINE_ANIMATED_NUMBER(SVGFEDiffuseLightingElement, SVGNames::surfaceScaleAttr, SurfaceScale, surfaceScale) +DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), KernelUnitLengthX, kernelUnitLengthX) +DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), KernelUnitLengthY, kernelUnitLengthY) + inline SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement(const QualifiedName& tagName, Document* document) : SVGFilterPrimitiveStandardAttributes(tagName, document) , m_diffuseConstant(1) @@ -130,11 +137,11 @@ PassRefPtr<FilterEffect> SVGFEDiffuseLightingElement::build(SVGFilterBuilder* fi PassRefPtr<LightSource> SVGFEDiffuseLightingElement::findLights() const { - for (Node* n = firstChild(); n; n = n->nextSibling()) { - if (n->hasTagName(SVGNames::feDistantLightTag) || - n->hasTagName(SVGNames::fePointLightTag) || - n->hasTagName(SVGNames::feSpotLightTag)) { - SVGFELightElement* lightNode = static_cast<SVGFELightElement*>(n); + for (Node* node = firstChild(); node; node = node->nextSibling()) { + if (node->hasTagName(SVGNames::feDistantLightTag) + || node->hasTagName(SVGNames::fePointLightTag) + || node->hasTagName(SVGNames::feSpotLightTag)) { + SVGFELightElement* lightNode = static_cast<SVGFELightElement*>(node); return lightNode->lightSource(); } } diff --git a/WebCore/svg/SVGFEDiffuseLightingElement.h b/WebCore/svg/SVGFEDiffuseLightingElement.h index 8ad4f5c..d56ced9 100644 --- a/WebCore/svg/SVGFEDiffuseLightingElement.h +++ b/WebCore/svg/SVGFEDiffuseLightingElement.h @@ -46,11 +46,12 @@ private: static const AtomicString& kernelUnitLengthXIdentifier(); static const AtomicString& kernelUnitLengthYIdentifier(); - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEDiffuseLightingElement, SVGNames::inAttr, String, In1, in1) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEDiffuseLightingElement, SVGNames::diffuseConstantAttr, float, DiffuseConstant, diffuseConstant) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEDiffuseLightingElement, SVGNames::surfaceScaleAttr, float, SurfaceScale, surfaceScale) - DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), float, KernelUnitLengthX, kernelUnitLengthX) - DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), float, KernelUnitLengthY, kernelUnitLengthY) + // Animated property declarations + DECLARE_ANIMATED_STRING(In1, in1) + DECLARE_ANIMATED_NUMBER(DiffuseConstant, diffuseConstant) + DECLARE_ANIMATED_NUMBER(SurfaceScale, surfaceScale) + DECLARE_ANIMATED_NUMBER(KernelUnitLengthX, kernelUnitLengthX) + DECLARE_ANIMATED_NUMBER(KernelUnitLengthY, kernelUnitLengthY) PassRefPtr<LightSource> findLights() const; }; diff --git a/WebCore/svg/SVGFEDisplacementMapElement.cpp b/WebCore/svg/SVGFEDisplacementMapElement.cpp index a2a1f88..a363b3a 100644 --- a/WebCore/svg/SVGFEDisplacementMapElement.cpp +++ b/WebCore/svg/SVGFEDisplacementMapElement.cpp @@ -23,9 +23,17 @@ #include "SVGFEDisplacementMapElement.h" #include "Attribute.h" +#include "SVGNames.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_STRING(SVGFEDisplacementMapElement, SVGNames::inAttr, In1, in1) +DEFINE_ANIMATED_STRING(SVGFEDisplacementMapElement, SVGNames::in2Attr, In2, in2) +DEFINE_ANIMATED_ENUMERATION(SVGFEDisplacementMapElement, SVGNames::xChannelSelectorAttr, XChannelSelector, xChannelSelector) +DEFINE_ANIMATED_ENUMERATION(SVGFEDisplacementMapElement, SVGNames::yChannelSelectorAttr, YChannelSelector, yChannelSelector) +DEFINE_ANIMATED_NUMBER(SVGFEDisplacementMapElement, SVGNames::scaleAttr, Scale, scale) + inline SVGFEDisplacementMapElement::SVGFEDisplacementMapElement(const QualifiedName& tagName, Document* document) : SVGFilterPrimitiveStandardAttributes(tagName, document) , m_xChannelSelector(CHANNEL_A) @@ -42,11 +50,11 @@ ChannelSelectorType SVGFEDisplacementMapElement::stringToChannel(const String& k { if (key == "R") return CHANNEL_R; - else if (key == "G") + if (key == "G") return CHANNEL_G; - else if (key == "B") + if (key == "B") return CHANNEL_B; - else if (key == "A") + if (key == "A") return CHANNEL_A; return CHANNEL_UNKNOWN; diff --git a/WebCore/svg/SVGFEDisplacementMapElement.h b/WebCore/svg/SVGFEDisplacementMapElement.h index 296340f..3af378c 100644 --- a/WebCore/svg/SVGFEDisplacementMapElement.h +++ b/WebCore/svg/SVGFEDisplacementMapElement.h @@ -22,6 +22,8 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "FEDisplacementMap.h" +#include "SVGAnimatedEnumeration.h" +#include "SVGAnimatedNumber.h" #include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { @@ -39,12 +41,13 @@ private: virtual void svgAttributeChanged(const QualifiedName&); virtual void synchronizeProperty(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); - - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEDisplacementMapElement, SVGNames::inAttr, String, In1, in1) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEDisplacementMapElement, SVGNames::in2Attr, String, In2, in2) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEDisplacementMapElement, SVGNames::xChannelSelectorAttr, int, XChannelSelector, xChannelSelector) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEDisplacementMapElement, SVGNames::yChannelSelectorAttr, int, YChannelSelector, yChannelSelector) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEDisplacementMapElement, SVGNames::scaleAttr, float, Scale, scale) + + // Animated property declarations + DECLARE_ANIMATED_STRING(In1, in1) + DECLARE_ANIMATED_STRING(In2, in2) + DECLARE_ANIMATED_ENUMERATION(XChannelSelector, xChannelSelector) + DECLARE_ANIMATED_ENUMERATION(YChannelSelector, yChannelSelector) + DECLARE_ANIMATED_NUMBER(Scale, scale) }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEDistantLightElement.h b/WebCore/svg/SVGFEDistantLightElement.h index 9024cce..04964ac 100644 --- a/WebCore/svg/SVGFEDistantLightElement.h +++ b/WebCore/svg/SVGFEDistantLightElement.h @@ -25,15 +25,15 @@ namespace WebCore { - class SVGFEDistantLightElement : public SVGFELightElement { - public: - static PassRefPtr<SVGFEDistantLightElement> create(const QualifiedName&, Document*); +class SVGFEDistantLightElement : public SVGFELightElement { +public: + static PassRefPtr<SVGFEDistantLightElement> create(const QualifiedName&, Document*); - private: - SVGFEDistantLightElement(const QualifiedName&, Document*); +private: + SVGFEDistantLightElement(const QualifiedName&, Document*); - virtual PassRefPtr<LightSource> lightSource() const; - }; + virtual PassRefPtr<LightSource> lightSource() const; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGFEFuncAElement.h b/WebCore/svg/SVGFEFuncAElement.h index f92ad5b..26fcc23 100644 --- a/WebCore/svg/SVGFEFuncAElement.h +++ b/WebCore/svg/SVGFEFuncAElement.h @@ -26,13 +26,13 @@ namespace WebCore { - class SVGFEFuncAElement : public SVGComponentTransferFunctionElement { - public: - static PassRefPtr<SVGFEFuncAElement> create(const QualifiedName&, Document*); +class SVGFEFuncAElement : public SVGComponentTransferFunctionElement { +public: + static PassRefPtr<SVGFEFuncAElement> create(const QualifiedName&, Document*); - private: - SVGFEFuncAElement(const QualifiedName&, Document*); - }; +private: + SVGFEFuncAElement(const QualifiedName&, Document*); +}; } // namespace WebCore diff --git a/WebCore/svg/SVGFEFuncBElement.h b/WebCore/svg/SVGFEFuncBElement.h index ea664f5..83143db 100644 --- a/WebCore/svg/SVGFEFuncBElement.h +++ b/WebCore/svg/SVGFEFuncBElement.h @@ -26,13 +26,13 @@ namespace WebCore { - class SVGFEFuncBElement : public SVGComponentTransferFunctionElement { - public: - static PassRefPtr<SVGFEFuncBElement> create(const QualifiedName&, Document*); +class SVGFEFuncBElement : public SVGComponentTransferFunctionElement { +public: + static PassRefPtr<SVGFEFuncBElement> create(const QualifiedName&, Document*); - private: - SVGFEFuncBElement(const QualifiedName&, Document*); - }; +private: + SVGFEFuncBElement(const QualifiedName&, Document*); +}; } // namespace WebCore diff --git a/WebCore/svg/SVGFEFuncGElement.h b/WebCore/svg/SVGFEFuncGElement.h index df32106..1c679b6 100644 --- a/WebCore/svg/SVGFEFuncGElement.h +++ b/WebCore/svg/SVGFEFuncGElement.h @@ -26,13 +26,13 @@ namespace WebCore { - class SVGFEFuncGElement : public SVGComponentTransferFunctionElement { - public: - static PassRefPtr<SVGFEFuncGElement> create(const QualifiedName&, Document*); +class SVGFEFuncGElement : public SVGComponentTransferFunctionElement { +public: + static PassRefPtr<SVGFEFuncGElement> create(const QualifiedName&, Document*); - private: - SVGFEFuncGElement(const QualifiedName&, Document*); - }; +private: + SVGFEFuncGElement(const QualifiedName&, Document*); +}; } // namespace WebCore diff --git a/WebCore/svg/SVGFEFuncRElement.h b/WebCore/svg/SVGFEFuncRElement.h index 601095f..b3e651c 100644 --- a/WebCore/svg/SVGFEFuncRElement.h +++ b/WebCore/svg/SVGFEFuncRElement.h @@ -26,13 +26,13 @@ namespace WebCore { - class SVGFEFuncRElement : public SVGComponentTransferFunctionElement { - public: - static PassRefPtr<SVGFEFuncRElement> create(const QualifiedName&, Document*); +class SVGFEFuncRElement : public SVGComponentTransferFunctionElement { +public: + static PassRefPtr<SVGFEFuncRElement> create(const QualifiedName&, Document*); - private: - SVGFEFuncRElement(const QualifiedName&, Document*); - }; +private: + SVGFEFuncRElement(const QualifiedName&, Document*); +}; } // namespace WebCore diff --git a/WebCore/svg/SVGFEGaussianBlurElement.cpp b/WebCore/svg/SVGFEGaussianBlurElement.cpp index 4b0855c..43b6fd6 100644 --- a/WebCore/svg/SVGFEGaussianBlurElement.cpp +++ b/WebCore/svg/SVGFEGaussianBlurElement.cpp @@ -29,6 +29,11 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_STRING(SVGFEGaussianBlurElement, SVGNames::inAttr, In1, in1) +DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, stdDeviationXIdentifier(), StdDeviationX, stdDeviationX) +DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, stdDeviationYIdentifier(), StdDeviationY, stdDeviationY) + inline SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(const QualifiedName& tagName, Document* document) : SVGFilterPrimitiveStandardAttributes(tagName, document) { diff --git a/WebCore/svg/SVGFEGaussianBlurElement.h b/WebCore/svg/SVGFEGaussianBlurElement.h index ad06008..1b04658 100644 --- a/WebCore/svg/SVGFEGaussianBlurElement.h +++ b/WebCore/svg/SVGFEGaussianBlurElement.h @@ -23,6 +23,7 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "FEGaussianBlur.h" +#include "SVGAnimatedNumber.h" #include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { @@ -44,9 +45,10 @@ private: static const AtomicString& stdDeviationXIdentifier(); static const AtomicString& stdDeviationYIdentifier(); - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEGaussianBlurElement, SVGNames::inAttr, String, In1, in1) - DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, stdDeviationXIdentifier(), float, StdDeviationX, stdDeviationX) - DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, stdDeviationYIdentifier(), float, StdDeviationY, stdDeviationY) + // Animated property declarations + DECLARE_ANIMATED_STRING(In1, in1) + DECLARE_ANIMATED_NUMBER(StdDeviationX, stdDeviationX) + DECLARE_ANIMATED_NUMBER(StdDeviationY, stdDeviationY) }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEImageElement.cpp b/WebCore/svg/SVGFEImageElement.cpp index e0ba7a6..04ea14c 100644 --- a/WebCore/svg/SVGFEImageElement.cpp +++ b/WebCore/svg/SVGFEImageElement.cpp @@ -32,12 +32,16 @@ #include "RenderObject.h" #include "RenderSVGResource.h" #include "SVGImageBufferTools.h" -#include "SVGLength.h" #include "SVGNames.h" #include "SVGPreserveAspectRatio.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGFEImageElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio) +DEFINE_ANIMATED_STRING(SVGFEImageElement, XLinkNames::hrefAttr, Href, href) +DEFINE_ANIMATED_BOOLEAN(SVGFEImageElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + inline SVGFEImageElement::SVGFEImageElement(const QualifiedName& tagName, Document* document) : SVGFilterPrimitiveStandardAttributes(tagName, document) { diff --git a/WebCore/svg/SVGFEImageElement.h b/WebCore/svg/SVGFEImageElement.h index 78ba8e3..64d95dc 100644 --- a/WebCore/svg/SVGFEImageElement.h +++ b/WebCore/svg/SVGFEImageElement.h @@ -25,11 +25,11 @@ #include "CachedResourceClient.h" #include "CachedResourceHandle.h" #include "ImageBuffer.h" +#include "SVGAnimatedPreserveAspectRatio.h" #include "SVGExternalResourcesRequired.h" #include "SVGFEImage.h" #include "SVGFilterPrimitiveStandardAttributes.h" #include "SVGLangSpace.h" -#include "SVGPreserveAspectRatio.h" #include "SVGURIReference.h" namespace WebCore { @@ -57,13 +57,14 @@ private: void requestImageResource(); - DECLARE_ANIMATED_PROPERTY_NEW(SVGFEImageElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) + // Animated property declarations + DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) // SVGURIReference - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEImageElement, XLinkNames::hrefAttr, String, Href, href) + DECLARE_ANIMATED_STRING(Href, href) // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEImageElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) CachedResourceHandle<CachedImage> m_cachedImage; OwnPtr<ImageBuffer> m_targetImage; diff --git a/WebCore/svg/SVGFELightElement.cpp b/WebCore/svg/SVGFELightElement.cpp index 7fed774..8ff8eb1 100644 --- a/WebCore/svg/SVGFELightElement.cpp +++ b/WebCore/svg/SVGFELightElement.cpp @@ -25,12 +25,25 @@ #include "SVGFELightElement.h" #include "Attribute.h" +#include "RenderObject.h" #include "RenderSVGResource.h" #include "SVGFilterElement.h" #include "SVGNames.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::azimuthAttr, Azimuth, azimuth) +DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::elevationAttr, Elevation, elevation) +DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::xAttr, X, x) +DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::yAttr, Y, y) +DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::zAttr, Z, z) +DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::pointsAtXAttr, PointsAtX, pointsAtX) +DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::pointsAtYAttr, PointsAtY, pointsAtY) +DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::pointsAtZAttr, PointsAtZ, pointsAtZ) +DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::specularExponentAttr, SpecularExponent, specularExponent) +DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::limitingConeAngleAttr, LimitingConeAngle, limitingConeAngle) + SVGFELightElement::SVGFELightElement(const QualifiedName& tagName, Document* document) : SVGElement(tagName, document) , m_specularExponent(1) diff --git a/WebCore/svg/SVGFELightElement.h b/WebCore/svg/SVGFELightElement.h index 986a0dc..2f6e687 100644 --- a/WebCore/svg/SVGFELightElement.h +++ b/WebCore/svg/SVGFELightElement.h @@ -24,7 +24,7 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "LightSource.h" -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedNumber.h" #include "SVGElement.h" namespace WebCore { @@ -42,16 +42,17 @@ private: virtual void synchronizeProperty(const QualifiedName&); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::azimuthAttr, float, Azimuth, azimuth) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::elevationAttr, float, Elevation, elevation) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::xAttr, float, X, x) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::yAttr, float, Y, y) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::zAttr, float, Z, z) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::pointsAtXAttr, float, PointsAtX, pointsAtX) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::pointsAtYAttr, float, PointsAtY, pointsAtY) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::pointsAtZAttr, float, PointsAtZ, pointsAtZ) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::specularExponentAttr, float, SpecularExponent, specularExponent) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFELightElement, SVGNames::limitingConeAngleAttr, float, LimitingConeAngle, limitingConeAngle) + // Animated property declarations + DECLARE_ANIMATED_NUMBER(Azimuth, azimuth) + DECLARE_ANIMATED_NUMBER(Elevation, elevation) + DECLARE_ANIMATED_NUMBER(X, x) + DECLARE_ANIMATED_NUMBER(Y, y) + DECLARE_ANIMATED_NUMBER(Z, z) + DECLARE_ANIMATED_NUMBER(PointsAtX, pointsAtX) + DECLARE_ANIMATED_NUMBER(PointsAtY, pointsAtY) + DECLARE_ANIMATED_NUMBER(PointsAtZ, pointsAtZ) + DECLARE_ANIMATED_NUMBER(SpecularExponent, specularExponent) + DECLARE_ANIMATED_NUMBER(LimitingConeAngle, limitingConeAngle) }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEMergeElement.cpp b/WebCore/svg/SVGFEMergeElement.cpp index bc6bed5..92f2346 100644 --- a/WebCore/svg/SVGFEMergeElement.cpp +++ b/WebCore/svg/SVGFEMergeElement.cpp @@ -24,6 +24,7 @@ #include "SVGFEMergeElement.h" #include "SVGFEMergeNodeElement.h" +#include "SVGNames.h" namespace WebCore { @@ -41,9 +42,9 @@ PassRefPtr<FilterEffect> SVGFEMergeElement::build(SVGFilterBuilder* filterBuilde { RefPtr<FilterEffect> effect = FEMerge::create(filter); FilterEffectVector& mergeInputs = effect->inputEffects(); - for (Node* n = firstChild(); n != 0; n = n->nextSibling()) { - if (n->hasTagName(SVGNames::feMergeNodeTag)) { - FilterEffect* mergeEffect = filterBuilder->getEffectById(static_cast<SVGFEMergeNodeElement*>(n)->in1()); + for (Node* node = firstChild(); node; node = node->nextSibling()) { + if (node->hasTagName(SVGNames::feMergeNodeTag)) { + FilterEffect* mergeEffect = filterBuilder->getEffectById(static_cast<SVGFEMergeNodeElement*>(node)->in1()); if (!mergeEffect) return 0; mergeInputs.append(mergeEffect); diff --git a/WebCore/svg/SVGFEMergeNodeElement.cpp b/WebCore/svg/SVGFEMergeNodeElement.cpp index 54bb2fe..83739de 100644 --- a/WebCore/svg/SVGFEMergeNodeElement.cpp +++ b/WebCore/svg/SVGFEMergeNodeElement.cpp @@ -24,11 +24,16 @@ #include "SVGFEMergeNodeElement.h" #include "Attribute.h" +#include "RenderObject.h" #include "RenderSVGResource.h" #include "SVGFilterElement.h" +#include "SVGNames.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_STRING(SVGFEMergeNodeElement, SVGNames::inAttr, In1, in1) + inline SVGFEMergeNodeElement::SVGFEMergeNodeElement(const QualifiedName& tagName, Document* document) : SVGElement(tagName, document) { diff --git a/WebCore/svg/SVGFEMergeNodeElement.h b/WebCore/svg/SVGFEMergeNodeElement.h index a40d7a2..14f0e8e 100644 --- a/WebCore/svg/SVGFEMergeNodeElement.h +++ b/WebCore/svg/SVGFEMergeNodeElement.h @@ -22,24 +22,25 @@ #define SVGFEMergeNodeElement_h #if ENABLE(SVG) && ENABLE(FILTERS) -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedString.h" #include "SVGElement.h" namespace WebCore { - class SVGFEMergeNodeElement : public SVGElement { - public: - static PassRefPtr<SVGFEMergeNodeElement> create(const QualifiedName&, Document*); +class SVGFEMergeNodeElement : public SVGElement { +public: + static PassRefPtr<SVGFEMergeNodeElement> create(const QualifiedName&, Document*); - private: - SVGFEMergeNodeElement(const QualifiedName&, Document*); +private: + SVGFEMergeNodeElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEMergeNodeElement, SVGNames::inAttr, String, In1, in1) - }; + // Animated property declarations + DECLARE_ANIMATED_STRING(In1, in1) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGFEMorphologyElement.cpp b/WebCore/svg/SVGFEMorphologyElement.cpp index 5db1807..282c495 100644 --- a/WebCore/svg/SVGFEMorphologyElement.cpp +++ b/WebCore/svg/SVGFEMorphologyElement.cpp @@ -28,6 +28,12 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_STRING(SVGFEMorphologyElement, SVGNames::inAttr, In1, in1) +DEFINE_ANIMATED_ENUMERATION(SVGFEMorphologyElement, SVGNames::operatorAttr, _operator, _operator) +DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, radiusXIdentifier(), RadiusX, radiusX) +DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, radiusYIdentifier(), RadiusY, radiusY) + inline SVGFEMorphologyElement::SVGFEMorphologyElement(const QualifiedName& tagName, Document* document) : SVGFilterPrimitiveStandardAttributes(tagName, document) , m__operator(FEMORPHOLOGY_OPERATOR_ERODE) @@ -127,6 +133,6 @@ PassRefPtr<FilterEffect> SVGFEMorphologyElement::build(SVGFilterBuilder* filterB return effect.release(); } -} //namespace WebCore +} // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGFEMorphologyElement.h b/WebCore/svg/SVGFEMorphologyElement.h index ba40f32..77190e6 100644 --- a/WebCore/svg/SVGFEMorphologyElement.h +++ b/WebCore/svg/SVGFEMorphologyElement.h @@ -22,6 +22,8 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "FEMorphology.h" +#include "SVGAnimatedEnumeration.h" +#include "SVGAnimatedNumber.h" #include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { @@ -43,10 +45,11 @@ private: static const AtomicString& radiusXIdentifier(); static const AtomicString& radiusYIdentifier(); - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEMorphologyElement, SVGNames::inAttr, String, In1, in1) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEMorphologyElement, SVGNames::operatorAttr, int, _operator, _operator) - DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEMorphologyElement, SVGNames::radiusAttr, radiusXIdentifier(), float, RadiusX, radiusX) - DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEMorphologyElement, SVGNames::radiusAttr, radiusYIdentifier(), float, RadiusY, radiusY) + // Animated property declarations + DECLARE_ANIMATED_STRING(In1, in1) + DECLARE_ANIMATED_ENUMERATION(_operator, _operator) + DECLARE_ANIMATED_NUMBER(RadiusX, radiusX) + DECLARE_ANIMATED_NUMBER(RadiusY, radiusY) }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEOffsetElement.cpp b/WebCore/svg/SVGFEOffsetElement.cpp index 2119cfb..d41e6db 100644 --- a/WebCore/svg/SVGFEOffsetElement.cpp +++ b/WebCore/svg/SVGFEOffsetElement.cpp @@ -23,10 +23,16 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEOffsetElement.h" -#include "Attr.h" +#include "Attribute.h" +#include "SVGNames.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_STRING(SVGFEOffsetElement, SVGNames::inAttr, In1, in1) +DEFINE_ANIMATED_NUMBER(SVGFEOffsetElement, SVGNames::dxAttr, Dx, dx) +DEFINE_ANIMATED_NUMBER(SVGFEOffsetElement, SVGNames::dyAttr, Dy, dy) + inline SVGFEOffsetElement::SVGFEOffsetElement(const QualifiedName& tagName, Document* document) : SVGFilterPrimitiveStandardAttributes(tagName, document) { diff --git a/WebCore/svg/SVGFEOffsetElement.h b/WebCore/svg/SVGFEOffsetElement.h index 51c2ce0..2092df2 100644 --- a/WebCore/svg/SVGFEOffsetElement.h +++ b/WebCore/svg/SVGFEOffsetElement.h @@ -23,6 +23,7 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "FEOffset.h" +#include "SVGAnimatedNumber.h" #include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { @@ -39,9 +40,10 @@ private: virtual void synchronizeProperty(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEOffsetElement, SVGNames::inAttr, String, In1, in1) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEOffsetElement, SVGNames::dxAttr, float, Dx, dx) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEOffsetElement, SVGNames::dyAttr, float, Dy, dy) + // Animated property declarations + DECLARE_ANIMATED_STRING(In1, in1) + DECLARE_ANIMATED_NUMBER(Dx, dx) + DECLARE_ANIMATED_NUMBER(Dy, dy) }; } // namespace WebCore diff --git a/WebCore/svg/SVGFEPointLightElement.h b/WebCore/svg/SVGFEPointLightElement.h index 270d36d..a3f47e8 100644 --- a/WebCore/svg/SVGFEPointLightElement.h +++ b/WebCore/svg/SVGFEPointLightElement.h @@ -25,15 +25,15 @@ namespace WebCore { - class SVGFEPointLightElement : public SVGFELightElement { - public: - static PassRefPtr<SVGFEPointLightElement> create(const QualifiedName&, Document*); +class SVGFEPointLightElement : public SVGFELightElement { +public: + static PassRefPtr<SVGFEPointLightElement> create(const QualifiedName&, Document*); - private: - SVGFEPointLightElement(const QualifiedName&, Document*); +private: + SVGFEPointLightElement(const QualifiedName&, Document*); - virtual PassRefPtr<LightSource> lightSource() const; - }; + virtual PassRefPtr<LightSource> lightSource() const; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGFESpecularLightingElement.cpp b/WebCore/svg/SVGFESpecularLightingElement.cpp index 09fb6e0..806d0cd 100644 --- a/WebCore/svg/SVGFESpecularLightingElement.cpp +++ b/WebCore/svg/SVGFESpecularLightingElement.cpp @@ -25,6 +25,7 @@ #include "SVGFESpecularLightingElement.h" #include "Attribute.h" +#include "RenderStyle.h" #include "SVGColor.h" #include "SVGFELightElement.h" #include "SVGNames.h" @@ -32,6 +33,14 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_STRING(SVGFESpecularLightingElement, SVGNames::inAttr, In1, in1) +DEFINE_ANIMATED_NUMBER(SVGFESpecularLightingElement, SVGNames::specularConstantAttr, SpecularConstant, specularConstant) +DEFINE_ANIMATED_NUMBER(SVGFESpecularLightingElement, SVGNames::specularExponentAttr, SpecularExponent, specularExponent) +DEFINE_ANIMATED_NUMBER(SVGFESpecularLightingElement, SVGNames::surfaceScaleAttr, SurfaceScale, surfaceScale) +DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), KernelUnitLengthX, kernelUnitLengthX) +DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), KernelUnitLengthY, kernelUnitLengthY) + inline SVGFESpecularLightingElement::SVGFESpecularLightingElement(const QualifiedName& tagName, Document* document) : SVGFilterPrimitiveStandardAttributes(tagName, document) , m_specularConstant(1) @@ -108,11 +117,11 @@ void SVGFESpecularLightingElement::synchronizeProperty(const QualifiedName& attr PassRefPtr<LightSource> SVGFESpecularLightingElement::findLights() const { - for (Node* n = firstChild(); n; n = n->nextSibling()) { - if (n->hasTagName(SVGNames::feDistantLightTag) || - n->hasTagName(SVGNames::fePointLightTag) || - n->hasTagName(SVGNames::feSpotLightTag)) { - SVGFELightElement* lightNode = static_cast<SVGFELightElement*>(n); + for (Node* node = firstChild(); node; node = node->nextSibling()) { + if (node->hasTagName(SVGNames::feDistantLightTag) + || node->hasTagName(SVGNames::fePointLightTag) + || node->hasTagName(SVGNames::feSpotLightTag)) { + SVGFELightElement* lightNode = static_cast<SVGFELightElement*>(node); return lightNode->lightSource(); } } diff --git a/WebCore/svg/SVGFESpecularLightingElement.h b/WebCore/svg/SVGFESpecularLightingElement.h index f3ff446..ace3a3e 100644 --- a/WebCore/svg/SVGFESpecularLightingElement.h +++ b/WebCore/svg/SVGFESpecularLightingElement.h @@ -24,6 +24,7 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "FESpecularLighting.h" +#include "SVGAnimatedNumber.h" #include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { @@ -42,12 +43,13 @@ private: static const AtomicString& kernelUnitLengthXIdentifier(); static const AtomicString& kernelUnitLengthYIdentifier(); - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFESpecularLightingElement, SVGNames::inAttr, String, In1, in1) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFESpecularLightingElement, SVGNames::specularConstantAttr, float, SpecularConstant, specularConstant) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFESpecularLightingElement, SVGNames::specularExponentAttr, float, SpecularExponent, specularExponent) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFESpecularLightingElement, SVGNames::surfaceScaleAttr, float, SurfaceScale, surfaceScale) - DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), float, KernelUnitLengthX, kernelUnitLengthX) - DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), float, KernelUnitLengthY, kernelUnitLengthY) + // Animated property declarations + DECLARE_ANIMATED_STRING(In1, in1) + DECLARE_ANIMATED_NUMBER(SpecularConstant, specularConstant) + DECLARE_ANIMATED_NUMBER(SpecularExponent, specularExponent) + DECLARE_ANIMATED_NUMBER(SurfaceScale, surfaceScale) + DECLARE_ANIMATED_NUMBER(KernelUnitLengthX, kernelUnitLengthX) + DECLARE_ANIMATED_NUMBER(KernelUnitLengthY, kernelUnitLengthY) PassRefPtr<LightSource> findLights() const; }; diff --git a/WebCore/svg/SVGFESpotLightElement.h b/WebCore/svg/SVGFESpotLightElement.h index 79fc5fc..fe1e73e 100644 --- a/WebCore/svg/SVGFESpotLightElement.h +++ b/WebCore/svg/SVGFESpotLightElement.h @@ -25,15 +25,15 @@ namespace WebCore { - class SVGFESpotLightElement : public SVGFELightElement { - public: - static PassRefPtr<SVGFESpotLightElement> create(const QualifiedName&, Document*); +class SVGFESpotLightElement : public SVGFELightElement { +public: + static PassRefPtr<SVGFESpotLightElement> create(const QualifiedName&, Document*); - private: - SVGFESpotLightElement(const QualifiedName&, Document*); +private: + SVGFESpotLightElement(const QualifiedName&, Document*); - virtual PassRefPtr<LightSource> lightSource() const; - }; + virtual PassRefPtr<LightSource> lightSource() const; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGFETileElement.cpp b/WebCore/svg/SVGFETileElement.cpp index 9d00a54..e981482 100644 --- a/WebCore/svg/SVGFETileElement.cpp +++ b/WebCore/svg/SVGFETileElement.cpp @@ -23,11 +23,15 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFETileElement.h" -#include "Attr.h" +#include "Attribute.h" +#include "SVGNames.h" #include "SVGRenderStyle.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_STRING(SVGFETileElement, SVGNames::inAttr, In1, in1) + inline SVGFETileElement::SVGFETileElement(const QualifiedName& tagName, Document* document) : SVGFilterPrimitiveStandardAttributes(tagName, document) { diff --git a/WebCore/svg/SVGFETileElement.h b/WebCore/svg/SVGFETileElement.h index b4f3380..f47d355 100644 --- a/WebCore/svg/SVGFETileElement.h +++ b/WebCore/svg/SVGFETileElement.h @@ -39,7 +39,8 @@ private: virtual void synchronizeProperty(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFETileElement, SVGNames::inAttr, String, In1, in1) + // Animated property declarations + DECLARE_ANIMATED_STRING(In1, in1) }; } // namespace WebCore diff --git a/WebCore/svg/SVGFETurbulenceElement.cpp b/WebCore/svg/SVGFETurbulenceElement.cpp index 739f8e5..0f59bf7 100644 --- a/WebCore/svg/SVGFETurbulenceElement.cpp +++ b/WebCore/svg/SVGFETurbulenceElement.cpp @@ -24,10 +24,19 @@ #include "SVGFETurbulenceElement.h" #include "Attribute.h" +#include "SVGNames.h" #include "SVGParserUtilities.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, baseFrequencyXIdentifier(), BaseFrequencyX, baseFrequencyX) +DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, baseFrequencyYIdentifier(), BaseFrequencyY, baseFrequencyY) +DEFINE_ANIMATED_INTEGER(SVGFETurbulenceElement, SVGNames::numOctavesAttr, NumOctaves, numOctaves) +DEFINE_ANIMATED_NUMBER(SVGFETurbulenceElement, SVGNames::seedAttr, Seed, seed) +DEFINE_ANIMATED_ENUMERATION(SVGFETurbulenceElement, SVGNames::stitchTilesAttr, StitchTiles, stitchTiles) +DEFINE_ANIMATED_ENUMERATION(SVGFETurbulenceElement, SVGNames::typeAttr, Type, type) + inline SVGFETurbulenceElement::SVGFETurbulenceElement(const QualifiedName& tagName, Document* document) : SVGFilterPrimitiveStandardAttributes(tagName, document) , m_numOctaves(1) diff --git a/WebCore/svg/SVGFETurbulenceElement.h b/WebCore/svg/SVGFETurbulenceElement.h index 1877ad7..5e436f4 100644 --- a/WebCore/svg/SVGFETurbulenceElement.h +++ b/WebCore/svg/SVGFETurbulenceElement.h @@ -23,6 +23,8 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "FETurbulence.h" +#include "SVGAnimatedEnumeration.h" +#include "SVGAnimatedNumber.h" #include "SVGFilterPrimitiveStandardAttributes.h" namespace WebCore { @@ -48,12 +50,13 @@ private: static const AtomicString& baseFrequencyXIdentifier(); static const AtomicString& baseFrequencyYIdentifier(); - DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, baseFrequencyXIdentifier(), float, BaseFrequencyX, baseFrequencyX) - DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, baseFrequencyYIdentifier(), float, BaseFrequencyY, baseFrequencyY) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFETurbulenceElement, SVGNames::numOctavesAttr, long, NumOctaves, numOctaves) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFETurbulenceElement, SVGNames::seedAttr, float, Seed, seed) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFETurbulenceElement, SVGNames::stitchTilesAttr, int, StitchTiles, stitchTiles) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFETurbulenceElement, SVGNames::typeAttr, int, Type, type) + // Animated property declarations + DECLARE_ANIMATED_NUMBER(BaseFrequencyX, baseFrequencyX) + DECLARE_ANIMATED_NUMBER(BaseFrequencyY, baseFrequencyY) + DECLARE_ANIMATED_INTEGER(NumOctaves, numOctaves) + DECLARE_ANIMATED_NUMBER(Seed, seed) + DECLARE_ANIMATED_ENUMERATION(StitchTiles, stitchTiles) + DECLARE_ANIMATED_ENUMERATION(Type, type) }; } // namespace WebCore diff --git a/WebCore/svg/SVGFilterElement.cpp b/WebCore/svg/SVGFilterElement.cpp index 323dd4c..03ff7fa 100644 --- a/WebCore/svg/SVGFilterElement.cpp +++ b/WebCore/svg/SVGFilterElement.cpp @@ -27,18 +27,27 @@ #include "SVGFilterElement.h" #include "Attr.h" -#include "FloatSize.h" -#include "PlatformString.h" #include "RenderSVGResourceFilter.h" #include "SVGFilterBuilder.h" #include "SVGFilterPrimitiveStandardAttributes.h" -#include "SVGLength.h" #include "SVGNames.h" #include "SVGParserUtilities.h" #include "SVGUnitTypes.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_ENUMERATION(SVGFilterElement, SVGNames::filterUnitsAttr, FilterUnits, filterUnits) +DEFINE_ANIMATED_ENUMERATION(SVGFilterElement, SVGNames::primitiveUnitsAttr, PrimitiveUnits, primitiveUnits) +DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::xAttr, X, x) +DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::yAttr, Y, y) +DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::widthAttr, Width, width) +DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::heightAttr, Height, height) +DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFilterElement, SVGNames::filterResAttr, filterResXIdentifier(), FilterResX, filterResX) +DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFilterElement, SVGNames::filterResAttr, filterResYIdentifier(), FilterResY, filterResY) +DEFINE_ANIMATED_STRING(SVGFilterElement, XLinkNames::hrefAttr, Href, href) +DEFINE_ANIMATED_BOOLEAN(SVGFilterElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + inline SVGFilterElement::SVGFilterElement(const QualifiedName& tagName, Document* document) : SVGStyledElement(tagName, document) , SVGURIReference() diff --git a/WebCore/svg/SVGFilterElement.h b/WebCore/svg/SVGFilterElement.h index 4efb958..a438625 100644 --- a/WebCore/svg/SVGFilterElement.h +++ b/WebCore/svg/SVGFilterElement.h @@ -24,9 +24,10 @@ #define SVGFilterElement_h #if ENABLE(SVG) && ENABLE(FILTERS) +#include "SVGAnimatedBoolean.h" +#include "SVGAnimatedEnumeration.h" +#include "SVGAnimatedInteger.h" #include "SVGAnimatedLength.h" -#include "SVGAnimatedPropertyMacros.h" -#include "RenderObject.h" #include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" #include "SVGStyledElement.h" @@ -61,21 +62,21 @@ private: static const AtomicString& filterResXIdentifier(); static const AtomicString& filterResYIdentifier(); - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFilterElement, SVGNames::filterUnitsAttr, int, FilterUnits, filterUnits) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFilterElement, SVGNames::primitiveUnitsAttr, int, PrimitiveUnits, primitiveUnits) - DECLARE_ANIMATED_PROPERTY_NEW(SVGFilterElement, SVGNames::xAttr, SVGLength, X, x) - DECLARE_ANIMATED_PROPERTY_NEW(SVGFilterElement, SVGNames::yAttr, SVGLength, Y, y) - DECLARE_ANIMATED_PROPERTY_NEW(SVGFilterElement, SVGNames::widthAttr, SVGLength, Width, width) - DECLARE_ANIMATED_PROPERTY_NEW(SVGFilterElement, SVGNames::heightAttr, SVGLength, Height, height) - - DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFilterElement, SVGNames::filterResAttr, filterResXIdentifier(), long, FilterResX, filterResX) - DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFilterElement, SVGNames::filterResAttr, filterResYIdentifier(), long, FilterResY, filterResY) + // Animated property declarations + DECLARE_ANIMATED_ENUMERATION(FilterUnits, filterUnits) + DECLARE_ANIMATED_ENUMERATION(PrimitiveUnits, primitiveUnits) + DECLARE_ANIMATED_LENGTH(X, x) + DECLARE_ANIMATED_LENGTH(Y, y) + DECLARE_ANIMATED_LENGTH(Width, width) + DECLARE_ANIMATED_LENGTH(Height, height) + DECLARE_ANIMATED_INTEGER(FilterResX, filterResX) + DECLARE_ANIMATED_INTEGER(FilterResY, filterResY) // SVGURIReference - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFilterElement, XLinkNames::hrefAttr, String, Href, href) + DECLARE_ANIMATED_STRING(Href, href) // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFilterElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) }; } diff --git a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp index c2c443e..bd717ea 100644 --- a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp +++ b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp @@ -34,6 +34,13 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::xAttr, X, x) +DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::yAttr, Y, y) +DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::widthAttr, Width, width) +DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::heightAttr, Height, height) +DEFINE_ANIMATED_STRING(SVGFilterPrimitiveStandardAttributes, SVGNames::resultAttr, Result, result) + SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(const QualifiedName& tagName, Document* document) : SVGStyledElement(tagName, document) , m_x(LengthModeWidth, "0%") diff --git a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h index d7abc7f..b13084b 100644 --- a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h +++ b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h @@ -25,10 +25,8 @@ #include "FilterEffect.h" #include "RenderSVGResource.h" #include "SVGAnimatedLength.h" -#include "SVGAnimatedPropertyMacros.h" #include "SVGFilterBuilder.h" #include "SVGFilterElement.h" -#include "SVGNames.h" #include "SVGStyledElement.h" #include <wtf/PassRefPtr.h> @@ -62,11 +60,12 @@ private: virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - DECLARE_ANIMATED_PROPERTY_NEW(SVGFilterPrimitiveStandardAttributes, SVGNames::xAttr, SVGLength, X, x) - DECLARE_ANIMATED_PROPERTY_NEW(SVGFilterPrimitiveStandardAttributes, SVGNames::yAttr, SVGLength, Y, y) - DECLARE_ANIMATED_PROPERTY_NEW(SVGFilterPrimitiveStandardAttributes, SVGNames::widthAttr, SVGLength, Width, width) - DECLARE_ANIMATED_PROPERTY_NEW(SVGFilterPrimitiveStandardAttributes, SVGNames::heightAttr, SVGLength, Height, height) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFilterPrimitiveStandardAttributes, SVGNames::resultAttr, String, Result, result) + // Animated property declarations + DECLARE_ANIMATED_LENGTH(X, x) + DECLARE_ANIMATED_LENGTH(Y, y) + DECLARE_ANIMATED_LENGTH(Width, width) + DECLARE_ANIMATED_LENGTH(Height, height) + DECLARE_ANIMATED_STRING(Result, result) }; } // namespace WebCore diff --git a/WebCore/svg/SVGFitToViewBox.cpp b/WebCore/svg/SVGFitToViewBox.cpp index e5bd5db..fadb982 100644 --- a/WebCore/svg/SVGFitToViewBox.cpp +++ b/WebCore/svg/SVGFitToViewBox.cpp @@ -52,8 +52,7 @@ bool SVGFitToViewBox::parseViewBox(Document* doc, const UChar*& c, const UChar* float y = 0.0f; float width = 0.0f; float height = 0.0f; - bool valid = (parseNumber(c, end, x) && parseNumber(c, end, y) && - parseNumber(c, end, width) && parseNumber(c, end, height, false)); + bool valid = parseNumber(c, end, x) && parseNumber(c, end, y) && parseNumber(c, end, width) && parseNumber(c, end, height, false); if (!validate) { viewBox = FloatRect(x, y, width, height); return true; @@ -108,8 +107,7 @@ bool SVGFitToViewBox::parseMappedAttribute(Document* document, Attribute* attr) bool SVGFitToViewBox::isKnownAttribute(const QualifiedName& attrName) { - return (attrName == SVGNames::viewBoxAttr || - attrName == SVGNames::preserveAspectRatioAttr); + return attrName == SVGNames::viewBoxAttr || attrName == SVGNames::preserveAspectRatioAttr; } } diff --git a/WebCore/svg/SVGFont.cpp b/WebCore/svg/SVGFont.cpp index 25dbbe3..dd99ac5 100644 --- a/WebCore/svg/SVGFont.cpp +++ b/WebCore/svg/SVGFont.cpp @@ -27,14 +27,15 @@ #include "GraphicsContext.h" #include "RenderObject.h" #include "RenderSVGResourceSolidColor.h" -#include "SimpleFontData.h" #include "SVGAltGlyphElement.h" #include "SVGFontData.h" -#include "SVGGlyphElement.h" -#include "SVGGlyphMap.h" #include "SVGFontElement.h" #include "SVGFontFaceElement.h" +#include "SVGGlyphElement.h" +#include "SVGGlyphMap.h" #include "SVGMissingGlyphElement.h" +#include "SVGNames.h" +#include "SimpleFontData.h" #include "XMLNames.h" using namespace WTF::Unicode; @@ -43,7 +44,7 @@ namespace WebCore { static inline float convertEmUnitToPixel(float fontSize, float unitsPerEm, float value) { - if (unitsPerEm == 0.0f) + if (!unitsPerEm) return 0.0f; return value * fontSize / unitsPerEm; @@ -241,7 +242,7 @@ struct SVGTextRunWalker { { ASSERT(0 <= from && from <= to && to - from <= run.length()); - const String text = Font::normalizeSpaces(String(run.data(from), to - from)); + const String text = Font::normalizeSpaces(String(run.data(from), run.length())); Vector<SVGGlyphIdentifier::ArabicForm> chars(charactersWithArabicForm(text, run.rtl())); SVGGlyphIdentifier identifier; @@ -511,7 +512,7 @@ void Font::drawTextUsingSVGFont(GraphicsContext* context, const TextRun& run, SVGTextRunWalker<SVGTextRunWalkerDrawTextData> runWalker(fontData, fontElement, data, drawTextUsingSVGFontCallback, drawTextMissingGlyphCallback); runWalker.walk(run, isVerticalText, language, from, to); - RenderSVGResourceMode resourceMode = context->textDrawingMode() == cTextStroke ? ApplyToStrokeMode : ApplyToFillMode; + RenderSVGResourceMode resourceMode = context->textDrawingMode() == TextModeStroke ? ApplyToStrokeMode : ApplyToFillMode; unsigned numGlyphs = data.glyphIdentifiers.size(); unsigned fallbackCharacterIndex = 0; @@ -534,12 +535,9 @@ void Font::drawTextUsingSVGFont(GraphicsContext* context, const TextRun& run, Path glyphPath = identifier.pathData; glyphPath.transform(glyphPathTransform); - context->beginPath(); - context->addPath(glyphPath); - RenderStyle* style = run.referencingRenderObject() ? run.referencingRenderObject()->style() : 0; if (activePaintingResource->applyResource(run.referencingRenderObject(), style, context, resourceMode)) - activePaintingResource->postApplyResource(run.referencingRenderObject(), context, resourceMode); + activePaintingResource->postApplyResource(run.referencingRenderObject(), context, resourceMode, &glyphPath); context->restore(); } diff --git a/WebCore/svg/SVGFontElement.cpp b/WebCore/svg/SVGFontElement.cpp index ae0cb6e..d70d46a 100644 --- a/WebCore/svg/SVGFontElement.cpp +++ b/WebCore/svg/SVGFontElement.cpp @@ -34,11 +34,10 @@ #include "SVGVKernElement.h" #include <wtf/ASCIICType.h> -using namespace WTF; - namespace WebCore { -using namespace SVGNames; +// Animated property declarations +DEFINE_ANIMATED_BOOLEAN(SVGFontElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) inline SVGFontElement::SVGFontElement(const QualifiedName& tagName, Document* document) : SVGStyledElement(tagName, document) @@ -72,7 +71,7 @@ void SVGFontElement::invalidateGlyphCache() SVGMissingGlyphElement* SVGFontElement::firstMissingGlyphElement() const { for (Node* child = firstChild(); child; child = child->nextSibling()) { - if (child->hasTagName(missing_glyphTag)) + if (child->hasTagName(SVGNames::missing_glyphTag)) return static_cast<SVGMissingGlyphElement*>(child); } @@ -85,15 +84,15 @@ void SVGFontElement::ensureGlyphCache() const return; for (Node* child = firstChild(); child; child = child->nextSibling()) { - if (child->hasTagName(glyphTag)) { + if (child->hasTagName(SVGNames::glyphTag)) { SVGGlyphElement* glyph = static_cast<SVGGlyphElement*>(child); - String unicode = glyph->getAttribute(unicodeAttr); + String unicode = glyph->getAttribute(SVGNames::unicodeAttr); if (unicode.length()) m_glyphMap.add(unicode, glyph->buildGlyphIdentifier()); - } else if (child->hasTagName(hkernTag)) { + } else if (child->hasTagName(SVGNames::hkernTag)) { SVGHKernElement* hkern = static_cast<SVGHKernElement*>(child); hkern->buildHorizontalKerningPair(m_horizontalKerningPairs); - } else if (child->hasTagName(vkernTag)) { + } else if (child->hasTagName(SVGNames::vkernTag)) { SVGVKernElement* vkern = static_cast<SVGVKernElement*>(child); vkern->buildVerticalKerningPair(m_verticalKerningPairs); } diff --git a/WebCore/svg/SVGFontElement.h b/WebCore/svg/SVGFontElement.h index e81ac61..b2de38c 100644 --- a/WebCore/svg/SVGFontElement.h +++ b/WebCore/svg/SVGFontElement.h @@ -23,7 +23,7 @@ #define SVGFontElement_h #if ENABLE(SVG_FONTS) -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedBoolean.h" #include "SVGExternalResourcesRequired.h" #include "SVGGlyphElement.h" #include "SVGGlyphMap.h" @@ -74,8 +74,10 @@ private: void ensureGlyphCache() const; + // Animated property declarations + // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFontElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) mutable KerningPairVector m_horizontalKerningPairs; mutable KerningPairVector m_verticalKerningPairs; diff --git a/WebCore/svg/SVGFontFaceElement.cpp b/WebCore/svg/SVGFontFaceElement.cpp index 97f457d..892d54d 100644 --- a/WebCore/svg/SVGFontFaceElement.cpp +++ b/WebCore/svg/SVGFontFaceElement.cpp @@ -71,39 +71,39 @@ static int cssPropertyIdForSVGAttributeName(const QualifiedName& attrName) propertyNameToIdMap = new HashMap<AtomicStringImpl*, int>; // This is a list of all @font-face CSS properties which are exposed as SVG XML attributes // Those commented out are not yet supported by WebCore's style system - //mapAttributeToCSSProperty(propertyNameToIdMap, accent_heightAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, alphabeticAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, ascentAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, bboxAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, cap_heightAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, descentAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, accent_heightAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, alphabeticAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, ascentAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, bboxAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, cap_heightAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, descentAttr); mapAttributeToCSSProperty(propertyNameToIdMap, font_familyAttr); mapAttributeToCSSProperty(propertyNameToIdMap, font_sizeAttr); mapAttributeToCSSProperty(propertyNameToIdMap, font_stretchAttr); mapAttributeToCSSProperty(propertyNameToIdMap, font_styleAttr); mapAttributeToCSSProperty(propertyNameToIdMap, font_variantAttr); mapAttributeToCSSProperty(propertyNameToIdMap, font_weightAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, hangingAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, ideographicAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, mathematicalAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, overline_positionAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, overline_thicknessAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, panose_1Attr); - //mapAttributeToCSSProperty(propertyNameToIdMap, slopeAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, stemhAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, stemvAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, strikethrough_positionAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, strikethrough_thicknessAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, underline_positionAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, underline_thicknessAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, unicode_rangeAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, units_per_emAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, v_alphabeticAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, v_hangingAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, v_ideographicAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, v_mathematicalAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, widthsAttr); - //mapAttributeToCSSProperty(propertyNameToIdMap, x_heightAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, hangingAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, ideographicAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, mathematicalAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, overline_positionAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, overline_thicknessAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, panose_1Attr); + // mapAttributeToCSSProperty(propertyNameToIdMap, slopeAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, stemhAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, stemvAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, strikethrough_positionAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, strikethrough_thicknessAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, underline_positionAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, underline_thicknessAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, unicode_rangeAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, units_per_emAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, v_alphabeticAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, v_hangingAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, v_ideographicAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, v_mathematicalAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, widthsAttr); + // mapAttributeToCSSProperty(propertyNameToIdMap, x_heightAttr); } return propertyNameToIdMap->get(attrName.localName().impl()); @@ -262,11 +262,6 @@ String SVGFontFaceElement::fontFamily() const return m_styleDeclaration->getPropertyValue(CSSPropertyFontFamily); } -SVGFontElement* SVGFontFaceElement::associatedFontElement() const -{ - return m_fontElement.get(); -} - void SVGFontFaceElement::rebuildFontFace() { ASSERT(inDocument()); diff --git a/WebCore/svg/SVGFontFaceElement.h b/WebCore/svg/SVGFontFaceElement.h index ead2e1f..5e974a7 100644 --- a/WebCore/svg/SVGFontFaceElement.h +++ b/WebCore/svg/SVGFontFaceElement.h @@ -27,44 +27,44 @@ namespace WebCore { - class CSSFontFaceRule; - class CSSMutableStyleDeclaration; - class SVGFontElement; +class CSSFontFaceRule; +class CSSMutableStyleDeclaration; +class SVGFontElement; - class SVGFontFaceElement : public SVGElement { - public: - static PassRefPtr<SVGFontFaceElement> create(const QualifiedName&, Document*); +class SVGFontFaceElement : public SVGElement { +public: + static PassRefPtr<SVGFontFaceElement> create(const QualifiedName&, Document*); - unsigned unitsPerEm() const; - int xHeight() const; - float horizontalOriginX() const; - float horizontalOriginY() const; - float horizontalAdvanceX() const; - float verticalOriginX() const; - float verticalOriginY() const; - float verticalAdvanceY() const; - int ascent() const; - int descent() const; - String fontFamily() const; + unsigned unitsPerEm() const; + int xHeight() const; + float horizontalOriginX() const; + float horizontalOriginY() const; + float horizontalAdvanceX() const; + float verticalOriginX() const; + float verticalOriginY() const; + float verticalAdvanceY() const; + int ascent() const; + int descent() const; + String fontFamily() const; - SVGFontElement* associatedFontElement() const; - void rebuildFontFace(); - void removeFromMappedElementSheet(); + SVGFontElement* associatedFontElement() const { return m_fontElement; } + void rebuildFontFace(); + void removeFromMappedElementSheet(); - private: - SVGFontFaceElement(const QualifiedName&, Document*); +private: + SVGFontFaceElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseMappedAttribute(Attribute*); - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - virtual void insertedIntoDocument(); - virtual void removedFromDocument(); + virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); + virtual void insertedIntoDocument(); + virtual void removedFromDocument(); - RefPtr<CSSFontFaceRule> m_fontFaceRule; - RefPtr<CSSMutableStyleDeclaration> m_styleDeclaration; + RefPtr<CSSFontFaceRule> m_fontFaceRule; + RefPtr<CSSMutableStyleDeclaration> m_styleDeclaration; - RefPtr<SVGFontElement> m_fontElement; - }; + SVGFontElement* m_fontElement; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGFontFaceNameElement.h b/WebCore/svg/SVGFontFaceNameElement.h index 462d7a8..e99d2d5 100644 --- a/WebCore/svg/SVGFontFaceNameElement.h +++ b/WebCore/svg/SVGFontFaceNameElement.h @@ -25,17 +25,17 @@ namespace WebCore { - class CSSFontFaceSrcValue; +class CSSFontFaceSrcValue; - class SVGFontFaceNameElement : public SVGElement { - public: - static PassRefPtr<SVGFontFaceNameElement> create(const QualifiedName&, Document*); - - PassRefPtr<CSSFontFaceSrcValue> srcValue() const; +class SVGFontFaceNameElement : public SVGElement { +public: + static PassRefPtr<SVGFontFaceNameElement> create(const QualifiedName&, Document*); + + PassRefPtr<CSSFontFaceSrcValue> srcValue() const; - private: - SVGFontFaceNameElement(const QualifiedName&, Document*); - }; +private: + SVGFontFaceNameElement(const QualifiedName&, Document*); +}; } // namespace WebCore diff --git a/WebCore/svg/SVGFontFaceSrcElement.cpp b/WebCore/svg/SVGFontFaceSrcElement.cpp index e003944..ce75872 100644 --- a/WebCore/svg/SVGFontFaceSrcElement.cpp +++ b/WebCore/svg/SVGFontFaceSrcElement.cpp @@ -22,8 +22,8 @@ #if ENABLE(SVG_FONTS) #include "SVGFontFaceSrcElement.h" -#include "CSSValueList.h" #include "CSSFontFaceSrcValue.h" +#include "CSSValueList.h" #include "SVGFontFaceElement.h" #include "SVGFontFaceNameElement.h" #include "SVGFontFaceUriElement.h" diff --git a/WebCore/svg/SVGFontFaceSrcElement.h b/WebCore/svg/SVGFontFaceSrcElement.h index e6f8d30..5e27625 100644 --- a/WebCore/svg/SVGFontFaceSrcElement.h +++ b/WebCore/svg/SVGFontFaceSrcElement.h @@ -25,19 +25,19 @@ namespace WebCore { - class CSSValueList; - - class SVGFontFaceSrcElement : public SVGElement { - public: - static PassRefPtr<SVGFontFaceSrcElement> create(const QualifiedName&, Document*); - - PassRefPtr<CSSValueList> srcValue() const; - - private: - SVGFontFaceSrcElement(const QualifiedName&, Document*); - - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - }; +class CSSValueList; + +class SVGFontFaceSrcElement : public SVGElement { +public: + static PassRefPtr<SVGFontFaceSrcElement> create(const QualifiedName&, Document*); + + PassRefPtr<CSSValueList> srcValue() const; + +private: + SVGFontFaceSrcElement(const QualifiedName&, Document*); + + virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); +}; } // namespace WebCore diff --git a/WebCore/svg/SVGFontFaceUriElement.h b/WebCore/svg/SVGFontFaceUriElement.h index 8859ea6..2de98e3 100644 --- a/WebCore/svg/SVGFontFaceUriElement.h +++ b/WebCore/svg/SVGFontFaceUriElement.h @@ -27,24 +27,25 @@ namespace WebCore { - class CSSFontFaceSrcValue; - class CachedFont; +class CSSFontFaceSrcValue; +class CachedFont; - class SVGFontFaceUriElement : public SVGElement, public CachedResourceClient { - public: - static PassRefPtr<SVGFontFaceUriElement> create(const QualifiedName&, Document*); +class SVGFontFaceUriElement : public SVGElement, public CachedResourceClient { +public: + static PassRefPtr<SVGFontFaceUriElement> create(const QualifiedName&, Document*); - virtual ~SVGFontFaceUriElement(); + virtual ~SVGFontFaceUriElement(); - PassRefPtr<CSSFontFaceSrcValue> srcValue() const; + PassRefPtr<CSSFontFaceSrcValue> srcValue() const; - private: - SVGFontFaceUriElement(const QualifiedName&, Document*); - - virtual void parseMappedAttribute(Attribute*); - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - virtual void insertedIntoDocument(); +private: + SVGFontFaceUriElement(const QualifiedName&, Document*); + + virtual void parseMappedAttribute(Attribute*); + virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); + virtual void insertedIntoDocument(); +<<<<<<< HEAD #ifdef ANDROID_INSTRUMENT void* operator new(size_t size) { return SVGElement::operator new(size); @@ -62,9 +63,12 @@ namespace WebCore { #endif void loadFont(); +======= + void loadFont(); +>>>>>>> webkit.org at r74534 (trunk) - CachedResourceHandle<CachedFont> m_cachedFont; - }; + CachedResourceHandle<CachedFont> m_cachedFont; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGForeignObjectElement.cpp b/WebCore/svg/SVGForeignObjectElement.cpp index 78063fc..c2fcecb 100644 --- a/WebCore/svg/SVGForeignObjectElement.cpp +++ b/WebCore/svg/SVGForeignObjectElement.cpp @@ -33,7 +33,15 @@ namespace WebCore { -SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tagName, Document* document) +// Animated property definitions +DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::xAttr, X, x) +DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::yAttr, Y, y) +DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::widthAttr, Width, width) +DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::heightAttr, Height, height) +DEFINE_ANIMATED_STRING(SVGForeignObjectElement, XLinkNames::hrefAttr, Href, href) +DEFINE_ANIMATED_BOOLEAN(SVGForeignObjectElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + +inline SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tagName, Document* document) : SVGStyledTransformableElement(tagName, document) , m_x(LengthModeWidth) , m_y(LengthModeHeight) diff --git a/WebCore/svg/SVGForeignObjectElement.h b/WebCore/svg/SVGForeignObjectElement.h index ee17c19..687d089 100644 --- a/WebCore/svg/SVGForeignObjectElement.h +++ b/WebCore/svg/SVGForeignObjectElement.h @@ -21,48 +21,48 @@ #define SVGForeignObjectElement_h #if ENABLE(SVG) && ENABLE(SVG_FOREIGN_OBJECT) +#include "SVGAnimatedBoolean.h" #include "SVGAnimatedLength.h" -#include "SVGAnimatedPropertyMacros.h" -#include "SVGTests.h" +#include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" -#include "SVGURIReference.h" #include "SVGStyledTransformableElement.h" -#include "SVGExternalResourcesRequired.h" +#include "SVGTests.h" +#include "SVGURIReference.h" namespace WebCore { - class SVGLength; - class SVGForeignObjectElement : public SVGStyledTransformableElement, - public SVGTests, - public SVGLangSpace, - public SVGExternalResourcesRequired { - public: - static PassRefPtr<SVGForeignObjectElement> create(const QualifiedName&, Document*); +class SVGForeignObjectElement : public SVGStyledTransformableElement, + public SVGTests, + public SVGLangSpace, + public SVGExternalResourcesRequired { +public: + static PassRefPtr<SVGForeignObjectElement> create(const QualifiedName&, Document*); - private: - SVGForeignObjectElement(const QualifiedName&, Document*); +private: + SVGForeignObjectElement(const QualifiedName&, Document*); - virtual bool isValid() const { return SVGTests::isValid(); } - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual bool isValid() const { return SVGTests::isValid(); } + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual bool childShouldCreateRenderer(Node*) const; - virtual RenderObject* createRenderer(RenderArena* arena, RenderStyle* style); + virtual bool childShouldCreateRenderer(Node*) const; + virtual RenderObject* createRenderer(RenderArena* arena, RenderStyle* style); - virtual bool selfHasRelativeLengths() const; + virtual bool selfHasRelativeLengths() const; - DECLARE_ANIMATED_PROPERTY_NEW(SVGForeignObjectElement, SVGNames::xAttr, SVGLength, X, x) - DECLARE_ANIMATED_PROPERTY_NEW(SVGForeignObjectElement, SVGNames::yAttr, SVGLength, Y, y) - DECLARE_ANIMATED_PROPERTY_NEW(SVGForeignObjectElement, SVGNames::widthAttr, SVGLength, Width, width) - DECLARE_ANIMATED_PROPERTY_NEW(SVGForeignObjectElement, SVGNames::heightAttr, SVGLength, Height, height) + // Animated property declarations + DECLARE_ANIMATED_LENGTH(X, x) + DECLARE_ANIMATED_LENGTH(Y, y) + DECLARE_ANIMATED_LENGTH(Width, width) + DECLARE_ANIMATED_LENGTH(Height, height) - // SVGURIReference - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGForeignObjectElement, XLinkNames::hrefAttr, String, Href, href) + // SVGURIReference + DECLARE_ANIMATED_STRING(Href, href) - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGForeignObjectElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) - }; + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGGElement.cpp b/WebCore/svg/SVGGElement.cpp index c58eefa..233aa74 100644 --- a/WebCore/svg/SVGGElement.cpp +++ b/WebCore/svg/SVGGElement.cpp @@ -26,9 +26,13 @@ #include "RenderSVGHiddenContainer.h" #include "RenderSVGResource.h" #include "RenderSVGTransformableContainer.h" +#include "SVGNames.h" namespace WebCore { +// Animated property declarations +DEFINE_ANIMATED_BOOLEAN(SVGGElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + SVGGElement::SVGGElement(const QualifiedName& tagName, Document* document) : SVGStyledTransformableElement(tagName, document) { diff --git a/WebCore/svg/SVGGElement.h b/WebCore/svg/SVGGElement.h index b0003d1..3c00b34 100644 --- a/WebCore/svg/SVGGElement.h +++ b/WebCore/svg/SVGGElement.h @@ -22,7 +22,7 @@ #define SVGGElement_h #if ENABLE(SVG) -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedBoolean.h" #include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" #include "SVGStyledTransformableElement.h" @@ -30,32 +30,34 @@ namespace WebCore { - class SVGGElement : public SVGStyledTransformableElement, - public SVGTests, - public SVGLangSpace, - public SVGExternalResourcesRequired { - public: - static PassRefPtr<SVGGElement> create(const QualifiedName&, Document*); +class SVGGElement : public SVGStyledTransformableElement, + public SVGTests, + public SVGLangSpace, + public SVGExternalResourcesRequired { +public: + static PassRefPtr<SVGGElement> create(const QualifiedName&, Document*); - virtual bool isShadowTreeContainerElement() const { return false; } + virtual bool isShadowTreeContainerElement() const { return false; } - protected: - SVGGElement(const QualifiedName&, Document*); +protected: + SVGGElement(const QualifiedName&, Document*); - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - private: - virtual bool isValid() const { return SVGTests::isValid(); } +private: + virtual bool isValid() const { return SVGTests::isValid(); } - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual bool rendererIsNeeded(RenderStyle*); + virtual bool rendererIsNeeded(RenderStyle*); - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGGElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) - }; + // Animated property declarations + + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGGlyphElement.cpp b/WebCore/svg/SVGGlyphElement.cpp index baa9966..a64d833 100644 --- a/WebCore/svg/SVGGlyphElement.cpp +++ b/WebCore/svg/SVGGlyphElement.cpp @@ -80,11 +80,11 @@ static inline SVGGlyphIdentifier::ArabicForm parseArabicForm(const AtomicString& { if (value == "medial") return SVGGlyphIdentifier::Medial; - else if (value == "terminal") + if (value == "terminal") return SVGGlyphIdentifier::Terminal; - else if (value == "isolated") + if (value == "isolated") return SVGGlyphIdentifier::Isolated; - else if (value == "initial") + if (value == "initial") return SVGGlyphIdentifier::Initial; return SVGGlyphIdentifier::None; @@ -94,7 +94,7 @@ static inline SVGGlyphIdentifier::Orientation parseOrientation(const AtomicStrin { if (value == "h") return SVGGlyphIdentifier::Horizontal; - else if (value == "v") + if (value == "v") return SVGGlyphIdentifier::Vertical; return SVGGlyphIdentifier::Both; diff --git a/WebCore/svg/SVGGlyphElement.h b/WebCore/svg/SVGGlyphElement.h index 7dc7430..4ac5d9b 100644 --- a/WebCore/svg/SVGGlyphElement.h +++ b/WebCore/svg/SVGGlyphElement.h @@ -23,109 +23,109 @@ #define SVGGlyphElement_h #if ENABLE(SVG_FONTS) +#include "Path.h" #include "SVGStyledElement.h" -#include <wtf/Forward.h> #include <limits> -#include "Path.h" +#include <wtf/Forward.h> namespace WebCore { - class SVGFontData; - - // Describe a SVG <glyph> element - struct SVGGlyphIdentifier { - enum Orientation { - Vertical, - Horizontal, - Both - }; - - // SVG Font depends on exactly this order. - enum ArabicForm { - None = 0, - Isolated, - Terminal, - Initial, - Medial - }; - - SVGGlyphIdentifier() - : isValid(false) - , orientation(Both) - , arabicForm(None) - , priority(0) - , nameLength(0) - , horizontalAdvanceX(0.0f) - , verticalOriginX(0.0f) - , verticalOriginY(0.0f) - , verticalAdvanceY(0.0f) - { - } - - // Used to mark our float properties as "to be inherited from SVGFontData" - static float inheritedValue() - { - static float s_inheritedValue = std::numeric_limits<float>::infinity(); - return s_inheritedValue; - } - - bool operator==(const SVGGlyphIdentifier& other) const - { - return isValid == other.isValid - && orientation == other.orientation - && arabicForm == other.arabicForm - && glyphName == other.glyphName - && horizontalAdvanceX == other.horizontalAdvanceX - && verticalOriginX == other.verticalOriginX - && verticalOriginY == other.verticalOriginY - && verticalAdvanceY == other.verticalAdvanceY - && languages == other.languages; - } - - bool isValid : 1; - - unsigned orientation : 2; // Orientation - unsigned arabicForm : 3; // ArabicForm - int priority; - size_t nameLength; - String glyphName; - - float horizontalAdvanceX; - float verticalOriginX; - float verticalOriginY; - float verticalAdvanceY; - - Path pathData; - Vector<String> languages; - }; - - class SVGGlyphElement : public SVGStyledElement { - public: - static PassRefPtr<SVGGlyphElement> create(const QualifiedName&, Document*); - - SVGGlyphIdentifier buildGlyphIdentifier() const; +class SVGFontData; - // Helper function used by SVGFont - static void inheritUnspecifiedAttributes(SVGGlyphIdentifier&, const SVGFontData*); - static String querySVGFontLanguage(const SVGElement*); - - // Helper function shared between SVGGlyphElement & SVGMissingGlyphElement - static SVGGlyphIdentifier buildGenericGlyphIdentifier(const SVGElement*); - - private: - SVGGlyphElement(const QualifiedName&, Document*); - - virtual void parseMappedAttribute(Attribute*); - - virtual void insertedIntoDocument(); - virtual void removedFromDocument(); - - virtual bool rendererIsNeeded(RenderStyle*) { return false; } +// Describe a SVG <glyph> element +struct SVGGlyphIdentifier { + enum Orientation { + Vertical, + Horizontal, + Both + }; - void invalidateGlyphCache(); + // SVG Font depends on exactly this order. + enum ArabicForm { + None = 0, + Isolated, + Terminal, + Initial, + Medial }; + SVGGlyphIdentifier() + : isValid(false) + , orientation(Both) + , arabicForm(None) + , priority(0) + , nameLength(0) + , horizontalAdvanceX(0.0f) + , verticalOriginX(0.0f) + , verticalOriginY(0.0f) + , verticalAdvanceY(0.0f) + { + } + + // Used to mark our float properties as "to be inherited from SVGFontData" + static float inheritedValue() + { + static float s_inheritedValue = std::numeric_limits<float>::infinity(); + return s_inheritedValue; + } + + bool operator==(const SVGGlyphIdentifier& other) const + { + return isValid == other.isValid + && orientation == other.orientation + && arabicForm == other.arabicForm + && glyphName == other.glyphName + && horizontalAdvanceX == other.horizontalAdvanceX + && verticalOriginX == other.verticalOriginX + && verticalOriginY == other.verticalOriginY + && verticalAdvanceY == other.verticalAdvanceY + && languages == other.languages; + } + + bool isValid : 1; + + unsigned orientation : 2; // Orientation + unsigned arabicForm : 3; // ArabicForm + int priority; + size_t nameLength; + String glyphName; + + float horizontalAdvanceX; + float verticalOriginX; + float verticalOriginY; + float verticalAdvanceY; + + Path pathData; + Vector<String> languages; +}; + +class SVGGlyphElement : public SVGStyledElement { +public: + static PassRefPtr<SVGGlyphElement> create(const QualifiedName&, Document*); + + SVGGlyphIdentifier buildGlyphIdentifier() const; + + // Helper function used by SVGFont + static void inheritUnspecifiedAttributes(SVGGlyphIdentifier&, const SVGFontData*); + static String querySVGFontLanguage(const SVGElement*); + + // Helper function shared between SVGGlyphElement & SVGMissingGlyphElement + static SVGGlyphIdentifier buildGenericGlyphIdentifier(const SVGElement*); + +private: + SVGGlyphElement(const QualifiedName&, Document*); + + virtual void parseMappedAttribute(Attribute*); + + virtual void insertedIntoDocument(); + virtual void removedFromDocument(); + + virtual bool rendererIsNeeded(RenderStyle*) { return false; } + + void invalidateGlyphCache(); +}; + } // namespace WebCore #endif // ENABLE(SVG_FONTS) diff --git a/WebCore/svg/SVGGlyphMap.h b/WebCore/svg/SVGGlyphMap.h index aba0c86..5241b2e 100644 --- a/WebCore/svg/SVGGlyphMap.h +++ b/WebCore/svg/SVGGlyphMap.h @@ -23,87 +23,86 @@ #if ENABLE(SVG_FONTS) #include "SVGGlyphElement.h" - namespace WebCore { - struct GlyphMapNode; - - typedef HashMap<UChar, RefPtr<GlyphMapNode> > GlyphMapLayer; +struct GlyphMapNode; - struct GlyphMapNode : public RefCounted<GlyphMapNode> { - private: - GlyphMapNode() { } - public: - static PassRefPtr<GlyphMapNode> create() { return adoptRef(new GlyphMapNode); } +typedef HashMap<UChar, RefPtr<GlyphMapNode> > GlyphMapLayer; - Vector<SVGGlyphIdentifier> glyphs; +struct GlyphMapNode : public RefCounted<GlyphMapNode> { +private: + GlyphMapNode() { } +public: + static PassRefPtr<GlyphMapNode> create() { return adoptRef(new GlyphMapNode); } - GlyphMapLayer children; - }; + Vector<SVGGlyphIdentifier> glyphs; - class SVGGlyphMap { + GlyphMapLayer children; +}; - public: - SVGGlyphMap() : m_currentPriority(0) { } +class SVGGlyphMap { - void add(const String& string, const SVGGlyphIdentifier& glyph) - { - size_t len = string.length(); - GlyphMapLayer* currentLayer = &m_rootLayer; +public: + SVGGlyphMap() : m_currentPriority(0) { } - RefPtr<GlyphMapNode> node; - for (size_t i = 0; i < len; i++) { - UChar curChar = string[i]; - node = currentLayer->get(curChar); - if (!node) { - node = GlyphMapNode::create(); - currentLayer->set(curChar, node); - } - currentLayer = &node->children; - } + void add(const String& string, const SVGGlyphIdentifier& glyph) + { + size_t len = string.length(); + GlyphMapLayer* currentLayer = &m_rootLayer; - if (node) { - node->glyphs.append(glyph); - node->glyphs.last().priority = m_currentPriority++; - node->glyphs.last().nameLength = len; - node->glyphs.last().isValid = true; + RefPtr<GlyphMapNode> node; + for (size_t i = 0; i < len; ++i) { + UChar curChar = string[i]; + node = currentLayer->get(curChar); + if (!node) { + node = GlyphMapNode::create(); + currentLayer->set(curChar, node); } + currentLayer = &node->children; } - static inline bool compareGlyphPriority(const SVGGlyphIdentifier& first, const SVGGlyphIdentifier& second) - { - return first.priority < second.priority; + if (node) { + node->glyphs.append(glyph); + node->glyphs.last().priority = m_currentPriority++; + node->glyphs.last().nameLength = len; + node->glyphs.last().isValid = true; } - - void get(const String& string, Vector<SVGGlyphIdentifier>& glyphs) - { - GlyphMapLayer* currentLayer = &m_rootLayer; - - for (size_t i = 0; i < string.length(); i++) { - UChar curChar = string[i]; - RefPtr<GlyphMapNode> node = currentLayer->get(curChar); - if (!node) - break; - glyphs.append(node->glyphs); - currentLayer = &node->children; - } - std::sort(glyphs.begin(), glyphs.end(), compareGlyphPriority); + } + + static inline bool compareGlyphPriority(const SVGGlyphIdentifier& first, const SVGGlyphIdentifier& second) + { + return first.priority < second.priority; + } + + void get(const String& string, Vector<SVGGlyphIdentifier>& glyphs) + { + GlyphMapLayer* currentLayer = &m_rootLayer; + + for (size_t i = 0; i < string.length(); ++i) { + UChar curChar = string[i]; + RefPtr<GlyphMapNode> node = currentLayer->get(curChar); + if (!node) + break; + glyphs.append(node->glyphs); + currentLayer = &node->children; } + std::sort(glyphs.begin(), glyphs.end(), compareGlyphPriority); + } - void clear() - { - m_rootLayer.clear(); - m_currentPriority = 0; - } + void clear() + { + m_rootLayer.clear(); + m_currentPriority = 0; + } - private: - GlyphMapLayer m_rootLayer; - int m_currentPriority; - }; +private: + GlyphMapLayer m_rootLayer; + int m_currentPriority; +}; } #endif // ENABLE(SVG_FONTS) -#endif //SVGGlyphMap_h +#endif // SVGGlyphMap_h diff --git a/WebCore/svg/SVGGradientElement.cpp b/WebCore/svg/SVGGradientElement.cpp index 7ec66ce..f36fea5 100644 --- a/WebCore/svg/SVGGradientElement.cpp +++ b/WebCore/svg/SVGGradientElement.cpp @@ -26,8 +26,8 @@ #include "Attribute.h" #include "CSSStyleSelector.h" -#include "RenderSVGPath.h" #include "RenderSVGHiddenContainer.h" +#include "RenderSVGPath.h" #include "RenderSVGResourceLinearGradient.h" #include "RenderSVGResourceRadialGradient.h" #include "SVGNames.h" @@ -38,6 +38,13 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_ENUMERATION(SVGGradientElement, SVGNames::spreadMethodAttr, SpreadMethod, spreadMethod) +DEFINE_ANIMATED_ENUMERATION(SVGGradientElement, SVGNames::gradientUnitsAttr, GradientUnits, gradientUnits) +DEFINE_ANIMATED_TRANSFORM_LIST(SVGGradientElement, SVGNames::gradientTransformAttr, GradientTransform, gradientTransform) +DEFINE_ANIMATED_STRING(SVGGradientElement, XLinkNames::hrefAttr, Href, href) +DEFINE_ANIMATED_BOOLEAN(SVGGradientElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + SVGGradientElement::SVGGradientElement(const QualifiedName& tagName, Document* document) : SVGStyledElement(tagName, document) , m_gradientUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) diff --git a/WebCore/svg/SVGGradientElement.h b/WebCore/svg/SVGGradientElement.h index 1b28e22..1fd1f0b 100644 --- a/WebCore/svg/SVGGradientElement.h +++ b/WebCore/svg/SVGGradientElement.h @@ -23,43 +23,44 @@ #if ENABLE(SVG) #include "Gradient.h" -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedBoolean.h" +#include "SVGAnimatedEnumeration.h" #include "SVGAnimatedTransformList.h" #include "SVGExternalResourcesRequired.h" #include "SVGStyledElement.h" -#include "SVGTransformList.h" #include "SVGURIReference.h" namespace WebCore { - class SVGGradientElement : public SVGStyledElement, - public SVGURIReference, - public SVGExternalResourcesRequired { - public: - Vector<Gradient::ColorStop> buildStops(); +class SVGGradientElement : public SVGStyledElement, + public SVGURIReference, + public SVGExternalResourcesRequired { +public: + Vector<Gradient::ColorStop> buildStops(); - protected: - SVGGradientElement(const QualifiedName&, Document*); +protected: + SVGGradientElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - private: - virtual bool needsPendingResourceHandling() const { return false; } +private: + virtual bool needsPendingResourceHandling() const { return false; } - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); + virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGGradientElement, SVGNames::spreadMethodAttr, int, SpreadMethod, spreadMethod) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGGradientElement, SVGNames::gradientUnitsAttr, int, GradientUnits, gradientUnits) - DECLARE_ANIMATED_TRANSFORM_LIST_PROPERTY_NEW(SVGGradientElement, SVGNames::gradientTransformAttr, SVGTransformList, GradientTransform, gradientTransform) + // Animated property declarations + DECLARE_ANIMATED_ENUMERATION(SpreadMethod, spreadMethod) + DECLARE_ANIMATED_ENUMERATION(GradientUnits, gradientUnits) + DECLARE_ANIMATED_TRANSFORM_LIST(GradientTransform, gradientTransform) - // SVGURIReference - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGGradientElement, XLinkNames::hrefAttr, String, Href, href) + // SVGURIReference + DECLARE_ANIMATED_STRING(Href, href) - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGGradientElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) - }; + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGHKernElement.cpp b/WebCore/svg/SVGHKernElement.cpp index 7f83241..4632378 100644 --- a/WebCore/svg/SVGHKernElement.cpp +++ b/WebCore/svg/SVGHKernElement.cpp @@ -24,9 +24,9 @@ #if ENABLE(SVG_FONTS) #include "SVGHKernElement.h" +#include "SVGFontData.h" #include "SVGFontElement.h" #include "SVGFontFaceElement.h" -#include "SVGFontData.h" #include "SVGNames.h" #include "SimpleFontData.h" #include "XMLNames.h" diff --git a/WebCore/svg/SVGHKernElement.h b/WebCore/svg/SVGHKernElement.h index 7249fac..0defcbb 100644 --- a/WebCore/svg/SVGHKernElement.h +++ b/WebCore/svg/SVGHKernElement.h @@ -27,20 +27,20 @@ namespace WebCore { - class SVGHKernElement : public SVGElement { - public: - static PassRefPtr<SVGHKernElement> create(const QualifiedName&, Document*); +class SVGHKernElement : public SVGElement { +public: + static PassRefPtr<SVGHKernElement> create(const QualifiedName&, Document*); - void buildHorizontalKerningPair(KerningPairVector&); + void buildHorizontalKerningPair(KerningPairVector&); - private: - SVGHKernElement(const QualifiedName&, Document*); +private: + SVGHKernElement(const QualifiedName&, Document*); - virtual void insertedIntoDocument(); - virtual void removedFromDocument(); + virtual void insertedIntoDocument(); + virtual void removedFromDocument(); - virtual bool rendererIsNeeded(RenderStyle*) { return false; } - }; + virtual bool rendererIsNeeded(RenderStyle*) { return false; } +}; } // namespace WebCore diff --git a/WebCore/svg/SVGImageElement.cpp b/WebCore/svg/SVGImageElement.cpp index dd80c65..80bf34b 100644 --- a/WebCore/svg/SVGImageElement.cpp +++ b/WebCore/svg/SVGImageElement.cpp @@ -29,14 +29,21 @@ #include "RenderImageResource.h" #include "RenderSVGImage.h" #include "RenderSVGResource.h" -#include "SVGDocument.h" -#include "SVGLength.h" -#include "SVGPreserveAspectRatio.h" +#include "SVGNames.h" #include "SVGSVGElement.h" #include "XLinkNames.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::xAttr, X, x) +DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::yAttr, Y, y) +DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::widthAttr, Width, width) +DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::heightAttr, Height, height) +DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGImageElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio) +DEFINE_ANIMATED_STRING(SVGImageElement, XLinkNames::hrefAttr, Href, href) +DEFINE_ANIMATED_BOOLEAN(SVGImageElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + inline SVGImageElement::SVGImageElement(const QualifiedName& tagName, Document* document) : SVGStyledTransformableElement(tagName, document) , m_x(LengthModeWidth) diff --git a/WebCore/svg/SVGImageElement.h b/WebCore/svg/SVGImageElement.h index b9f3865..06e6490 100644 --- a/WebCore/svg/SVGImageElement.h +++ b/WebCore/svg/SVGImageElement.h @@ -22,64 +22,63 @@ #define SVGImageElement_h #if ENABLE(SVG) +#include "SVGAnimatedBoolean.h" #include "SVGAnimatedLength.h" -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedPreserveAspectRatio.h" #include "SVGExternalResourcesRequired.h" -#include "SVGLangSpace.h" #include "SVGImageLoader.h" +#include "SVGLangSpace.h" #include "SVGStyledTransformableElement.h" #include "SVGTests.h" #include "SVGURIReference.h" -#include "SVGPreserveAspectRatio.h" namespace WebCore { - class SVGLength; - - class SVGImageElement : public SVGStyledTransformableElement, - public SVGTests, - public SVGLangSpace, - public SVGExternalResourcesRequired, - public SVGURIReference { - public: - static PassRefPtr<SVGImageElement> create(const QualifiedName&, Document*); +class SVGImageElement : public SVGStyledTransformableElement, + public SVGTests, + public SVGLangSpace, + public SVGExternalResourcesRequired, + public SVGURIReference { +public: + static PassRefPtr<SVGImageElement> create(const QualifiedName&, Document*); - private: - SVGImageElement(const QualifiedName&, Document*); - - virtual bool isValid() const { return SVGTests::isValid(); } +private: + SVGImageElement(const QualifiedName&, Document*); + + virtual bool isValid() const { return SVGTests::isValid(); } - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual void attach(); - virtual void insertedIntoDocument(); + virtual void attach(); + virtual void insertedIntoDocument(); - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual const QualifiedName& imageSourceAttributeName() const; - virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; + virtual const QualifiedName& imageSourceAttributeName() const; + virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; - virtual bool haveLoadedRequiredResources(); + virtual bool haveLoadedRequiredResources(); - virtual bool selfHasRelativeLengths() const; - virtual void willMoveToNewOwnerDocument(); + virtual bool selfHasRelativeLengths() const; + virtual void willMoveToNewOwnerDocument(); - DECLARE_ANIMATED_PROPERTY_NEW(SVGImageElement, SVGNames::xAttr, SVGLength, X, x) - DECLARE_ANIMATED_PROPERTY_NEW(SVGImageElement, SVGNames::yAttr, SVGLength, Y, y) - DECLARE_ANIMATED_PROPERTY_NEW(SVGImageElement, SVGNames::widthAttr, SVGLength, Width, width) - DECLARE_ANIMATED_PROPERTY_NEW(SVGImageElement, SVGNames::heightAttr, SVGLength, Height, height) - DECLARE_ANIMATED_PROPERTY_NEW(SVGImageElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) + // Animated property declarations + DECLARE_ANIMATED_LENGTH(X, x) + DECLARE_ANIMATED_LENGTH(Y, y) + DECLARE_ANIMATED_LENGTH(Width, width) + DECLARE_ANIMATED_LENGTH(Height, height) + DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) - // SVGURIReference - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGImageElement, XLinkNames::hrefAttr, String, Href, href) + // SVGURIReference + DECLARE_ANIMATED_STRING(Href, href) - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGImageElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) - SVGImageLoader m_imageLoader; - }; + SVGImageLoader m_imageLoader; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGImageLoader.cpp b/WebCore/svg/SVGImageLoader.cpp index 8f1c1b5..17e9004 100644 --- a/WebCore/svg/SVGImageLoader.cpp +++ b/WebCore/svg/SVGImageLoader.cpp @@ -26,8 +26,8 @@ #include "Event.h" #include "EventNames.h" #include "HTMLParserIdioms.h" -#include "SVGImageElement.h" #include "RenderImage.h" +#include "SVGImageElement.h" namespace WebCore { diff --git a/WebCore/svg/SVGImageLoader.h b/WebCore/svg/SVGImageLoader.h index 98dcffc..b7a1617 100644 --- a/WebCore/svg/SVGImageLoader.h +++ b/WebCore/svg/SVGImageLoader.h @@ -25,16 +25,16 @@ namespace WebCore { - class SVGImageElement; +class SVGImageElement; - class SVGImageLoader : public ImageLoader { - public: - SVGImageLoader(SVGImageElement*); +class SVGImageLoader : public ImageLoader { +public: + SVGImageLoader(SVGImageElement*); - private: - virtual void dispatchLoadEvent(); - virtual String sourceURI(const AtomicString&) const; - }; +private: + virtual void dispatchLoadEvent(); + virtual String sourceURI(const AtomicString&) const; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGLangSpace.cpp b/WebCore/svg/SVGLangSpace.cpp index ad6458c..73a52e9 100644 --- a/WebCore/svg/SVGLangSpace.cpp +++ b/WebCore/svg/SVGLangSpace.cpp @@ -55,7 +55,8 @@ bool SVGLangSpace::parseMappedAttribute(Attribute* attr) if (attr->name().matches(XMLNames::langAttr)) { setXmllang(attr->value()); return true; - } else if (attr->name().matches(XMLNames::spaceAttr)) { + } + if (attr->name().matches(XMLNames::spaceAttr)) { setXmlspace(attr->value()); return true; } @@ -65,8 +66,7 @@ bool SVGLangSpace::parseMappedAttribute(Attribute* attr) bool SVGLangSpace::isKnownAttribute(const QualifiedName& attrName) { - return (attrName.matches(XMLNames::langAttr) || - attrName.matches(XMLNames::spaceAttr)); + return attrName.matches(XMLNames::langAttr) || attrName.matches(XMLNames::spaceAttr); } } diff --git a/WebCore/svg/SVGLangSpace.h b/WebCore/svg/SVGLangSpace.h index 723fa7a..61c6edf 100644 --- a/WebCore/svg/SVGLangSpace.h +++ b/WebCore/svg/SVGLangSpace.h @@ -26,24 +26,24 @@ namespace WebCore { - class Attribute; - class QualifiedName; +class Attribute; +class QualifiedName; - class SVGLangSpace { - public: - const AtomicString& xmllang() const { return m_lang; } - void setXmllang(const AtomicString& xmlLang); +class SVGLangSpace { +public: + const AtomicString& xmllang() const { return m_lang; } + void setXmllang(const AtomicString& xmlLang); - const AtomicString& xmlspace() const; - void setXmlspace(const AtomicString& xmlSpace); + const AtomicString& xmlspace() const; + void setXmlspace(const AtomicString& xmlSpace); - bool parseMappedAttribute(Attribute*); - bool isKnownAttribute(const QualifiedName&); + bool parseMappedAttribute(Attribute*); + bool isKnownAttribute(const QualifiedName&); - private: - AtomicString m_lang; - AtomicString m_space; - }; +private: + AtomicString m_lang; + AtomicString m_space; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGLength.cpp b/WebCore/svg/SVGLength.cpp index 5377c7f..b0b7d1c 100644 --- a/WebCore/svg/SVGLength.cpp +++ b/WebCore/svg/SVGLength.cpp @@ -29,6 +29,7 @@ #include "FrameView.h" #include "RenderObject.h" #include "RenderView.h" +#include "SVGNames.h" #include "SVGParserUtilities.h" #include "SVGSVGElement.h" @@ -92,9 +93,13 @@ inline SVGLengthType stringToLengthType(const UChar*& ptr, const UChar* end) return LengthTypeNumber; const UChar firstChar = *ptr; + ++ptr; - if (++ptr == end) - return firstChar == '%' ? LengthTypePercentage : LengthTypeUnknown; + if (firstChar == '%') { + if (ptr == end) + return LengthTypePercentage; + return LengthTypeUnknown; + } const UChar secondChar = *ptr; diff --git a/WebCore/svg/SVGLength.h b/WebCore/svg/SVGLength.h index ccd22ee..a256ed3 100644 --- a/WebCore/svg/SVGLength.h +++ b/WebCore/svg/SVGLength.h @@ -23,7 +23,7 @@ #if ENABLE(SVG) #include "ExceptionCode.h" -#include <wtf/text/WTFString.h> +#include "SVGPropertyTraits.h" namespace WebCore { @@ -118,6 +118,13 @@ private: unsigned int m_unit; }; +template<> +struct SVGPropertyTraits<SVGLength> { + static SVGLength initialValue() { return SVGLength(); } + static String toString(const SVGLength& type) { return type.valueAsString(); } +}; + + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGLengthList.h b/WebCore/svg/SVGLengthList.h index 8b08557..865f7bc 100644 --- a/WebCore/svg/SVGLengthList.h +++ b/WebCore/svg/SVGLengthList.h @@ -35,6 +35,14 @@ public: String valueAsString() const; }; +template<> +struct SVGPropertyTraits<SVGLengthList> { + typedef SVGLength ListItemType; + + static SVGLengthList initialValue() { return SVGLengthList(); } + static String toString(const SVGLengthList& type) { return type.valueAsString(); } +}; + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGLineElement.cpp b/WebCore/svg/SVGLineElement.cpp index e4986a2..cfe43da 100644 --- a/WebCore/svg/SVGLineElement.cpp +++ b/WebCore/svg/SVGLineElement.cpp @@ -32,6 +32,13 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::x1Attr, X1, x1) +DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::y1Attr, Y1, y1) +DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::x2Attr, X2, x2) +DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::y2Attr, Y2, y2) +DEFINE_ANIMATED_BOOLEAN(SVGLineElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + inline SVGLineElement::SVGLineElement(const QualifiedName& tagName, Document* document) : SVGStyledTransformableElement(tagName, document) , m_x1(LengthModeWidth) diff --git a/WebCore/svg/SVGLineElement.h b/WebCore/svg/SVGLineElement.h index 4e876e1..ad60a95 100644 --- a/WebCore/svg/SVGLineElement.h +++ b/WebCore/svg/SVGLineElement.h @@ -22,8 +22,8 @@ #define SVGLineElement_h #if ENABLE(SVG) +#include "SVGAnimatedBoolean.h" #include "SVGAnimatedLength.h" -#include "SVGAnimatedPropertyMacros.h" #include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" #include "SVGStyledTransformableElement.h" @@ -31,38 +31,37 @@ namespace WebCore { - class SVGLength; +class SVGLineElement : public SVGStyledTransformableElement, + public SVGTests, + public SVGLangSpace, + public SVGExternalResourcesRequired { +public: + static PassRefPtr<SVGLineElement> create(const QualifiedName&, Document*); - class SVGLineElement : public SVGStyledTransformableElement, - public SVGTests, - public SVGLangSpace, - public SVGExternalResourcesRequired { - public: - static PassRefPtr<SVGLineElement> create(const QualifiedName&, Document*); +private: + SVGLineElement(const QualifiedName&, Document*); + + virtual bool isValid() const { return SVGTests::isValid(); } - private: - SVGLineElement(const QualifiedName&, Document*); - - virtual bool isValid() const { return SVGTests::isValid(); } + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual void toPathData(Path&) const; - virtual void toPathData(Path&) const; + virtual bool supportsMarkers() const { return true; } - virtual bool supportsMarkers() const { return true; } + virtual bool selfHasRelativeLengths() const; - virtual bool selfHasRelativeLengths() const; + // Animated property declarations + DECLARE_ANIMATED_LENGTH(X1, x1) + DECLARE_ANIMATED_LENGTH(Y1, y1) + DECLARE_ANIMATED_LENGTH(X2, x2) + DECLARE_ANIMATED_LENGTH(Y2, y2) - DECLARE_ANIMATED_PROPERTY_NEW(SVGLineElement, SVGNames::x1Attr, SVGLength, X1, x1) - DECLARE_ANIMATED_PROPERTY_NEW(SVGLineElement, SVGNames::y1Attr, SVGLength, Y1, y1) - DECLARE_ANIMATED_PROPERTY_NEW(SVGLineElement, SVGNames::x2Attr, SVGLength, X2, x2) - DECLARE_ANIMATED_PROPERTY_NEW(SVGLineElement, SVGNames::y2Attr, SVGLength, Y2, y2) - - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGLineElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) - }; + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGLinearGradientElement.cpp b/WebCore/svg/SVGLinearGradientElement.cpp index fa3e40c..5bece06 100644 --- a/WebCore/svg/SVGLinearGradientElement.cpp +++ b/WebCore/svg/SVGLinearGradientElement.cpp @@ -39,6 +39,12 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::x1Attr, X1, x1) +DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::y1Attr, Y1, y1) +DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::x2Attr, X2, x2) +DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::y2Attr, Y2, y2) + inline SVGLinearGradientElement::SVGLinearGradientElement(const QualifiedName& tagName, Document* document) : SVGGradientElement(tagName, document) , m_x1(LengthModeWidth) diff --git a/WebCore/svg/SVGLinearGradientElement.h b/WebCore/svg/SVGLinearGradientElement.h index 4ebe9f6..198f0ee 100644 --- a/WebCore/svg/SVGLinearGradientElement.h +++ b/WebCore/svg/SVGLinearGradientElement.h @@ -23,37 +23,36 @@ #if ENABLE(SVG) #include "SVGAnimatedLength.h" -#include "SVGAnimatedPropertyMacros.h" #include "SVGGradientElement.h" namespace WebCore { - struct LinearGradientAttributes; - class SVGLength; +struct LinearGradientAttributes; - class SVGLinearGradientElement : public SVGGradientElement { - public: - static PassRefPtr<SVGLinearGradientElement> create(const QualifiedName&, Document*); +class SVGLinearGradientElement : public SVGGradientElement { +public: + static PassRefPtr<SVGLinearGradientElement> create(const QualifiedName&, Document*); - void collectGradientAttributes(LinearGradientAttributes&); - void calculateStartEndPoints(const LinearGradientAttributes&, FloatPoint& startPoint, FloatPoint& endPoint); + void collectGradientAttributes(LinearGradientAttributes&); + void calculateStartEndPoints(const LinearGradientAttributes&, FloatPoint& startPoint, FloatPoint& endPoint); - private: - SVGLinearGradientElement(const QualifiedName&, Document*); +private: + SVGLinearGradientElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual bool selfHasRelativeLengths() const; + virtual bool selfHasRelativeLengths() const; - DECLARE_ANIMATED_PROPERTY_NEW(SVGLinearGradientElement, SVGNames::x1Attr, SVGLength, X1, x1) - DECLARE_ANIMATED_PROPERTY_NEW(SVGLinearGradientElement, SVGNames::y1Attr, SVGLength, Y1, y1) - DECLARE_ANIMATED_PROPERTY_NEW(SVGLinearGradientElement, SVGNames::x2Attr, SVGLength, X2, x2) - DECLARE_ANIMATED_PROPERTY_NEW(SVGLinearGradientElement, SVGNames::y2Attr, SVGLength, Y2, y2) - }; + // Animated property declarations + DECLARE_ANIMATED_LENGTH(X1, x1) + DECLARE_ANIMATED_LENGTH(Y1, y1) + DECLARE_ANIMATED_LENGTH(X2, x2) + DECLARE_ANIMATED_LENGTH(Y2, y2) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGLocatable.cpp b/WebCore/svg/SVGLocatable.cpp index b3dce01..43961d9 100644 --- a/WebCore/svg/SVGLocatable.cpp +++ b/WebCore/svg/SVGLocatable.cpp @@ -97,7 +97,7 @@ AffineTransform SVGLocatable::computeCTM(const SVGElement* element, CTMScope mod if (currentElement == stopAtElement) break; - current = current->isShadowNode() ? current->shadowParentNode() : current->parentNode(); + current = current->parentOrHostNode(); } return ctm; diff --git a/WebCore/svg/SVGMPathElement.cpp b/WebCore/svg/SVGMPathElement.cpp index c6da308..0df262e 100644 --- a/WebCore/svg/SVGMPathElement.cpp +++ b/WebCore/svg/SVGMPathElement.cpp @@ -23,10 +23,15 @@ #include "SVGMPathElement.h" #include "Document.h" +#include "SVGNames.h" #include "SVGPathElement.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_STRING(SVGMPathElement, XLinkNames::hrefAttr, Href, href) +DEFINE_ANIMATED_BOOLEAN(SVGMPathElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + inline SVGMPathElement::SVGMPathElement(const QualifiedName& tagName, Document* document) : SVGElement(tagName, document) { diff --git a/WebCore/svg/SVGMPathElement.h b/WebCore/svg/SVGMPathElement.h index 3d10e5b..2fa7c28 100644 --- a/WebCore/svg/SVGMPathElement.h +++ b/WebCore/svg/SVGMPathElement.h @@ -21,34 +21,37 @@ #define SVGMPathElement_h #if ENABLE(SVG) -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedBoolean.h" +#include "SVGAnimatedString.h" #include "SVGExternalResourcesRequired.h" #include "SVGURIReference.h" namespace WebCore { - class SVGPathElement; +class SVGPathElement; + +class SVGMPathElement : public SVGElement, + public SVGURIReference, + public SVGExternalResourcesRequired { +public: + static PassRefPtr<SVGMPathElement> create(const QualifiedName&, Document*); + + SVGPathElement* pathElement(); + +private: + SVGMPathElement(const QualifiedName&, Document*); - class SVGMPathElement : public SVGElement, - public SVGURIReference, - public SVGExternalResourcesRequired { - public: - static PassRefPtr<SVGMPathElement> create(const QualifiedName&, Document*); - - SVGPathElement* pathElement(); - - private: - SVGMPathElement(const QualifiedName&, Document*); - - virtual void parseMappedAttribute(Attribute*); - virtual void synchronizeProperty(const QualifiedName&); - - // SVGURIReference - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGMPathElement, XLinkNames::hrefAttr, String, Href, href) - - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGMPathElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) - }; + virtual void parseMappedAttribute(Attribute*); + virtual void synchronizeProperty(const QualifiedName&); + + // Animated property declarations + + // SVGURIReference + DECLARE_ANIMATED_STRING(Href, href) + + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGMarkerElement.cpp b/WebCore/svg/SVGMarkerElement.cpp index 8b6d41c..3174711 100644 --- a/WebCore/svg/SVGMarkerElement.cpp +++ b/WebCore/svg/SVGMarkerElement.cpp @@ -25,17 +25,26 @@ #include "SVGMarkerElement.h" #include "Attribute.h" -#include "PlatformString.h" #include "RenderSVGResourceMarker.h" #include "SVGFitToViewBox.h" -#include "SVGLength.h" #include "SVGNames.h" -#include "SVGPreserveAspectRatio.h" #include "SVGSVGElement.h" namespace WebCore { -SVGMarkerElement::SVGMarkerElement(const QualifiedName& tagName, Document* document) +// Animated property definitions +DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::refXAttr, RefX, refX) +DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::refYAttr, RefY, refY) +DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::markerWidthAttr, MarkerWidth, markerWidth) +DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::markerHeightAttr, MarkerHeight, markerHeight) +DEFINE_ANIMATED_ENUMERATION(SVGMarkerElement, SVGNames::markerUnitsAttr, MarkerUnits, markerUnits) +DEFINE_ANIMATED_ENUMERATION_MULTIPLE_WRAPPERS(SVGMarkerElement, SVGNames::orientAttr, orientTypeIdentifier(), OrientType, orientType) +DEFINE_ANIMATED_ANGLE_MULTIPLE_WRAPPERS(SVGMarkerElement, SVGNames::orientAttr, orientAngleIdentifier(), OrientAngle, orientAngle) +DEFINE_ANIMATED_BOOLEAN(SVGMarkerElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) +DEFINE_ANIMATED_RECT(SVGMarkerElement, SVGNames::viewBoxAttr, ViewBox, viewBox) +DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGMarkerElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio) + +inline SVGMarkerElement::SVGMarkerElement(const QualifiedName& tagName, Document* document) : SVGStyledElement(tagName, document) , m_refX(LengthModeWidth) , m_refY(LengthModeHeight) diff --git a/WebCore/svg/SVGMarkerElement.h b/WebCore/svg/SVGMarkerElement.h index e84357e..472baa6 100644 --- a/WebCore/svg/SVGMarkerElement.h +++ b/WebCore/svg/SVGMarkerElement.h @@ -22,10 +22,12 @@ #define SVGMarkerElement_h #if ENABLE(SVG) -#include "RenderObject.h" -#include "SVGAngle.h" +#include "SVGAnimatedAngle.h" +#include "SVGAnimatedBoolean.h" +#include "SVGAnimatedEnumeration.h" #include "SVGAnimatedLength.h" -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedPreserveAspectRatio.h" +#include "SVGAnimatedRect.h" #include "SVGExternalResourcesRequired.h" #include "SVGFitToViewBox.h" #include "SVGLangSpace.h" @@ -33,8 +35,6 @@ namespace WebCore { -class Document; - class SVGMarkerElement : public SVGStyledElement, public SVGLangSpace, public SVGExternalResourcesRequired, @@ -76,20 +76,21 @@ private: static const AtomicString& orientTypeIdentifier(); static const AtomicString& orientAngleIdentifier(); - DECLARE_ANIMATED_PROPERTY_NEW(SVGMarkerElement, SVGNames::refXAttr, SVGLength, RefX, refX) - DECLARE_ANIMATED_PROPERTY_NEW(SVGMarkerElement, SVGNames::refYAttr, SVGLength, RefY, refY) - DECLARE_ANIMATED_PROPERTY_NEW(SVGMarkerElement, SVGNames::markerWidthAttr, SVGLength, MarkerWidth, markerWidth) - DECLARE_ANIMATED_PROPERTY_NEW(SVGMarkerElement, SVGNames::markerHeightAttr, SVGLength, MarkerHeight, markerHeight) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGMarkerElement, SVGNames::markerUnitsAttr, int, MarkerUnits, markerUnits) - DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGMarkerElement, SVGNames::orientAttr, orientTypeIdentifier(), int, OrientType, orientType) - DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGMarkerElement, SVGNames::orientAttr, orientAngleIdentifier(), SVGAngle, OrientAngle, orientAngle) + // Animated property declarations + DECLARE_ANIMATED_LENGTH(RefX, refX) + DECLARE_ANIMATED_LENGTH(RefY, refY) + DECLARE_ANIMATED_LENGTH(MarkerWidth, markerWidth) + DECLARE_ANIMATED_LENGTH(MarkerHeight, markerHeight) + DECLARE_ANIMATED_ENUMERATION(MarkerUnits, markerUnits) + DECLARE_ANIMATED_ENUMERATION(OrientType, orientType) + DECLARE_ANIMATED_ANGLE(OrientAngle, orientAngle) // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGMarkerElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) // SVGFitToViewBox - DECLARE_ANIMATED_PROPERTY_NEW(SVGMarkerElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox) - DECLARE_ANIMATED_PROPERTY_NEW(SVGMarkerElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) + DECLARE_ANIMATED_RECT(ViewBox, viewBox) + DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) }; } diff --git a/WebCore/svg/SVGMaskElement.cpp b/WebCore/svg/SVGMaskElement.cpp index dda8924..ec23e29 100644 --- a/WebCore/svg/SVGMaskElement.cpp +++ b/WebCore/svg/SVGMaskElement.cpp @@ -29,15 +29,21 @@ #include "Attribute.h" #include "CSSStyleSelector.h" #include "RenderSVGResourceMasker.h" -#include "SVGLength.h" #include "SVGNames.h" #include "SVGRenderSupport.h" #include "SVGUnitTypes.h" -using namespace std; - namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_ENUMERATION(SVGMaskElement, SVGNames::maskUnitsAttr, MaskUnits, maskUnits) +DEFINE_ANIMATED_ENUMERATION(SVGMaskElement, SVGNames::maskContentUnitsAttr, MaskContentUnits, maskContentUnits) +DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::xAttr, X, x) +DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::yAttr, Y, y) +DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::widthAttr, Width, width) +DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::heightAttr, Height, height) +DEFINE_ANIMATED_BOOLEAN(SVGMaskElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + inline SVGMaskElement::SVGMaskElement(const QualifiedName& tagName, Document* document) : SVGStyledLocatableElement(tagName, document) , m_maskUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) diff --git a/WebCore/svg/SVGMaskElement.h b/WebCore/svg/SVGMaskElement.h index 599d184..87e91ff 100644 --- a/WebCore/svg/SVGMaskElement.h +++ b/WebCore/svg/SVGMaskElement.h @@ -21,9 +21,9 @@ #define SVGMaskElement_h #if ENABLE(SVG) -#include "RenderObject.h" +#include "SVGAnimatedBoolean.h" +#include "SVGAnimatedEnumeration.h" #include "SVGAnimatedLength.h" -#include "SVGAnimatedPropertyMacros.h" #include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" #include "SVGStyledLocatableElement.h" @@ -31,42 +31,41 @@ namespace WebCore { - class SVGLength; +class SVGMaskElement : public SVGStyledLocatableElement, + public SVGTests, + public SVGLangSpace, + public SVGExternalResourcesRequired { +public: + static PassRefPtr<SVGMaskElement> create(const QualifiedName&, Document*); - class SVGMaskElement : public SVGStyledLocatableElement, - public SVGTests, - public SVGLangSpace, - public SVGExternalResourcesRequired { - public: - static PassRefPtr<SVGMaskElement> create(const QualifiedName&, Document*); + FloatRect maskBoundingBox(const FloatRect&) const; - FloatRect maskBoundingBox(const FloatRect&) const; +private: + SVGMaskElement(const QualifiedName&, Document*); - private: - SVGMaskElement(const QualifiedName&, Document*); + virtual bool isValid() const { return SVGTests::isValid(); } + virtual bool needsPendingResourceHandling() const { return false; } - virtual bool isValid() const { return SVGTests::isValid(); } - virtual bool needsPendingResourceHandling() const { return false; } + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); + virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual bool selfHasRelativeLengths() const; - virtual bool selfHasRelativeLengths() const; + // Animated property declarations + DECLARE_ANIMATED_ENUMERATION(MaskUnits, maskUnits) + DECLARE_ANIMATED_ENUMERATION(MaskContentUnits, maskContentUnits) + DECLARE_ANIMATED_LENGTH(X, x) + DECLARE_ANIMATED_LENGTH(Y, y) + DECLARE_ANIMATED_LENGTH(Width, width) + DECLARE_ANIMATED_LENGTH(Height, height) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGMaskElement, SVGNames::maskUnitsAttr, int, MaskUnits, maskUnits) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGMaskElement, SVGNames::maskContentUnitsAttr, int, MaskContentUnits, maskContentUnits) - DECLARE_ANIMATED_PROPERTY_NEW(SVGMaskElement, SVGNames::xAttr, SVGLength, X, x) - DECLARE_ANIMATED_PROPERTY_NEW(SVGMaskElement, SVGNames::yAttr, SVGLength, Y, y) - DECLARE_ANIMATED_PROPERTY_NEW(SVGMaskElement, SVGNames::widthAttr, SVGLength, Width, width) - DECLARE_ANIMATED_PROPERTY_NEW(SVGMaskElement, SVGNames::heightAttr, SVGLength, Height, height) - - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGMaskElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) - }; + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) +}; } diff --git a/WebCore/svg/SVGMetadataElement.h b/WebCore/svg/SVGMetadataElement.h index 4cac5bc..8fdbfb4 100644 --- a/WebCore/svg/SVGMetadataElement.h +++ b/WebCore/svg/SVGMetadataElement.h @@ -26,13 +26,13 @@ namespace WebCore { - class SVGMetadataElement : public SVGElement { - public: - static PassRefPtr<SVGMetadataElement> create(const QualifiedName&, Document*); +class SVGMetadataElement : public SVGElement { +public: + static PassRefPtr<SVGMetadataElement> create(const QualifiedName&, Document*); - private: - SVGMetadataElement(const QualifiedName&, Document*); - }; +private: + SVGMetadataElement(const QualifiedName&, Document*); +}; } // namespace WebCore diff --git a/WebCore/svg/SVGMissingGlyphElement.h b/WebCore/svg/SVGMissingGlyphElement.h index ecae295..a133d6d 100644 --- a/WebCore/svg/SVGMissingGlyphElement.h +++ b/WebCore/svg/SVGMissingGlyphElement.h @@ -25,15 +25,15 @@ namespace WebCore { - class SVGMissingGlyphElement : public SVGStyledElement { - public: - static PassRefPtr<SVGMissingGlyphElement> create(const QualifiedName&, Document*); +class SVGMissingGlyphElement : public SVGStyledElement { +public: + static PassRefPtr<SVGMissingGlyphElement> create(const QualifiedName&, Document*); - private: - SVGMissingGlyphElement(const QualifiedName&, Document*); +private: + SVGMissingGlyphElement(const QualifiedName&, Document*); - virtual bool rendererIsNeeded(RenderStyle*) { return false; } - }; + virtual bool rendererIsNeeded(RenderStyle*) { return false; } +}; } // namespace WebCore diff --git a/WebCore/svg/SVGNumberList.h b/WebCore/svg/SVGNumberList.h index abc82da..f42d937 100644 --- a/WebCore/svg/SVGNumberList.h +++ b/WebCore/svg/SVGNumberList.h @@ -22,8 +22,8 @@ #define SVGNumberList_h #if ENABLE(SVG) +#include "SVGPropertyTraits.h" #include <wtf/Vector.h> -#include <wtf/text/WTFString.h> namespace WebCore { @@ -35,6 +35,14 @@ public: String valueAsString() const; }; +template<> +struct SVGPropertyTraits<SVGNumberList> { + typedef float ListItemType; + + static SVGNumberList initialValue() { return SVGNumberList(); } + static String toString(const SVGNumberList& type) { return type.valueAsString(); } +}; + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGPaint.cpp b/WebCore/svg/SVGPaint.cpp index b36e97d..76c13d5 100644 --- a/WebCore/svg/SVGPaint.cpp +++ b/WebCore/svg/SVGPaint.cpp @@ -23,6 +23,7 @@ #if ENABLE(SVG) #include "SVGPaint.h" + #include "SVGURIReference.h" namespace WebCore { @@ -99,9 +100,9 @@ String SVGPaint::cssText() const { if (m_paintType == SVG_PAINTTYPE_NONE) return "none"; - else if (m_paintType == SVG_PAINTTYPE_CURRENTCOLOR) + if (m_paintType == SVG_PAINTTYPE_CURRENTCOLOR) return "currentColor"; - else if (m_paintType == SVG_PAINTTYPE_URI) + if (m_paintType == SVG_PAINTTYPE_URI) return "url(" + m_uri + ")"; return SVGColor::cssText(); diff --git a/WebCore/svg/SVGPaint.h b/WebCore/svg/SVGPaint.h index f0ceb4c..9b66295 100644 --- a/WebCore/svg/SVGPaint.h +++ b/WebCore/svg/SVGPaint.h @@ -22,75 +22,74 @@ #ifndef SVGPaint_h #define SVGPaint_h #if ENABLE(SVG) - -#include "SVGColor.h" #include "PlatformString.h" +#include "SVGColor.h" namespace WebCore { - class SVGPaint : public SVGColor { - public: - enum SVGPaintType { - SVG_PAINTTYPE_UNKNOWN = 0, - SVG_PAINTTYPE_RGBCOLOR = 1, - SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR = 2, - SVG_PAINTTYPE_NONE = 101, - SVG_PAINTTYPE_CURRENTCOLOR = 102, - SVG_PAINTTYPE_URI_NONE = 103, - SVG_PAINTTYPE_URI_CURRENTCOLOR = 104, - SVG_PAINTTYPE_URI_RGBCOLOR = 105, - SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR = 106, - SVG_PAINTTYPE_URI = 107 - }; +class SVGPaint : public SVGColor { +public: + enum SVGPaintType { + SVG_PAINTTYPE_UNKNOWN = 0, + SVG_PAINTTYPE_RGBCOLOR = 1, + SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR = 2, + SVG_PAINTTYPE_NONE = 101, + SVG_PAINTTYPE_CURRENTCOLOR = 102, + SVG_PAINTTYPE_URI_NONE = 103, + SVG_PAINTTYPE_URI_CURRENTCOLOR = 104, + SVG_PAINTTYPE_URI_RGBCOLOR = 105, + SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR = 106, + SVG_PAINTTYPE_URI = 107 + }; - static PassRefPtr<SVGPaint> create() - { - return adoptRef(new SVGPaint); - } - static PassRefPtr<SVGPaint> create(SVGPaintType type) - { - return adoptRef(new SVGPaint(type)); - } - static PassRefPtr<SVGPaint> create(const Color& color) - { - return adoptRef(new SVGPaint(color)); - } - static PassRefPtr<SVGPaint> create(SVGPaintType type, const String& uri) - { - return adoptRef(new SVGPaint(type, uri, String(), String())); - } - static PassRefPtr<SVGPaint> create(const String& uri, const Color& color) - { - return adoptRef(new SVGPaint(uri, color)); - } + static PassRefPtr<SVGPaint> create() + { + return adoptRef(new SVGPaint); + } + static PassRefPtr<SVGPaint> create(SVGPaintType type) + { + return adoptRef(new SVGPaint(type)); + } + static PassRefPtr<SVGPaint> create(const Color& color) + { + return adoptRef(new SVGPaint(color)); + } + static PassRefPtr<SVGPaint> create(SVGPaintType type, const String& uri) + { + return adoptRef(new SVGPaint(type, uri, String(), String())); + } + static PassRefPtr<SVGPaint> create(const String& uri, const Color& color) + { + return adoptRef(new SVGPaint(uri, color)); + } - // 'SVGPaint' functions - SVGPaintType paintType() const { return m_paintType; } - String uri() const; + // 'SVGPaint' functions + SVGPaintType paintType() const { return m_paintType; } + String uri() const; - void setUri(const String&); - void setPaint(SVGPaintType, const String& uri, const String& rgbPaint, const String& iccPaint, ExceptionCode&); - - static SVGPaint* defaultFill(); - static SVGPaint* defaultStroke(); + void setUri(const String&); + void setPaint(SVGPaintType, const String& uri, const String& rgbPaint, const String& iccPaint, ExceptionCode&); + + static SVGPaint* defaultFill(); + static SVGPaint* defaultStroke(); - bool matchesTargetURI(const String& referenceId); + bool matchesTargetURI(const String& referenceId); - private: - SVGPaint(); - SVGPaint(const String& uri); - SVGPaint(SVGPaintType); - SVGPaint(SVGPaintType, const String& uri, const String& rgbPaint, const String& iccPaint); - SVGPaint(const Color& c); - SVGPaint(const String& uri, const Color& c); +private: + SVGPaint(); + SVGPaint(const String& uri); + SVGPaint(SVGPaintType); + SVGPaint(SVGPaintType, const String& uri, const String& rgbPaint, const String& iccPaint); + SVGPaint(const Color& c); + SVGPaint(const String& uri, const Color& c); - virtual bool isSVGPaint() const { return true; } + virtual bool isSVGPaint() const { return true; } - virtual String cssText() const; + virtual String cssText() const; - SVGPaintType m_paintType; - String m_uri; - }; + SVGPaintType m_paintType; + String m_uri; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGParserUtilities.cpp b/WebCore/svg/SVGParserUtilities.cpp index 63bc5bb..0405230 100644 --- a/WebCore/svg/SVGParserUtilities.cpp +++ b/WebCore/svg/SVGParserUtilities.cpp @@ -27,8 +27,9 @@ #include "Document.h" #include "FloatPoint.h" -#include <limits> #include "SVGPointList.h" + +#include <limits> #include <wtf/ASCIICType.h> namespace WebCore { diff --git a/WebCore/svg/SVGParserUtilities.h b/WebCore/svg/SVGParserUtilities.h index 0718d50..da8ac1f 100644 --- a/WebCore/svg/SVGParserUtilities.h +++ b/WebCore/svg/SVGParserUtilities.h @@ -30,43 +30,43 @@ typedef Vector<UnicodeRange> UnicodeRanges; namespace WebCore { - class SVGPointList; +class SVGPointList; - bool parseNumber(const UChar*& ptr, const UChar* end, float& number, bool skip = true); - bool parseNumberOptionalNumber(const String& s, float& h, float& v); - bool parseArcFlag(const UChar*& ptr, const UChar* end, bool& flag); +bool parseNumber(const UChar*& ptr, const UChar* end, float& number, bool skip = true); +bool parseNumberOptionalNumber(const String& s, float& h, float& v); +bool parseArcFlag(const UChar*& ptr, const UChar* end, bool& flag); - // SVG allows several different whitespace characters: - // http://www.w3.org/TR/SVG/paths.html#PathDataBNF - inline bool isWhitespace(const UChar& c) - { - return (c == ' ' || c == '\t' || c == '\n' || c == '\r'); - } +// SVG allows several different whitespace characters: +// http://www.w3.org/TR/SVG/paths.html#PathDataBNF +inline bool isWhitespace(const UChar& c) +{ + return c == ' ' || c == '\t' || c == '\n' || c == '\r'; +} - inline bool skipOptionalSpaces(const UChar*& ptr, const UChar* end) - { - while (ptr < end && isWhitespace(*ptr)) - ptr++; - return ptr < end; - } +inline bool skipOptionalSpaces(const UChar*& ptr, const UChar* end) +{ + while (ptr < end && isWhitespace(*ptr)) + ptr++; + return ptr < end; +} - inline bool skipOptionalSpacesOrDelimiter(const UChar*& ptr, const UChar* end, UChar delimiter = ',') - { - if (ptr < end && !isWhitespace(*ptr) && *ptr != delimiter) - return false; - if (skipOptionalSpaces(ptr, end)) { - if (ptr < end && *ptr == delimiter) { - ptr++; - skipOptionalSpaces(ptr, end); - } +inline bool skipOptionalSpacesOrDelimiter(const UChar*& ptr, const UChar* end, UChar delimiter = ',') +{ + if (ptr < end && !isWhitespace(*ptr) && *ptr != delimiter) + return false; + if (skipOptionalSpaces(ptr, end)) { + if (ptr < end && *ptr == delimiter) { + ptr++; + skipOptionalSpaces(ptr, end); } - return ptr < end; } + return ptr < end; +} - bool pointsListFromSVGData(SVGPointList& pointsList, const String& points); - Vector<String> parseDelimitedString(const String& input, const char seperator); - bool parseKerningUnicodeString(const String& input, UnicodeRanges&, HashSet<String>& stringList); - bool parseGlyphName(const String& input, HashSet<String>& values); +bool pointsListFromSVGData(SVGPointList& pointsList, const String& points); +Vector<String> parseDelimitedString(const String& input, const char seperator); +bool parseKerningUnicodeString(const String& input, UnicodeRanges&, HashSet<String>& stringList); +bool parseGlyphName(const String& input, HashSet<String>& values); } // namespace WebCore diff --git a/WebCore/svg/SVGPathElement.cpp b/WebCore/svg/SVGPathElement.cpp index d9993ae..77b543f 100644 --- a/WebCore/svg/SVGPathElement.cpp +++ b/WebCore/svg/SVGPathElement.cpp @@ -26,6 +26,7 @@ #include "Attribute.h" #include "RenderSVGPath.h" #include "RenderSVGResource.h" +#include "SVGNames.h" #include "SVGPathParserFactory.h" #include "SVGPathSegArc.h" #include "SVGPathSegClosePath.h" @@ -37,13 +38,17 @@ #include "SVGPathSegLinetoHorizontal.h" #include "SVGPathSegLinetoVertical.h" #include "SVGPathSegList.h" -#include "SVGPathSegListPropertyTearOff.h" #include "SVGPathSegListBuilder.h" +#include "SVGPathSegListPropertyTearOff.h" #include "SVGPathSegMoveto.h" #include "SVGSVGElement.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_NUMBER(SVGPathElement, SVGNames::pathLengthAttr, PathLength, pathLength) +DEFINE_ANIMATED_BOOLEAN(SVGPathElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + inline SVGPathElement::SVGPathElement(const QualifiedName& tagName, Document* document) : SVGStyledTransformableElement(tagName, document) , m_pathByteStream(SVGPathByteStream::create()) diff --git a/WebCore/svg/SVGPathElement.h b/WebCore/svg/SVGPathElement.h index 0590dea..6ea7d55 100644 --- a/WebCore/svg/SVGPathElement.h +++ b/WebCore/svg/SVGPathElement.h @@ -22,8 +22,9 @@ #define SVGPathElement_h #if ENABLE(SVG) +#include "SVGAnimatedBoolean.h" +#include "SVGAnimatedNumber.h" #include "SVGAnimatedPathSegListPropertyTearOff.h" -#include "SVGAnimatedPropertyMacros.h" #include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" #include "SVGPathByteStream.h" @@ -105,10 +106,11 @@ private: virtual void svgAttributeChanged(const QualifiedName&); virtual bool supportsMarkers() const { return true; } - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGPathElement, SVGNames::pathLengthAttr, float, PathLength, pathLength) + // Animated property declarations + DECLARE_ANIMATED_NUMBER(PathLength, pathLength) // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGPathElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) void synchronizeD(); diff --git a/WebCore/svg/SVGPathParserFactory.h b/WebCore/svg/SVGPathParserFactory.h index 5ae5e8a..895e65a 100644 --- a/WebCore/svg/SVGPathParserFactory.h +++ b/WebCore/svg/SVGPathParserFactory.h @@ -23,9 +23,10 @@ #if ENABLE(SVG) #include "Path.h" #include "PlatformString.h" +#include "SVGPathByteStream.h" #include "SVGPathConsumer.h" #include "SVGPathSegList.h" -#include "SVGPathByteStream.h" + #include <wtf/OwnPtr.h> namespace WebCore { diff --git a/WebCore/svg/SVGPathSegList.cpp b/WebCore/svg/SVGPathSegList.cpp index 09a3c0d..3782e19 100644 --- a/WebCore/svg/SVGPathSegList.cpp +++ b/WebCore/svg/SVGPathSegList.cpp @@ -25,6 +25,7 @@ #if ENABLE(SVG) #include "SVGPathSegList.h" +#include "SVGNames.h" #include "SVGPathElement.h" #include "SVGPathParserFactory.h" diff --git a/WebCore/svg/SVGPathSegList.h b/WebCore/svg/SVGPathSegList.h index 48a1845..5013b9f 100644 --- a/WebCore/svg/SVGPathSegList.h +++ b/WebCore/svg/SVGPathSegList.h @@ -21,12 +21,12 @@ #define SVGPathSegList_h #if ENABLE(SVG) -#include <wtf/Vector.h> -#include <wtf/text/WTFString.h> - #include "SVGPathSeg.h" #include "SVGPropertyTraits.h" +#include <wtf/Vector.h> +#include <wtf/text/WTFString.h> + namespace WebCore { class SVGElement; diff --git a/WebCore/svg/SVGPatternElement.cpp b/WebCore/svg/SVGPatternElement.cpp index ed2e354..29723e7 100644 --- a/WebCore/svg/SVGPatternElement.cpp +++ b/WebCore/svg/SVGPatternElement.cpp @@ -33,22 +33,28 @@ #include "PatternAttributes.h" #include "RenderSVGContainer.h" #include "RenderSVGResourcePattern.h" -#include "SVGLength.h" #include "SVGNames.h" #include "SVGRenderSupport.h" #include "SVGSVGElement.h" #include "SVGStyledTransformableElement.h" -#include "SVGTransformList.h" #include "SVGTransformable.h" #include "SVGUnitTypes.h" -#include <math.h> -#include <wtf/MathExtras.h> -#include <wtf/OwnPtr.h> - -using namespace std; namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::xAttr, X, x) +DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::yAttr, Y, y) +DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::widthAttr, Width, width) +DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::heightAttr, Height, height) +DEFINE_ANIMATED_ENUMERATION(SVGPatternElement, SVGNames::patternUnitsAttr, PatternUnits, patternUnits) +DEFINE_ANIMATED_ENUMERATION(SVGPatternElement, SVGNames::patternContentUnitsAttr, PatternContentUnits, patternContentUnits) +DEFINE_ANIMATED_TRANSFORM_LIST(SVGPatternElement, SVGNames::patternTransformAttr, PatternTransform, patternTransform) +DEFINE_ANIMATED_STRING(SVGPatternElement, XLinkNames::hrefAttr, Href, href) +DEFINE_ANIMATED_BOOLEAN(SVGPatternElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) +DEFINE_ANIMATED_RECT(SVGPatternElement, SVGNames::viewBoxAttr, ViewBox, viewBox) +DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGPatternElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio) + inline SVGPatternElement::SVGPatternElement(const QualifiedName& tagName, Document* document) : SVGStyledElement(tagName, document) , m_x(LengthModeWidth) diff --git a/WebCore/svg/SVGPatternElement.h b/WebCore/svg/SVGPatternElement.h index 37f91ca..e581308 100644 --- a/WebCore/svg/SVGPatternElement.h +++ b/WebCore/svg/SVGPatternElement.h @@ -22,67 +22,68 @@ #define SVGPatternElement_h #if ENABLE(SVG) +#include "SVGAnimatedBoolean.h" +#include "SVGAnimatedEnumeration.h" #include "SVGAnimatedLength.h" -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedPreserveAspectRatio.h" +#include "SVGAnimatedRect.h" #include "SVGAnimatedTransformList.h" #include "SVGExternalResourcesRequired.h" #include "SVGFitToViewBox.h" #include "SVGLangSpace.h" #include "SVGStyledElement.h" #include "SVGTests.h" -#include "SVGTransformList.h" #include "SVGURIReference.h" namespace WebCore { - struct PatternAttributes; +struct PatternAttributes; - class SVGLength; - - class SVGPatternElement : public SVGStyledElement, - public SVGURIReference, - public SVGTests, - public SVGLangSpace, - public SVGExternalResourcesRequired, - public SVGFitToViewBox { - public: - static PassRefPtr<SVGPatternElement> create(const QualifiedName&, Document*); - - void collectPatternAttributes(PatternAttributes&) const; - - private: - SVGPatternElement(const QualifiedName&, Document*); - - virtual bool isValid() const { return SVGTests::isValid(); } - virtual bool needsPendingResourceHandling() const { return false; } - - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - - virtual bool selfHasRelativeLengths() const; - - DECLARE_ANIMATED_PROPERTY_NEW(SVGPatternElement, SVGNames::xAttr, SVGLength, X, x) - DECLARE_ANIMATED_PROPERTY_NEW(SVGPatternElement, SVGNames::yAttr, SVGLength, Y, y) - DECLARE_ANIMATED_PROPERTY_NEW(SVGPatternElement, SVGNames::widthAttr, SVGLength, Width, width) - DECLARE_ANIMATED_PROPERTY_NEW(SVGPatternElement, SVGNames::heightAttr, SVGLength, Height, height) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGPatternElement, SVGNames::patternUnitsAttr, int, PatternUnits, patternUnits) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGPatternElement, SVGNames::patternContentUnitsAttr, int, PatternContentUnits, patternContentUnits) - DECLARE_ANIMATED_TRANSFORM_LIST_PROPERTY_NEW(SVGPatternElement, SVGNames::patternTransformAttr, SVGTransformList, PatternTransform, patternTransform) - - // SVGURIReference - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGPatternElement, XLinkNames::hrefAttr, String, Href, href) - - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGPatternElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) - - // SVGPatternElement - DECLARE_ANIMATED_PROPERTY_NEW(SVGPatternElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox) - DECLARE_ANIMATED_PROPERTY_NEW(SVGPatternElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) - }; +class SVGPatternElement : public SVGStyledElement, + public SVGURIReference, + public SVGTests, + public SVGLangSpace, + public SVGExternalResourcesRequired, + public SVGFitToViewBox { +public: + static PassRefPtr<SVGPatternElement> create(const QualifiedName&, Document*); + + void collectPatternAttributes(PatternAttributes&) const; + +private: + SVGPatternElement(const QualifiedName&, Document*); + + virtual bool isValid() const { return SVGTests::isValid(); } + virtual bool needsPendingResourceHandling() const { return false; } + + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); + virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); + + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + + virtual bool selfHasRelativeLengths() const; + + // Animated property declarations + DECLARE_ANIMATED_LENGTH(X, x) + DECLARE_ANIMATED_LENGTH(Y, y) + DECLARE_ANIMATED_LENGTH(Width, width) + DECLARE_ANIMATED_LENGTH(Height, height) + DECLARE_ANIMATED_ENUMERATION(PatternUnits, patternUnits) + DECLARE_ANIMATED_ENUMERATION(PatternContentUnits, patternContentUnits) + DECLARE_ANIMATED_TRANSFORM_LIST(PatternTransform, patternTransform) + + // SVGURIReference + DECLARE_ANIMATED_STRING(Href, href) + + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) + + // SVGPatternElement + DECLARE_ANIMATED_RECT(ViewBox, viewBox) + DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGPointList.h b/WebCore/svg/SVGPointList.h index 9f2efc9..4918936 100644 --- a/WebCore/svg/SVGPointList.h +++ b/WebCore/svg/SVGPointList.h @@ -23,8 +23,8 @@ #if ENABLE(SVG) #include "QualifiedName.h" +#include "SVGPropertyTraits.h" #include <wtf/Vector.h> -#include <wtf/text/WTFString.h> namespace WebCore { @@ -39,6 +39,12 @@ public: static bool createAnimated(const SVGPointList& fromList, const SVGPointList& toList, SVGPointList& resultList, float progress); }; +template<> +struct SVGPropertyTraits<SVGPointList> { + static SVGPointList initialValue() { return SVGPointList(); } + typedef FloatPoint ListItemType; +}; + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGPolyElement.cpp b/WebCore/svg/SVGPolyElement.cpp index beef21f..0fb48d7 100644 --- a/WebCore/svg/SVGPolyElement.cpp +++ b/WebCore/svg/SVGPolyElement.cpp @@ -34,6 +34,9 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_BOOLEAN(SVGPolyElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document* document) : SVGStyledTransformableElement(tagName, document) { diff --git a/WebCore/svg/SVGPolyElement.h b/WebCore/svg/SVGPolyElement.h index 0855218..3af8a79 100644 --- a/WebCore/svg/SVGPolyElement.h +++ b/WebCore/svg/SVGPolyElement.h @@ -22,7 +22,7 @@ #define SVGPolyElement_h #if ENABLE(SVG) -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedBoolean.h" #include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" #include "SVGPointList.h" @@ -54,7 +54,7 @@ private: virtual bool supportsMarkers() const { return true; } // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGPolyElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) void synchronizePoints(); diff --git a/WebCore/svg/SVGPolygonElement.cpp b/WebCore/svg/SVGPolygonElement.cpp index 3439a78..f0bca35 100644 --- a/WebCore/svg/SVGPolygonElement.cpp +++ b/WebCore/svg/SVGPolygonElement.cpp @@ -23,6 +23,8 @@ #if ENABLE(SVG) #include "SVGPolygonElement.h" +#include "Path.h" + namespace WebCore { inline SVGPolygonElement::SVGPolygonElement(const QualifiedName& tagName, Document* document) diff --git a/WebCore/svg/SVGPolylineElement.cpp b/WebCore/svg/SVGPolylineElement.cpp index 8bd6d7b..e72173b 100644 --- a/WebCore/svg/SVGPolylineElement.cpp +++ b/WebCore/svg/SVGPolylineElement.cpp @@ -23,6 +23,8 @@ #if ENABLE(SVG) #include "SVGPolylineElement.h" +#include "Path.h" + namespace WebCore { inline SVGPolylineElement::SVGPolylineElement(const QualifiedName& tagName, Document* document) diff --git a/WebCore/svg/SVGPreserveAspectRatio.h b/WebCore/svg/SVGPreserveAspectRatio.h index eda82d4..bf00ee4 100644 --- a/WebCore/svg/SVGPreserveAspectRatio.h +++ b/WebCore/svg/SVGPreserveAspectRatio.h @@ -23,7 +23,7 @@ #if ENABLE(SVG) #include "ExceptionCode.h" -#include <wtf/text/WTFString.h> +#include "SVGPropertyTraits.h" namespace WebCore { @@ -86,6 +86,12 @@ private: SVGMeetOrSliceType m_meetOrSlice; }; +template<> +struct SVGPropertyTraits<SVGPreserveAspectRatio> { + static SVGPreserveAspectRatio initialValue() { return SVGPreserveAspectRatio(); } + static String toString(const SVGPreserveAspectRatio& type) { return type.valueAsString(); } +}; + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGRadialGradientElement.cpp b/WebCore/svg/SVGRadialGradientElement.cpp index aaf32bc..d525531 100644 --- a/WebCore/svg/SVGRadialGradientElement.cpp +++ b/WebCore/svg/SVGRadialGradientElement.cpp @@ -31,7 +31,6 @@ #include "FloatPoint.h" #include "RadialGradientAttributes.h" #include "RenderSVGResourceRadialGradient.h" -#include "SVGLength.h" #include "SVGNames.h" #include "SVGStopElement.h" #include "SVGTransform.h" @@ -40,6 +39,13 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::cxAttr, Cx, cx) +DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::cyAttr, Cy, cy) +DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::rAttr, R, r) +DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::fxAttr, Fx, fx) +DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::fyAttr, Fy, fy) + inline SVGRadialGradientElement::SVGRadialGradientElement(const QualifiedName& tagName, Document* document) : SVGGradientElement(tagName, document) , m_cx(LengthModeWidth, "50%") diff --git a/WebCore/svg/SVGRadialGradientElement.h b/WebCore/svg/SVGRadialGradientElement.h index f223514..199eaba 100644 --- a/WebCore/svg/SVGRadialGradientElement.h +++ b/WebCore/svg/SVGRadialGradientElement.h @@ -23,38 +23,37 @@ #if ENABLE(SVG) #include "SVGAnimatedLength.h" -#include "SVGAnimatedPropertyMacros.h" #include "SVGGradientElement.h" namespace WebCore { - struct RadialGradientAttributes; - class SVGLength; +struct RadialGradientAttributes; - class SVGRadialGradientElement : public SVGGradientElement { - public: - static PassRefPtr<SVGRadialGradientElement> create(const QualifiedName&, Document*); +class SVGRadialGradientElement : public SVGGradientElement { +public: + static PassRefPtr<SVGRadialGradientElement> create(const QualifiedName&, Document*); - void collectGradientAttributes(RadialGradientAttributes&); - void calculateFocalCenterPointsAndRadius(const RadialGradientAttributes&, FloatPoint& focalPoint, FloatPoint& centerPoint, float& radius); + void collectGradientAttributes(RadialGradientAttributes&); + void calculateFocalCenterPointsAndRadius(const RadialGradientAttributes&, FloatPoint& focalPoint, FloatPoint& centerPoint, float& radius); - private: - SVGRadialGradientElement(const QualifiedName&, Document*); +private: + SVGRadialGradientElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual bool selfHasRelativeLengths() const; + virtual bool selfHasRelativeLengths() const; - DECLARE_ANIMATED_PROPERTY_NEW(SVGRadialGradientElement, SVGNames::cxAttr, SVGLength, Cx, cx) - DECLARE_ANIMATED_PROPERTY_NEW(SVGRadialGradientElement, SVGNames::cyAttr, SVGLength, Cy, cy) - DECLARE_ANIMATED_PROPERTY_NEW(SVGRadialGradientElement, SVGNames::rAttr, SVGLength, R, r) - DECLARE_ANIMATED_PROPERTY_NEW(SVGRadialGradientElement, SVGNames::fxAttr, SVGLength, Fx, fx) - DECLARE_ANIMATED_PROPERTY_NEW(SVGRadialGradientElement, SVGNames::fyAttr, SVGLength, Fy, fy) - }; + // Animated property declarations + DECLARE_ANIMATED_LENGTH(Cx, cx) + DECLARE_ANIMATED_LENGTH(Cy, cy) + DECLARE_ANIMATED_LENGTH(R, r) + DECLARE_ANIMATED_LENGTH(Fx, fx) + DECLARE_ANIMATED_LENGTH(Fy, fy) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGRect.h b/WebCore/svg/SVGRect.h new file mode 100644 index 0000000..379a5bf --- /dev/null +++ b/WebCore/svg/SVGRect.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef SVGRect_h +#define SVGRect_h + +#if ENABLE(SVG) +#include "FloatRect.h" +#include "SVGPropertyTraits.h" +#include <wtf/text/StringBuilder.h> + +namespace WebCore { + +template<> +struct SVGPropertyTraits<FloatRect> { + static FloatRect initialValue() { return FloatRect(); } + static String toString(const FloatRect& type) + { + StringBuilder builder; + builder.append(String::number(type.x())); + builder.append(' '); + builder.append(String::number(type.y())); + builder.append(' '); + builder.append(String::number(type.width())); + builder.append(' '); + builder.append(String::number(type.height())); + builder.append(' '); + return builder.toString(); + } +}; + +} // namespace WebCore + +#endif // ENABLE(SVG) +#endif // SVGRect_h diff --git a/WebCore/svg/SVGRectElement.cpp b/WebCore/svg/SVGRectElement.cpp index 167f737..d5db5b9 100644 --- a/WebCore/svg/SVGRectElement.cpp +++ b/WebCore/svg/SVGRectElement.cpp @@ -31,6 +31,15 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::xAttr, X, x) +DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::yAttr, Y, y) +DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::widthAttr, Width, width) +DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::heightAttr, Height, height) +DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::rxAttr, Rx, rx) +DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::ryAttr, Ry, ry) +DEFINE_ANIMATED_BOOLEAN(SVGRectElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + inline SVGRectElement::SVGRectElement(const QualifiedName& tagName, Document* document) : SVGStyledTransformableElement(tagName, document) , m_x(LengthModeWidth) diff --git a/WebCore/svg/SVGRectElement.h b/WebCore/svg/SVGRectElement.h index 8cc262f..0c30378 100644 --- a/WebCore/svg/SVGRectElement.h +++ b/WebCore/svg/SVGRectElement.h @@ -22,8 +22,8 @@ #define SVGRectElement_h #if ENABLE(SVG) +#include "SVGAnimatedBoolean.h" #include "SVGAnimatedLength.h" -#include "SVGAnimatedPropertyMacros.h" #include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" #include "SVGStyledTransformableElement.h" @@ -31,36 +31,37 @@ namespace WebCore { - class SVGRectElement : public SVGStyledTransformableElement, - public SVGTests, - public SVGLangSpace, - public SVGExternalResourcesRequired { - public: - static PassRefPtr<SVGRectElement> create(const QualifiedName&, Document*); +class SVGRectElement : public SVGStyledTransformableElement, + public SVGTests, + public SVGLangSpace, + public SVGExternalResourcesRequired { +public: + static PassRefPtr<SVGRectElement> create(const QualifiedName&, Document*); - private: - SVGRectElement(const QualifiedName&, Document*); - - virtual bool isValid() const { return SVGTests::isValid(); } +private: + SVGRectElement(const QualifiedName&, Document*); + + virtual bool isValid() const { return SVGTests::isValid(); } - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual void toPathData(Path&) const; + virtual void toPathData(Path&) const; - virtual bool selfHasRelativeLengths() const; + virtual bool selfHasRelativeLengths() const; - DECLARE_ANIMATED_PROPERTY_NEW(SVGRectElement, SVGNames::xAttr, SVGLength, X, x) - DECLARE_ANIMATED_PROPERTY_NEW(SVGRectElement, SVGNames::yAttr, SVGLength, Y, y) - DECLARE_ANIMATED_PROPERTY_NEW(SVGRectElement, SVGNames::widthAttr, SVGLength, Width, width) - DECLARE_ANIMATED_PROPERTY_NEW(SVGRectElement, SVGNames::heightAttr, SVGLength, Height, height) - DECLARE_ANIMATED_PROPERTY_NEW(SVGRectElement, SVGNames::rxAttr, SVGLength, Rx, rx) - DECLARE_ANIMATED_PROPERTY_NEW(SVGRectElement, SVGNames::ryAttr, SVGLength, Ry, ry) + // Animated property declarations + DECLARE_ANIMATED_LENGTH(X, x) + DECLARE_ANIMATED_LENGTH(Y, y) + DECLARE_ANIMATED_LENGTH(Width, width) + DECLARE_ANIMATED_LENGTH(Height, height) + DECLARE_ANIMATED_LENGTH(Rx, rx) + DECLARE_ANIMATED_LENGTH(Ry, ry) - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGRectElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) - }; + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGSVGElement.cpp b/WebCore/svg/SVGSVGElement.cpp index e64f665..8b33c89 100644 --- a/WebCore/svg/SVGSVGElement.cpp +++ b/WebCore/svg/SVGSVGElement.cpp @@ -40,7 +40,6 @@ #include "RenderSVGViewportContainer.h" #include "SMILTimeContainer.h" #include "SVGAngle.h" -#include "SVGLength.h" #include "SVGNames.h" #include "SVGPreserveAspectRatio.h" #include "SVGTransform.h" @@ -54,16 +53,17 @@ namespace WebCore { -using namespace HTMLNames; -using namespace SVGNames; +// Animated property definitions +DEFINE_ANIMATED_LENGTH(SVGSVGElement, SVGNames::xAttr, X, x) +DEFINE_ANIMATED_LENGTH(SVGSVGElement, SVGNames::yAttr, Y, y) +DEFINE_ANIMATED_LENGTH(SVGSVGElement, SVGNames::widthAttr, Width, width) +DEFINE_ANIMATED_LENGTH(SVGSVGElement, SVGNames::heightAttr, Height, height) +DEFINE_ANIMATED_BOOLEAN(SVGSVGElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) +DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGSVGElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio) +DEFINE_ANIMATED_RECT(SVGSVGElement, SVGNames::viewBoxAttr, ViewBox, viewBox) -SVGSVGElement::SVGSVGElement(const QualifiedName& tagName, Document* doc) +inline SVGSVGElement::SVGSVGElement(const QualifiedName& tagName, Document* doc) : SVGStyledLocatableElement(tagName, doc) - , SVGTests() - , SVGLangSpace() - , SVGExternalResourcesRequired() - , SVGFitToViewBox() - , SVGZoomAndPan() , m_x(LengthModeWidth) , m_y(LengthModeHeight) , m_width(LengthModeWidth, "100%") @@ -106,7 +106,7 @@ void SVGSVGElement::didMoveToNewOwnerDocument() const AtomicString& SVGSVGElement::contentScriptType() const { DEFINE_STATIC_LOCAL(const AtomicString, defaultValue, ("text/ecmascript")); - const AtomicString& n = getAttribute(contentScriptTypeAttr); + const AtomicString& n = getAttribute(SVGNames::contentScriptTypeAttr); return n.isNull() ? defaultValue : n; } @@ -118,7 +118,7 @@ void SVGSVGElement::setContentScriptType(const AtomicString& type) const AtomicString& SVGSVGElement::contentStyleType() const { DEFINE_STATIC_LOCAL(const AtomicString, defaultValue, ("text/css")); - const AtomicString& n = getAttribute(contentStyleTypeAttr); + const AtomicString& n = getAttribute(SVGNames::contentStyleTypeAttr); return n.isNull() ? defaultValue : n; } @@ -246,11 +246,11 @@ void SVGSVGElement::parseMappedAttribute(Attribute* attr) bool setListener = true; // Only handle events if we're the outermost <svg> element - if (attr->name() == onunloadAttr) + if (attr->name() == HTMLNames::onunloadAttr) document()->setWindowAttributeEventListener(eventNames().unloadEvent, createAttributeEventListener(document()->frame(), attr)); - else if (attr->name() == onresizeAttr) + else if (attr->name() == HTMLNames::onresizeAttr) document()->setWindowAttributeEventListener(eventNames().resizeEvent, createAttributeEventListener(document()->frame(), attr)); - else if (attr->name() == onscrollAttr) + else if (attr->name() == HTMLNames::onscrollAttr) document()->setWindowAttributeEventListener(eventNames().scrollEvent, createAttributeEventListener(document()->frame(), attr)); else if (attr->name() == SVGNames::onzoomAttr) document()->setWindowAttributeEventListener(eventNames().zoomEvent, createAttributeEventListener(document()->frame(), attr)); @@ -261,9 +261,9 @@ void SVGSVGElement::parseMappedAttribute(Attribute* attr) return; } - if (attr->name() == onabortAttr) + if (attr->name() == HTMLNames::onabortAttr) document()->setWindowAttributeEventListener(eventNames().abortEvent, createAttributeEventListener(document()->frame(), attr)); - else if (attr->name() == onerrorAttr) + else if (attr->name() == HTMLNames::onerrorAttr) document()->setWindowAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(document()->frame(), attr)); else if (attr->name() == SVGNames::xAttr) setXBaseValue(SVGLength(LengthModeWidth, attr->value())); diff --git a/WebCore/svg/SVGSVGElement.h b/WebCore/svg/SVGSVGElement.h index f73fb3f..0995c67 100644 --- a/WebCore/svg/SVGSVGElement.h +++ b/WebCore/svg/SVGSVGElement.h @@ -22,9 +22,10 @@ #define SVGSVGElement_h #if ENABLE(SVG) -#include "IntSize.h" +#include "SVGAnimatedBoolean.h" #include "SVGAnimatedLength.h" -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedPreserveAspectRatio.h" +#include "SVGAnimatedRect.h" #include "SVGExternalResourcesRequired.h" #include "SVGFitToViewBox.h" #include "SVGLangSpace.h" @@ -33,143 +34,145 @@ #include "SVGZoomAndPan.h" namespace WebCore { - class SVGAngle; - class SVGLength; - class SVGMatrix; - class SVGTransform; - class SVGViewSpec; - class SVGViewElement; - class SMILTimeContainer; - class SVGSVGElement : public SVGStyledLocatableElement, - public SVGTests, - public SVGLangSpace, - public SVGExternalResourcesRequired, - public SVGFitToViewBox, - public SVGZoomAndPan { - public: - static PassRefPtr<SVGSVGElement> create(const QualifiedName&, Document*); - - virtual bool isValid() const { return SVGTests::isValid(); } - // 'SVGSVGElement' functions - const AtomicString& contentScriptType() const; - void setContentScriptType(const AtomicString& type); +class SVGAngle; +class SVGMatrix; +class SVGTransform; +class SVGViewSpec; +class SVGViewElement; +class SMILTimeContainer; - const AtomicString& contentStyleType() const; - void setContentStyleType(const AtomicString& type); +class SVGSVGElement : public SVGStyledLocatableElement, + public SVGTests, + public SVGLangSpace, + public SVGExternalResourcesRequired, + public SVGFitToViewBox, + public SVGZoomAndPan { +public: + static PassRefPtr<SVGSVGElement> create(const QualifiedName&, Document*); - FloatRect viewport() const; + virtual bool isValid() const { return SVGTests::isValid(); } - void setContainerSize(const IntSize& containerSize) { m_containerSize = containerSize; m_hasSetContainerSize = true; } - IntSize containerSize() const { return m_containerSize; } - bool hasSetContainerSize() const { return m_hasSetContainerSize; } - int relativeWidthValue() const; - int relativeHeightValue() const; + // 'SVGSVGElement' functions + const AtomicString& contentScriptType() const; + void setContentScriptType(const AtomicString& type); - float pixelUnitToMillimeterX() const; - float pixelUnitToMillimeterY() const; - float screenPixelToMillimeterX() const; - float screenPixelToMillimeterY() const; + const AtomicString& contentStyleType() const; + void setContentStyleType(const AtomicString& type); - bool useCurrentView() const; - void setUseCurrentView(bool currentView); + FloatRect viewport() const; - SVGViewSpec* currentView() const; + void setContainerSize(const IntSize& containerSize) { m_containerSize = containerSize; m_hasSetContainerSize = true; } + IntSize containerSize() const { return m_containerSize; } + bool hasSetContainerSize() const { return m_hasSetContainerSize; } + int relativeWidthValue() const; + int relativeHeightValue() const; - float currentScale() const; - void setCurrentScale(float scale); + float pixelUnitToMillimeterX() const; + float pixelUnitToMillimeterY() const; + float screenPixelToMillimeterX() const; + float screenPixelToMillimeterY() const; - FloatPoint& currentTranslate() { return m_translation; } - void setCurrentTranslate(const FloatPoint&); + bool useCurrentView() const; + void setUseCurrentView(bool currentView); - // Only used from the bindings. - void updateCurrentTranslate(); + SVGViewSpec* currentView() const; - SMILTimeContainer* timeContainer() const { return m_timeContainer.get(); } - - void pauseAnimations(); - void unpauseAnimations(); - bool animationsPaused() const; + float currentScale() const; + void setCurrentScale(float scale); - float getCurrentTime() const; - void setCurrentTime(float seconds); + FloatPoint& currentTranslate() { return m_translation; } + void setCurrentTranslate(const FloatPoint&); - unsigned suspendRedraw(unsigned maxWaitMilliseconds); - void unsuspendRedraw(unsigned suspendHandleId); - void unsuspendRedrawAll(); - void forceRedraw(); + // Only used from the bindings. + void updateCurrentTranslate(); - NodeList* getIntersectionList(const FloatRect&, SVGElement* referenceElement); - NodeList* getEnclosureList(const FloatRect&, SVGElement* referenceElement); - bool checkIntersection(SVGElement*, const FloatRect&); - bool checkEnclosure(SVGElement*, const FloatRect&); - void deselectAll(); + SMILTimeContainer* timeContainer() const { return m_timeContainer.get(); } + + void pauseAnimations(); + void unpauseAnimations(); + bool animationsPaused() const; - static float createSVGNumber(); - static SVGLength createSVGLength(); - static SVGAngle createSVGAngle(); - static FloatPoint createSVGPoint(); - static SVGMatrix createSVGMatrix(); - static FloatRect createSVGRect(); - static SVGTransform createSVGTransform(); - static SVGTransform createSVGTransformFromMatrix(const SVGMatrix&); + float getCurrentTime() const; + void setCurrentTime(float seconds); - AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const; + unsigned suspendRedraw(unsigned maxWaitMilliseconds); + void unsuspendRedraw(unsigned suspendHandleId); + void unsuspendRedrawAll(); + void forceRedraw(); - void inheritViewAttributes(SVGViewElement*); + NodeList* getIntersectionList(const FloatRect&, SVGElement* referenceElement); + NodeList* getEnclosureList(const FloatRect&, SVGElement* referenceElement); + bool checkIntersection(SVGElement*, const FloatRect&); + bool checkEnclosure(SVGElement*, const FloatRect&); + void deselectAll(); - bool isOutermostSVG() const; + static float createSVGNumber(); + static SVGLength createSVGLength(); + static SVGAngle createSVGAngle(); + static FloatPoint createSVGPoint(); + static SVGMatrix createSVGMatrix(); + static FloatRect createSVGRect(); + static SVGTransform createSVGTransform(); + static SVGTransform createSVGTransformFromMatrix(const SVGMatrix&); - Element* getElementById(const AtomicString&) const; + AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const; - protected: - virtual void willMoveToNewOwnerDocument(); - virtual void didMoveToNewOwnerDocument(); + void inheritViewAttributes(SVGViewElement*); - private: - SVGSVGElement(const QualifiedName&, Document*); - virtual ~SVGSVGElement(); + bool isOutermostSVG() const; - virtual bool isSVG() const { return true; } - - virtual void parseMappedAttribute(Attribute*); + Element* getElementById(const AtomicString&) const; - virtual bool rendererIsNeeded(RenderStyle* style) { return StyledElement::rendererIsNeeded(style); } - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); +protected: + virtual void willMoveToNewOwnerDocument(); + virtual void didMoveToNewOwnerDocument(); - virtual void insertedIntoDocument(); - virtual void removedFromDocument(); +private: + SVGSVGElement(const QualifiedName&, Document*); + virtual ~SVGSVGElement(); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual bool isSVG() const { return true; } + + virtual void parseMappedAttribute(Attribute*); - virtual bool selfHasRelativeLengths() const; + virtual bool rendererIsNeeded(RenderStyle* style) { return StyledElement::rendererIsNeeded(style); } + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - DECLARE_ANIMATED_PROPERTY_NEW(SVGSVGElement, SVGNames::xAttr, SVGLength, X, x) - DECLARE_ANIMATED_PROPERTY_NEW(SVGSVGElement, SVGNames::yAttr, SVGLength, Y, y) - DECLARE_ANIMATED_PROPERTY_NEW(SVGSVGElement, SVGNames::widthAttr, SVGLength, Width, width) - DECLARE_ANIMATED_PROPERTY_NEW(SVGSVGElement, SVGNames::heightAttr, SVGLength, Height, height) + virtual void insertedIntoDocument(); + virtual void removedFromDocument(); - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGSVGElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - // SVGFitToViewBox - DECLARE_ANIMATED_PROPERTY_NEW(SVGSVGElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox) - DECLARE_ANIMATED_PROPERTY_NEW(SVGSVGElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) + virtual bool selfHasRelativeLengths() const; + + // Animated property declarations + DECLARE_ANIMATED_LENGTH(X, x) + DECLARE_ANIMATED_LENGTH(Y, y) + DECLARE_ANIMATED_LENGTH(Width, width) + DECLARE_ANIMATED_LENGTH(Height, height) + + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) + + // SVGFitToViewBox + DECLARE_ANIMATED_RECT(ViewBox, viewBox) + DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) - virtual void documentWillBecomeInactive(); - virtual void documentDidBecomeActive(); - - virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const; - - bool m_useCurrentView; - RefPtr<SMILTimeContainer> m_timeContainer; - FloatPoint m_translation; - float m_scale; - mutable OwnPtr<SVGViewSpec> m_viewSpec; - IntSize m_containerSize; - bool m_hasSetContainerSize; - }; + virtual void documentWillBecomeInactive(); + virtual void documentDidBecomeActive(); + + virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const; + + bool m_useCurrentView; + RefPtr<SMILTimeContainer> m_timeContainer; + FloatPoint m_translation; + float m_scale; + mutable OwnPtr<SVGViewSpec> m_viewSpec; + IntSize m_containerSize; + bool m_hasSetContainerSize; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGScriptElement.cpp b/WebCore/svg/SVGScriptElement.cpp index 9146ddc..6452700 100644 --- a/WebCore/svg/SVGScriptElement.cpp +++ b/WebCore/svg/SVGScriptElement.cpp @@ -31,15 +31,19 @@ namespace WebCore { -inline SVGScriptElement::SVGScriptElement(const QualifiedName& tagName, Document* document, bool createdByParser, bool isEvaluated) +// Animated property definitions +DEFINE_ANIMATED_STRING(SVGScriptElement, XLinkNames::hrefAttr, Href, href) +DEFINE_ANIMATED_BOOLEAN(SVGScriptElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + +inline SVGScriptElement::SVGScriptElement(const QualifiedName& tagName, Document* document, bool wasInsertedByParser, bool wasAlreadyStarted) : SVGElement(tagName, document) - , ScriptElement(this, createdByParser, isEvaluated) + , ScriptElement(this, wasInsertedByParser, wasAlreadyStarted) { } -PassRefPtr<SVGScriptElement> SVGScriptElement::create(const QualifiedName& tagName, Document* document, bool createdByParser) +PassRefPtr<SVGScriptElement> SVGScriptElement::create(const QualifiedName& tagName, Document* document, bool insertedByParser) { - return adoptRef(new SVGScriptElement(tagName, document, createdByParser, false)); + return adoptRef(new SVGScriptElement(tagName, document, insertedByParser, false)); } void SVGScriptElement::parseMappedAttribute(Attribute* attr) @@ -68,7 +72,7 @@ void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName) // Handle dynamic updates of the 'externalResourcesRequired' attribute. Only possible case: changing from 'true' to 'false' // causes an immediate dispatch of the SVGLoad event. If the attribute value was 'false' before inserting the script element // in the document, the SVGLoad event has already been dispatched. - if (!externalResourcesRequiredBaseValue() && !haveFiredLoadEvent() && !createdByParser()) { + if (!externalResourcesRequiredBaseValue() && !haveFiredLoadEvent() && !wasInsertedByParser()) { setHaveFiredLoadEvent(true); ASSERT(haveLoadedRequiredResources()); @@ -98,7 +102,7 @@ void SVGScriptElement::insertedIntoDocument() SVGElement::insertedIntoDocument(); ScriptElement::insertedIntoDocument(sourceAttributeValue()); - if (createdByParser()) + if (wasInsertedByParser()) return; // Eventually send SVGLoad event now for the dynamically inserted script element @@ -201,7 +205,7 @@ void SVGScriptElement::dispatchLoadEvent() { bool externalResourcesRequired = externalResourcesRequiredBaseValue(); - if (createdByParser()) + if (wasInsertedByParser()) ASSERT(externalResourcesRequired != haveFiredLoadEvent()); else if (haveFiredLoadEvent()) { // If we've already fired an load event and externalResourcesRequired is set to 'true' @@ -232,7 +236,7 @@ void SVGScriptElement::dispatchErrorEvent() PassRefPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren() const { - return adoptRef(new SVGScriptElement(tagQName(), document(), false, isEvaluated())); + return adoptRef(new SVGScriptElement(tagQName(), document(), false, wasAlreadyStarted())); } } diff --git a/WebCore/svg/SVGScriptElement.h b/WebCore/svg/SVGScriptElement.h index 7532bf2..df502e0 100644 --- a/WebCore/svg/SVGScriptElement.h +++ b/WebCore/svg/SVGScriptElement.h @@ -22,7 +22,8 @@ #define SVGScriptElement_h #if ENABLE(SVG) -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedBoolean.h" +#include "SVGAnimatedString.h" #include "SVGElement.h" #include "SVGExternalResourcesRequired.h" #include "SVGURIReference.h" @@ -30,55 +31,57 @@ namespace WebCore { - class SVGScriptElement : public SVGElement - , public SVGURIReference - , public SVGExternalResourcesRequired - , public ScriptElement { - public: - static PassRefPtr<SVGScriptElement> create(const QualifiedName&, Document*, bool createdByParser); +class SVGScriptElement : public SVGElement + , public SVGURIReference + , public SVGExternalResourcesRequired + , public ScriptElement { +public: + static PassRefPtr<SVGScriptElement> create(const QualifiedName&, Document*, bool wasInsertedByParser); - String type() const; - void setType(const String&); + String type() const; + void setType(const String&); - private: - SVGScriptElement(const QualifiedName&, Document*, bool createdByParser, bool isEvaluated); +private: + SVGScriptElement(const QualifiedName&, Document*, bool wasInsertedByParser, bool wasAlreadyStarted); - virtual void parseMappedAttribute(Attribute*); - virtual void insertedIntoDocument(); - virtual void removedFromDocument(); - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); + virtual void parseMappedAttribute(Attribute*); + virtual void insertedIntoDocument(); + virtual void removedFromDocument(); + virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); - virtual bool isURLAttribute(Attribute*) const; - virtual void finishParsingChildren(); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); + virtual bool isURLAttribute(Attribute*) const; + virtual void finishParsingChildren(); - virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; + virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; - virtual bool haveLoadedRequiredResources(); + virtual bool haveLoadedRequiredResources(); - virtual String sourceAttributeValue() const; - virtual String charsetAttributeValue() const; - virtual String typeAttributeValue() const; - virtual String languageAttributeValue() const; - virtual String forAttributeValue() const; - virtual String eventAttributeValue() const; - virtual bool asyncAttributeValue() const; - virtual bool deferAttributeValue() const; + virtual String sourceAttributeValue() const; + virtual String charsetAttributeValue() const; + virtual String typeAttributeValue() const; + virtual String languageAttributeValue() const; + virtual String forAttributeValue() const; + virtual String eventAttributeValue() const; + virtual bool asyncAttributeValue() const; + virtual bool deferAttributeValue() const; - virtual void dispatchLoadEvent(); - virtual void dispatchErrorEvent(); + virtual void dispatchLoadEvent(); + virtual void dispatchErrorEvent(); - PassRefPtr<Element> cloneElementWithoutAttributesAndChildren() const; + PassRefPtr<Element> cloneElementWithoutAttributesAndChildren() const; - // SVGURIReference - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGScriptElement, XLinkNames::hrefAttr, String, Href, href) + // Animated property declarations - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGScriptElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) + // SVGURIReference + DECLARE_ANIMATED_STRING(Href, href) - String m_type; - }; + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) + + String m_type; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGStopElement.cpp b/WebCore/svg/SVGStopElement.cpp index cd78a46..10bd9ae 100644 --- a/WebCore/svg/SVGStopElement.cpp +++ b/WebCore/svg/SVGStopElement.cpp @@ -32,6 +32,9 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_NUMBER(SVGStopElement, SVGNames::offsetAttr, Offset, offset) + inline SVGStopElement::SVGStopElement(const QualifiedName& tagName, Document* document) : SVGStyledElement(tagName, document) , m_offset(0) diff --git a/WebCore/svg/SVGStopElement.h b/WebCore/svg/SVGStopElement.h index 8da2655..907afae 100644 --- a/WebCore/svg/SVGStopElement.h +++ b/WebCore/svg/SVGStopElement.h @@ -22,30 +22,31 @@ #define SVGStopElement_h #if ENABLE(SVG) -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedNumber.h" #include "SVGStyledElement.h" namespace WebCore { - class SVGStopElement : public SVGStyledElement { - public: - static PassRefPtr<SVGStopElement> create(const QualifiedName&, Document*); +class SVGStopElement : public SVGStyledElement { +public: + static PassRefPtr<SVGStopElement> create(const QualifiedName&, Document*); - Color stopColorIncludingOpacity() const; + Color stopColorIncludingOpacity() const; - private: - SVGStopElement(const QualifiedName&, Document*); +private: + SVGStopElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual bool isGradientStop() const { return true; } + virtual bool isGradientStop() const { return true; } - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGStopElement, SVGNames::offsetAttr, float, Offset, offset) - }; + // Animated property declarations + DECLARE_ANIMATED_NUMBER(Offset, offset) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGStringList.h b/WebCore/svg/SVGStringList.h index 9d74624..5463cc2 100644 --- a/WebCore/svg/SVGStringList.h +++ b/WebCore/svg/SVGStringList.h @@ -23,8 +23,8 @@ #if ENABLE(SVG) #include "QualifiedName.h" +#include "SVGPropertyTraits.h" #include <wtf/Vector.h> -#include <wtf/text/WTFString.h> namespace WebCore { @@ -49,6 +49,11 @@ private: const QualifiedName& m_attributeName; }; +template<> +struct SVGPropertyTraits<SVGStringList> { + typedef String ListItemType; +}; + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGStyledElement.cpp b/WebCore/svg/SVGStyledElement.cpp index d5ef486..a9fadb6 100644 --- a/WebCore/svg/SVGStyledElement.cpp +++ b/WebCore/svg/SVGStyledElement.cpp @@ -46,6 +46,9 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_STRING(SVGStyledElement, HTMLNames::classAttr, ClassName, className) + using namespace SVGNames; void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, int>* propertyNameToIdMap, const QualifiedName& attrName) @@ -77,8 +80,8 @@ String SVGStyledElement::title() const // Walk up the tree, to find out whether we're inside a <use> shadow tree, to find the right title. Node* parent = const_cast<SVGStyledElement*>(this); while (parent) { - if (!parent->isShadowNode()) { - parent = parent->parentNode(); + if (!parent->isShadowRoot()) { + parent = parent->parentNodeGuaranteedHostFree(); continue; } diff --git a/WebCore/svg/SVGStyledElement.h b/WebCore/svg/SVGStyledElement.h index 4f796b8..0714d43 100644 --- a/WebCore/svg/SVGStyledElement.h +++ b/WebCore/svg/SVGStyledElement.h @@ -22,69 +22,69 @@ #define SVGStyledElement_h #if ENABLE(SVG) -#include "SVGAnimatedPropertyMacros.h" -#include "HTMLNames.h" +#include "SVGAnimatedString.h" #include "SVGLocatable.h" #include "SVGStylable.h" #include <wtf/HashSet.h> namespace WebCore { - void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, int>* propertyNameToIdMap, const QualifiedName& attrName); +void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, int>* propertyNameToIdMap, const QualifiedName& attrName); - class SVGStyledElement : public SVGElement, - public SVGStylable { - public: - virtual ~SVGStyledElement(); +class SVGStyledElement : public SVGElement, + public SVGStylable { +public: + virtual ~SVGStyledElement(); - virtual String title() const; + virtual String title() const; - bool hasRelativeLengths() const { return !m_elementsWithRelativeLengths.isEmpty(); } + bool hasRelativeLengths() const { return !m_elementsWithRelativeLengths.isEmpty(); } - virtual bool supportsMarkers() const { return false; } + virtual bool supportsMarkers() const { return false; } - virtual PassRefPtr<CSSValue> getPresentationAttribute(const String& name); + virtual PassRefPtr<CSSValue> getPresentationAttribute(const String& name); - bool isKnownAttribute(const QualifiedName&); + bool isKnownAttribute(const QualifiedName&); - // Centralized place to force a manual style resolution. Hacky but needed for now. - PassRefPtr<RenderStyle> resolveStyle(RenderStyle* parentStyle); + // Centralized place to force a manual style resolution. Hacky but needed for now. + PassRefPtr<RenderStyle> resolveStyle(RenderStyle* parentStyle); - bool instanceUpdatesBlocked() const; - void setInstanceUpdatesBlocked(bool); + bool instanceUpdatesBlocked() const; + void setInstanceUpdatesBlocked(bool); - virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const; + virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const; - virtual CSSStyleDeclaration* style() { return StyledElement::style(); } + virtual CSSStyleDeclaration* style() { return StyledElement::style(); } - protected: - SVGStyledElement(const QualifiedName&, Document*); +protected: + SVGStyledElement(const QualifiedName&, Document*); - virtual bool rendererIsNeeded(RenderStyle*); + virtual bool rendererIsNeeded(RenderStyle*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual void attach(); - virtual void insertedIntoDocument(); - virtual void removedFromDocument(); - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); + virtual void attach(); + virtual void insertedIntoDocument(); + virtual void removedFromDocument(); + virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - static int cssPropertyIdForSVGAttributeName(const QualifiedName&); - void updateRelativeLengthsInformation() { updateRelativeLengthsInformation(selfHasRelativeLengths(), this); } - void updateRelativeLengthsInformation(bool hasRelativeLengths, SVGStyledElement*); + static int cssPropertyIdForSVGAttributeName(const QualifiedName&); + void updateRelativeLengthsInformation() { updateRelativeLengthsInformation(selfHasRelativeLengths(), this); } + void updateRelativeLengthsInformation(bool hasRelativeLengths, SVGStyledElement*); - virtual bool selfHasRelativeLengths() const { return false; } + virtual bool selfHasRelativeLengths() const { return false; } - private: - virtual bool isStyled() const { return true; } +private: + virtual bool isStyled() const { return true; } - HashSet<SVGStyledElement*> m_elementsWithRelativeLengths; + HashSet<SVGStyledElement*> m_elementsWithRelativeLengths; - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGStyledElement, HTMLNames::classAttr, String, ClassName, className) - }; + // Animated property declarations + DECLARE_ANIMATED_STRING(ClassName, className) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGStyledTransformableElement.cpp b/WebCore/svg/SVGStyledTransformableElement.cpp index dec0af9..71be01d 100644 --- a/WebCore/svg/SVGStyledTransformableElement.cpp +++ b/WebCore/svg/SVGStyledTransformableElement.cpp @@ -24,14 +24,15 @@ #include "SVGStyledTransformableElement.h" #include "AffineTransform.h" -#include "Attr.h" +#include "Attribute.h" #include "RenderSVGPath.h" -#include "SVGDocument.h" -#include "SVGStyledElement.h" -#include "SVGTransformList.h" +#include "SVGNames.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_TRANSFORM_LIST(SVGStyledTransformableElement, SVGNames::transformAttr, Transform, transform) + SVGStyledTransformableElement::SVGStyledTransformableElement(const QualifiedName& tagName, Document* document) : SVGStyledLocatableElement(tagName, document) { diff --git a/WebCore/svg/SVGStyledTransformableElement.h b/WebCore/svg/SVGStyledTransformableElement.h index 54907c1..1d882e5 100644 --- a/WebCore/svg/SVGStyledTransformableElement.h +++ b/WebCore/svg/SVGStyledTransformableElement.h @@ -22,14 +22,14 @@ #define SVGStyledTransformableElement_h #if ENABLE(SVG) -#include "Path.h" -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedTransformList.h" #include "SVGStyledLocatableElement.h" #include "SVGTransformable.h" namespace WebCore { class AffineTransform; +class Path; class SVGStyledTransformableElement : public SVGStyledLocatableElement, public SVGTransformable { @@ -60,7 +60,8 @@ protected: virtual void parseMappedAttribute(Attribute*); virtual void synchronizeProperty(const QualifiedName&); - DECLARE_ANIMATED_TRANSFORM_LIST_PROPERTY_NEW(SVGStyledTransformableElement, SVGNames::transformAttr, SVGTransformList, Transform, transform) + // Animated property declarations + DECLARE_ANIMATED_TRANSFORM_LIST(Transform, transform) private: virtual bool isStyledTransformable() const { return true; } diff --git a/WebCore/svg/SVGSwitchElement.cpp b/WebCore/svg/SVGSwitchElement.cpp index b2588f5..853bf03 100644 --- a/WebCore/svg/SVGSwitchElement.cpp +++ b/WebCore/svg/SVGSwitchElement.cpp @@ -19,6 +19,7 @@ */ #include "config.h" + #if ENABLE(SVG) #include "SVGSwitchElement.h" @@ -27,6 +28,9 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_BOOLEAN(SVGSwitchElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + inline SVGSwitchElement::SVGSwitchElement(const QualifiedName& tagName, Document* document) : SVGStyledTransformableElement(tagName, document) { diff --git a/WebCore/svg/SVGSwitchElement.h b/WebCore/svg/SVGSwitchElement.h index 1b006ec..937a1e4 100644 --- a/WebCore/svg/SVGSwitchElement.h +++ b/WebCore/svg/SVGSwitchElement.h @@ -22,33 +22,36 @@ #define SVGSwitchElement_h #if ENABLE(SVG) -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedBoolean.h" #include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" #include "SVGStyledTransformableElement.h" #include "SVGTests.h" namespace WebCore { - class SVGSwitchElement : public SVGStyledTransformableElement, - public SVGTests, - public SVGLangSpace, - public SVGExternalResourcesRequired { - public: - static PassRefPtr<SVGSwitchElement> create(const QualifiedName&, Document*); - - private: - SVGSwitchElement(const QualifiedName&, Document*); - - virtual bool isValid() const { return SVGTests::isValid(); } - - virtual bool childShouldCreateRenderer(Node*) const; - - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual void synchronizeProperty(const QualifiedName&); - - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGSwitchElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) - }; + +class SVGSwitchElement : public SVGStyledTransformableElement, + public SVGTests, + public SVGLangSpace, + public SVGExternalResourcesRequired { +public: + static PassRefPtr<SVGSwitchElement> create(const QualifiedName&, Document*); + +private: + SVGSwitchElement(const QualifiedName&, Document*); + + virtual bool isValid() const { return SVGTests::isValid(); } + + virtual bool childShouldCreateRenderer(Node*) const; + + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual void synchronizeProperty(const QualifiedName&); + + // Animated property declarations + + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGSymbolElement.cpp b/WebCore/svg/SVGSymbolElement.cpp index 7dab3e1..ee4278d 100644 --- a/WebCore/svg/SVGSymbolElement.cpp +++ b/WebCore/svg/SVGSymbolElement.cpp @@ -19,14 +19,20 @@ */ #include "config.h" + #if ENABLE(SVG) #include "SVGSymbolElement.h" -#include "PlatformString.h" #include "SVGFitToViewBox.h" +#include "SVGNames.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_BOOLEAN(SVGSymbolElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) +DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGSymbolElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio) +DEFINE_ANIMATED_RECT(SVGSymbolElement, SVGNames::viewBoxAttr, ViewBox, viewBox) + inline SVGSymbolElement::SVGSymbolElement(const QualifiedName& tagName, Document* document) : SVGStyledElement(tagName, document) { diff --git a/WebCore/svg/SVGSymbolElement.h b/WebCore/svg/SVGSymbolElement.h index 1aa7cbf..e049f0d 100644 --- a/WebCore/svg/SVGSymbolElement.h +++ b/WebCore/svg/SVGSymbolElement.h @@ -22,7 +22,9 @@ #define SVGSymbolElement_h #if ENABLE(SVG) -#include "SVGAnimatedPropertyMacros.h" +#include "SVGAnimatedBoolean.h" +#include "SVGAnimatedPreserveAspectRatio.h" +#include "SVGAnimatedRect.h" #include "SVGExternalResourcesRequired.h" #include "SVGFitToViewBox.h" #include "SVGLangSpace.h" @@ -30,30 +32,32 @@ namespace WebCore { - class SVGSymbolElement : public SVGStyledElement, - public SVGLangSpace, - public SVGExternalResourcesRequired, - public SVGFitToViewBox { - public: - static PassRefPtr<SVGSymbolElement> create(const QualifiedName&, Document*); +class SVGSymbolElement : public SVGStyledElement, + public SVGLangSpace, + public SVGExternalResourcesRequired, + public SVGFitToViewBox { +public: + static PassRefPtr<SVGSymbolElement> create(const QualifiedName&, Document*); - private: - SVGSymbolElement(const QualifiedName&, Document*); +private: + SVGSymbolElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); - virtual bool rendererIsNeeded(RenderStyle*) { return false; } + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); + virtual bool rendererIsNeeded(RenderStyle*) { return false; } - virtual bool selfHasRelativeLengths() const; + virtual bool selfHasRelativeLengths() const; - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGSymbolElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) + // Animated property declarations + + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) - // SVGFitToViewBox - DECLARE_ANIMATED_PROPERTY_NEW(SVGSymbolElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox) - DECLARE_ANIMATED_PROPERTY_NEW(SVGSymbolElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) - }; + // SVGFitToViewBox + DECLARE_ANIMATED_RECT(ViewBox, viewBox) + DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGTRefElement.cpp b/WebCore/svg/SVGTRefElement.cpp index 72a037a..14c4700 100644 --- a/WebCore/svg/SVGTRefElement.cpp +++ b/WebCore/svg/SVGTRefElement.cpp @@ -32,6 +32,9 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_STRING(SVGTRefElement, XLinkNames::hrefAttr, Href, href) + inline SVGTRefElement::SVGTRefElement(const QualifiedName& tagName, Document* document) : SVGTextPositioningElement(tagName, document) { @@ -81,17 +84,32 @@ void SVGTRefElement::synchronizeProperty(const QualifiedName& attrName) synchronizeHref(); } +RenderObject* SVGTRefElement::createRenderer(RenderArena* arena, RenderStyle*) +{ + return new (arena) RenderSVGInline(this); +} + bool SVGTRefElement::childShouldCreateRenderer(Node* child) const { - if (child->isTextNode() || child->hasTagName(SVGNames::tspanTag) || - child->hasTagName(SVGNames::trefTag)) + if (child->isTextNode()) return true; + return false; } -RenderObject* SVGTRefElement::createRenderer(RenderArena* arena, RenderStyle*) +bool SVGTRefElement::rendererIsNeeded(RenderStyle* style) { - return new (arena) RenderSVGInline(this); + if (parentNode() + && (parentNode()->hasTagName(SVGNames::aTag) +#if ENABLE(SVG_FONTS) + || parentNode()->hasTagName(SVGNames::altGlyphTag) +#endif + || parentNode()->hasTagName(SVGNames::textTag) + || parentNode()->hasTagName(SVGNames::textPathTag) + || parentNode()->hasTagName(SVGNames::tspanTag))) + return StyledElement::rendererIsNeeded(style); + + return false; } } diff --git a/WebCore/svg/SVGTRefElement.h b/WebCore/svg/SVGTRefElement.h index ffbfa55..8b98383 100644 --- a/WebCore/svg/SVGTRefElement.h +++ b/WebCore/svg/SVGTRefElement.h @@ -27,26 +27,29 @@ namespace WebCore { - class SVGTRefElement : public SVGTextPositioningElement, - public SVGURIReference { - public: - static PassRefPtr<SVGTRefElement> create(const QualifiedName&, Document*); +class SVGTRefElement : public SVGTextPositioningElement, + public SVGURIReference { +public: + static PassRefPtr<SVGTRefElement> create(const QualifiedName&, Document*); - private: - SVGTRefElement(const QualifiedName&, Document*); +private: + SVGTRefElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual bool childShouldCreateRenderer(Node*) const; + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual bool childShouldCreateRenderer(Node*) const; + virtual bool rendererIsNeeded(RenderStyle*); - void updateReferencedText(); + void updateReferencedText(); - // SVGURIReference - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGTRefElement, XLinkNames::hrefAttr, String, Href, href) - }; + // Animated property declarations + + // SVGURIReference + DECLARE_ANIMATED_STRING(Href, href) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGTSpanElement.cpp b/WebCore/svg/SVGTSpanElement.cpp index b88600a..8fe30e2 100644 --- a/WebCore/svg/SVGTSpanElement.cpp +++ b/WebCore/svg/SVGTSpanElement.cpp @@ -39,24 +39,38 @@ PassRefPtr<SVGTSpanElement> SVGTSpanElement::create(const QualifiedName& tagName return adoptRef(new SVGTSpanElement(tagName, document)); } +RenderObject* SVGTSpanElement::createRenderer(RenderArena* arena, RenderStyle*) +{ + return new (arena) RenderSVGTSpan(this); +} + bool SVGTSpanElement::childShouldCreateRenderer(Node* child) const { if (child->isTextNode() + || child->hasTagName(SVGNames::aTag) #if ENABLE(SVG_FONTS) || child->hasTagName(SVGNames::altGlyphTag) #endif - || child->hasTagName(SVGNames::tspanTag) || child->hasTagName(SVGNames::trefTag) - || child->hasTagName(SVGNames::aTag) - || child->hasTagName(SVGNames::textPathTag)) + || child->hasTagName(SVGNames::tspanTag)) return true; return false; } -RenderObject* SVGTSpanElement::createRenderer(RenderArena* arena, RenderStyle*) +bool SVGTSpanElement::rendererIsNeeded(RenderStyle* style) { - return new (arena) RenderSVGTSpan(this); + if (parentNode() + && (parentNode()->hasTagName(SVGNames::aTag) +#if ENABLE(SVG_FONTS) + || parentNode()->hasTagName(SVGNames::altGlyphTag) +#endif + || parentNode()->hasTagName(SVGNames::textTag) + || parentNode()->hasTagName(SVGNames::textPathTag) + || parentNode()->hasTagName(SVGNames::tspanTag))) + return StyledElement::rendererIsNeeded(style); + + return false; } } diff --git a/WebCore/svg/SVGTSpanElement.h b/WebCore/svg/SVGTSpanElement.h index 9b276a8..58a7990 100644 --- a/WebCore/svg/SVGTSpanElement.h +++ b/WebCore/svg/SVGTSpanElement.h @@ -26,16 +26,17 @@ namespace WebCore { - class SVGTSpanElement : public SVGTextPositioningElement { - public: - static PassRefPtr<SVGTSpanElement> create(const QualifiedName&, Document*); +class SVGTSpanElement : public SVGTextPositioningElement { +public: + static PassRefPtr<SVGTSpanElement> create(const QualifiedName&, Document*); - private: - SVGTSpanElement(const QualifiedName&, Document*); - - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual bool childShouldCreateRenderer(Node*) const; - }; +private: + SVGTSpanElement(const QualifiedName&, Document*); + + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual bool childShouldCreateRenderer(Node*) const; + virtual bool rendererIsNeeded(RenderStyle*); +}; } // namespace WebCore diff --git a/WebCore/svg/SVGTextContentElement.cpp b/WebCore/svg/SVGTextContentElement.cpp index 65b89e9..037ce3b 100644 --- a/WebCore/svg/SVGTextContentElement.cpp +++ b/WebCore/svg/SVGTextContentElement.cpp @@ -27,12 +27,18 @@ #include "CSSValueKeywords.h" #include "Frame.h" #include "RenderObject.h" +#include "SVGNames.h" #include "SVGTextQuery.h" #include "SelectionController.h" #include "XMLNames.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_LENGTH(SVGTextContentElement, SVGNames::textLengthAttr, TextLength, textLength) +DEFINE_ANIMATED_ENUMERATION(SVGTextContentElement, SVGNames::lengthAdjustAttr, LengthAdjust, lengthAdjust) +DEFINE_ANIMATED_BOOLEAN(SVGTextContentElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Document* document) : SVGStyledElement(tagName, document) , m_textLength(LengthModeOther) diff --git a/WebCore/svg/SVGTextContentElement.h b/WebCore/svg/SVGTextContentElement.h index fd2e003..60b023b 100644 --- a/WebCore/svg/SVGTextContentElement.h +++ b/WebCore/svg/SVGTextContentElement.h @@ -22,8 +22,9 @@ #define SVGTextContentElement_h #if ENABLE(SVG) +#include "SVGAnimatedBoolean.h" +#include "SVGAnimatedEnumeration.h" #include "SVGAnimatedLength.h" -#include "SVGAnimatedPropertyMacros.h" #include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" #include "SVGStyledElement.h" @@ -31,53 +32,52 @@ namespace WebCore { - class SVGLength; - - class SVGTextContentElement : public SVGStyledElement, - public SVGTests, - public SVGLangSpace, - public SVGExternalResourcesRequired { - public: - enum SVGLengthAdjustType { - LENGTHADJUST_UNKNOWN = 0, - LENGTHADJUST_SPACING = 1, - LENGTHADJUST_SPACINGANDGLYPHS = 2 - }; +class SVGTextContentElement : public SVGStyledElement, + public SVGTests, + public SVGLangSpace, + public SVGExternalResourcesRequired { +public: + enum SVGLengthAdjustType { + LENGTHADJUST_UNKNOWN = 0, + LENGTHADJUST_SPACING = 1, + LENGTHADJUST_SPACINGANDGLYPHS = 2 + }; - unsigned getNumberOfChars() const; - float getComputedTextLength() const; - float getSubStringLength(unsigned charnum, unsigned nchars, ExceptionCode&) const; - FloatPoint getStartPositionOfChar(unsigned charnum, ExceptionCode&) const; - FloatPoint getEndPositionOfChar(unsigned charnum, ExceptionCode&) const; - FloatRect getExtentOfChar(unsigned charnum, ExceptionCode&) const; - float getRotationOfChar(unsigned charnum, ExceptionCode&) const; - int getCharNumAtPosition(const FloatPoint&) const; - void selectSubString(unsigned charnum, unsigned nchars, ExceptionCode&) const; + unsigned getNumberOfChars() const; + float getComputedTextLength() const; + float getSubStringLength(unsigned charnum, unsigned nchars, ExceptionCode&) const; + FloatPoint getStartPositionOfChar(unsigned charnum, ExceptionCode&) const; + FloatPoint getEndPositionOfChar(unsigned charnum, ExceptionCode&) const; + FloatRect getExtentOfChar(unsigned charnum, ExceptionCode&) const; + float getRotationOfChar(unsigned charnum, ExceptionCode&) const; + int getCharNumAtPosition(const FloatPoint&) const; + void selectSubString(unsigned charnum, unsigned nchars, ExceptionCode&) const; - bool isKnownAttribute(const QualifiedName&); + bool isKnownAttribute(const QualifiedName&); - static SVGTextContentElement* elementFromRenderer(RenderObject*); + static SVGTextContentElement* elementFromRenderer(RenderObject*); - protected: - SVGTextContentElement(const QualifiedName&, Document*); +protected: + SVGTextContentElement(const QualifiedName&, Document*); - virtual bool isValid() const { return SVGTests::isValid(); } + virtual bool isValid() const { return SVGTests::isValid(); } - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual bool selfHasRelativeLengths() const; + virtual bool selfHasRelativeLengths() const; - private: - virtual bool isTextContent() const { return true; } +private: + virtual bool isTextContent() const { return true; } - DECLARE_ANIMATED_PROPERTY_NEW(SVGTextContentElement, SVGNames::textLengthAttr, SVGLength, TextLength, textLength) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGTextContentElement, SVGNames::lengthAdjustAttr, int, LengthAdjust, lengthAdjust) + // Animated property declarations + DECLARE_ANIMATED_LENGTH(TextLength, textLength) + DECLARE_ANIMATED_ENUMERATION(LengthAdjust, lengthAdjust) - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGTextContentElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) - }; + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGTextElement.cpp b/WebCore/svg/SVGTextElement.cpp index 2e80cdd..7229824 100644 --- a/WebCore/svg/SVGTextElement.cpp +++ b/WebCore/svg/SVGTextElement.cpp @@ -28,16 +28,17 @@ #include "FloatRect.h" #include "RenderSVGResource.h" #include "RenderSVGText.h" -#include "SVGLengthList.h" +#include "SVGNames.h" #include "SVGRenderStyle.h" #include "SVGTSpanElement.h" -#include "SVGTransformList.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_TRANSFORM_LIST(SVGTextElement, SVGNames::transformAttr, Transform, transform) + inline SVGTextElement::SVGTextElement(const QualifiedName& tagName, Document* doc) : SVGTextPositioningElement(tagName, doc) - , SVGTransformable() { } @@ -106,11 +107,15 @@ RenderObject* SVGTextElement::createRenderer(RenderArena* arena, RenderStyle*) bool SVGTextElement::childShouldCreateRenderer(Node* child) const { if (child->isTextNode() + || child->hasTagName(SVGNames::aTag) #if ENABLE(SVG_FONTS) || child->hasTagName(SVGNames::altGlyphTag) #endif - || child->hasTagName(SVGNames::tspanTag) || child->hasTagName(SVGNames::trefTag) || child->hasTagName(SVGNames::aTag) || child->hasTagName(SVGNames::textPathTag)) + || child->hasTagName(SVGNames::textPathTag) + || child->hasTagName(SVGNames::trefTag) + || child->hasTagName(SVGNames::tspanTag)) return true; + return false; } diff --git a/WebCore/svg/SVGTextElement.h b/WebCore/svg/SVGTextElement.h index 3bfee46..8dda8c6 100644 --- a/WebCore/svg/SVGTextElement.h +++ b/WebCore/svg/SVGTextElement.h @@ -28,38 +28,39 @@ namespace WebCore { - class SVGTextElement : public SVGTextPositioningElement, - public SVGTransformable { - public: - static PassRefPtr<SVGTextElement> create(const QualifiedName&, Document*); +class SVGTextElement : public SVGTextPositioningElement, + public SVGTransformable { +public: + static PassRefPtr<SVGTextElement> create(const QualifiedName&, Document*); - virtual SVGElement* nearestViewportElement() const; - virtual SVGElement* farthestViewportElement() const; + virtual SVGElement* nearestViewportElement() const; + virtual SVGElement* farthestViewportElement() const; - virtual FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate) const; - virtual AffineTransform getCTM(StyleUpdateStrategy = AllowStyleUpdate) const; - virtual AffineTransform getScreenCTM(StyleUpdateStrategy = AllowStyleUpdate) const; - virtual AffineTransform animatedLocalTransform() const; + virtual FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate) const; + virtual AffineTransform getCTM(StyleUpdateStrategy = AllowStyleUpdate) const; + virtual AffineTransform getScreenCTM(StyleUpdateStrategy = AllowStyleUpdate) const; + virtual AffineTransform animatedLocalTransform() const; - private: - SVGTextElement(const QualifiedName&, Document*); +private: + SVGTextElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseMappedAttribute(Attribute*); - virtual AffineTransform* supplementalTransform(); - virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const { return SVGTransformable::localCoordinateSpaceTransform(mode); } + virtual AffineTransform* supplementalTransform(); + virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const { return SVGTransformable::localCoordinateSpaceTransform(mode); } - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual bool childShouldCreateRenderer(Node*) const; - - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual bool childShouldCreateRenderer(Node*) const; + + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - DECLARE_ANIMATED_TRANSFORM_LIST_PROPERTY_NEW(SVGTextElement, SVGNames::transformAttr, SVGTransformList, Transform, transform) - - // Used by <animateMotion> - OwnPtr<AffineTransform> m_supplementalTransform; - }; + // Animated property declarations + DECLARE_ANIMATED_TRANSFORM_LIST(Transform, transform) + + // Used by <animateMotion> + OwnPtr<AffineTransform> m_supplementalTransform; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGTextPathElement.cpp b/WebCore/svg/SVGTextPathElement.cpp index bbfa0e2..5bd4e4b 100644 --- a/WebCore/svg/SVGTextPathElement.cpp +++ b/WebCore/svg/SVGTextPathElement.cpp @@ -23,18 +23,19 @@ #if ENABLE(SVG) #include "SVGTextPathElement.h" -#include "AffineTransform.h" #include "Attribute.h" -#include "FloatRect.h" +#include "SVGNames.h" #include "RenderSVGResource.h" #include "RenderSVGTextPath.h" -#include "SVGLengthList.h" -#include "SVGPathElement.h" -#include "SVGRenderStyle.h" -#include "SVGTransformList.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_LENGTH(SVGTextPathElement, SVGNames::startOffsetAttr, StartOffset, startOffset) +DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::methodAttr, Method, method) +DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::spacingAttr, Spacing, spacing) +DEFINE_ANIMATED_STRING(SVGTextPathElement, XLinkNames::hrefAttr, Href, href) + inline SVGTextPathElement::SVGTextPathElement(const QualifiedName& tagName, Document* document) : SVGTextContentElement(tagName, document) , m_startOffset(LengthModeOther) @@ -117,18 +118,24 @@ RenderObject* SVGTextPathElement::createRenderer(RenderArena* arena, RenderStyle bool SVGTextPathElement::childShouldCreateRenderer(Node* child) const { if (child->isTextNode() -#if ENABLE(SVG_FONTS) - || child->hasTagName(SVGNames::altGlyphTag) -#endif - || child->hasTagName(SVGNames::trefTag) - || child->hasTagName(SVGNames::tspanTag) || child->hasTagName(SVGNames::aTag) - || child->hasTagName(SVGNames::textPathTag)) + || child->hasTagName(SVGNames::trefTag) + || child->hasTagName(SVGNames::tspanTag)) return true; return false; } +bool SVGTextPathElement::rendererIsNeeded(RenderStyle* style) +{ + if (parentNode() + && (parentNode()->hasTagName(SVGNames::aTag) + || parentNode()->hasTagName(SVGNames::textTag))) + return StyledElement::rendererIsNeeded(style); + + return false; +} + void SVGTextPathElement::insertedIntoDocument() { SVGTextContentElement::insertedIntoDocument(); diff --git a/WebCore/svg/SVGTextPathElement.h b/WebCore/svg/SVGTextPathElement.h index 2375078..9652294 100644 --- a/WebCore/svg/SVGTextPathElement.h +++ b/WebCore/svg/SVGTextPathElement.h @@ -26,54 +26,57 @@ #include "SVGURIReference.h" namespace WebCore { + enum SVGTextPathMethodType { - SVG_TEXTPATH_METHODTYPE_UNKNOWN = 0, - SVG_TEXTPATH_METHODTYPE_ALIGN = 1, - SVG_TEXTPATH_METHODTYPE_STRETCH = 2 - }; + SVG_TEXTPATH_METHODTYPE_UNKNOWN = 0, + SVG_TEXTPATH_METHODTYPE_ALIGN = 1, + SVG_TEXTPATH_METHODTYPE_STRETCH = 2 +}; + +enum SVGTextPathSpacingType { + SVG_TEXTPATH_SPACINGTYPE_UNKNOWN = 0, + SVG_TEXTPATH_SPACINGTYPE_AUTO = 1, + SVG_TEXTPATH_SPACINGTYPE_EXACT = 2 +}; - enum SVGTextPathSpacingType { - SVG_TEXTPATH_SPACINGTYPE_UNKNOWN = 0, - SVG_TEXTPATH_SPACINGTYPE_AUTO = 1, - SVG_TEXTPATH_SPACINGTYPE_EXACT = 2 +class SVGTextPathElement : public SVGTextContentElement, + public SVGURIReference { +public: + // Forward declare these enums in the w3c naming scheme, for IDL generation + enum { + TEXTPATH_METHODTYPE_UNKNOWN = SVG_TEXTPATH_METHODTYPE_UNKNOWN, + TEXTPATH_METHODTYPE_ALIGN = SVG_TEXTPATH_METHODTYPE_ALIGN, + TEXTPATH_METHODTYPE_STRETCH = SVG_TEXTPATH_METHODTYPE_STRETCH, + TEXTPATH_SPACINGTYPE_UNKNOWN = SVG_TEXTPATH_SPACINGTYPE_UNKNOWN, + TEXTPATH_SPACINGTYPE_AUTO = SVG_TEXTPATH_SPACINGTYPE_AUTO, + TEXTPATH_SPACINGTYPE_EXACT = SVG_TEXTPATH_SPACINGTYPE_EXACT }; - class SVGTextPathElement : public SVGTextContentElement, - public SVGURIReference { - public: - // Forward declare these enums in the w3c naming scheme, for IDL generation - enum { - TEXTPATH_METHODTYPE_UNKNOWN = SVG_TEXTPATH_METHODTYPE_UNKNOWN, - TEXTPATH_METHODTYPE_ALIGN = SVG_TEXTPATH_METHODTYPE_ALIGN, - TEXTPATH_METHODTYPE_STRETCH = SVG_TEXTPATH_METHODTYPE_STRETCH, - TEXTPATH_SPACINGTYPE_UNKNOWN = SVG_TEXTPATH_SPACINGTYPE_UNKNOWN, - TEXTPATH_SPACINGTYPE_AUTO = SVG_TEXTPATH_SPACINGTYPE_AUTO, - TEXTPATH_SPACINGTYPE_EXACT = SVG_TEXTPATH_SPACINGTYPE_EXACT - }; - - static PassRefPtr<SVGTextPathElement> create(const QualifiedName&, Document*); + static PassRefPtr<SVGTextPathElement> create(const QualifiedName&, Document*); - private: - SVGTextPathElement(const QualifiedName&, Document*); +private: + SVGTextPathElement(const QualifiedName&, Document*); - virtual void insertedIntoDocument(); + virtual void insertedIntoDocument(); - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual bool childShouldCreateRenderer(Node*) const; + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual bool childShouldCreateRenderer(Node*) const; + virtual bool rendererIsNeeded(RenderStyle*); - virtual bool selfHasRelativeLengths() const; + virtual bool selfHasRelativeLengths() const; - DECLARE_ANIMATED_PROPERTY_NEW(SVGTextPathElement, SVGNames::startOffsetAttr, SVGLength, StartOffset, startOffset) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGTextPathElement, SVGNames::methodAttr, int, Method, method) - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGTextPathElement, SVGNames::spacingAttr, int, Spacing, spacing) - - // SVGURIReference - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGTextPathElement, XLinkNames::hrefAttr, String, Href, href) - }; + // Animated property declarations + DECLARE_ANIMATED_LENGTH(StartOffset, startOffset) + DECLARE_ANIMATED_ENUMERATION(Method, method) + DECLARE_ANIMATED_ENUMERATION(Spacing, spacing) + + // SVGURIReference + DECLARE_ANIMATED_STRING(Href, href) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGTextPositioningElement.cpp b/WebCore/svg/SVGTextPositioningElement.cpp index bb65262..544d192 100644 --- a/WebCore/svg/SVGTextPositioningElement.cpp +++ b/WebCore/svg/SVGTextPositioningElement.cpp @@ -32,6 +32,13 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_LENGTH_LIST(SVGTextPositioningElement, SVGNames::xAttr, X, x) +DEFINE_ANIMATED_LENGTH_LIST(SVGTextPositioningElement, SVGNames::yAttr, Y, y) +DEFINE_ANIMATED_LENGTH_LIST(SVGTextPositioningElement, SVGNames::dxAttr, Dx, dx) +DEFINE_ANIMATED_LENGTH_LIST(SVGTextPositioningElement, SVGNames::dyAttr, Dy, dy) +DEFINE_ANIMATED_NUMBER_LIST(SVGTextPositioningElement, SVGNames::rotateAttr, Rotate, rotate) + SVGTextPositioningElement::SVGTextPositioningElement(const QualifiedName& tagName, Document* document) : SVGTextContentElement(tagName, document) { diff --git a/WebCore/svg/SVGTextPositioningElement.h b/WebCore/svg/SVGTextPositioningElement.h index e1798de..e4bc4ea 100644 --- a/WebCore/svg/SVGTextPositioningElement.h +++ b/WebCore/svg/SVGTextPositioningElement.h @@ -22,32 +22,33 @@ #define SVGTextPositioningElement_h #if ENABLE(SVG) +#include "SVGAnimatedLengthList.h" +#include "SVGAnimatedNumberList.h" #include "SVGTextContentElement.h" -#include "SVGLengthList.h" -#include "SVGNumberList.h" namespace WebCore { - class SVGTextPositioningElement : public SVGTextContentElement { - public: - static SVGTextPositioningElement* elementFromRenderer(RenderObject*); +class SVGTextPositioningElement : public SVGTextContentElement { +public: + static SVGTextPositioningElement* elementFromRenderer(RenderObject*); - protected: - SVGTextPositioningElement(const QualifiedName&, Document*); +protected: + SVGTextPositioningElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual void parseMappedAttribute(Attribute*); + virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual bool selfHasRelativeLengths() const; + virtual bool selfHasRelativeLengths() const; - DECLARE_ANIMATED_LIST_PROPERTY_NEW(SVGTextPositioningElement, SVGNames::xAttr, SVGLengthList, X, x) - DECLARE_ANIMATED_LIST_PROPERTY_NEW(SVGTextPositioningElement, SVGNames::yAttr, SVGLengthList, Y, y) - DECLARE_ANIMATED_LIST_PROPERTY_NEW(SVGTextPositioningElement, SVGNames::dxAttr, SVGLengthList, Dx, dx) - DECLARE_ANIMATED_LIST_PROPERTY_NEW(SVGTextPositioningElement, SVGNames::dyAttr, SVGLengthList, Dy, dy) - DECLARE_ANIMATED_LIST_PROPERTY_NEW(SVGTextPositioningElement, SVGNames::rotateAttr, SVGNumberList, Rotate, rotate) - }; + // Animated property declarations + DECLARE_ANIMATED_LENGTH_LIST(X, x) + DECLARE_ANIMATED_LENGTH_LIST(Y, y) + DECLARE_ANIMATED_LENGTH_LIST(Dx, dx) + DECLARE_ANIMATED_LENGTH_LIST(Dy, dy) + DECLARE_ANIMATED_NUMBER_LIST(Rotate, rotate) +}; } // namespace WebCore diff --git a/WebCore/svg/SVGTransformList.h b/WebCore/svg/SVGTransformList.h index e071355..0afc832 100644 --- a/WebCore/svg/SVGTransformList.h +++ b/WebCore/svg/SVGTransformList.h @@ -22,9 +22,9 @@ #define SVGTransformList_h #if ENABLE(SVG) +#include "SVGPropertyTraits.h" #include "SVGTransform.h" #include <wtf/Vector.h> -#include <wtf/text/WTFString.h> namespace WebCore { @@ -41,6 +41,13 @@ public: String valueAsString() const; }; +template<> +struct SVGPropertyTraits<SVGTransformList> { + static SVGTransformList initialValue() { return SVGTransformList(); } + static String toString(const SVGTransformList& type) { return type.valueAsString(); } + typedef SVGTransform ListItemType; +}; + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGTransformList.idl b/WebCore/svg/SVGTransformList.idl index cdd813d..8bbb091 100644 --- a/WebCore/svg/SVGTransformList.idl +++ b/WebCore/svg/SVGTransformList.idl @@ -44,7 +44,9 @@ module svg { [StrictTypeChecking, RequiresAllArguments=Raise] SVGTransform appendItem(in SVGTransform item) raises(DOMException, SVGException); - [StrictTypeChecking, RequiresAllArguments=Raise] SVGTransform createSVGTransformFromMatrix(in SVGMatrix matrix); + [StrictTypeChecking, RequiresAllArguments=Raise] SVGTransform createSVGTransformFromMatrix(in SVGMatrix matrix) + raises(DOMException); + SVGTransform consolidate() raises(DOMException); }; diff --git a/WebCore/svg/SVGUseElement.cpp b/WebCore/svg/SVGUseElement.cpp index 909c663..f259b85 100644 --- a/WebCore/svg/SVGUseElement.cpp +++ b/WebCore/svg/SVGUseElement.cpp @@ -37,8 +37,7 @@ #include "SVGElementInstance.h" #include "SVGElementInstanceList.h" #include "SVGGElement.h" -#include "SVGLength.h" -#include "SVGPreserveAspectRatio.h" +#include "SVGNames.h" #include "SVGSMILElement.h" #include "SVGSVGElement.h" #include "SVGShadowTreeElements.h" @@ -57,6 +56,14 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_LENGTH(SVGUseElement, SVGNames::xAttr, X, x) +DEFINE_ANIMATED_LENGTH(SVGUseElement, SVGNames::yAttr, Y, y) +DEFINE_ANIMATED_LENGTH(SVGUseElement, SVGNames::widthAttr, Width, width) +DEFINE_ANIMATED_LENGTH(SVGUseElement, SVGNames::heightAttr, Height, height) +DEFINE_ANIMATED_STRING(SVGUseElement, XLinkNames::hrefAttr, Href, href) +DEFINE_ANIMATED_BOOLEAN(SVGUseElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) + inline SVGUseElement::SVGUseElement(const QualifiedName& tagName, Document* document) : SVGStyledTransformableElement(tagName, document) , m_x(LengthModeWidth) @@ -130,7 +137,7 @@ void SVGUseElement::insertedIntoDocument() void SVGUseElement::removedFromDocument() { SVGStyledTransformableElement::removedFromDocument(); - detachInstance(); + m_targetElementInstance = 0; } void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName) @@ -486,17 +493,18 @@ void SVGUseElement::buildShadowAndInstanceTree(SVGShadowTreeRootElement* shadowR // The will be expanded soon anyway - see expandUseElementsInShadowTree(). ContainerNode* parent = parentNode(); while (parent) { - if (parent->isShadowNode()) + if (parent->isShadowRoot()) return; - parent = parent->parentNode(); + parent = parent->parentNodeGuaranteedHostFree(); } - + SVGElement* target = 0; if (targetElement && targetElement->isSVGElement()) target = static_cast<SVGElement*>(targetElement); - detachInstance(); + if (m_targetElementInstance) + m_targetElementInstance = 0; // Do not allow self-referencing. // 'target' may be null, if it's a non SVG namespaced element. @@ -522,7 +530,7 @@ void SVGUseElement::buildShadowAndInstanceTree(SVGShadowTreeRootElement* shadowR // SVG specification does not say a word about <use> & cycles. My view on this is: just ignore it! // Non-appearing <use> content is easier to debug, then half-appearing content. if (foundProblem) { - detachInstance(); + m_targetElementInstance = 0; return; } @@ -555,7 +563,7 @@ void SVGUseElement::buildShadowAndInstanceTree(SVGShadowTreeRootElement* shadowR // Do NOT leave an inconsistent instance tree around, instead destruct it. if (!m_targetElementInstance->shadowTreeElement()) { shadowRoot->removeAllChildren(); - detachInstance(); + m_targetElementInstance = 0; return; } @@ -575,7 +583,7 @@ void SVGUseElement::buildShadowAndInstanceTree(SVGShadowTreeRootElement* shadowR #ifdef DUMP_SHADOW_TREE ExceptionCode ec = 0; - PassRefPtr<XMLSerializer> serializer = XMLSerializer::create(); + RefPtr<XMLSerializer> serializer = XMLSerializer::create(); String markup = serializer->serializeToString(shadowRoot, ec); ASSERT(!ec); @@ -594,14 +602,6 @@ void SVGUseElement::buildShadowAndInstanceTree(SVGShadowTreeRootElement* shadowR updateRelativeLengthsInformation(); } -void SVGUseElement::detachInstance() -{ - if (!m_targetElementInstance) - return; - m_targetElementInstance->clearUseElement(); - m_targetElementInstance = 0; -} - RenderObject* SVGUseElement::createRenderer(RenderArena* arena, RenderStyle*) { return new (arena) RenderSVGShadowTreeRootContainer(this); @@ -624,18 +624,18 @@ void SVGUseElement::attach() void SVGUseElement::detach() { SVGStyledTransformableElement::detach(); - detachInstance(); + m_targetElementInstance = 0; } -static bool isDirectReference(Node* n) +static bool isDirectReference(Node* node) { - return n->hasTagName(SVGNames::pathTag) || - n->hasTagName(SVGNames::rectTag) || - n->hasTagName(SVGNames::circleTag) || - n->hasTagName(SVGNames::ellipseTag) || - n->hasTagName(SVGNames::polygonTag) || - n->hasTagName(SVGNames::polylineTag) || - n->hasTagName(SVGNames::textTag); + return node->hasTagName(SVGNames::pathTag) + || node->hasTagName(SVGNames::rectTag) + || node->hasTagName(SVGNames::circleTag) + || node->hasTagName(SVGNames::ellipseTag) + || node->hasTagName(SVGNames::polygonTag) + || node->hasTagName(SVGNames::polylineTag) + || node->hasTagName(SVGNames::textTag); } void SVGUseElement::toClipPath(Path& path) const diff --git a/WebCore/svg/SVGUseElement.h b/WebCore/svg/SVGUseElement.h index 845270d..a8f2b82 100644 --- a/WebCore/svg/SVGUseElement.h +++ b/WebCore/svg/SVGUseElement.h @@ -22,8 +22,8 @@ #define SVGUseElement_h #if ENABLE(SVG) +#include "SVGAnimatedBoolean.h" #include "SVGAnimatedLength.h" -#include "SVGAnimatedPropertyMacros.h" #include "SVGExternalResourcesRequired.h" #include "SVGLangSpace.h" #include "SVGStyledTransformableElement.h" @@ -32,95 +32,94 @@ namespace WebCore { - class SVGElementInstance; - class SVGLength; - class SVGShadowTreeRootElement; +class SVGElementInstance; +class SVGShadowTreeRootElement; - class SVGUseElement : public SVGStyledTransformableElement, - public SVGTests, - public SVGLangSpace, - public SVGExternalResourcesRequired, - public SVGURIReference { - public: - static PassRefPtr<SVGUseElement> create(const QualifiedName&, Document*); +class SVGUseElement : public SVGStyledTransformableElement, + public SVGTests, + public SVGLangSpace, + public SVGExternalResourcesRequired, + public SVGURIReference { +public: + static PassRefPtr<SVGUseElement> create(const QualifiedName&, Document*); - SVGElementInstance* instanceRoot() const; - SVGElementInstance* animatedInstanceRoot() const; - SVGElementInstance* instanceForShadowTreeElement(Node*) const; - void invalidateShadowTree(); + SVGElementInstance* instanceRoot() const; + SVGElementInstance* animatedInstanceRoot() const; + SVGElementInstance* instanceForShadowTreeElement(Node*) const; + void invalidateShadowTree(); - RenderObject* rendererClipChild() const; + RenderObject* rendererClipChild() const; - private: - SVGUseElement(const QualifiedName&, Document*); +private: + SVGUseElement(const QualifiedName&, Document*); - virtual bool isValid() const { return SVGTests::isValid(); } + virtual bool isValid() const { return SVGTests::isValid(); } - virtual void insertedIntoDocument(); - virtual void removedFromDocument(); - virtual void buildPendingResource(); + virtual void insertedIntoDocument(); + virtual void removedFromDocument(); + virtual void buildPendingResource(); - virtual void parseMappedAttribute(Attribute*); - virtual void svgAttributeChanged(const QualifiedName&); - virtual void synchronizeProperty(const QualifiedName&); + virtual void parseMappedAttribute(Attribute*); + virtual void svgAttributeChanged(const QualifiedName&); + virtual void synchronizeProperty(const QualifiedName&); - virtual void recalcStyle(StyleChange = NoChange); - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual void attach(); - virtual void detach(); + virtual void recalcStyle(StyleChange = NoChange); + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual void attach(); + virtual void detach(); - virtual void toClipPath(Path&) const; + virtual void toClipPath(Path&) const; - static void removeDisallowedElementsFromSubtree(Node* element); + static void removeDisallowedElementsFromSubtree(Node* element); - void setUpdatesBlocked(bool blocked) { m_updatesBlocked = blocked; } + void setUpdatesBlocked(bool blocked) { m_updatesBlocked = blocked; } - friend class RenderSVGShadowTreeRootContainer; - bool isPendingResource() const { return m_isPendingResource; } - void buildShadowAndInstanceTree(SVGShadowTreeRootElement*); - void detachInstance(); + friend class RenderSVGShadowTreeRootContainer; + bool isPendingResource() const { return m_isPendingResource; } + void buildShadowAndInstanceTree(SVGShadowTreeRootElement*); - virtual bool selfHasRelativeLengths() const; + virtual bool selfHasRelativeLengths() const; - DECLARE_ANIMATED_PROPERTY_NEW(SVGUseElement, SVGNames::xAttr, SVGLength, X, x) - DECLARE_ANIMATED_PROPERTY_NEW(SVGUseElement, SVGNames::yAttr, SVGLength, Y, y) - DECLARE_ANIMATED_PROPERTY_NEW(SVGUseElement, SVGNames::widthAttr, SVGLength, Width, width) - DECLARE_ANIMATED_PROPERTY_NEW(SVGUseElement, SVGNames::heightAttr, SVGLength, Height, height) + // Instance tree handling + void buildInstanceTree(SVGElement* target, SVGElementInstance* targetInstance, bool& foundCycle); + void handleDeepUseReferencing(SVGUseElement* use, SVGElementInstance* targetInstance, bool& foundCycle); - // SVGURIReference - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGUseElement, XLinkNames::hrefAttr, String, Href, href) + // Shadow tree handling + void buildShadowTree(SVGShadowTreeRootElement*, SVGElement* target, SVGElementInstance* targetInstance); - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGUseElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) +#if ENABLE(SVG) && ENABLE(SVG_USE) + void expandUseElementsInShadowTree(SVGShadowTreeRootElement*, Node* element); + void expandSymbolElementsInShadowTree(SVGShadowTreeRootElement*, Node* element); +#endif - // Instance tree handling - void buildInstanceTree(SVGElement* target, SVGElementInstance* targetInstance, bool& foundCycle); - void handleDeepUseReferencing(SVGUseElement* use, SVGElementInstance* targetInstance, bool& foundCycle); + // "Tree connector" + void associateInstancesWithShadowTreeElements(Node* target, SVGElementInstance* targetInstance); + SVGElementInstance* instanceForShadowTreeElement(Node* element, SVGElementInstance* instance) const; - // Shadow tree handling - void buildShadowTree(SVGShadowTreeRootElement*, SVGElement* target, SVGElementInstance* targetInstance); + void transferUseAttributesToReplacedElement(SVGElement* from, SVGElement* to) const; + void transferEventListenersToShadowTree(SVGElementInstance* target); -#if ENABLE(SVG) && ENABLE(SVG_USE) - void expandUseElementsInShadowTree(SVGShadowTreeRootElement*, Node* element); - void expandSymbolElementsInShadowTree(SVGShadowTreeRootElement*, Node* element); -#endif + void updateContainerOffsets(); + void updateContainerSizes(); - // "Tree connector" - void associateInstancesWithShadowTreeElements(Node* target, SVGElementInstance* targetInstance); - SVGElementInstance* instanceForShadowTreeElement(Node* element, SVGElementInstance* instance) const; + // Animated property declarations + DECLARE_ANIMATED_LENGTH(X, x) + DECLARE_ANIMATED_LENGTH(Y, y) + DECLARE_ANIMATED_LENGTH(Width, width) + DECLARE_ANIMATED_LENGTH(Height, height) - void transferUseAttributesToReplacedElement(SVGElement* from, SVGElement* to) const; - void transferEventListenersToShadowTree(SVGElementInstance* target); + // SVGURIReference + DECLARE_ANIMATED_STRING(Href, href) - void updateContainerOffsets(); - void updateContainerSizes(); + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) - bool m_updatesBlocked; - bool m_isPendingResource; - bool m_needsShadowTreeRecreation; - String m_resourceId; - RefPtr<SVGElementInstance> m_targetElementInstance; - }; + bool m_updatesBlocked; + bool m_isPendingResource; + bool m_needsShadowTreeRecreation; + String m_resourceId; + RefPtr<SVGElementInstance> m_targetElementInstance; +}; } diff --git a/WebCore/svg/SVGViewElement.cpp b/WebCore/svg/SVGViewElement.cpp index c59a080..ee3c8d1 100644 --- a/WebCore/svg/SVGViewElement.cpp +++ b/WebCore/svg/SVGViewElement.cpp @@ -23,8 +23,7 @@ #if ENABLE(SVG) #include "SVGViewElement.h" -#include "Attr.h" -#include "PlatformString.h" +#include "Attribute.h" #include "SVGFitToViewBox.h" #include "SVGNames.h" #include "SVGStringList.h" @@ -32,6 +31,11 @@ namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_BOOLEAN(SVGViewElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) +DEFINE_ANIMATED_RECT(SVGViewElement, SVGNames::viewBoxAttr, ViewBox, viewBox) +DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGViewElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio) + inline SVGViewElement::SVGViewElement(const QualifiedName& tagName, Document* document) : SVGStyledElement(tagName, document) , m_viewTarget(SVGNames::viewTargetAttr) diff --git a/WebCore/svg/SVGViewElement.h b/WebCore/svg/SVGViewElement.h index 7e239e3..0e2e4fd 100644 --- a/WebCore/svg/SVGViewElement.h +++ b/WebCore/svg/SVGViewElement.h @@ -22,41 +22,45 @@ #define SVGViewElement_h #if ENABLE(SVG) -#include "SVGAnimatedPropertyMacros.h" -#include "SVGStringList.h" -#include "SVGStyledElement.h" +#include "SVGAnimatedBoolean.h" +#include "SVGAnimatedPreserveAspectRatio.h" +#include "SVGAnimatedRect.h" #include "SVGExternalResourcesRequired.h" #include "SVGFitToViewBox.h" +#include "SVGStringList.h" +#include "SVGStyledElement.h" #include "SVGZoomAndPan.h" namespace WebCore { - class SVGViewElement : public SVGStyledElement, - public SVGExternalResourcesRequired, - public SVGFitToViewBox, - public SVGZoomAndPan { - public: - static PassRefPtr<SVGViewElement> create(const QualifiedName&, Document*); +class SVGViewElement : public SVGStyledElement, + public SVGExternalResourcesRequired, + public SVGFitToViewBox, + public SVGZoomAndPan { +public: + static PassRefPtr<SVGViewElement> create(const QualifiedName&, Document*); + + SVGStringList& viewTarget() { return m_viewTarget; } - SVGStringList& viewTarget() { return m_viewTarget; } +private: + SVGViewElement(const QualifiedName&, Document*); - private: - SVGViewElement(const QualifiedName&, Document*); + virtual void parseMappedAttribute(Attribute*); + virtual void synchronizeProperty(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); - virtual void synchronizeProperty(const QualifiedName&); + virtual bool rendererIsNeeded(RenderStyle*) { return false; } - virtual bool rendererIsNeeded(RenderStyle*) { return false; } + // Animated property declarations - // SVGExternalResourcesRequired - DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGViewElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) + // SVGExternalResourcesRequired + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) - // SVGFitToViewBox - DECLARE_ANIMATED_PROPERTY_NEW(SVGViewElement, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox) - DECLARE_ANIMATED_PROPERTY_NEW(SVGViewElement, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) + // SVGFitToViewBox + DECLARE_ANIMATED_RECT(ViewBox, viewBox) + DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) - SVGStringList m_viewTarget; - }; + SVGStringList m_viewTarget; +}; } // namespace WebCore diff --git a/WebCore/svg/SVGViewSpec.cpp b/WebCore/svg/SVGViewSpec.cpp index a0a683b..a1663d4 100644 --- a/WebCore/svg/SVGViewSpec.cpp +++ b/WebCore/svg/SVGViewSpec.cpp @@ -18,19 +18,22 @@ */ #include "config.h" + #if ENABLE(SVG) #include "SVGViewSpec.h" #include "Document.h" -#include "PlatformString.h" +#include "SVGNames.h" #include "SVGParserUtilities.h" -#include "SVGPreserveAspectRatio.h" #include "SVGSVGElement.h" -#include "SVGTransformList.h" #include "SVGTransformable.h" namespace WebCore { +// Animated property definitions +DEFINE_ANIMATED_RECT(SVGViewSpec, SVGNames::viewBoxAttr, ViewBox, viewBox) +DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGViewSpec, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio) + SVGViewSpec::SVGViewSpec(SVGElement* contextElement) : m_contextElement(contextElement) { diff --git a/WebCore/svg/SVGViewSpec.h b/WebCore/svg/SVGViewSpec.h index dd466ef..686cec3 100644 --- a/WebCore/svg/SVGViewSpec.h +++ b/WebCore/svg/SVGViewSpec.h @@ -21,49 +21,49 @@ #define SVGViewSpec_h #if ENABLE(SVG) -#include "SVGAnimatedPropertyMacros.h" -#include "SVGElement.h" +#include "SVGAnimatedPreserveAspectRatio.h" +#include "SVGAnimatedRect.h" #include "SVGFitToViewBox.h" +#include "SVGTransformList.h" #include "SVGZoomAndPan.h" -#include <wtf/RefPtr.h> - namespace WebCore { - class SVGElement; - class SVGTransformList; +class SVGElement; + +class SVGViewSpec : public SVGFitToViewBox, + public SVGZoomAndPan, + public Noncopyable { +public: + SVGViewSpec(SVGElement*); - class SVGViewSpec : public SVGFitToViewBox, - public SVGZoomAndPan, - public Noncopyable { - public: - SVGViewSpec(SVGElement*); + bool parseViewSpec(const String&); - bool parseViewSpec(const String&); + void setTransform(const String&); + SVGTransformList transform() const { return m_transform; } - void setTransform(const String&); - SVGTransformList transform() const { return m_transform; } + void setViewBoxString(const String&); - void setViewBoxString(const String&); + void setPreserveAspectRatioString(const String&); - void setPreserveAspectRatioString(const String&); + void setViewTargetString(const String&); + String viewTargetString() const { return m_viewTargetString; } + SVGElement* viewTarget() const; - void setViewTargetString(const String&); - String viewTargetString() const { return m_viewTargetString; } - SVGElement* viewTarget() const; + SVGElement* contextElement() const { return const_cast<SVGElement*>(m_contextElement); } - SVGElement* contextElement() const { return const_cast<SVGElement*>(m_contextElement); } +private: + SVGElement* m_contextElement; - private: - SVGElement* m_contextElement; + // Animated property declarations - // SVGFitToViewBox - DECLARE_ANIMATED_PROPERTY_NEW(SVGViewSpec, SVGNames::viewBoxAttr, FloatRect, ViewBox, viewBox) - DECLARE_ANIMATED_PROPERTY_NEW(SVGViewSpec, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio, PreserveAspectRatio, preserveAspectRatio) + // SVGFitToViewBox + DECLARE_ANIMATED_RECT(ViewBox, viewBox) + DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) - SVGTransformList m_transform; - String m_viewTargetString; - }; + SVGTransformList m_transform; + String m_viewTargetString; +}; } // namespace WebCore diff --git a/WebCore/svg/animation/SMILTimeContainer.cpp b/WebCore/svg/animation/SMILTimeContainer.cpp index b790859..3251d5b 100644 --- a/WebCore/svg/animation/SMILTimeContainer.cpp +++ b/WebCore/svg/animation/SMILTimeContainer.cpp @@ -27,11 +27,11 @@ #include "SMILTimeContainer.h" #if ENABLE(SVG) - #include "CSSComputedStyleDeclaration.h" #include "CSSParser.h" #include "Document.h" #include "SVGAnimationElement.h" +#include "SVGNames.h" #include "SVGSMILElement.h" #include "SVGSVGElement.h" #include <wtf/CurrentTime.h> diff --git a/WebCore/svg/animation/SVGSMILElement.cpp b/WebCore/svg/animation/SVGSMILElement.cpp index 441cfc3..a6aa6a7 100644 --- a/WebCore/svg/animation/SVGSMILElement.cpp +++ b/WebCore/svg/animation/SVGSMILElement.cpp @@ -148,7 +148,7 @@ void SVGSMILElement::insertedIntoDocument() #ifndef NDEBUG // Verify we are not in <use> instance tree. for (ContainerNode* n = this; n; n = n->parentNode()) - ASSERT(!n->isShadowNode()); + ASSERT(!n->isShadowRoot()); #endif SVGSVGElement* owner = ownerSVGElement(); if (!owner) @@ -961,4 +961,3 @@ void SVGSMILElement::beginByLinkActivation() } #endif - diff --git a/WebCore/svg/graphics/filters/SVGFEImage.cpp b/WebCore/svg/graphics/filters/SVGFEImage.cpp index 6a1914a..6ed305e 100644 --- a/WebCore/svg/graphics/filters/SVGFEImage.cpp +++ b/WebCore/svg/graphics/filters/SVGFEImage.cpp @@ -56,11 +56,11 @@ void FEImage::determineAbsolutePaintRect() void FEImage::apply() { - if (!m_image.get()) + if (!m_image.get() || hasResult()) return; - GraphicsContext* filterContext = effectContext(); - if (!filterContext) + ImageBuffer* resultImage = createImageBufferResult(); + if (!resultImage) return; FloatRect srcRect(FloatPoint(), m_image->size()); @@ -70,7 +70,7 @@ void FEImage::apply() IntPoint paintLocation = absolutePaintRect().location(); destRect.move(-paintLocation.x(), -paintLocation.y()); - filterContext->drawImage(m_image.get(), ColorSpaceDeviceRGB, destRect, srcRect); + resultImage->context()->drawImage(m_image.get(), ColorSpaceDeviceRGB, destRect, srcRect); } void FEImage::dump() diff --git a/WebCore/svg/properties/SVGAnimatedPropertyMacros.h b/WebCore/svg/properties/SVGAnimatedPropertyMacros.h index 53dbd40..d5ba21a 100644 --- a/WebCore/svg/properties/SVGAnimatedPropertyMacros.h +++ b/WebCore/svg/properties/SVGAnimatedPropertyMacros.h @@ -23,18 +23,11 @@ #define SVGAnimatedPropertyMacros_h #if ENABLE(SVG) -#include "SVGAnimatedListPropertyTearOff.h" -#include "SVGAnimatedStaticPropertyTearOff.h" #include "SVGAnimatedPropertySynchronizer.h" -#include "SVGAnimatedPropertyTearOff.h" -#include "SVGAnimatedTransformListPropertyTearOff.h" -#include "SVGNames.h" // FIXME: Temporary hack, until we expand the macros in all files, so we don't need a global SVGNames.h include #include "SVGPropertyTraits.h" namespace WebCore { -class SVGElement; - // GetOwnerElementForType implementation template<typename OwnerType, bool isDerivedFromSVGElement> struct GetOwnerElementForType; @@ -69,6 +62,7 @@ struct IsDerivedFromSVGElement<SVGViewSpec> { static const bool value = false; }; +// SVGSynchronizableAnimatedProperty implementation template<typename PropertyType> struct SVGSynchronizableAnimatedProperty { SVGSynchronizableAnimatedProperty() @@ -95,8 +89,24 @@ struct SVGSynchronizableAnimatedProperty { bool shouldSynchronize : 1; }; -// FIXME: These macros should be removed, after the transition to the new SVGAnimatedProperty concept is finished. -#define DECLARE_ANIMATED_PROPERTY_NEW_SHARED(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, TearOffType, PropertyType, UpperProperty, LowerProperty) \ +#define DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, TearOffType, PropertyType, UpperProperty, LowerProperty) \ +void OwnerType::synchronize##UpperProperty() \ +{ \ + if (!m_##LowerProperty.shouldSynchronize) \ + return; \ + AtomicString value(SVGPropertyTraits<PropertyType>::toString(LowerProperty##BaseValue())); \ + SVGElement* contextElement = GetOwnerElementForType<OwnerType, IsDerivedFromSVGElement<OwnerType>::value>::ownerElement(this); \ + SVGAnimatedPropertySynchronizer<IsDerivedFromSVGElement<OwnerType>::value>::synchronize(contextElement, DOMAttribute, value); \ +} \ +\ +PassRefPtr<TearOffType> OwnerType::LowerProperty##Animated() \ +{ \ + m_##LowerProperty.shouldSynchronize = true; \ + SVGElement* contextElement = GetOwnerElementForType<OwnerType, IsDerivedFromSVGElement<OwnerType>::value>::ownerElement(this); \ + return SVGAnimatedProperty::lookupOrCreateWrapper<TearOffType, PropertyType>(contextElement, DOMAttribute, SVGDOMAttributeIdentifier, m_##LowerProperty.value); \ +} + +#define DECLARE_ANIMATED_PROPERTY(TearOffType, PropertyType, UpperProperty, LowerProperty) \ public: \ PropertyType& LowerProperty() const \ { \ @@ -113,61 +123,28 @@ void set##UpperProperty##BaseValue(const PropertyType& type) \ m_##LowerProperty.value = type; \ } \ \ -void synchronize##UpperProperty() \ -{ \ - if (!m_##LowerProperty.shouldSynchronize) \ - return; \ - AtomicString value(SVGPropertyTraits<PropertyType>::toString(LowerProperty##BaseValue())); \ - SVGElement* contextElement = GetOwnerElementForType<OwnerType, IsDerivedFromSVGElement<OwnerType>::value>::ownerElement(this); \ - SVGAnimatedPropertySynchronizer<IsDerivedFromSVGElement<OwnerType>::value>::synchronize(contextElement, DOMAttribute, value); \ -} \ +PassRefPtr<TearOffType> LowerProperty##Animated(); \ \ -PassRefPtr<TearOffType> LowerProperty##Animated() \ -{ \ - m_##LowerProperty.shouldSynchronize = true; \ - SVGElement* contextElement = GetOwnerElementForType<OwnerType, IsDerivedFromSVGElement<OwnerType>::value>::ownerElement(this); \ - return SVGAnimatedProperty::lookupOrCreateWrapper<TearOffType, PropertyType>(contextElement, DOMAttribute, SVGDOMAttributeIdentifier, m_##LowerProperty.value); \ -} \ private: \ + void synchronize##UpperProperty(); \ +\ mutable SVGSynchronizableAnimatedProperty<PropertyType> m_##LowerProperty; -#define DECLARE_ANIMATED_PROPERTY_NEW(OwnerType, DOMAttribute, PropertyType, UpperProperty, LowerProperty) \ -DECLARE_ANIMATED_PROPERTY_NEW_SHARED(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedPropertyTearOff<PropertyType>, PropertyType, UpperProperty, LowerProperty) - -#define DECLARE_ANIMATED_PROPERTY_MULTIPLE_WRAPPERS_NEW(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, PropertyType, UpperProperty, LowerProperty) \ -DECLARE_ANIMATED_PROPERTY_NEW_SHARED(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, SVGAnimatedPropertyTearOff<PropertyType>, PropertyType, UpperProperty, LowerProperty) - -#define DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, PropertyType, UpperProperty, LowerProperty) \ -DECLARE_ANIMATED_PROPERTY_NEW_SHARED(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, SVGAnimatedStaticPropertyTearOff<PropertyType>, PropertyType, UpperProperty, LowerProperty) +#define DECLARE_ANIMATED_LIST_PROPERTY(TearOffType, PropertyType, UpperProperty, LowerProperty) \ +DECLARE_ANIMATED_PROPERTY(TearOffType, PropertyType, UpperProperty, LowerProperty) \ +void detachAnimated##UpperProperty##ListWrappers(unsigned newListSize); -#define DECLARE_ANIMATED_STATIC_PROPERTY_NEW(OwnerType, DOMAttribute, PropertyType, UpperProperty, LowerProperty) \ -DECLARE_ANIMATED_PROPERTY_NEW_SHARED(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedStaticPropertyTearOff<PropertyType>, PropertyType, UpperProperty, LowerProperty) - -#define DECLARE_ANIMATED_LIST_PROPERTY_NEW(OwnerType, DOMAttribute, PropertyType, UpperProperty, LowerProperty) \ -DECLARE_ANIMATED_PROPERTY_NEW_SHARED(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedListPropertyTearOff<PropertyType>, PropertyType, UpperProperty, LowerProperty) \ -\ -void detachAnimated##UpperProperty##ListWrappers(unsigned newListSize) \ -{ \ - SVGElement* contextElement = GetOwnerElementForType<OwnerType, IsDerivedFromSVGElement<OwnerType>::value>::ownerElement(this); \ - SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGAnimatedListPropertyTearOff<PropertyType> >(contextElement, DOMAttribute.localName()); \ - if (!wrapper) \ - return; \ - static_cast<SVGAnimatedListPropertyTearOff<PropertyType>*>(wrapper)->detachListWrappers(newListSize); \ -} - -#define DECLARE_ANIMATED_TRANSFORM_LIST_PROPERTY_NEW(OwnerType, DOMAttribute, PropertyType, UpperProperty, LowerProperty) \ -DECLARE_ANIMATED_PROPERTY_NEW_SHARED(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedTransformListPropertyTearOff, PropertyType, UpperProperty, LowerProperty) \ -\ -void detachAnimated##UpperProperty##ListWrappers(unsigned newListSize) \ +#define DEFINE_ANIMATED_LIST_PROPERTY(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, TearOffType, PropertyType, UpperProperty, LowerProperty) \ +DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, TearOffType, PropertyType, UpperProperty, LowerProperty) \ +void OwnerType::detachAnimated##UpperProperty##ListWrappers(unsigned newListSize) \ { \ SVGElement* contextElement = GetOwnerElementForType<OwnerType, IsDerivedFromSVGElement<OwnerType>::value>::ownerElement(this); \ - SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGAnimatedTransformListPropertyTearOff>(contextElement, DOMAttribute.localName()); \ + SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<TearOffType>(contextElement, DOMAttribute.localName()); \ if (!wrapper) \ return; \ - static_cast<SVGAnimatedTransformListPropertyTearOff*>(wrapper)->detachListWrappers(newListSize); \ + static_cast<TearOffType*>(wrapper)->detachListWrappers(newListSize); \ } - } #endif // ENABLE(SVG) diff --git a/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h b/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h index b97073d..bb52442 100644 --- a/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h +++ b/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h @@ -21,6 +21,8 @@ #define SVGAnimatedPropertySynchronizer_h #if ENABLE(SVG) +#include "SVGElement.h" + namespace WebCore { // Helper template used for synchronizing SVG <-> XML properties diff --git a/WebCore/svg/properties/SVGListProperty.h b/WebCore/svg/properties/SVGListProperty.h index 9018923..0985ddb 100644 --- a/WebCore/svg/properties/SVGListProperty.h +++ b/WebCore/svg/properties/SVGListProperty.h @@ -21,8 +21,8 @@ #define SVGListProperty_h #if ENABLE(SVG) -#include "ExceptionCode.h" #include "SVGAnimatedProperty.h" +#include "SVGException.h" #include "SVGPropertyTearOff.h" #include "SVGPropertyTraits.h" diff --git a/WebCore/svg/properties/SVGPathSegListPropertyTearOff.cpp b/WebCore/svg/properties/SVGPathSegListPropertyTearOff.cpp index af1b30c..a4eaf73 100644 --- a/WebCore/svg/properties/SVGPathSegListPropertyTearOff.cpp +++ b/WebCore/svg/properties/SVGPathSegListPropertyTearOff.cpp @@ -23,6 +23,7 @@ #include "SVGPathSegListPropertyTearOff.h" #include "SVGAnimatedPathSegListPropertyTearOff.h" +#include "SVGNames.h" #include "SVGPathElement.h" #include "SVGPathSegWithContext.h" diff --git a/WebCore/svg/properties/SVGPropertyTraits.h b/WebCore/svg/properties/SVGPropertyTraits.h index 5364853..0ed9339 100644 --- a/WebCore/svg/properties/SVGPropertyTraits.h +++ b/WebCore/svg/properties/SVGPropertyTraits.h @@ -22,16 +22,7 @@ #define SVGPropertyTraits_h #if ENABLE(SVG) -#include "FloatRect.h" -#include "SVGAngle.h" -#include "SVGLength.h" -#include "SVGLengthList.h" -#include "SVGNumberList.h" -#include "SVGPointList.h" -#include "SVGPreserveAspectRatio.h" -#include "SVGStringList.h" -#include "SVGTransformList.h" -#include <wtf/text/StringBuilder.h> +#include <wtf/text/WTFString.h> namespace WebCore { @@ -39,12 +30,6 @@ template<typename PropertyType> struct SVGPropertyTraits { }; template<> -struct SVGPropertyTraits<SVGAngle> { - static SVGAngle initialValue() { return SVGAngle(); } - static String toString(const SVGAngle& type) { return type.valueAsString(); } -}; - -template<> struct SVGPropertyTraits<bool> { static bool initialValue() { return false; } static String toString(bool type) { return type ? "true" : "false"; } @@ -63,81 +48,17 @@ struct SVGPropertyTraits<long> { }; template<> -struct SVGPropertyTraits<SVGLength> { - static SVGLength initialValue() { return SVGLength(); } - static String toString(const SVGLength& type) { return type.valueAsString(); } -}; - -template<> -struct SVGPropertyTraits<SVGLengthList> { - typedef SVGLength ListItemType; - - static SVGLengthList initialValue() { return SVGLengthList(); } - static String toString(const SVGLengthList& type) { return type.valueAsString(); } -}; - -template<> struct SVGPropertyTraits<float> { static float initialValue() { return 0; } static String toString(float type) { return String::number(type); } }; template<> -struct SVGPropertyTraits<SVGNumberList> { - typedef float ListItemType; - - static SVGNumberList initialValue() { return SVGNumberList(); } - static String toString(const SVGNumberList& type) { return type.valueAsString(); } -}; - -template<> -struct SVGPropertyTraits<SVGPreserveAspectRatio> { - static SVGPreserveAspectRatio initialValue() { return SVGPreserveAspectRatio(); } - static String toString(const SVGPreserveAspectRatio& type) { return type.valueAsString(); } -}; - -template<> -struct SVGPropertyTraits<FloatRect> { - static FloatRect initialValue() { return FloatRect(); } - static String toString(const FloatRect& type) - { - StringBuilder builder; - builder.append(String::number(type.x())); - builder.append(' '); - builder.append(String::number(type.y())); - builder.append(' '); - builder.append(String::number(type.width())); - builder.append(' '); - builder.append(String::number(type.height())); - builder.append(' '); - return builder.toString(); - } -}; - -template<> struct SVGPropertyTraits<String> { static String initialValue() { return String(); } static String toString(const String& type) { return type; } }; -template<> -struct SVGPropertyTraits<SVGStringList> { - typedef String ListItemType; -}; - -template<> -struct SVGPropertyTraits<SVGPointList> { - static SVGPointList initialValue() { return SVGPointList(); } - typedef FloatPoint ListItemType; -}; - -template<> -struct SVGPropertyTraits<SVGTransformList> { - static SVGTransformList initialValue() { return SVGTransformList(); } - static String toString(const SVGTransformList& type) { return type.valueAsString(); } - typedef SVGTransform ListItemType; -}; - } #endif diff --git a/WebCore/svg/properties/SVGTransformListPropertyTearOff.h b/WebCore/svg/properties/SVGTransformListPropertyTearOff.h index 3739348..e496c81 100644 --- a/WebCore/svg/properties/SVGTransformListPropertyTearOff.h +++ b/WebCore/svg/properties/SVGTransformListPropertyTearOff.h @@ -22,6 +22,7 @@ #if ENABLE(SVG) #include "SVGListPropertyTearOff.h" +#include "SVGTransformList.h" namespace WebCore { @@ -37,9 +38,12 @@ public: return adoptRef(new SVGTransformListPropertyTearOff(animatedProperty, role)); } - PassRefPtr<SVGPropertyTearOff<SVGTransform> > createSVGTransformFromMatrix(SVGPropertyTearOff<SVGMatrix>* matrix) + PassRefPtr<SVGPropertyTearOff<SVGTransform> > createSVGTransformFromMatrix(SVGPropertyTearOff<SVGMatrix>* matrix, ExceptionCode& ec) { - ASSERT(matrix); + if (!matrix) { + ec = TYPE_MISMATCH_ERR; + return 0; + } SVGTransformList& values = m_animatedProperty->values(); return SVGPropertyTearOff<SVGTransform>::create(values.createSVGTransformFromMatrix(matrix->propertyReference())); } |