Remove PassRefPtr from svg/properties classes.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Mar 2015 20:39:50 +0000 (20:39 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Mar 2015 20:39:50 +0000 (20:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=142063.

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2015-03-10
Reviewed by Darin Adler.
Source/WebCore:

Remove PassRefPtr from svg/properties classes. All the return types and
the local variables should be RefPtr. If we are sure the pointer can't
be null, we use Ref instead.

* svg/SVGMarkerElement.cpp:
(WebCore::SVGMarkerElement::lookupOrCreateOrientTypeWrapper):
(WebCore::SVGMarkerElement::orientTypeAnimated):
* svg/SVGMarkerElement.h:
* svg/SVGPathElement.cpp:
(WebCore::SVGPathElement::lookupOrCreateDWrapper):
(WebCore::SVGPathElement::pathSegList):
(WebCore::SVGPathElement::animatedPathSegList):
* svg/SVGPathElement.h:
* svg/SVGPolyElement.cpp:
(WebCore::SVGPolyElement::lookupOrCreatePointsWrapper):
(WebCore::SVGPolyElement::points):
(WebCore::SVGPolyElement::animatedPoints):
* svg/SVGPolyElement.h:
* svg/SVGTextContentElement.cpp:
(WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper):
(WebCore::SVGTextContentElement::textLengthAnimated):
* svg/SVGTextContentElement.h:
* svg/SVGViewSpec.cpp:
(WebCore::SVGViewSpec::transform):
(WebCore::SVGViewSpec::viewBoxAnimated):
(WebCore::SVGViewSpec::preserveAspectRatioAnimated):
(WebCore::SVGViewSpec::lookupOrCreateViewBoxWrapper):
(WebCore::SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper):
(WebCore::SVGViewSpec::lookupOrCreateTransformWrapper):
* svg/SVGViewSpec.h:
* svg/properties/SVGAnimatedEnumerationPropertyTearOff.h:
(WebCore::SVGAnimatedEnumerationPropertyTearOff::create):
* svg/properties/SVGAnimatedListPropertyTearOff.h:
(WebCore::SVGAnimatedListPropertyTearOff::create):
* svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
(WebCore::SVGAnimatedPathSegListPropertyTearOff::create):
* svg/properties/SVGAnimatedProperty.h:
(WebCore::SVGAnimatedProperty::lookupOrCreateWrapper):
* svg/properties/SVGAnimatedPropertyMacros.h:
* svg/properties/SVGAnimatedPropertyTearOff.h:
(WebCore::SVGAnimatedPropertyTearOff::create):
* svg/properties/SVGAnimatedStaticPropertyTearOff.h:
(WebCore::SVGAnimatedStaticPropertyTearOff::create):
* svg/properties/SVGAnimatedTransformListPropertyTearOff.h:
(WebCore::SVGAnimatedTransformListPropertyTearOff::create):
* svg/properties/SVGListProperty.h:
(WebCore::SVGListProperty::initializeValuesAndWrappers):
(WebCore::SVGListProperty::getItemValuesAndWrappers):
(WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers):
(WebCore::SVGListProperty::replaceItemValuesAndWrappers):
(WebCore::SVGListProperty::removeItemValuesAndWrappers):
(WebCore::SVGListProperty::appendItemValuesAndWrappers):
* svg/properties/SVGListPropertyTearOff.h:
(WebCore::SVGListPropertyTearOff::create):
(WebCore::SVGListPropertyTearOff::initialize):
(WebCore::SVGListPropertyTearOff::getItem):
(WebCore::SVGListPropertyTearOff::insertItemBefore):
(WebCore::SVGListPropertyTearOff::replaceItem):
(WebCore::SVGListPropertyTearOff::removeItem):
(WebCore::SVGListPropertyTearOff::appendItem):
* svg/properties/SVGPathSegListPropertyTearOff.cpp:
(WebCore::SVGPathSegListPropertyTearOff::getItem):
(WebCore::SVGPathSegListPropertyTearOff::replaceItem):
(WebCore::SVGPathSegListPropertyTearOff::removeItem):
* svg/properties/SVGPathSegListPropertyTearOff.h:
(WebCore::SVGPathSegListPropertyTearOff::create):
(WebCore::SVGPathSegListPropertyTearOff::initialize):
(WebCore::SVGPathSegListPropertyTearOff::insertItemBefore):
(WebCore::SVGPathSegListPropertyTearOff::appendItem):
* svg/properties/SVGPropertyInfo.h:
* svg/properties/SVGStaticListPropertyTearOff.h:
(WebCore::SVGStaticListPropertyTearOff::create):
* svg/properties/SVGStaticPropertyTearOff.h:
(WebCore::SVGStaticPropertyTearOff::create):
* svg/properties/SVGTransformListPropertyTearOff.h:
(WebCore::SVGTransformListPropertyTearOff::create):
(WebCore::SVGTransformListPropertyTearOff::createSVGTransformFromMatrix):
(WebCore::SVGTransformListPropertyTearOff::consolidate):

Source/WTF:

* wtf/Ref.h:
(WTF::static_reference_cast): Add a stat_cast function to Ref<>.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181345 268f45cc-cd09-0410-ab3c-d52691b4dbfc

29 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/Ref.h
Source/WebCore/ChangeLog
Source/WebCore/svg/SVGMarkerElement.cpp
Source/WebCore/svg/SVGMarkerElement.h
Source/WebCore/svg/SVGPathElement.cpp
Source/WebCore/svg/SVGPathElement.h
Source/WebCore/svg/SVGPolyElement.cpp
Source/WebCore/svg/SVGPolyElement.h
Source/WebCore/svg/SVGTextContentElement.cpp
Source/WebCore/svg/SVGTextContentElement.h
Source/WebCore/svg/SVGViewSpec.cpp
Source/WebCore/svg/SVGViewSpec.h
Source/WebCore/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h
Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h
Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h
Source/WebCore/svg/properties/SVGAnimatedProperty.h
Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h
Source/WebCore/svg/properties/SVGAnimatedPropertyTearOff.h
Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h
Source/WebCore/svg/properties/SVGAnimatedTransformListPropertyTearOff.h
Source/WebCore/svg/properties/SVGListProperty.h
Source/WebCore/svg/properties/SVGListPropertyTearOff.h
Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.cpp
Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.h
Source/WebCore/svg/properties/SVGPropertyInfo.h
Source/WebCore/svg/properties/SVGStaticListPropertyTearOff.h
Source/WebCore/svg/properties/SVGStaticPropertyTearOff.h
Source/WebCore/svg/properties/SVGTransformListPropertyTearOff.h

index ae1b4fe1482fa63d4daec629d2d1d03760987b3c..5ab30f2df1b35b79bb63214601157b94e71728c0 100644 (file)
@@ -1,3 +1,13 @@
+2015-03-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        Remove PassRefPtr from svg/properties classes.
+        https://bugs.webkit.org/show_bug.cgi?id=142063.
+
+        Reviewed by Darin Adler.
+
+        * wtf/Ref.h:
+        (WTF::static_reference_cast): Add a stat_cast function to Ref<>.
+
 2015-03-10  Mark Lam  <mark.lam@apple.com>
 
         [Win] JSC Build Warnings Need to be Resolved.
index 28d64a40833367de0390b04105fd170cf0419cb1..ee951778d0bbd64e321b62a3bb1407593e510506 100644 (file)
@@ -148,6 +148,16 @@ template<typename T> template<typename U> inline Ref<T> Ref<T>::replace(Ref<U>&&
     return oldReference;
 }
 
+template<typename T, typename U> inline Ref<T> static_reference_cast(Ref<U>& reference)
+{
+    return Ref<T>(static_cast<T&>(reference.get()));
+}
+
+template<typename T, typename U> inline Ref<T> static_reference_cast(const Ref<U>& reference)
+{
+    return Ref<T>(static_cast<T&>(reference.copyRef().get()));
+}
+
 template <typename T>
 struct GetPtrHelper<Ref<T>> {
     typedef T* PtrType;
@@ -166,5 +176,6 @@ inline Ref<T> adoptRef(T& reference)
 
 using WTF::Ref;
 using WTF::adoptRef;
+using WTF::static_reference_cast;
 
 #endif // WTF_Ref_h
index 0bd906d997532772eaab7dd88edddc7961c1c372..dd3123d950b5314779e099532813db687bfa159d 100644 (file)
@@ -1,3 +1,89 @@
+2015-03-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        Remove PassRefPtr from svg/properties classes.
+        https://bugs.webkit.org/show_bug.cgi?id=142063.
+
+        Reviewed by Darin Adler.
+        
+        Remove PassRefPtr from svg/properties classes. All the return types and
+        the local variables should be RefPtr. If we are sure the pointer can't
+        be null, we use Ref instead.
+
+        * svg/SVGMarkerElement.cpp:
+        (WebCore::SVGMarkerElement::lookupOrCreateOrientTypeWrapper):
+        (WebCore::SVGMarkerElement::orientTypeAnimated):
+        * svg/SVGMarkerElement.h:
+        * svg/SVGPathElement.cpp:
+        (WebCore::SVGPathElement::lookupOrCreateDWrapper):
+        (WebCore::SVGPathElement::pathSegList):
+        (WebCore::SVGPathElement::animatedPathSegList):
+        * svg/SVGPathElement.h:
+        * svg/SVGPolyElement.cpp:
+        (WebCore::SVGPolyElement::lookupOrCreatePointsWrapper):
+        (WebCore::SVGPolyElement::points):
+        (WebCore::SVGPolyElement::animatedPoints):
+        * svg/SVGPolyElement.h:
+        * svg/SVGTextContentElement.cpp:
+        (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper):
+        (WebCore::SVGTextContentElement::textLengthAnimated):
+        * svg/SVGTextContentElement.h:
+        * svg/SVGViewSpec.cpp:
+        (WebCore::SVGViewSpec::transform):
+        (WebCore::SVGViewSpec::viewBoxAnimated):
+        (WebCore::SVGViewSpec::preserveAspectRatioAnimated):
+        (WebCore::SVGViewSpec::lookupOrCreateViewBoxWrapper):
+        (WebCore::SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper):
+        (WebCore::SVGViewSpec::lookupOrCreateTransformWrapper):
+        * svg/SVGViewSpec.h:
+        * svg/properties/SVGAnimatedEnumerationPropertyTearOff.h:
+        (WebCore::SVGAnimatedEnumerationPropertyTearOff::create):
+        * svg/properties/SVGAnimatedListPropertyTearOff.h:
+        (WebCore::SVGAnimatedListPropertyTearOff::create):
+        * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
+        (WebCore::SVGAnimatedPathSegListPropertyTearOff::create):
+        * svg/properties/SVGAnimatedProperty.h:
+        (WebCore::SVGAnimatedProperty::lookupOrCreateWrapper):
+        * svg/properties/SVGAnimatedPropertyMacros.h:
+        * svg/properties/SVGAnimatedPropertyTearOff.h:
+        (WebCore::SVGAnimatedPropertyTearOff::create):
+        * svg/properties/SVGAnimatedStaticPropertyTearOff.h:
+        (WebCore::SVGAnimatedStaticPropertyTearOff::create):
+        * svg/properties/SVGAnimatedTransformListPropertyTearOff.h:
+        (WebCore::SVGAnimatedTransformListPropertyTearOff::create):
+        * svg/properties/SVGListProperty.h:
+        (WebCore::SVGListProperty::initializeValuesAndWrappers):
+        (WebCore::SVGListProperty::getItemValuesAndWrappers):
+        (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers):
+        (WebCore::SVGListProperty::replaceItemValuesAndWrappers):
+        (WebCore::SVGListProperty::removeItemValuesAndWrappers):
+        (WebCore::SVGListProperty::appendItemValuesAndWrappers):
+        * svg/properties/SVGListPropertyTearOff.h:
+        (WebCore::SVGListPropertyTearOff::create):
+        (WebCore::SVGListPropertyTearOff::initialize):
+        (WebCore::SVGListPropertyTearOff::getItem):
+        (WebCore::SVGListPropertyTearOff::insertItemBefore):
+        (WebCore::SVGListPropertyTearOff::replaceItem):
+        (WebCore::SVGListPropertyTearOff::removeItem):
+        (WebCore::SVGListPropertyTearOff::appendItem):
+        * svg/properties/SVGPathSegListPropertyTearOff.cpp:
+        (WebCore::SVGPathSegListPropertyTearOff::getItem):
+        (WebCore::SVGPathSegListPropertyTearOff::replaceItem):
+        (WebCore::SVGPathSegListPropertyTearOff::removeItem):
+        * svg/properties/SVGPathSegListPropertyTearOff.h:
+        (WebCore::SVGPathSegListPropertyTearOff::create):
+        (WebCore::SVGPathSegListPropertyTearOff::initialize):
+        (WebCore::SVGPathSegListPropertyTearOff::insertItemBefore):
+        (WebCore::SVGPathSegListPropertyTearOff::appendItem):
+        * svg/properties/SVGPropertyInfo.h:
+        * svg/properties/SVGStaticListPropertyTearOff.h:
+        (WebCore::SVGStaticListPropertyTearOff::create):
+        * svg/properties/SVGStaticPropertyTearOff.h:
+        (WebCore::SVGStaticPropertyTearOff::create):
+        * svg/properties/SVGTransformListPropertyTearOff.h:
+        (WebCore::SVGTransformListPropertyTearOff::create):
+        (WebCore::SVGTransformListPropertyTearOff::createSVGTransformFromMatrix):
+        (WebCore::SVGTransformListPropertyTearOff::consolidate):
+
 2015-03-10  Timothy Horton  <timothy_horton@apple.com>
 
         Fix the build
index 7efbdeca8faaa155d20935e5865b0ddc54163ba1..00f43dc62b4bd338c8c9a243b74db121166f41d3 100644 (file)
@@ -239,7 +239,7 @@ void SVGMarkerElement::synchronizeOrientType(SVGElement* contextElement)
     ownerType.m_orientType.synchronize(&ownerType, orientTypePropertyInfo()->attributeName, autoString);
 }
 
-PassRefPtr<SVGAnimatedProperty> SVGMarkerElement::lookupOrCreateOrientTypeWrapper(SVGElement* contextElement)
+Ref<SVGAnimatedProperty> SVGMarkerElement::lookupOrCreateOrientTypeWrapper(SVGElement* contextElement)
 {
     ASSERT(contextElement);
     SVGMarkerElement& ownerType = downcast<SVGMarkerElement>(*contextElement);
@@ -258,10 +258,10 @@ SVGMarkerOrientType& SVGMarkerElement::orientType() const
     return m_orientType.value;
 }
 
-PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> SVGMarkerElement::orientTypeAnimated()
+Ref<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> SVGMarkerElement::orientTypeAnimated()
 {
     m_orientType.shouldSynchronize = true;
-    return static_pointer_cast<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>>(lookupOrCreateOrientTypeWrapper(this));
+    return static_reference_cast<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>>(lookupOrCreateOrientTypeWrapper(this));
 }
 
 }
index ce3ac5652ea3f7f7b50a96702ef4f306370726be..a3b24dc1261878e15ebadb6df3fe00d06b2f8390 100644 (file)
@@ -157,11 +157,11 @@ private:
 public:
     // Custom 'orientType' property.
     static void synchronizeOrientType(SVGElement* contextElement);
-    static PassRefPtr<SVGAnimatedProperty> lookupOrCreateOrientTypeWrapper(SVGElement* contextElement);
+    static Ref<SVGAnimatedProperty> lookupOrCreateOrientTypeWrapper(SVGElement* contextElement);
     SVGMarkerOrientType& orientType() const;
     SVGMarkerOrientType& orientTypeBaseValue() const { return m_orientType.value; }
     void setOrientTypeBaseValue(const SVGMarkerOrientType& type) { m_orientType.value = type; }
-    PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> orientTypeAnimated();
+    Ref<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> orientTypeAnimated();
 
 private:
     mutable SVGSynchronizableAnimatedProperty<SVGMarkerOrientType> m_orientType;
index 18527be580546ad8a4e75b0d01bed1c359e01356..3c8725759cf7d7212181cdbab42694e0b4cc7900 100644 (file)
@@ -311,13 +311,13 @@ SVGPathByteStream* SVGPathElement::pathByteStream() const
     return static_cast<SVGAnimatedPathSegListPropertyTearOff*>(property)->animatedPathByteStream();
 }
 
-PassRefPtr<SVGAnimatedProperty> SVGPathElement::lookupOrCreateDWrapper(SVGElement* contextElement)
+Ref<SVGAnimatedProperty> SVGPathElement::lookupOrCreateDWrapper(SVGElement* contextElement)
 {
     ASSERT(contextElement);
     SVGPathElement& ownerType = downcast<SVGPathElement>(*contextElement);
 
     if (SVGAnimatedProperty* property = SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(&ownerType, dPropertyInfo()))
-        return property;
+        return *property;
 
     // Build initial SVGPathSegList.
     buildSVGPathSegListFromByteStream(ownerType.m_pathByteStream.get(), &ownerType, ownerType.m_pathSegList.value, UnalteredParsing);
@@ -338,7 +338,7 @@ void SVGPathElement::synchronizeD(SVGElement* contextElement)
 SVGPathSegListPropertyTearOff* SVGPathElement::pathSegList()
 {
     m_pathSegList.shouldSynchronize = true;
-    return static_cast<SVGPathSegListPropertyTearOff*>(static_pointer_cast<SVGAnimatedPathSegListPropertyTearOff>(lookupOrCreateDWrapper(this))->baseVal());
+    return static_cast<SVGPathSegListPropertyTearOff*>(static_reference_cast<SVGAnimatedPathSegListPropertyTearOff>(lookupOrCreateDWrapper(this))->baseVal());
 }
 
 SVGPathSegListPropertyTearOff* SVGPathElement::normalizedPathSegList()
@@ -351,7 +351,7 @@ SVGPathSegListPropertyTearOff* SVGPathElement::animatedPathSegList()
 {
     m_pathSegList.shouldSynchronize = true;
     m_isAnimValObserved = true;
-    return static_cast<SVGPathSegListPropertyTearOff*>(static_pointer_cast<SVGAnimatedPathSegListPropertyTearOff>(lookupOrCreateDWrapper(this))->animVal());
+    return static_cast<SVGPathSegListPropertyTearOff*>(static_reference_cast<SVGAnimatedPathSegListPropertyTearOff>(lookupOrCreateDWrapper(this))->animVal());
 }
 
 SVGPathSegListPropertyTearOff* SVGPathElement::animatedNormalizedPathSegList()
index e14f7843b76c947bb327b85ba0999246294844a3..ace6c574e65a3c25d056def545c0439b1587ed39 100644 (file)
@@ -109,7 +109,7 @@ private:
 
     // Custom 'd' property
     static void synchronizeD(SVGElement* contextElement);
-    static PassRefPtr<SVGAnimatedProperty> lookupOrCreateDWrapper(SVGElement* contextElement);
+    static Ref<SVGAnimatedProperty> lookupOrCreateDWrapper(SVGElement* contextElement);
 
     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPathElement)
         DECLARE_ANIMATED_NUMBER(PathLength, pathLength)
index 1ffcf656ebffedd98a1242379d59647272691c0a..afd2d3b4322a89661f7e5c82952bcb05cba8372e 100644 (file)
@@ -137,7 +137,7 @@ void SVGPolyElement::synchronizePoints(SVGElement* contextElement)
     ownerType.m_points.synchronize(&ownerType, pointsPropertyInfo()->attributeName, ownerType.m_points.value.valueAsString());
 }
 
-PassRefPtr<SVGAnimatedProperty> SVGPolyElement::lookupOrCreatePointsWrapper(SVGElement* contextElement)
+Ref<SVGAnimatedProperty> SVGPolyElement::lookupOrCreatePointsWrapper(SVGElement* contextElement)
 {
     ASSERT(contextElement);
     SVGPolyElement& ownerType = downcast<SVGPolyElement>(*contextElement);
@@ -148,13 +148,13 @@ PassRefPtr<SVGAnimatedProperty> SVGPolyElement::lookupOrCreatePointsWrapper(SVGE
 SVGListPropertyTearOff<SVGPointList>* SVGPolyElement::points()
 {
     m_points.shouldSynchronize = true;
-    return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cast<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal());
+    return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_reference_cast<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal());
 }
 
 SVGListPropertyTearOff<SVGPointList>* SVGPolyElement::animatedPoints()
 {
     m_points.shouldSynchronize = true;
-    return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cast<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal());
+    return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_reference_cast<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal());
 }
 
 }
index fc46d7c7b987122a2e0df73a52d36cf46049dfaa..1988615448cdbb0ee746af5d5740c1f4bc89ace7 100644 (file)
@@ -52,7 +52,7 @@ private:
 
     // Custom 'points' property
     static void synchronizePoints(SVGElement* contextElement);
-    static PassRefPtr<SVGAnimatedProperty> lookupOrCreatePointsWrapper(SVGElement* contextElement);
+    static Ref<SVGAnimatedProperty> lookupOrCreatePointsWrapper(SVGElement* contextElement);
 
     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPolyElement)
         DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired)
index ab8705c582034d3a03c1e042fb4362ca600ac16f..d90df61da4554e05ce8467009beb118ef53caa57 100644 (file)
@@ -81,7 +81,7 @@ void SVGTextContentElement::synchronizeTextLength(SVGElement* contextElement)
     ownerType.m_textLength.synchronize(&ownerType, textLengthPropertyInfo()->attributeName, value);
 }
 
-PassRefPtr<SVGAnimatedProperty> SVGTextContentElement::lookupOrCreateTextLengthWrapper(SVGElement* contextElement)
+Ref<SVGAnimatedProperty> SVGTextContentElement::lookupOrCreateTextLengthWrapper(SVGElement* contextElement)
 {
     ASSERT(contextElement);
     SVGTextContentElement& ownerType = downcast<SVGTextContentElement>(*contextElement);
@@ -89,14 +89,14 @@ PassRefPtr<SVGAnimatedProperty> SVGTextContentElement::lookupOrCreateTextLengthW
         (&ownerType, textLengthPropertyInfo(), ownerType.m_textLength.value);
 }
 
-PassRefPtr<SVGAnimatedLength> SVGTextContentElement::textLengthAnimated()
+Ref<SVGAnimatedLength> SVGTextContentElement::textLengthAnimated()
 {
     static NeverDestroyed<SVGLength> defaultTextLength(LengthModeOther);
     if (m_specifiedTextLength == defaultTextLength)
         m_textLength.value.newValueSpecifiedUnits(LengthTypeNumber, getComputedTextLength(), ASSERT_NO_EXCEPTION);
 
     m_textLength.shouldSynchronize = true;
-    return static_pointer_cast<SVGAnimatedLength>(lookupOrCreateTextLengthWrapper(this));
+    return static_reference_cast<SVGAnimatedLength>(lookupOrCreateTextLengthWrapper(this));
 
 }
 
index 09f20e40cce63f4ce1685e03ffb6905ec2311776..faba94f00ff4022cb59cb30c1a753119335c64e3 100644 (file)
@@ -88,7 +88,7 @@ public:
     // textLength is not declared using the standard DECLARE_ANIMATED_LENGTH macro
     // as its getter needs special handling (return getComputedTextLength(), instead of m_textLength).
     SVGLength& specifiedTextLength() { return m_specifiedTextLength; }
-    PassRefPtr<SVGAnimatedLength> textLengthAnimated();
+    Ref<SVGAnimatedLength> textLengthAnimated();
     static const SVGPropertyInfo* textLengthPropertyInfo();
 
 protected:
@@ -109,7 +109,7 @@ private:
 
     // Custom 'textLength' property
     static void synchronizeTextLength(SVGElement* contextElement);
-    static PassRefPtr<SVGAnimatedProperty> lookupOrCreateTextLengthWrapper(SVGElement* contextElement);
+    static Ref<SVGAnimatedProperty> lookupOrCreateTextLengthWrapper(SVGElement* contextElement);
     mutable SVGSynchronizableAnimatedProperty<SVGLength> m_textLength;
     SVGLength m_specifiedTextLength;
   
index 509d985a2a38825f7da85f7d1ba5398f11103d8e..568fedc277aa464d25de60b3edc09fe50e2dfedf 100644 (file)
@@ -148,40 +148,40 @@ SVGElement* SVGViewSpec::viewTarget() const
 SVGTransformListPropertyTearOff* SVGViewSpec::transform()
 {
     if (!m_contextElement)
-        return 0;
+        return nullptr;
     // Return the animVal here, as its readonly by default - which is exactly what we want here.
-    return static_cast<SVGTransformListPropertyTearOff*>(static_pointer_cast<SVGAnimatedTransformList>(lookupOrCreateTransformWrapper(this))->animVal());
+    return static_cast<SVGTransformListPropertyTearOff*>(static_reference_cast<SVGAnimatedTransformList>(lookupOrCreateTransformWrapper(this))->animVal());
 }
 
-PassRefPtr<SVGAnimatedRect> SVGViewSpec::viewBoxAnimated()
+RefPtr<SVGAnimatedRect> SVGViewSpec::viewBoxAnimated()
 {
     if (!m_contextElement)
-        return 0;
-    return static_pointer_cast<SVGAnimatedRect>(lookupOrCreateViewBoxWrapper(this));
+        return nullptr;
+    return static_reference_cast<SVGAnimatedRect>(lookupOrCreateViewBoxWrapper(this));
 }
 
-PassRefPtr<SVGAnimatedPreserveAspectRatio> SVGViewSpec::preserveAspectRatioAnimated()
+RefPtr<SVGAnimatedPreserveAspectRatio> SVGViewSpec::preserveAspectRatioAnimated()
 {
     if (!m_contextElement)
-        return 0;
-    return static_pointer_cast<SVGAnimatedPreserveAspectRatio>(lookupOrCreatePreserveAspectRatioWrapper(this));
+        return nullptr;
+    return static_reference_cast<SVGAnimatedPreserveAspectRatio>(lookupOrCreatePreserveAspectRatioWrapper(this));
 }
 
-PassRefPtr<SVGAnimatedProperty> SVGViewSpec::lookupOrCreateViewBoxWrapper(SVGViewSpec* ownerType)
+Ref<SVGAnimatedProperty> SVGViewSpec::lookupOrCreateViewBoxWrapper(SVGViewSpec* ownerType)
 {
     ASSERT(ownerType);
     ASSERT(ownerType->contextElement());
     return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedRect, FloatRect>(ownerType->contextElement(), viewBoxPropertyInfo(), ownerType->m_viewBox);
 }
 
-PassRefPtr<SVGAnimatedProperty> SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper(SVGViewSpec* ownerType)
+Ref<SVGAnimatedProperty> SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper(SVGViewSpec* ownerType)
 {
     ASSERT(ownerType);
     ASSERT(ownerType->contextElement());
     return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedPreserveAspectRatio, SVGPreserveAspectRatio>(ownerType->contextElement(), preserveAspectRatioPropertyInfo(), ownerType->m_preserveAspectRatio);
 }
 
-PassRefPtr<SVGAnimatedProperty> SVGViewSpec::lookupOrCreateTransformWrapper(SVGViewSpec* ownerType)
+Ref<SVGAnimatedProperty> SVGViewSpec::lookupOrCreateTransformWrapper(SVGViewSpec* ownerType)
 {
     ASSERT(ownerType);
     ASSERT(ownerType->contextElement());
index 51c917dadda652801f77f5e1ce09a0cb7240a0be..f85246711985cdbd471ef666b5f379f256c9cb76 100644 (file)
@@ -72,13 +72,13 @@ public:
     SVGTransformList transformBaseValue() const { return m_transform; }
 
     // Custom animated 'viewBox' property.
-    PassRefPtr<SVGAnimatedRect> viewBoxAnimated();
+    RefPtr<SVGAnimatedRect> viewBoxAnimated();
     FloatRect& viewBox() { return m_viewBox; }
     FloatRect viewBoxBaseValue() const { return m_viewBox; }
     void setViewBoxBaseValue(const FloatRect& viewBox) { m_viewBox = viewBox; }
 
     // Custom animated 'preserveAspectRatio' property.
-    PassRefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated();
+    RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated();
     SVGPreserveAspectRatio& preserveAspectRatio() { return m_preserveAspectRatio; }
     SVGPreserveAspectRatio preserveAspectRatioBaseValue() const { return m_preserveAspectRatio; }
     void setPreserveAspectRatioBaseValue(const SVGPreserveAspectRatio& preserveAspectRatio) { m_preserveAspectRatio = preserveAspectRatio; }
@@ -94,9 +94,9 @@ private:
     static const AtomicString& viewBoxIdentifier();
     static const AtomicString& preserveAspectRatioIdentifier();
 
-    static PassRefPtr<SVGAnimatedProperty> lookupOrCreateTransformWrapper(SVGViewSpec* contextElement);
-    static PassRefPtr<SVGAnimatedProperty> lookupOrCreateViewBoxWrapper(SVGViewSpec* contextElement);
-    static PassRefPtr<SVGAnimatedProperty> lookupOrCreatePreserveAspectRatioWrapper(SVGViewSpec* contextElement);
+    static Ref<SVGAnimatedProperty> lookupOrCreateTransformWrapper(SVGViewSpec* contextElement);
+    static Ref<SVGAnimatedProperty> lookupOrCreateViewBoxWrapper(SVGViewSpec* contextElement);
+    static Ref<SVGAnimatedProperty> lookupOrCreatePreserveAspectRatioWrapper(SVGViewSpec* contextElement);
 
     SVGElement* m_contextElement;
     SVGZoomAndPanType m_zoomAndPan;
index defb78960d1b55277271fb53ec07e9cdce42f09a..d1d2d0303bde01fd61273f699e581ab24beaea24 100644 (file)
@@ -39,10 +39,10 @@ public:
         SVGAnimatedStaticPropertyTearOff<unsigned>::setBaseVal(property, ec);
     }
 
-    static PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<EnumType>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, EnumType& property)
+    static Ref<SVGAnimatedEnumerationPropertyTearOff<EnumType>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, EnumType& property)
     {
         ASSERT(contextElement);
-        return adoptRef(new SVGAnimatedEnumerationPropertyTearOff<EnumType>(contextElement, attributeName, animatedPropertyType, reinterpret_cast<unsigned&>(property)));
+        return adoptRef(*new SVGAnimatedEnumerationPropertyTearOff<EnumType>(contextElement, attributeName, animatedPropertyType, reinterpret_cast<unsigned&>(property)));
     }
 
     EnumType& currentAnimatedValue()
index d8c0fdfbad3353406221e6a369fc27e5b173c40f..7652094933d18fea037bbc727fc85fee44290a51 100644 (file)
@@ -153,10 +153,10 @@ public:
         synchronizeWrappersIfNeeded();
     }
 
-    static PassRefPtr<SVGAnimatedListPropertyTearOff<PropertyType>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& values)
+    static Ref<SVGAnimatedListPropertyTearOff<PropertyType>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& values)
     {
         ASSERT(contextElement);
-        return adoptRef(new SVGAnimatedListPropertyTearOff<PropertyType>(contextElement, attributeName, animatedPropertyType, values));
+        return adoptRef(*new SVGAnimatedListPropertyTearOff<PropertyType>(contextElement, attributeName, animatedPropertyType, values));
     }
 
 protected:
index 97426c6601eb19cb0f6ffed89b01291059e8d9ed..f554e6c15fec2fe4d020997e64761b82afe9b263 100644 (file)
@@ -59,10 +59,10 @@ public:
         static_cast<SVGPathSegListPropertyTearOff*>(m_baseVal.get())->removeItemFromList(itemIndex, shouldSynchronizeWrappers);
     }
 
-    static PassRefPtr<SVGAnimatedPathSegListPropertyTearOff> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGPathSegList& values)
+    static Ref<SVGAnimatedPathSegListPropertyTearOff> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGPathSegList& values)
     {
         ASSERT(contextElement);
-        return adoptRef(new SVGAnimatedPathSegListPropertyTearOff(contextElement, attributeName, animatedPropertyType, values));
+        return adoptRef(*new SVGAnimatedPathSegListPropertyTearOff(contextElement, attributeName, animatedPropertyType, values));
     }
 
     using SVGAnimatedListPropertyTearOff<SVGPathSegList>::animationStarted;
index 8b3b5add1918dd573f8136312030a9ca3fda4790..5b880e7d8bd53e74952fc989512da065b7d176e5 100644 (file)
@@ -48,18 +48,18 @@ public:
     virtual ~SVGAnimatedProperty();
 
     template<typename OwnerType, typename TearOffType, typename PropertyType>
-    static PassRefPtr<TearOffType> lookupOrCreateWrapper(OwnerType* element, const SVGPropertyInfo* info, PropertyType& property)
+    static TearOffType& lookupOrCreateWrapper(OwnerType* element, const SVGPropertyInfo* info, PropertyType& property)
     {
         ASSERT(info);
         SVGAnimatedPropertyDescription key(element, info->propertyIdentifier);
-        RefPtr<SVGAnimatedProperty> wrapper = animatedPropertyCache()->get(key);
-        if (!wrapper) {
-            wrapper = TearOffType::create(element, info->attributeName, info->animatedPropertyType, property);
+        auto& slot = animatedPropertyCache()->add(key, nullptr).iterator->value;
+        if (!slot) {
+            Ref<SVGAnimatedProperty> wrapper = TearOffType::create(element, info->attributeName, info->animatedPropertyType, property);
             if (info->animatedPropertyState == PropertyIsReadOnly)
                 wrapper->setIsReadOnly();
-            animatedPropertyCache()->set(key, wrapper.get());
+            slot = &wrapper.leakRef();
         }
-        return static_pointer_cast<TearOffType>(wrapper);
+        return static_cast<TearOffType&>(*slot);
     }
 
     template<typename OwnerType, typename TearOffType>
index bd2b00f0d8af784c26707be3b5f5c345bda4ee34..e11a52b44b4ff262487c13a60ce3d6ec0a9a11a9 100644 (file)
@@ -132,10 +132,10 @@ public: \
         m_##LowerProperty.isValid = validValue; \
     } \
 \
-    PassRefPtr<TearOffType> LowerProperty##Animated() \
+    Ref<TearOffType> LowerProperty##Animated() \
     { \
         m_##LowerProperty.shouldSynchronize = true; \
-        return static_pointer_cast<TearOffType>(lookupOrCreate##UpperProperty##Wrapper(this)); \
+        return static_reference_cast<TearOffType>(lookupOrCreate##UpperProperty##Wrapper(this)); \
     } \
 \
     bool LowerProperty##IsValid() const \
@@ -152,7 +152,7 @@ private: \
         m_##LowerProperty.synchronize(this, LowerProperty##PropertyInfo()->attributeName, value); \
     } \
 \
-    static PassRefPtr<SVGAnimatedProperty> lookupOrCreate##UpperProperty##Wrapper(SVGElement* maskedOwnerType) \
+    static Ref<SVGAnimatedProperty> lookupOrCreate##UpperProperty##Wrapper(SVGElement* maskedOwnerType) \
     { \
         ASSERT(maskedOwnerType); \
         UseOwnerType* ownerType = static_cast<UseOwnerType*>(maskedOwnerType); \
index a77a3b76e9ec0893e9d6dfb7744c7578d25a9648..a118267bf99f9f08e51877c16a926fdc571640c7 100644 (file)
@@ -57,10 +57,10 @@ public:
         return m_animVal.get();
     }
 
-    static PassRefPtr<SVGAnimatedPropertyTearOff<PropertyType>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& property)
+    static Ref<SVGAnimatedPropertyTearOff<PropertyType>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& property)
     {
         ASSERT(contextElement);
-        return adoptRef(new SVGAnimatedPropertyTearOff<PropertyType>(contextElement, attributeName, animatedPropertyType, property));
+        return adoptRef(*new SVGAnimatedPropertyTearOff<PropertyType>(contextElement, attributeName, animatedPropertyType, property));
     }
 
     PropertyType& currentAnimatedValue()
index 22112db3859295018f6f6675ee50e0896e37c158..2d769e960e35bdb8012d517c7eb97f6862c2e48d 100644 (file)
@@ -48,10 +48,10 @@ public:
         commitChange();
     }
 
-    static PassRefPtr<SVGAnimatedStaticPropertyTearOff<PropertyType>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& property)
+    static Ref<SVGAnimatedStaticPropertyTearOff<PropertyType>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& property)
     {
         ASSERT(contextElement);
-        return adoptRef(new SVGAnimatedStaticPropertyTearOff<PropertyType>(contextElement, attributeName, animatedPropertyType, property));
+        return adoptRef(*new SVGAnimatedStaticPropertyTearOff<PropertyType>(contextElement, attributeName, animatedPropertyType, property));
     }
 
     PropertyType& currentAnimatedValue()
index 85a7a55b4173f7e2ffd5027a7eda72a0ac751f03..9311e35859c4c169198f91dfcdbe497b6f7f6585 100644 (file)
@@ -42,10 +42,10 @@ public:
         return static_cast<SVGListPropertyTearOff<SVGTransformList>*>(m_animVal.get());
     }
 
-    static PassRefPtr<SVGAnimatedTransformListPropertyTearOff> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGTransformList& values)
+    static Ref<SVGAnimatedTransformListPropertyTearOff> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGTransformList& values)
     {
         ASSERT(contextElement);
-        return adoptRef(new SVGAnimatedTransformListPropertyTearOff(contextElement, attributeName, animatedPropertyType, values));
+        return adoptRef(*new SVGAnimatedTransformListPropertyTearOff(contextElement, attributeName, animatedPropertyType, values));
     }
 
 private:
index 185570ec3bcaa304eb14e47045c3eeafa2666ab4..480884ea72ca7d0da67c130e3f23dd781dfcbcac 100644 (file)
@@ -44,7 +44,7 @@ public:
 
     typedef typename SVGPropertyTraits<PropertyType>::ListItemType ListItemType;
     typedef SVGPropertyTearOff<ListItemType> ListItemTearOff;
-    typedef PassRefPtr<ListItemTearOff> PassListItemTearOff;
+    typedef RefPtr<ListItemTearOff> PtrListItemTearOff;
     typedef SVGAnimatedListPropertyTearOff<PropertyType> AnimatedListPropertyTearOff;
     typedef typename SVGAnimatedListPropertyTearOff<PropertyType>::ListWrapperCache ListWrapperCache;
 
@@ -138,19 +138,18 @@ public:
         return newItem;
     }
 
-    PassListItemTearOff initializeValuesAndWrappers(PassListItemTearOff passNewItem, ExceptionCode& ec)
+    PtrListItemTearOff initializeValuesAndWrappers(PtrListItemTearOff newItem, ExceptionCode& ec)
     {
         ASSERT(m_wrappers);
         if (!canAlterList(ec))
-            return 0;
+            return nullptr;
 
         // Not specified, but FF/Opera do it this way, and it's just sane.
-        if (!passNewItem) {
+        if (!newItem) {
             ec = SVGException::SVG_WRONG_TYPE_ERR;
-            return 0;
+            return nullptr;
         }
 
-        RefPtr<ListItemTearOff> newItem = passNewItem;
         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.
@@ -164,7 +163,7 @@ public:
         m_wrappers->append(newItem);
 
         commitChange();
-        return newItem.release();
+        return newItem;
     }
 
     // SVGList::getItem()
@@ -187,11 +186,11 @@ public:
         return m_values->at(index);
     }
 
-    PassListItemTearOff getItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index, ExceptionCode& ec)
+    PtrListItemTearOff getItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index, ExceptionCode& ec)
     {
         ASSERT(m_wrappers);
         if (!canGetItem(index, ec))
-            return 0;
+            return nullptr;
 
         // 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.
@@ -232,23 +231,22 @@ public:
         return newItem;
     }
 
-    PassListItemTearOff insertItemBeforeValuesAndWrappers(PassListItemTearOff passNewItem, unsigned index, ExceptionCode& ec)
+    PtrListItemTearOff insertItemBeforeValuesAndWrappers(PtrListItemTearOff newItem, unsigned index, ExceptionCode& ec)
     {
         ASSERT(m_wrappers);
         if (!canAlterList(ec))
-            return 0;
+            return nullptr;
 
         // Not specified, but FF/Opera do it this way, and it's just sane.
-        if (!passNewItem) {
+        if (!newItem) {
             ec = SVGException::SVG_WRONG_TYPE_ERR;
-            return 0;
+            return nullptr;
         }
 
         // 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();
 
-        RefPtr<ListItemTearOff> newItem = passNewItem;
         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.
@@ -263,7 +261,7 @@ public:
         m_wrappers->insert(index, newItem);
 
         commitChange();
-        return newItem.release();
+        return newItem;
     }
 
     // SVGList::replaceItem()
@@ -305,31 +303,30 @@ public:
         return newItem;
     }
 
-    PassListItemTearOff replaceItemValuesAndWrappers(PassListItemTearOff passNewItem, unsigned index, ExceptionCode& ec)
+    PtrListItemTearOff replaceItemValuesAndWrappers(PtrListItemTearOff newItem, unsigned index, ExceptionCode& ec)
     {
         ASSERT(m_wrappers);
         if (!canReplaceItem(index, ec))
-            return 0;
+            return nullptr;
 
         // Not specified, but FF/Opera do it this way, and it's just sane.
-        if (!passNewItem) {
+        if (!newItem) {
             ec = SVGException::SVG_WRONG_TYPE_ERR;
-            return 0;
+            return nullptr;
         }
 
         ASSERT(m_values->size() == m_wrappers->size());
-        RefPtr<ListItemTearOff> newItem = passNewItem;
 
         // 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.
         if (!processIncomingListItemWrapper(newItem, &index))
-            return newItem.release();
+            return newItem;
 
         if (m_values->isEmpty()) {
             ASSERT(m_wrappers->isEmpty());
-            // 'passNewItem' already lived in our list, we removed it, and now we're empty, which means there's nothing to replace.
+            // 'newItem' already lived in our list, we removed it, and now we're empty, which means there's nothing to replace.
             ec = INDEX_SIZE_ERR;
-            return 0;
+            return nullptr;
         }
 
         // Detach the existing wrapper.
@@ -342,7 +339,7 @@ public:
         m_wrappers->at(index) = newItem;
 
         commitChange();
-        return newItem.release();
+        return newItem;
     }
 
     // SVGList::removeItem()
@@ -371,11 +368,11 @@ public:
         return oldItem;
     }
 
-    PassListItemTearOff removeItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index, ExceptionCode& ec)
+    PtrListItemTearOff removeItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index, ExceptionCode& ec)
     {
         ASSERT(m_wrappers);
         if (!canRemoveItem(index, ec))
-            return 0;
+            return nullptr;
 
         ASSERT(m_values->size() == m_wrappers->size());
 
@@ -408,19 +405,18 @@ public:
         return newItem;
     }
 
-    PassListItemTearOff appendItemValuesAndWrappers(PassListItemTearOff passNewItem, ExceptionCode& ec)
+    PtrListItemTearOff appendItemValuesAndWrappers(PtrListItemTearOff newItem, ExceptionCode& ec)
     {
         ASSERT(m_wrappers);
         if (!canAlterList(ec))
-            return 0;
+            return nullptr;
 
         // Not specified, but FF/Opera do it this way, and it's just sane.
-        if (!passNewItem) {
+        if (!newItem) {
             ec = SVGException::SVG_WRONG_TYPE_ERR;
-            return 0;
+            return nullptr;
         }
 
-        RefPtr<ListItemTearOff> newItem = passNewItem;
         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.
@@ -431,7 +427,7 @@ public:
         m_wrappers->append(newItem);
 
         commitChange(ListModificationAppend);
-        return newItem.release();
+        return newItem;
     }
 
     PropertyType& values()
index e2639a17ec507a49c7be5e0b35208b4543f3fde3..a90ffb548b6672bd0cb25b2856ae33ee9bf06aaa 100644 (file)
@@ -32,7 +32,7 @@ public:
 
     typedef typename SVGPropertyTraits<PropertyType>::ListItemType ListItemType;
     typedef SVGPropertyTearOff<ListItemType> ListItemTearOff;
-    typedef PassRefPtr<ListItemTearOff> PassListItemTearOff;
+    typedef RefPtr<ListItemTearOff> PtrListItemTearOff;
     typedef SVGAnimatedListPropertyTearOff<PropertyType> AnimatedListPropertyTearOff;
     typedef typename SVGAnimatedListPropertyTearOff<PropertyType>::ListWrapperCache ListWrapperCache;
 
@@ -40,10 +40,10 @@ public:
     using Base::m_values;
     using Base::m_wrappers;
 
-    static PassRefPtr<Self> create(AnimatedListPropertyTearOff* animatedProperty, SVGPropertyRole role, PropertyType& values, ListWrapperCache& wrappers)
+    static Ref<Self> create(AnimatedListPropertyTearOff* animatedProperty, SVGPropertyRole role, PropertyType& values, ListWrapperCache& wrappers)
     {
         ASSERT(animatedProperty);
-        return adoptRef(new Self(animatedProperty, role, values, wrappers));
+        return adoptRef(*new Self(animatedProperty, role, values, wrappers));
     }
 
     int findItem(ListItemTearOff* item) const
@@ -83,34 +83,34 @@ public:
         Base::clearValuesAndWrappers(ec);
     }
 
-    PassListItemTearOff initialize(PassListItemTearOff passNewItem, ExceptionCode& ec)
+    PtrListItemTearOff initialize(PtrListItemTearOff newItem, ExceptionCode& ec)
     {
-        return Base::initializeValuesAndWrappers(passNewItem, ec);
+        return Base::initializeValuesAndWrappers(newItem, ec);
     }
 
-    PassListItemTearOff getItem(unsigned index, ExceptionCode& ec)
+    PtrListItemTearOff getItem(unsigned index, ExceptionCode& ec)
     {
         return Base::getItemValuesAndWrappers(m_animatedProperty.get(), index, ec);
     }
 
-    PassListItemTearOff insertItemBefore(PassListItemTearOff passNewItem, unsigned index, ExceptionCode& ec)
+    PtrListItemTearOff insertItemBefore(PtrListItemTearOff newItem, unsigned index, ExceptionCode& ec)
     {
-        return Base::insertItemBeforeValuesAndWrappers(passNewItem, index, ec);
+        return Base::insertItemBeforeValuesAndWrappers(newItem, index, ec);
     }
 
-    PassListItemTearOff replaceItem(PassListItemTearOff passNewItem, unsigned index, ExceptionCode& ec)
+    PtrListItemTearOff replaceItem(PtrListItemTearOff newItem, unsigned index, ExceptionCode& ec)
     {
-        return Base::replaceItemValuesAndWrappers(passNewItem, index, ec);
+        return Base::replaceItemValuesAndWrappers(newItem, index, ec);
     }
 
-    PassListItemTearOff removeItem(unsigned index, ExceptionCode& ec)
+    PtrListItemTearOff removeItem(unsigned index, ExceptionCode& ec)
     {
         return Base::removeItemValuesAndWrappers(m_animatedProperty.get(), index, ec);
     }
 
-    PassListItemTearOff appendItem(PassListItemTearOff passNewItem, ExceptionCode& ec)
+    PtrListItemTearOff appendItem(PtrListItemTearOff newItem, ExceptionCode& ec)
     {
-        return Base::appendItemValuesAndWrappers(passNewItem, ec);
+        return Base::appendItemValuesAndWrappers(newItem, ec);
     }
 
 protected:
index 33e721c10e2bf7ae77656b7a4e0ea2d75d2a3740..5117ce62ca7dfb97f3efbd6a83fc419bd1f962af 100644 (file)
@@ -47,20 +47,20 @@ void SVGPathSegListPropertyTearOff::clear(ExceptionCode& ec)
     SVGPathSegListPropertyTearOff::Base::clearValues(ec);
 }
 
-SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::getItem(unsigned index, ExceptionCode& ec)
+SVGPathSegListPropertyTearOff::PtrListItemType SVGPathSegListPropertyTearOff::getItem(unsigned index, ExceptionCode& ec)
 {
     ListItemType returnedItem = Base::getItemValues(index, ec);
     if (returnedItem) {
         ASSERT(static_cast<SVGPathSegWithContext*>(returnedItem.get())->contextElement() == contextElement());
         ASSERT(static_cast<SVGPathSegWithContext*>(returnedItem.get())->role() == m_pathSegRole);
     }
-    return returnedItem.release();
+    return returnedItem;
 }
 
-SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::replaceItem(PassListItemType passNewItem, unsigned index, ExceptionCode& ec)
+SVGPathSegListPropertyTearOff::PtrListItemType SVGPathSegListPropertyTearOff::replaceItem(PtrListItemType newItem, unsigned index, ExceptionCode& ec)
 {
     // Not specified, but FF/Opera do it this way, and it's just sane.
-    if (!passNewItem) {
+    if (!newItem) {
         ec = SVGException::SVG_WRONG_TYPE_ERR;
         return 0;
     }
@@ -71,16 +71,15 @@ SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::r
         static_cast<SVGPathSegWithContext*>(replacedItem.get())->setContextAndRole(0, PathSegUndefinedRole);
     }
 
-    ListItemType newItem = passNewItem;
     return Base::replaceItemValues(newItem, index, ec);
 }
 
-SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::removeItem(unsigned index, ExceptionCode& ec)
+SVGPathSegListPropertyTearOff::PtrListItemType SVGPathSegListPropertyTearOff::removeItem(unsigned index, ExceptionCode& ec)
 {
     SVGPathSegListPropertyTearOff::ListItemType removedItem = SVGPathSegListPropertyTearOff::Base::removeItemValues(index, ec);
     if (removedItem)
         static_cast<SVGPathSegWithContext*>(removedItem.get())->setContextAndRole(0, PathSegUndefinedRole);
-    return removedItem.release();
+    return removedItem;
 }
 
 SVGPathElement* SVGPathSegListPropertyTearOff::contextElement() const
index c8068be93bb1c1b6889b7d221f3e21ed2a588d29..7d68cd0522c33794190bcaef91a3dc2ea2b17dc7 100644 (file)
@@ -32,12 +32,12 @@ public:
     typedef SVGListProperty<SVGPathSegList> Base;
     typedef SVGAnimatedListPropertyTearOff<SVGPathSegList> AnimatedListPropertyTearOff;
     typedef SVGPropertyTraits<SVGPathSegList>::ListItemType ListItemType;
-    typedef PassRefPtr<SVGPathSeg> PassListItemType;
+    typedef RefPtr<SVGPathSeg> PtrListItemType;
 
-    static PassRefPtr<SVGPathSegListPropertyTearOff> create(AnimatedListPropertyTearOff* animatedProperty, SVGPropertyRole role, SVGPathSegRole pathSegRole, SVGPathSegList& values, ListWrapperCache& wrappers)
+    static Ref<SVGPathSegListPropertyTearOff> create(AnimatedListPropertyTearOff* animatedProperty, SVGPropertyRole role, SVGPathSegRole pathSegRole, SVGPathSegList& values, ListWrapperCache& wrappers)
     {
         ASSERT(animatedProperty);
-        return adoptRef(new SVGPathSegListPropertyTearOff(animatedProperty, role, pathSegRole, values, wrappers));
+        return adoptRef(*new SVGPathSegListPropertyTearOff(animatedProperty, role, pathSegRole, values, wrappers));
     }
 
     int findItem(const ListItemType& item) const
@@ -67,46 +67,43 @@ public:
     // SVGList API
     void clear(ExceptionCode&);
 
-    PassListItemType initialize(PassListItemType passNewItem, ExceptionCode& ec)
+    PtrListItemType initialize(PtrListItemType newItem, ExceptionCode& ec)
     {
         // Not specified, but FF/Opera do it this way, and it's just sane.
-        if (!passNewItem) {
+        if (!newItem) {
             ec = SVGException::SVG_WRONG_TYPE_ERR;
-            return 0;
+            return nullptr;
         }
 
         clearContextAndRoles();
-        ListItemType newItem = passNewItem;
         return Base::initializeValues(newItem, ec);
     }
 
-    PassListItemType getItem(unsigned index, ExceptionCode&);
+    PtrListItemType getItem(unsigned index, ExceptionCode&);
 
-    PassListItemType insertItemBefore(PassListItemType passNewItem, unsigned index, ExceptionCode& ec)
+    PtrListItemType insertItemBefore(PtrListItemType newItem, unsigned index, ExceptionCode& ec)
     {
         // Not specified, but FF/Opera do it this way, and it's just sane.
-        if (!passNewItem) {
+        if (!newItem) {
             ec = SVGException::SVG_WRONG_TYPE_ERR;
             return 0;
         }
 
-        ListItemType newItem = passNewItem;
         return Base::insertItemBeforeValues(newItem, index, ec);
     }
 
-    PassListItemType replaceItem(PassListItemType, unsigned index, ExceptionCode&);
+    PtrListItemType replaceItem(PtrListItemType, unsigned index, ExceptionCode&);
 
-    PassListItemType removeItem(unsigned index, ExceptionCode&);
+    PtrListItemType removeItem(unsigned index, ExceptionCode&);
 
-    PassListItemType appendItem(PassListItemType passNewItem, ExceptionCode& ec)
+    PtrListItemType appendItem(PtrListItemType newItem, ExceptionCode& ec)
     {
         // Not specified, but FF/Opera do it this way, and it's just sane.
-        if (!passNewItem) {
+        if (!newItem) {
             ec = SVGException::SVG_WRONG_TYPE_ERR;
-            return 0;
+            return nullptr;
         }
 
-        ListItemType newItem = passNewItem;
         return Base::appendItemValues(newItem, ec);
     }
 
index d1482f165aabc2a67a9a146580bef1a580e2c864..69725b5aa362c374689d87a36c747832f6daacdc 100644 (file)
@@ -58,7 +58,7 @@ struct SVGPropertyInfo {
     WTF_MAKE_FAST_ALLOCATED;
 public:
     typedef void (*SynchronizeProperty)(SVGElement*);
-    typedef PassRefPtr<SVGAnimatedProperty> (*LookupOrCreateWrapperForAnimatedProperty)(SVGElement*);
+    typedef Ref<SVGAnimatedProperty> (*LookupOrCreateWrapperForAnimatedProperty)(SVGElement*);
 
     SVGPropertyInfo(AnimatedPropertyType newType, AnimatedPropertyState newState, const QualifiedName& newAttributeName,
                     const AtomicString& newPropertyIdentifier, SynchronizeProperty newSynchronizeProperty,
index 9d771f2d797c5077959ca7a241aac7d8ce07fbfd..bbfd1e1abe0a39c457fb3c0e9785008b1d2ed3ac 100644 (file)
@@ -35,9 +35,9 @@ public:
     using Base::m_role;
     using Base::m_values;
 
-    static PassRefPtr<SVGStaticListPropertyTearOff<PropertyType>> create(SVGElement& contextElement, PropertyType& values)
+    static Ref<SVGStaticListPropertyTearOff<PropertyType>> create(SVGElement& contextElement, PropertyType& values)
     {
-        return adoptRef(new SVGStaticListPropertyTearOff<PropertyType>(&contextElement, values));
+        return adoptRef(*new SVGStaticListPropertyTearOff<PropertyType>(&contextElement, values));
     }
 
     // SVGList API
index ee5bce83a5ba65cd4f2dcfe399362d251c1864c4..4e1b3302a1125144313c143c0904a1e55ee6d0e5 100644 (file)
@@ -37,9 +37,9 @@ public:
 
     // Used for non-animated POD types that are not associated with a SVGAnimatedProperty object, nor with a XML DOM attribute
     // (for example: SVGSVGElement::currentTranslate).
-    static PassRefPtr<Self> create(ContextElement& contextElement, PropertyType& value, UpdateMethod update)
+    static Ref<Self> create(ContextElement& contextElement, PropertyType& value, UpdateMethod update)
     {
-        return adoptRef(new Self(&contextElement, value, update));
+        return adoptRef(*new Self(&contextElement, value, update));
     }
 
     virtual void commitChange() { (m_contextElement.get()->*m_update)(); }
index 69bdfab4666af35699094f10d3a0eb0e8ee65167..0663648766a25cc9e9b61a70507fbf49a29d6cf2 100644 (file)
@@ -31,41 +31,41 @@ public:
     typedef SVGAnimatedListPropertyTearOff<SVGTransformList> AnimatedListPropertyTearOff;
     typedef SVGAnimatedListPropertyTearOff<SVGTransformList>::ListWrapperCache ListWrapperCache;
 
-    static PassRefPtr<SVGListPropertyTearOff<SVGTransformList>> create(AnimatedListPropertyTearOff* animatedProperty, SVGPropertyRole role, SVGTransformList& values, ListWrapperCache& wrappers)
+    static Ref<SVGListPropertyTearOff<SVGTransformList>> create(AnimatedListPropertyTearOff* animatedProperty, SVGPropertyRole role, SVGTransformList& values, ListWrapperCache& wrappers)
     {
         ASSERT(animatedProperty);
-        return adoptRef(new SVGTransformListPropertyTearOff(animatedProperty, role, values, wrappers));
+        return adoptRef(*new SVGTransformListPropertyTearOff(animatedProperty, role, values, wrappers));
     }
 
-    PassRefPtr<SVGPropertyTearOff<SVGTransform>> createSVGTransformFromMatrix(SVGPropertyTearOff<SVGMatrix>* matrix, ExceptionCode& ec)
+    RefPtr<SVGPropertyTearOff<SVGTransform>> createSVGTransformFromMatrix(SVGPropertyTearOff<SVGMatrix>* matrix, ExceptionCode& ec)
     {
         ASSERT(m_values);
         if (!matrix) {
             ec = TYPE_MISMATCH_ERR;
-            return 0;
+            return nullptr;
         }
         return SVGPropertyTearOff<SVGTransform>::create(m_values->createSVGTransformFromMatrix(matrix->propertyReference()));
     }
 
-    PassRefPtr<SVGPropertyTearOff<SVGTransform>> consolidate(ExceptionCode& ec)
+    RefPtr<SVGPropertyTearOff<SVGTransform>> consolidate(ExceptionCode& ec)
     {
         ASSERT(m_values);
         ASSERT(m_wrappers);
         if (!canAlterList(ec))
-            return 0;
+            return nullptr;
 
         ASSERT(m_values->size() == m_wrappers->size());
 
         // Spec: If the list was empty, then a value of null is returned.
         if (m_values->isEmpty())
-            return 0;
+            return nullptr;
 
         detachListWrappers(0);
         RefPtr<SVGPropertyTearOff<SVGTransform>> wrapper = SVGPropertyTearOff<SVGTransform>::create(m_values->consolidate());
         m_wrappers->append(wrapper);
 
         ASSERT(m_values->size() == m_wrappers->size());
-        return wrapper.release();
+        return wrapper;
     }
 
 private: