diff options
author | Steve Block <steveblock@google.com> | 2011-01-05 12:15:11 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-01-06 14:14:00 +0000 |
commit | d06194330da2bb8da887d2e1adeacb3a5c1504b2 (patch) | |
tree | e0af8413af65a8e30630563441af7bdb8478e513 /WebCore/svg/properties/SVGPropertyTraits.h | |
parent | 419a5cf2f8db6ca014df624865197ffb82caad37 (diff) | |
download | external_webkit-d06194330da2bb8da887d2e1adeacb3a5c1504b2.zip external_webkit-d06194330da2bb8da887d2e1adeacb3a5c1504b2.tar.gz external_webkit-d06194330da2bb8da887d2e1adeacb3a5c1504b2.tar.bz2 |
Merge WebKit at r72805: Initial merge by Git
Note that this is a backwards merge from Chromium release 9.0.600.0
to 9.0.597.0, to align with the Chromium 9 stable release branch.
Change-Id: I5d2bb4e8cee9d39ae8485abf48bdb55ecf8b3790
Diffstat (limited to 'WebCore/svg/properties/SVGPropertyTraits.h')
-rw-r--r-- | WebCore/svg/properties/SVGPropertyTraits.h | 81 |
1 files changed, 80 insertions, 1 deletions
diff --git a/WebCore/svg/properties/SVGPropertyTraits.h b/WebCore/svg/properties/SVGPropertyTraits.h index 0ed9339..5364853 100644 --- a/WebCore/svg/properties/SVGPropertyTraits.h +++ b/WebCore/svg/properties/SVGPropertyTraits.h @@ -22,7 +22,16 @@ #define SVGPropertyTraits_h #if ENABLE(SVG) -#include <wtf/text/WTFString.h> +#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> namespace WebCore { @@ -30,6 +39,12 @@ 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"; } @@ -48,17 +63,81 @@ 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 |