[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

zimmermann at webkit.org zimmermann at webkit.org
Wed Dec 22 14:51:34 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit fdc94863679d781fb970c89d1b0c7dcd7d35a2a0
Author: zimmermann at webkit.org <zimmermann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 22 13:26:25 2010 +0000

    2010-10-22  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Dirk Schulze.
    
            Further preparations to deploy the new SVGAnimatedProperty concept for the rest of the SVG datatypes
            https://bugs.webkit.org/show_bug.cgi?id=48125
    
            Model SVGListPropertyTearOff similar to SVGPropertyTearOff, allow it to be used for SVGXXXList datatypes, that are not animated. (SVGStringList)
            Recognize all SVG primitive datatypes in SVGPropertyTraits.
            Add a new - temporary - macro to support multiple animated properties that map to a single DOM attribute (kernelUnitLength attribute vs. kernelUnitLengthX/Y properties).
            These macros will all be removed and expanded by their content, as soon as the transition to the new SVGAnimatedProperty concept is done.
    
            Doesn't affect any tests yet, as the code is still unused.
    
            * svg/properties/SVGAnimatedProperty.h:
            (WebCore::SVGAnimatedProperty::lookupOrCreateWrapper):
            (WebCore::SVGAnimatedProperty::lookupWrapper):
            * svg/properties/SVGAnimatedPropertyMacros.h:
            * svg/properties/SVGAnimatedPropertySynchronizer.h:
            * svg/properties/SVGListPropertyTearOff.h:
            (WebCore::SVGListPropertyTearOff::create):
            (WebCore::SVGListPropertyTearOff::removeItemFromList):
            (WebCore::SVGListPropertyTearOff::detachListWrappers):
            (WebCore::SVGListPropertyTearOff::clear):
            (WebCore::SVGListPropertyTearOff::numberOfItems):
            (WebCore::SVGListPropertyTearOff::initialize):
            (WebCore::SVGListPropertyTearOff::getItem):
            (WebCore::SVGListPropertyTearOff::insertItemBefore):
            (WebCore::SVGListPropertyTearOff::replaceItem):
            (WebCore::SVGListPropertyTearOff::removeItem):
            (WebCore::SVGListPropertyTearOff::appendItem):
            (WebCore::SVGListPropertyTearOff::SVGListPropertyTearOff):
            (WebCore::SVGListPropertyTearOff::~SVGListPropertyTearOff):
            (WebCore::SVGListPropertyTearOff::commitChange):
            * svg/properties/SVGPropertyTearOff.h:
            * svg/properties/SVGPropertyTraits.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70303 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 35dbb3b..6ee4b18 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,40 @@
+2010-10-22  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        Further preparations to deploy the new SVGAnimatedProperty concept for the rest of the SVG datatypes
+        https://bugs.webkit.org/show_bug.cgi?id=48125
+
+        Model SVGListPropertyTearOff similar to SVGPropertyTearOff, allow it to be used for SVGXXXList datatypes, that are not animated. (SVGStringList)
+        Recognize all SVG primitive datatypes in SVGPropertyTraits.
+        Add a new - temporary - macro to support multiple animated properties that map to a single DOM attribute (kernelUnitLength attribute vs. kernelUnitLengthX/Y properties).
+        These macros will all be removed and expanded by their content, as soon as the transition to the new SVGAnimatedProperty concept is done.
+
+        Doesn't affect any tests yet, as the code is still unused.
+
+        * svg/properties/SVGAnimatedProperty.h:
+        (WebCore::SVGAnimatedProperty::lookupOrCreateWrapper):
+        (WebCore::SVGAnimatedProperty::lookupWrapper):
+        * svg/properties/SVGAnimatedPropertyMacros.h:
+        * svg/properties/SVGAnimatedPropertySynchronizer.h:
+        * svg/properties/SVGListPropertyTearOff.h:
+        (WebCore::SVGListPropertyTearOff::create):
+        (WebCore::SVGListPropertyTearOff::removeItemFromList):
+        (WebCore::SVGListPropertyTearOff::detachListWrappers):
+        (WebCore::SVGListPropertyTearOff::clear):
+        (WebCore::SVGListPropertyTearOff::numberOfItems):
+        (WebCore::SVGListPropertyTearOff::initialize):
+        (WebCore::SVGListPropertyTearOff::getItem):
+        (WebCore::SVGListPropertyTearOff::insertItemBefore):
+        (WebCore::SVGListPropertyTearOff::replaceItem):
+        (WebCore::SVGListPropertyTearOff::removeItem):
+        (WebCore::SVGListPropertyTearOff::appendItem):
+        (WebCore::SVGListPropertyTearOff::SVGListPropertyTearOff):
+        (WebCore::SVGListPropertyTearOff::~SVGListPropertyTearOff):
+        (WebCore::SVGListPropertyTearOff::commitChange):
+        * svg/properties/SVGPropertyTearOff.h:
+        * svg/properties/SVGPropertyTraits.h:
+
 2010-10-22  Sheriff Bot  <webkit.review.bot at gmail.com>
 
         Unreviewed, rolling out r70301.
diff --git a/WebCore/svg/properties/SVGAnimatedProperty.h b/WebCore/svg/properties/SVGAnimatedProperty.h
index 5276163..a532667 100644
--- a/WebCore/svg/properties/SVGAnimatedProperty.h
+++ b/WebCore/svg/properties/SVGAnimatedProperty.h
@@ -58,9 +58,9 @@ public:
     }
 
     template<typename TearOffType, typename PropertyType>
-    static PassRefPtr<TearOffType> lookupOrCreateWrapper(SVGElement* element, const QualifiedName& attributeName, PropertyType& property)
+    static PassRefPtr<TearOffType> lookupOrCreateWrapper(SVGElement* element, const QualifiedName& attributeName, const AtomicString& attributeIdentifier, PropertyType& property)
     {
-        SVGAnimatedPropertyDescription key(element, attributeName.localName());
+        SVGAnimatedPropertyDescription key(element, attributeIdentifier);
         RefPtr<SVGAnimatedProperty> wrapper = animatedPropertyCache()->get(key);
         if (!wrapper) {
             wrapper = TearOffType::create(element, attributeName, property);
@@ -71,9 +71,9 @@ public:
     }
 
     template<typename TearOffType>
-    static TearOffType* lookupWrapper(SVGElement* element, const QualifiedName& attributeName)
+    static TearOffType* lookupWrapper(SVGElement* element, const AtomicString& attributeIdentifier)
     {
-        SVGAnimatedPropertyDescription key(element, attributeName.localName());
+        SVGAnimatedPropertyDescription key(element, attributeIdentifier);
         return static_pointer_cast<TearOffType>(animatedPropertyCache()->get(key)).get();
     }
 
diff --git a/WebCore/svg/properties/SVGAnimatedPropertyMacros.h b/WebCore/svg/properties/SVGAnimatedPropertyMacros.h
index 81cba71..ac7b54b 100644
--- a/WebCore/svg/properties/SVGAnimatedPropertyMacros.h
+++ b/WebCore/svg/properties/SVGAnimatedPropertyMacros.h
@@ -26,6 +26,7 @@
 #include "SVGAnimatedListPropertyTearOff.h"
 #include "SVGAnimatedPropertySynchronizer.h"
 #include "SVGAnimatedPropertyTearOff.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 {
@@ -57,7 +58,7 @@ struct SVGSynchronizableAnimatedProperty {
 };
 
 // FIXME: These macros should be removed, after the transition to the new SVGAnimatedProperty concept is finished.
-#define DECLARE_ANIMATED_PROPERTY_NEW_SHARED(OwnerType, DOMAttribute, TearOffType, PropertyType, UpperProperty, LowerProperty) \
+#define DECLARE_ANIMATED_PROPERTY_NEW_SHARED(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, TearOffType, PropertyType, UpperProperty, LowerProperty) \
 public: \
 PropertyType& LowerProperty() const \
 { \
@@ -86,20 +87,23 @@ void synchronize##UpperProperty() \
 PassRefPtr<TearOffType> LowerProperty##Animated() \
 { \
     m_##LowerProperty.shouldSynchronize = true; \
-    return SVGAnimatedProperty::lookupOrCreateWrapper<TearOffType, PropertyType>(this, DOMAttribute, m_##LowerProperty.value); \
+    return SVGAnimatedProperty::lookupOrCreateWrapper<TearOffType, PropertyType>(this, DOMAttribute, SVGDOMAttributeIdentifier, m_##LowerProperty.value); \
 } \
 private: \
     mutable SVGSynchronizableAnimatedProperty<PropertyType> m_##LowerProperty;
 
 #define DECLARE_ANIMATED_PROPERTY_NEW(OwnerType, DOMAttribute, PropertyType, UpperProperty, LowerProperty) \
-DECLARE_ANIMATED_PROPERTY_NEW_SHARED(OwnerType, DOMAttribute, SVGAnimatedPropertyTearOff<PropertyType>, PropertyType, UpperProperty, LowerProperty)
+DECLARE_ANIMATED_PROPERTY_NEW_SHARED(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedPropertyTearOff<PropertyType>, PropertyType, UpperProperty, LowerProperty)
+
+#define DECLARE_ANIMATED_PROPERTY_NEW_MULTIPLE_WRAPPERS(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, PropertyType, UpperProperty, LowerProperty) \
+DECLARE_ANIMATED_PROPERTY_NEW_SHARED(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, SVGAnimatedPropertyTearOff<PropertyType>, PropertyType, UpperProperty, LowerProperty)
 
 #define DECLARE_ANIMATED_LIST_PROPERTY_NEW(OwnerType, DOMAttribute, PropertyType, UpperProperty, LowerProperty) \
-DECLARE_ANIMATED_PROPERTY_NEW_SHARED(OwnerType, DOMAttribute, SVGAnimatedListPropertyTearOff<PropertyType>, PropertyType, UpperProperty, LowerProperty) \
+DECLARE_ANIMATED_PROPERTY_NEW_SHARED(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedListPropertyTearOff<PropertyType>, PropertyType, UpperProperty, LowerProperty) \
 \
 void detachAnimated##UpperProperty##ListWrappers(unsigned newListSize) \
 { \
-    SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGAnimatedListPropertyTearOff<PropertyType> >(this, DOMAttribute); \
+    SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGAnimatedListPropertyTearOff<PropertyType> >(this, DOMAttribute.localName()); \
     if (!wrapper) \
         return; \
     static_cast<SVGAnimatedListPropertyTearOff<PropertyType>*>(wrapper)->detachListWrappers(newListSize); \
diff --git a/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h b/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h
index 476f1fd..2b816ab 100644
--- a/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h
+++ b/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h
@@ -20,8 +20,6 @@
 #ifndef SVGAnimatedPropertySynchronizer_h
 #define SVGAnimatedPropertySynchronizer_h
 
-#include "DeprecatedSVGAnimatedPropertyTraits.h"
-
 #if ENABLE(SVG)
 namespace WebCore {
 
diff --git a/WebCore/svg/properties/SVGListPropertyTearOff.h b/WebCore/svg/properties/SVGListPropertyTearOff.h
index f861074..5835c97 100644
--- a/WebCore/svg/properties/SVGListPropertyTearOff.h
+++ b/WebCore/svg/properties/SVGListPropertyTearOff.h
@@ -41,17 +41,24 @@ public:
     typedef PassRefPtr<ListItemTearOff> PassListItemTearOff;
     typedef Vector<RefPtr<ListItemTearOff> > ListWrapperCache;
 
+    // Used for [SVGAnimatedProperty] types (for example: SVGAnimatedLengthList::baseVal())
     static PassRefPtr<Self> create(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, PropertyType& values)
     {
         ASSERT(animatedProperty);
         return adoptRef(new Self(animatedProperty, role, values));
     }
 
+    // Used for non-animated POD types (for example: SVGStringList).
+    static PassRefPtr<Self> create(const PropertyType& initialValue)
+    {
+        return adoptRef(new Self(initialValue));
+    }
+
     int removeItemFromList(ListItemTearOff* removeItem, bool shouldSynchronizeWrappers)
     {
         // Lookup item in cache and remove its corresponding wrapper.
         unsigned size = m_wrappers.size();
-        ASSERT(size == m_values.size());
+        ASSERT(size == m_values->size());
         for (unsigned i = 0; i < size; ++i) {
             RefPtr<ListItemTearOff>& item = m_wrappers.at(i);
             if (item != removeItem)
@@ -59,7 +66,7 @@ public:
 
             item->detachWrapper();
             m_wrappers.remove(i);
-            m_values.remove(i);
+            m_values->remove(i);
 
             if (shouldSynchronizeWrappers)
                 commitChange();
@@ -74,7 +81,7 @@ public:
     {
         // See SVGPropertyTearOff::detachWrapper() for an explaination what's happening here.
         unsigned size = m_wrappers.size();
-        ASSERT(size == m_values.size());
+        ASSERT(size == m_values->size());
         for (unsigned i = 0; i < size; ++i) {
             RefPtr<ListItemTearOff>& item = m_wrappers.at(i);
             if (!item)
@@ -98,12 +105,12 @@ public:
         }
 
         detachListWrappers(0);
-        m_values.clear();
+        m_values->clear();
     }
 
     unsigned numberOfItems() const
     {
-        return m_values.size();
+        return m_values->size();
     }
 
     PassListItemTearOff initialize(PassListItemTearOff passNewItem, ExceptionCode& ec)
@@ -120,16 +127,16 @@ public:
         }
 
         RefPtr<ListItemTearOff> newItem = passNewItem;
-        ASSERT(m_values.size() == m_wrappers.size());
+        ASSERT(m_values->size() == m_wrappers.size());
 
         // Spec: If the inserted item is already in a list, it is removed from its previous list before it is inserted into this list.
         removeItemFromListIfNeeded(newItem.get(), 0);
 
         // Spec: Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.
         detachListWrappers(0);
-        m_values.clear();
+        m_values->clear();
         
-        m_values.append(newItem->propertyReference());
+        m_values->append(newItem->propertyReference());
         m_wrappers.append(newItem);
 
         commitChange();
@@ -138,20 +145,20 @@ public:
 
     PassListItemTearOff getItem(unsigned index, ExceptionCode& ec)
     {
-        if (index >= m_values.size()) {
+        if (index >= m_values->size()) {
             ec = INDEX_SIZE_ERR;
             return 0;
         }
 
         // Spec: Returns the specified item from the list. The returned item is the item itself and not a copy.
         // Any changes made to the item are immediately reflected in the list.
-        ASSERT(m_values.size() == m_wrappers.size());
+        ASSERT(m_values->size() == m_wrappers.size());
         RefPtr<ListItemTearOff> wrapper = m_wrappers.at(index);
         if (!wrapper) {
             // Create new wrapper, which is allowed to directly modify the item in the list, w/o copying and cache the wrapper in our map.
             // It is also associated with our animated property, so it can notify the SVG Element which holds the SVGAnimated*List
             // that it has been modified (and thus can call svgAttributeChanged(associatedAttributeName)).
-            wrapper = ListItemTearOff::create(m_animatedProperty.get(), UndefinedRole, m_values.at(index));
+            wrapper = ListItemTearOff::create(m_animatedProperty.get(), UndefinedRole, m_values->at(index));
             m_wrappers.at(index) = wrapper;
         }
 
@@ -172,18 +179,18 @@ public:
         }
 
         // Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
-        if (index > m_values.size())
-             index = m_values.size();
+        if (index > m_values->size())
+             index = m_values->size();
 
         RefPtr<ListItemTearOff> newItem = passNewItem;
-        ASSERT(m_values.size() == m_wrappers.size());
+        ASSERT(m_values->size() == m_wrappers.size());
 
         // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
         removeItemFromListIfNeeded(newItem.get(), &index);
 
         // Spec: Inserts a new item into the list at the specified position. The index of the item before which the new item is to be
         // inserted. The first item is number 0. If the index is equal to 0, then the new item is inserted at the front of the list.
-        m_values.insert(index, newItem->propertyReference());
+        m_values->insert(index, newItem->propertyReference());
 
         // Store new wrapper at position 'index', change its underlying value, so mutations of newItem, directly affect the item in the list.
         m_wrappers.insert(index, newItem);
@@ -199,7 +206,7 @@ public:
             return 0;
         }
 
-        if (index >= m_values.size()) {
+        if (index >= m_values->size()) {
             ec = INDEX_SIZE_ERR;
             return 0;
         }
@@ -211,7 +218,7 @@ public:
         }
 
         RefPtr<ListItemTearOff> newItem = passNewItem;
-        ASSERT(m_values.size() == m_wrappers.size());
+        ASSERT(m_values->size() == m_wrappers.size());
 
         // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
         // Spec: If the item is already in this list, note that the index of the item to replace is before the removal of the item.
@@ -223,7 +230,7 @@ public:
             oldItem->detachWrapper();
 
         // Update the value and the wrapper at the desired position 'index'. 
-        m_values.at(index) = newItem->propertyReference();
+        m_values->at(index) = newItem->propertyReference();
         m_wrappers.at(index) = newItem;
 
         commitChange();
@@ -237,12 +244,12 @@ public:
             return 0;
         }
 
-        if (index >= m_values.size()) {
+        if (index >= m_values->size()) {
             ec = INDEX_SIZE_ERR;
             return 0;
         }
 
-        ASSERT(m_values.size() == m_wrappers.size());
+        ASSERT(m_values->size() == m_wrappers.size());
 
         // Detach the existing wrapper.
         RefPtr<ListItemTearOff>& oldItem = m_wrappers.at(index);
@@ -251,7 +258,7 @@ public:
             m_wrappers.remove(index);
         }
 
-        m_values.remove(index);
+        m_values->remove(index);
 
         commitChange();
         return oldItem.release();
@@ -271,13 +278,13 @@ public:
         }
 
         RefPtr<ListItemTearOff> newItem = passNewItem;
-        ASSERT(m_values.size() == m_wrappers.size());
+        ASSERT(m_values->size() == m_wrappers.size());
 
         // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
         removeItemFromListIfNeeded(newItem.get(), 0);
 
         // Append the value and wrapper at the end of the list.
-        m_values.append(newItem->propertyReference());
+        m_values->append(newItem->propertyReference());
         m_wrappers.append(newItem);
 
         commitChange();
@@ -288,23 +295,40 @@ private:
     SVGListPropertyTearOff(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, PropertyType& values)
         : m_animatedProperty(animatedProperty)
         , m_role(role)
-        , m_values(values)
+        , m_values(&values)
+        , m_valuesIsCopy(false)
     {
+        // Using operator & is completly fine, as SVGAnimatedProperty owns this reference,
+        // and we're guaranteed to live as long as SVGAnimatedProperty does.
         if (!values.isEmpty())
             m_wrappers.fill(0, values.size());
     }
 
+    SVGListPropertyTearOff(const PropertyType& initialValue)
+        : m_animatedProperty(0)
+        , m_role(UndefinedRole)
+        , m_values(new PropertyType(initialValue))
+        , m_valuesIsCopy(true)
+    {
+    }
+
+    virtual ~SVGListPropertyTearOff()
+    {
+        if (m_valuesIsCopy)
+            delete m_values;
+    }
+
     void commitChange()
     {
         // Update existing wrappers, as the index in the m_values list has changed.
         unsigned size = m_wrappers.size();
-        ASSERT(size == m_values.size());
+        ASSERT(size == m_values->size());
         for (unsigned i = 0; i < size; ++i) {
             RefPtr<ListItemTearOff>& item = m_wrappers.at(i);
             if (!item)
                 continue;
             item->setAnimatedProperty(m_animatedProperty.get());
-            item->setValue(m_values.at(i));
+            item->setValue(m_values->at(i));
         }
 
         ASSERT(m_animatedProperty);
@@ -347,7 +371,8 @@ private:
     SVGPropertyRole m_role;
 
     // For the example above (text.x.baseVal): A reference to the SVGLengthList& stored in the SVGTextElement, which we can directly modify
-    PropertyType& m_values;
+    PropertyType* m_values;
+    bool m_valuesIsCopy : 1;
 
     // A list of wrappers, which is always in sync between m_values.
     ListWrapperCache m_wrappers;
diff --git a/WebCore/svg/properties/SVGPropertyTearOff.h b/WebCore/svg/properties/SVGPropertyTearOff.h
index 1f85a48..c548bbf 100644
--- a/WebCore/svg/properties/SVGPropertyTearOff.h
+++ b/WebCore/svg/properties/SVGPropertyTearOff.h
@@ -21,13 +21,12 @@
 #define SVGPropertyTearOff_h
 
 #if ENABLE(SVG)
+#include "SVGAnimatedProperty.h"
 #include "SVGElement.h"
 #include "SVGProperty.h"
 
 namespace WebCore {
 
-class SVGAnimatedProperty;
-
 template<typename PropertyType>
 class SVGPropertyTearOff : public SVGProperty {
 public:
@@ -41,7 +40,7 @@ public:
         return adoptRef(new Self(animatedProperty, value));
     }
 
-    // Used for [SVGLiveProperty] types (for example: SVGSVGElement::createSVGLength()).
+    // Used for non-animated POD types (for example: SVGLength).
     static PassRefPtr<Self> create(const PropertyType& initialValue)
     {
         return adoptRef(new Self(initialValue));
diff --git a/WebCore/svg/properties/SVGPropertyTraits.h b/WebCore/svg/properties/SVGPropertyTraits.h
index e728810..8d82a61 100644
--- a/WebCore/svg/properties/SVGPropertyTraits.h
+++ b/WebCore/svg/properties/SVGPropertyTraits.h
@@ -22,40 +22,90 @@
 #define SVGPropertyTraits_h
 
 #if ENABLE(SVG)
+#include "FloatRect.h"
+#include "SVGAngle.h"
 #include "SVGLength.h"
 #include "SVGLengthList.h"
+#include "SVGPreserveAspectRatio.h"
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
 template<typename PropertyType>
 struct SVGPropertyTraits { };
 
-// SVGAnimatedLength
 template<>
-struct SVGPropertyTraits<SVGLength> {
-    static SVGLength& initialValue()
-    {
-        DEFINE_STATIC_LOCAL(SVGLength, s_initialValue, ());
-        s_initialValue = SVGLength();
-        return s_initialValue;
-    }
+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"; }
+};
 
+template<>
+struct SVGPropertyTraits<int> {
+    static int initialValue() { return 0; }
+    static String toString(int type) { return String::number(type); }
+};
+
+template<>
+struct SVGPropertyTraits<long> {
+    static long initialValue() { return 0; }
+    static String toString(long type) { return String::number(type); }
+};
+
+template<>
+struct SVGPropertyTraits<SVGLength> {
+    static SVGLength initialValue() { return SVGLength(); }
     static String toString(const SVGLength& type) { return type.valueAsString(); }
 };
 
-// SVGAnimatedLengthList
 template<>
 struct SVGPropertyTraits<SVGLengthList> {
     typedef SVGLength ListItemType;
 
-    static SVGLengthList& initialValue()
+    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<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)
     {
-        DEFINE_STATIC_LOCAL(SVGLengthList, s_initialValue, ());
-        s_initialValue = SVGLengthList();
-        return s_initialValue;
+        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();
     }
+};
 
-    static String toString(const SVGLengthList& type) { return type.valueAsString(); }
+template<>
+struct SVGPropertyTraits<String> {
+    static String initialValue() { return String(); }
+    static String toString(const String& type) { return type; }
 };
 
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list