Title: [174715] trunk/Source
Revision
174715
Author
[email protected]
Date
2014-10-14 17:41:01 -0700 (Tue, 14 Oct 2014)

Log Message

Use is<>() / downcast<>() for PlatformCAAnimation subclasses
https://bugs.webkit.org/show_bug.cgi?id=137722

Reviewed by Simon Fraser.

Use is<>() / downcast<>() for PlatformCAAnimation subclasses and clean
up the surrounding code.

Source/WebCore:

No new tests, no behavior change.

* page/mac/ServicesOverlayController.mm:
(WebCore::ServicesOverlayController::Highlight::fadeIn):
(WebCore::ServicesOverlayController::Highlight::fadeOut):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::moveOrCopyLayerAnimation):
(WebCore::GraphicsLayerCA::updateAnimations):
(WebCore::GraphicsLayerCA::setAnimationOnLayer):
(WebCore::GraphicsLayerCA::pauseCAAnimationOnLayer):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/PlatformCAAnimation.h:
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/mac/PlatformCAAnimationMac.h:
* platform/graphics/ca/mac/PlatformCAAnimationMac.mm:
(PlatformCAAnimationMac::copy):
(PlatformCAAnimationMac::copyTimingFunctionFrom):
(PlatformCAAnimationMac::copyFromValueFrom):
(PlatformCAAnimationMac::copyToValueFrom):
(PlatformCAAnimationMac::copyValuesFrom):
(PlatformCAAnimationMac::copyKeyTimesFrom):
(PlatformCAAnimationMac::copyTimingFunctionsFrom):
* platform/graphics/ca/mac/PlatformCALayerMac.h:
* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(PlatformCALayerMac::addAnimationForKey):
* platform/graphics/ca/win/PlatformCAAnimationWin.cpp:
(PlatformCAAnimationWin::copy):
(PlatformCAAnimationWin::copyTimingFunctionFrom):
(PlatformCAAnimationWin::copyFromValueFrom):
(PlatformCAAnimationWin::copyToValueFrom):
(PlatformCAAnimationWin::copyValuesFrom):
(PlatformCAAnimationWin::copyKeyTimesFrom):
(PlatformCAAnimationWin::copyTimingFunctionsFrom):
* platform/graphics/ca/win/PlatformCAAnimationWin.h:
* platform/graphics/ca/win/PlatformCALayerWin.cpp:
(PlatformCALayerWin::addAnimationForKey):
* platform/graphics/ca/win/PlatformCALayerWin.h:

Source/WebKit2:

* WebProcess/WebPage/mac/PlatformCAAnimationRemote.h:
* WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm:
(WebKit::PlatformCAAnimationRemote::copy):
(WebKit::PlatformCAAnimationRemote::copyTimingFunctionFrom):
(WebKit::PlatformCAAnimationRemote::copyFromValueFrom):
(WebKit::PlatformCAAnimationRemote::copyToValueFrom):
(WebKit::PlatformCAAnimationRemote::copyValuesFrom):
(WebKit::PlatformCAAnimationRemote::copyKeyTimesFrom):
(WebKit::PlatformCAAnimationRemote::copyTimingFunctionsFrom):
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::addAnimationForKey):
(WebKit::PlatformCALayerRemote::animationStarted):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::commitTransientZoom):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (174714 => 174715)


--- trunk/Source/WebCore/ChangeLog	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebCore/ChangeLog	2014-10-15 00:41:01 UTC (rev 174715)
@@ -1,5 +1,53 @@
 2014-10-14  Chris Dumez  <[email protected]>
 
+        Use is<>() / downcast<>() for PlatformCAAnimation subclasses
+        https://bugs.webkit.org/show_bug.cgi?id=137722
+
+        Reviewed by Simon Fraser.
+
+        Use is<>() / downcast<>() for PlatformCAAnimation subclasses and clean
+        up the surrounding code.
+
+        No new tests, no behavior change.
+
+        * page/mac/ServicesOverlayController.mm:
+        (WebCore::ServicesOverlayController::Highlight::fadeIn):
+        (WebCore::ServicesOverlayController::Highlight::fadeOut):
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::moveOrCopyLayerAnimation):
+        (WebCore::GraphicsLayerCA::updateAnimations):
+        (WebCore::GraphicsLayerCA::setAnimationOnLayer):
+        (WebCore::GraphicsLayerCA::pauseCAAnimationOnLayer):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        * platform/graphics/ca/PlatformCAAnimation.h:
+        * platform/graphics/ca/PlatformCALayer.h:
+        * platform/graphics/ca/mac/PlatformCAAnimationMac.h:
+        * platform/graphics/ca/mac/PlatformCAAnimationMac.mm:
+        (PlatformCAAnimationMac::copy):
+        (PlatformCAAnimationMac::copyTimingFunctionFrom):
+        (PlatformCAAnimationMac::copyFromValueFrom):
+        (PlatformCAAnimationMac::copyToValueFrom):
+        (PlatformCAAnimationMac::copyValuesFrom):
+        (PlatformCAAnimationMac::copyKeyTimesFrom):
+        (PlatformCAAnimationMac::copyTimingFunctionsFrom):
+        * platform/graphics/ca/mac/PlatformCALayerMac.h:
+        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+        (PlatformCALayerMac::addAnimationForKey):
+        * platform/graphics/ca/win/PlatformCAAnimationWin.cpp:
+        (PlatformCAAnimationWin::copy):
+        (PlatformCAAnimationWin::copyTimingFunctionFrom):
+        (PlatformCAAnimationWin::copyFromValueFrom):
+        (PlatformCAAnimationWin::copyToValueFrom):
+        (PlatformCAAnimationWin::copyValuesFrom):
+        (PlatformCAAnimationWin::copyKeyTimesFrom):
+        (PlatformCAAnimationWin::copyTimingFunctionsFrom):
+        * platform/graphics/ca/win/PlatformCAAnimationWin.h:
+        * platform/graphics/ca/win/PlatformCALayerWin.cpp:
+        (PlatformCALayerWin::addAnimationForKey):
+        * platform/graphics/ca/win/PlatformCALayerWin.h:
+
+2014-10-14  Chris Dumez  <[email protected]>
+
         Use is<>() / downcast<>() for RenderInline
         https://bugs.webkit.org/show_bug.cgi?id=137704
 

Modified: trunk/Source/WebCore/page/mac/ServicesOverlayController.mm (174714 => 174715)


--- trunk/Source/WebCore/page/mac/ServicesOverlayController.mm	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebCore/page/mac/ServicesOverlayController.mm	2014-10-15 00:41:01 UTC (rev 174715)
@@ -178,7 +178,7 @@
     [animation setToValue:@1];
 
     RefPtr<PlatformCAAnimation> platformAnimation = PlatformCAAnimationMac::create(animation.get());
-    downcast<GraphicsLayerCA>(*layer()).platformCALayer()->addAnimationForKey("FadeHighlightIn", platformAnimation.get());
+    downcast<GraphicsLayerCA>(*layer()).platformCALayer()->addAnimationForKey("FadeHighlightIn", *platformAnimation);
 }
 
 void ServicesOverlayController::Highlight::fadeOut()
@@ -196,7 +196,7 @@
     }];
 
     RefPtr<PlatformCAAnimation> platformAnimation = PlatformCAAnimationMac::create(animation.get());
-    downcast<GraphicsLayerCA>(*layer()).platformCALayer()->addAnimationForKey("FadeHighlightOut", platformAnimation.get());
+    downcast<GraphicsLayerCA>(*layer()).platformCALayer()->addAnimationForKey("FadeHighlightOut", *platformAnimation);
     [CATransaction commit];
 }
 

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (174714 => 174715)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2014-10-15 00:41:01 UTC (rev 174715)
@@ -549,11 +549,11 @@
     switch (operation) {
     case Move:
         fromLayer->removeAnimationForKey(animationIdentifier);
-        toLayer->addAnimationForKey(animationIdentifier, anim.get());
+        toLayer->addAnimationForKey(animationIdentifier, *anim);
         break;
 
     case Copy:
-        toLayer->addAnimationForKey(animationIdentifier, anim.get());
+        toLayer->addAnimationForKey(animationIdentifier, *anim);
         break;
     }
 }
@@ -2109,7 +2109,7 @@
     if ((numAnimations = m_uncomittedAnimations.size())) {
         for (size_t i = 0; i < numAnimations; ++i) {
             const LayerPropertyAnimation& pendingAnimation = m_uncomittedAnimations[i];
-            setAnimationOnLayer(pendingAnimation.m_animation.get(), pendingAnimation.m_property, pendingAnimation.m_name, pendingAnimation.m_index, pendingAnimation.m_subIndex, pendingAnimation.m_timeOffset);
+            setAnimationOnLayer(*pendingAnimation.m_animation, pendingAnimation.m_property, pendingAnimation.m_name, pendingAnimation.m_index, pendingAnimation.m_subIndex, pendingAnimation.m_timeOffset);
             
             AnimationsMap::iterator it = m_runningAnimations.find(pendingAnimation.m_name);
             if (it == m_runningAnimations.end()) {
@@ -2141,12 +2141,12 @@
     return false;
 }
 
-void GraphicsLayerCA::setAnimationOnLayer(PlatformCAAnimation* caAnim, AnimatedPropertyID property, const String& animationName, int index, int subIndex, double timeOffset)
+void GraphicsLayerCA::setAnimationOnLayer(PlatformCAAnimation& caAnim, AnimatedPropertyID property, const String& animationName, int index, int subIndex, double timeOffset)
 {
     PlatformCALayer* layer = animatedLayer(property);
 
     if (timeOffset)
-        caAnim->setBeginTime(CACurrentMediaTime() - timeOffset);
+        caAnim.setBeginTime(CACurrentMediaTime() - timeOffset);
 
     String animationID = animationIdentifier(animationName, property, index, subIndex);
 
@@ -2221,7 +2221,7 @@
     newAnim->setSpeed(0);
     newAnim->setTimeOffset(timeOffset);
     
-    layer->addAnimationForKey(animationID, newAnim.get()); // This will replace the running animation.
+    layer->addAnimationForKey(animationID, *newAnim); // This will replace the running animation.
 
     // Pause the animations on the clones too.
     if (LayerMap* layerCloneMap = animatedLayerClones(property)) {
@@ -2230,7 +2230,7 @@
             // Skip immediate replicas, since they move with the original.
             if (m_replicaLayer && isReplicatedRootClone(it->key))
                 continue;
-            it->value->addAnimationForKey(animationID, newAnim.get());
+            it->value->addAnimationForKey(animationID, *newAnim);
         }
     }
 }

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (174714 => 174715)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2014-10-15 00:41:01 UTC (rev 174715)
@@ -388,7 +388,7 @@
     void ensureStructuralLayer(StructuralLayerPurpose);
     StructuralLayerPurpose structuralLayerPurpose() const;
 
-    void setAnimationOnLayer(PlatformCAAnimation*, AnimatedPropertyID, const String& animationName, int index, int subIndex, double timeOffset);
+    void setAnimationOnLayer(PlatformCAAnimation&, AnimatedPropertyID, const String& animationName, int index, int subIndex, double timeOffset);
     bool removeCAAnimationFromLayer(AnimatedPropertyID, const String& animationName, int index, int subINdex);
     void pauseCAAnimationOnLayer(AnimatedPropertyID, const String& animationName, int index, int subIndex, double timeOffset);
 

Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCAAnimation.h (174714 => 174715)


--- trunk/Source/WebCore/platform/graphics/ca/PlatformCAAnimation.h	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCAAnimation.h	2014-10-15 00:41:01 UTC (rev 174715)
@@ -31,6 +31,7 @@
 #include "FloatPoint3D.h"
 #include "TransformationMatrix.h"
 #include <wtf/RefCounted.h>
+#include <wtf/TypeCasts.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {
@@ -77,7 +78,7 @@
     virtual void setFillMode(FillModeType) = 0;
     
     virtual void setTimingFunction(const TimingFunction*, bool reverse = false) = 0;
-    virtual void copyTimingFunctionFrom(const PlatformCAAnimation*) = 0;
+    virtual void copyTimingFunctionFrom(const PlatformCAAnimation&) = 0;
 
     virtual bool isRemovedOnCompletion() const = 0;
     virtual void setRemovedOnCompletion(bool) = 0;
@@ -94,14 +95,14 @@
     virtual void setFromValue(const FloatPoint3D&) = 0;
     virtual void setFromValue(const WebCore::Color&) = 0;
     virtual void setFromValue(const FilterOperation*, int internalFilterPropertyIndex) = 0;
-    virtual void copyFromValueFrom(const PlatformCAAnimation*) = 0;
+    virtual void copyFromValueFrom(const PlatformCAAnimation&) = 0;
 
     virtual void setToValue(float) = 0;
     virtual void setToValue(const WebCore::TransformationMatrix&) = 0;
     virtual void setToValue(const FloatPoint3D&) = 0;
     virtual void setToValue(const WebCore::Color&) = 0;
     virtual void setToValue(const FilterOperation*, int internalFilterPropertyIndex) = 0;
-    virtual void copyToValueFrom(const PlatformCAAnimation*) = 0;
+    virtual void copyToValueFrom(const PlatformCAAnimation&) = 0;
 
     // Keyframe-animation properties.
     virtual void setValues(const Vector<float>&) = 0;
@@ -109,13 +110,13 @@
     virtual void setValues(const Vector<FloatPoint3D>&) = 0;
     virtual void setValues(const Vector<WebCore::Color>&) = 0;
     virtual void setValues(const Vector<RefPtr<FilterOperation>>&, int internalFilterPropertyIndex) = 0;
-    virtual void copyValuesFrom(const PlatformCAAnimation*) = 0;
+    virtual void copyValuesFrom(const PlatformCAAnimation&) = 0;
 
     virtual void setKeyTimes(const Vector<float>&) = 0;
-    virtual void copyKeyTimesFrom(const PlatformCAAnimation*) = 0;
+    virtual void copyKeyTimesFrom(const PlatformCAAnimation&) = 0;
 
     virtual void setTimingFunctions(const Vector<const TimingFunction*>&, bool reverse = false) = 0;
-    virtual void copyTimingFunctionsFrom(const PlatformCAAnimation*) = 0;
+    virtual void copyTimingFunctionsFrom(const PlatformCAAnimation&) = 0;
 
     void setActualStartTimeIfNeeded(CFTimeInterval t)
     {
@@ -135,9 +136,11 @@
     AnimationType m_type;
 };
 
-#define PLATFORM_CAANIMATION_TYPE_CASTS(ToValueTypeName, predicate) \
-    TYPE_CASTS_BASE(ToValueTypeName, WebCore::PlatformCAAnimation, object, object->predicate, object.predicate)
+} // namespace WebCore
 
-}
+#define SPECIALIZE_TYPE_TRAITS_CAANIMATION(ToValueTypeName, predicate) \
+SPECIALIZE_TYPE_TRAITS_BEGIN(ToValueTypeName) \
+    static bool isType(const WebCore::PlatformCAAnimation& animation) { return animation.predicate; } \
+SPECIALIZE_TYPE_TRAITS_END()
 
 #endif // PlatformCAAnimation_h

Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (174714 => 174715)


--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2014-10-15 00:41:01 UTC (rev 174715)
@@ -127,7 +127,7 @@
     // Any sublayers previously in the current layer are removed.
     virtual void adoptSublayers(PlatformCALayer& source) = 0;
 
-    virtual void addAnimationForKey(const String& key, PlatformCAAnimation*) = 0;
+    virtual void addAnimationForKey(const String& key, PlatformCAAnimation&) = 0;
     virtual void removeAnimationForKey(const String& key) = 0;
     virtual PassRefPtr<PlatformCAAnimation> animationForKey(const String& key) = 0;
 

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCAAnimationMac.h (174714 => 174715)


--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCAAnimationMac.h	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCAAnimationMac.h	2014-10-15 00:41:01 UTC (rev 174715)
@@ -83,7 +83,7 @@
     virtual void setFillMode(FillModeType) override;
     
     virtual void setTimingFunction(const TimingFunction*, bool reverse = false) override;
-    void copyTimingFunctionFrom(const PlatformCAAnimation*) override;
+    void copyTimingFunctionFrom(const PlatformCAAnimation&) override;
 
     virtual bool isRemovedOnCompletion() const override;
     virtual void setRemovedOnCompletion(bool) override;
@@ -100,14 +100,14 @@
     virtual void setFromValue(const FloatPoint3D&) override;
     virtual void setFromValue(const WebCore::Color&) override;
     virtual void setFromValue(const FilterOperation*, int internalFilterPropertyIndex) override;
-    virtual void copyFromValueFrom(const PlatformCAAnimation*) override;
+    virtual void copyFromValueFrom(const PlatformCAAnimation&) override;
 
     virtual void setToValue(float) override;
     virtual void setToValue(const WebCore::TransformationMatrix&) override;
     virtual void setToValue(const FloatPoint3D&) override;
     virtual void setToValue(const WebCore::Color&) override;
     virtual void setToValue(const FilterOperation*, int internalFilterPropertyIndex) override;
-    virtual void copyToValueFrom(const PlatformCAAnimation*) override;
+    virtual void copyToValueFrom(const PlatformCAAnimation&) override;
 
     // Keyframe-animation properties.
     virtual void setValues(const Vector<float>&) override;
@@ -115,13 +115,13 @@
     virtual void setValues(const Vector<FloatPoint3D>&) override;
     virtual void setValues(const Vector<WebCore::Color>&) override;
     virtual void setValues(const Vector<RefPtr<FilterOperation>>&, int internalFilterPropertyIndex) override;
-    virtual void copyValuesFrom(const PlatformCAAnimation*) override;
+    virtual void copyValuesFrom(const PlatformCAAnimation&) override;
 
     virtual void setKeyTimes(const Vector<float>&) override;
-    virtual void copyKeyTimesFrom(const PlatformCAAnimation*) override;
+    virtual void copyKeyTimesFrom(const PlatformCAAnimation&) override;
 
     virtual void setTimingFunctions(const Vector<const TimingFunction*>&, bool reverse = false) override;
-    virtual void copyTimingFunctionsFrom(const PlatformCAAnimation*) override;
+    virtual void copyTimingFunctionsFrom(const PlatformCAAnimation&) override;
 
 protected:
     PlatformCAAnimationMac(AnimationType, const String& keyPath);
@@ -131,8 +131,8 @@
     RetainPtr<CAPropertyAnimation> m_animation;
 };
 
-PLATFORM_CAANIMATION_TYPE_CASTS(PlatformCAAnimationMac, isPlatformCAAnimationMac())
+} // namespace WebCore
 
-}
+SPECIALIZE_TYPE_TRAITS_CAANIMATION(WebCore::PlatformCAAnimationMac, isPlatformCAAnimationMac())
 
 #endif // PlatformCAAnimationMac_h

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCAAnimationMac.mm (174714 => 174715)


--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCAAnimationMac.mm	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCAAnimationMac.mm	2014-10-15 00:41:01 UTC (rev 174715)
@@ -199,19 +199,19 @@
     animation->setFillMode(fillMode());
     animation->setRemovedOnCompletion(isRemovedOnCompletion());
     animation->setAdditive(isAdditive());
-    animation->copyTimingFunctionFrom(this);
+    animation->copyTimingFunctionFrom(*this);
     animation->setValueFunction(valueFunction());
 
-    setHasExplicitBeginTime(toPlatformCAAnimationMac(animation.get())->platformAnimation(), hasExplicitBeginTime(platformAnimation()));
+    setHasExplicitBeginTime(downcast<PlatformCAAnimationMac>(*animation).platformAnimation(), hasExplicitBeginTime(platformAnimation()));
     
     // Copy the specific Basic or Keyframe values.
     if (animationType() == Keyframe) {
-        animation->copyValuesFrom(this);
-        animation->copyKeyTimesFrom(this);
-        animation->copyTimingFunctionsFrom(this);
+        animation->copyValuesFrom(*this);
+        animation->copyKeyTimesFrom(*this);
+        animation->copyTimingFunctionsFrom(*this);
     } else {
-        animation->copyFromValueFrom(this);
-        animation->copyToValueFrom(this);
+        animation->copyFromValueFrom(*this);
+        animation->copyToValueFrom(*this);
     }
     
     return animation;
@@ -309,9 +309,9 @@
     [m_animation setTimingFunction:toCAMediaTimingFunction(value, reverse)];
 }
 
-void PlatformCAAnimationMac::copyTimingFunctionFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationMac::copyTimingFunctionFrom(const PlatformCAAnimation& value)
 {
-    [m_animation setTimingFunction:[toPlatformCAAnimationMac(value)->m_animation.get() timingFunction]];
+    [m_animation setTimingFunction:[downcast<PlatformCAAnimationMac>(value).m_animation.get() timingFunction]];
 }
 
 bool PlatformCAAnimationMac::isRemovedOnCompletion() const
@@ -393,12 +393,12 @@
     [static_cast<CABasicAnimation*>(m_animation.get()) setFromValue:value.get()];
 }
 
-void PlatformCAAnimationMac::copyFromValueFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationMac::copyFromValueFrom(const PlatformCAAnimation& value)
 {
-    if (animationType() != Basic || value->animationType() != Basic)
+    if (animationType() != Basic || value.animationType() != Basic)
         return;
         
-    CABasicAnimation* otherAnimation = static_cast<CABasicAnimation*>(toPlatformCAAnimationMac(value)->m_animation.get());
+    CABasicAnimation* otherAnimation = static_cast<CABasicAnimation*>(downcast<PlatformCAAnimationMac>(value).m_animation.get());
     [static_cast<CABasicAnimation*>(m_animation.get()) setFromValue:[otherAnimation fromValue]];
 }
 
@@ -450,12 +450,12 @@
     [static_cast<CABasicAnimation*>(m_animation.get()) setToValue:value.get()];
 }
 
-void PlatformCAAnimationMac::copyToValueFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationMac::copyToValueFrom(const PlatformCAAnimation& value)
 {
-    if (animationType() != Basic || value->animationType() != Basic)
+    if (animationType() != Basic || value.animationType() != Basic)
         return;
         
-    CABasicAnimation* otherAnimation = static_cast<CABasicAnimation*>(toPlatformCAAnimationMac(value)->m_animation.get());
+    CABasicAnimation* otherAnimation = static_cast<CABasicAnimation*>(downcast<PlatformCAAnimationMac>(value).m_animation.get());
     [static_cast<CABasicAnimation*>(m_animation.get()) setToValue:[otherAnimation toValue]];
 }
 
@@ -536,12 +536,12 @@
     [static_cast<CAKeyframeAnimation*>(m_animation.get()) setValues:array];
 }
 
-void PlatformCAAnimationMac::copyValuesFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationMac::copyValuesFrom(const PlatformCAAnimation& value)
 {
-    if (animationType() != Keyframe || value->animationType() != Keyframe)
+    if (animationType() != Keyframe || value.animationType() != Keyframe)
         return;
         
-    CAKeyframeAnimation* otherAnimation = static_cast<CAKeyframeAnimation*>(toPlatformCAAnimationMac(value)->m_animation.get());
+    CAKeyframeAnimation* otherAnimation = static_cast<CAKeyframeAnimation*>(downcast<PlatformCAAnimationMac>(value).m_animation.get());
     [static_cast<CAKeyframeAnimation*>(m_animation.get()) setValues:[otherAnimation values]];
 }
 
@@ -555,9 +555,9 @@
     [static_cast<CAKeyframeAnimation*>(m_animation.get()) setKeyTimes:array];
 }
 
-void PlatformCAAnimationMac::copyKeyTimesFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationMac::copyKeyTimesFrom(const PlatformCAAnimation& value)
 {
-    CAKeyframeAnimation* other = static_cast<CAKeyframeAnimation*>(toPlatformCAAnimationMac(value)->m_animation.get());
+    CAKeyframeAnimation* other = static_cast<CAKeyframeAnimation*>(downcast<PlatformCAAnimationMac>(value).m_animation.get());
     [static_cast<CAKeyframeAnimation*>(m_animation.get()) setKeyTimes:[other keyTimes]];
 }
 
@@ -571,8 +571,8 @@
     [static_cast<CAKeyframeAnimation*>(m_animation.get()) setTimingFunctions:array];
 }
 
-void PlatformCAAnimationMac::copyTimingFunctionsFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationMac::copyTimingFunctionsFrom(const PlatformCAAnimation& value)
 {
-    CAKeyframeAnimation* other = static_cast<CAKeyframeAnimation*>(toPlatformCAAnimationMac(value)->m_animation.get());
+    CAKeyframeAnimation* other = static_cast<CAKeyframeAnimation*>(downcast<PlatformCAAnimationMac>(value).m_animation.get());
     [static_cast<CAKeyframeAnimation*>(m_animation.get()) setTimingFunctions:[other timingFunctions]];
 }

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h (174714 => 174715)


--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h	2014-10-15 00:41:01 UTC (rev 174715)
@@ -61,7 +61,7 @@
     virtual const PlatformCALayerList* customSublayers() const override { return m_customSublayers.get(); }
     virtual void adoptSublayers(PlatformCALayer& source) override;
 
-    virtual void addAnimationForKey(const String& key, PlatformCAAnimation*) override;
+    virtual void addAnimationForKey(const String& key, PlatformCAAnimation&) override;
     virtual void removeAnimationForKey(const String& key) override;
     virtual PassRefPtr<PlatformCAAnimation> animationForKey(const String& key) override;
     virtual void animationStarted(const String& key, CFTimeInterval beginTime) override;

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (174714 => 174715)


--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2014-10-15 00:41:01 UTC (rev 174715)
@@ -453,7 +453,7 @@
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
-void PlatformCALayerMac::addAnimationForKey(const String& key, PlatformCAAnimation* animation)
+void PlatformCALayerMac::addAnimationForKey(const String& key, PlatformCAAnimation& animation)
 {
     // Add the delegate
     if (!m_delegate) {
@@ -462,7 +462,7 @@
         [webAnimationDelegate setOwner:this];
     }
     
-    CAPropertyAnimation* propertyAnimation = static_cast<CAPropertyAnimation*>(toPlatformCAAnimationMac(animation)->platformAnimation());
+    CAPropertyAnimation* propertyAnimation = static_cast<CAPropertyAnimation*>(downcast<PlatformCAAnimationMac>(animation).platformAnimation());
     if (![propertyAnimation delegate])
         [propertyAnimation setDelegate:static_cast<id>(m_delegate.get())];
      

Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp (174714 => 174715)


--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp	2014-10-15 00:41:01 UTC (rev 174715)
@@ -190,18 +190,18 @@
     animation->setFillMode(fillMode());
     animation->setRemovedOnCompletion(isRemovedOnCompletion());
     animation->setAdditive(isAdditive());
-    animation->copyTimingFunctionFrom(this);
+    animation->copyTimingFunctionFrom(*this);
     if (valueFunction())
         animation->setValueFunction(valueFunction());
     
     // Copy the specific Basic or Keyframe values
     if (animationType() == Keyframe) {
-        animation->copyValuesFrom(this);
-        animation->copyKeyTimesFrom(this);
-        animation->copyTimingFunctionsFrom(this);
+        animation->copyValuesFrom(*this);
+        animation->copyKeyTimesFrom(*this);
+        animation->copyTimingFunctionsFrom(*this);
     } else {
-        animation->copyFromValueFrom(this);
-        animation->copyToValueFrom(this);
+        animation->copyFromValueFrom(*this);
+        animation->copyToValueFrom(*this);
     }
     
     return animation;
@@ -297,9 +297,9 @@
     CACFAnimationSetTimingFunction(m_animation.get(), toCACFTimingFunction(value, reverse).get());
 }
 
-void PlatformCAAnimationWin::copyTimingFunctionFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationWin::copyTimingFunctionFrom(const PlatformCAAnimation& value)
 {
-    CACFTimingFunctionRef timingFunc = CACFAnimationGetTimingFunction(toPlatformCAAnimationWin(value)->m_animation.get());
+    CACFTimingFunctionRef timingFunc = CACFAnimationGetTimingFunction(downcast<PlatformCAAnimationWin>(value).m_animation.get());
     if (timingFunc)
         CACFAnimationSetTimingFunction(m_animation.get(), timingFunc);
 }
@@ -379,12 +379,12 @@
     // FIXME: Hardware filter animation not implemented on Windows
 }
 
-void PlatformCAAnimationWin::copyFromValueFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationWin::copyFromValueFrom(const PlatformCAAnimation& value)
 {
-    if (animationType() != Basic || value->animationType() != Basic)
+    if (animationType() != Basic || value.animationType() != Basic)
         return;
     
-    CACFAnimationSetFromValue(m_animation.get(), CACFAnimationGetFromValue(toPlatformCAAnimationWin(value)->platformAnimation()));
+    CACFAnimationSetFromValue(m_animation.get(), CACFAnimationGetFromValue(downcast<PlatformCAAnimationWin>(value).platformAnimation()));
 }
 
 void PlatformCAAnimationWin::setToValue(float value)
@@ -430,12 +430,12 @@
     // FIXME: Hardware filter animation not implemented on Windows
 }
 
-void PlatformCAAnimationWin::copyToValueFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationWin::copyToValueFrom(const PlatformCAAnimation& value)
 {
-    if (animationType() != Basic || value->animationType() != Basic)
+    if (animationType() != Basic || value.animationType() != Basic)
         return;
         
-    CACFAnimationSetToValue(m_animation.get(), CACFAnimationGetToValue(toPlatformCAAnimationWin(value)->platformAnimation()));
+    CACFAnimationSetToValue(m_animation.get(), CACFAnimationGetToValue(downcast<PlatformCAAnimationWin>(value).platformAnimation()));
 }
 
 // Keyframe-animation properties.
@@ -502,12 +502,12 @@
     // FIXME: Hardware filter animation not implemented on Windows
 }
 
-void PlatformCAAnimationWin::copyValuesFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationWin::copyValuesFrom(const PlatformCAAnimation& value)
 {
-    if (animationType() != Keyframe || value->animationType() != Keyframe)
+    if (animationType() != Keyframe || value.animationType() != Keyframe)
         return;
     
-    CACFAnimationSetValues(m_animation.get(), CACFAnimationGetValues(toPlatformCAAnimationWin(value)->platformAnimation()));
+    CACFAnimationSetValues(m_animation.get(), CACFAnimationGetValues(downcast<PlatformCAAnimationWin>(value).platformAnimation()));
 }
 
 void PlatformCAAnimationWin::setKeyTimes(const Vector<float>& value)
@@ -524,12 +524,12 @@
     CACFAnimationSetKeyTimes(m_animation.get(), array.get());
 }
 
-void PlatformCAAnimationWin::copyKeyTimesFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationWin::copyKeyTimesFrom(const PlatformCAAnimation& value)
 {
     if (animationType() != Keyframe)
         return;
 
-    CACFAnimationSetKeyTimes(m_animation.get(), CACFAnimationGetKeyTimes(toPlatformCAAnimationWin(value)->platformAnimation()));
+    CACFAnimationSetKeyTimes(m_animation.get(), CACFAnimationGetKeyTimes(downcast<PlatformCAAnimationWin>(value).platformAnimation()));
 }
 
 void PlatformCAAnimationWin::setTimingFunctions(const Vector<const TimingFunction*>& value, bool reverse)
@@ -547,9 +547,9 @@
     CACFAnimationSetTimingFunctions(m_animation.get(), array.get());
 }
 
-void PlatformCAAnimationWin::copyTimingFunctionsFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationWin::copyTimingFunctionsFrom(const PlatformCAAnimation& value)
 {
-    CACFAnimationSetTimingFunctions(m_animation.get(), CACFAnimationGetTimingFunctions(toPlatformCAAnimationWin(value)->platformAnimation()));
+    CACFAnimationSetTimingFunctions(m_animation.get(), CACFAnimationGetTimingFunctions(downcast<PlatformCAAnimationWin>(value).platformAnimation()));
 }
 
 #endif // PLATFORM(WIN)

Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.h (174714 => 174715)


--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.h	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.h	2014-10-15 00:41:01 UTC (rev 174715)
@@ -73,7 +73,7 @@
     virtual void setFillMode(FillModeType) override;
     
     virtual void setTimingFunction(const TimingFunction*, bool reverse = false) override;
-    void copyTimingFunctionFrom(const PlatformCAAnimation*) override;
+    void copyTimingFunctionFrom(const PlatformCAAnimation&) override;
 
     virtual bool isRemovedOnCompletion() const override;
     virtual void setRemovedOnCompletion(bool) override;
@@ -90,14 +90,14 @@
     virtual void setFromValue(const FloatPoint3D&) override;
     virtual void setFromValue(const WebCore::Color&) override;
     virtual void setFromValue(const FilterOperation*, int internalFilterPropertyIndex) override;
-    virtual void copyFromValueFrom(const PlatformCAAnimation*) override;
+    virtual void copyFromValueFrom(const PlatformCAAnimation&) override;
 
     virtual void setToValue(float) override;
     virtual void setToValue(const WebCore::TransformationMatrix&) override;
     virtual void setToValue(const FloatPoint3D&) override;
     virtual void setToValue(const WebCore::Color&) override;
     virtual void setToValue(const FilterOperation*, int internalFilterPropertyIndex) override;
-    virtual void copyToValueFrom(const PlatformCAAnimation*) override;
+    virtual void copyToValueFrom(const PlatformCAAnimation&) override;
 
     // Keyframe-animation properties.
     virtual void setValues(const Vector<float>&) override;
@@ -105,13 +105,13 @@
     virtual void setValues(const Vector<FloatPoint3D>&) override;
     virtual void setValues(const Vector<WebCore::Color>&) override;
     virtual void setValues(const Vector<RefPtr<FilterOperation>>&, int internalFilterPropertyIndex) override;
-    virtual void copyValuesFrom(const PlatformCAAnimation*) override;
+    virtual void copyValuesFrom(const PlatformCAAnimation&) override;
 
     virtual void setKeyTimes(const Vector<float>&) override;
-    virtual void copyKeyTimesFrom(const PlatformCAAnimation*) override;
+    virtual void copyKeyTimesFrom(const PlatformCAAnimation&) override;
 
     virtual void setTimingFunctions(const Vector<const TimingFunction*>&, bool reverse = false) override;
-    virtual void copyTimingFunctionsFrom(const PlatformCAAnimation*) override;
+    virtual void copyTimingFunctionsFrom(const PlatformCAAnimation&) override;
 
 protected:
     PlatformCAAnimationWin(AnimationType, const String& keyPath);
@@ -121,9 +121,9 @@
     RetainPtr<CACFAnimationRef> m_animation;
 };
 
-PLATFORM_CAANIMATION_TYPE_CASTS(PlatformCAAnimationWin, isPlatformCAAnimationWin())
+} // namespace WebCore
 
-}
+SPECIALIZE_TYPE_TRAITS_CAANIMATION(WebCore::PlatformCAAnimationWin, isPlatformCAAnimationWin())
 
 #endif // PLATFORM(WIN)
 

Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp (174714 => 174715)


--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp	2014-10-15 00:41:01 UTC (rev 174715)
@@ -309,12 +309,12 @@
     setSublayers(sublayers);
 }
 
-void PlatformCALayerWin::addAnimationForKey(const String& key, PlatformCAAnimation* animation)
+void PlatformCALayerWin::addAnimationForKey(const String& key, PlatformCAAnimation& animation)
 {
     // Add it to the animation list
-    m_animations.add(key, animation);
+    m_animations.add(key, &animation);
 
-    CACFLayerAddAnimation(m_layer.get(), key.createCFString().get(), toPlatformCAAnimationWin(animation)->platformAnimation());
+    CACFLayerAddAnimation(m_layer.get(), key.createCFString().get(), downcast<PlatformCAAnimationWin>(animation).platformAnimation());
     setNeedsCommit();
 
     // Tell the host about it so we can fire the start animation event

Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h (174714 => 174715)


--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h	2014-10-15 00:41:01 UTC (rev 174715)
@@ -52,7 +52,7 @@
     virtual const PlatformCALayerList* customSublayers() const override { return m_customSublayers.get(); }
     virtual void adoptSublayers(PlatformCALayer& source) override;
 
-    virtual void addAnimationForKey(const String& key, PlatformCAAnimation*) override;
+    virtual void addAnimationForKey(const String& key, PlatformCAAnimation&) override;
     virtual void removeAnimationForKey(const String& key) override;
     virtual PassRefPtr<PlatformCAAnimation> animationForKey(const String& key) override;
     virtual void animationStarted(const String& key, CFTimeInterval beginTime) override;

Modified: trunk/Source/WebKit2/ChangeLog (174714 => 174715)


--- trunk/Source/WebKit2/ChangeLog	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebKit2/ChangeLog	2014-10-15 00:41:01 UTC (rev 174715)
@@ -1,3 +1,29 @@
+2014-10-14  Chris Dumez  <[email protected]>
+
+        Use is<>() / downcast<>() for PlatformCAAnimation subclasses
+        https://bugs.webkit.org/show_bug.cgi?id=137722
+
+        Reviewed by Simon Fraser.
+
+        Use is<>() / downcast<>() for PlatformCAAnimation subclasses and clean
+        up the surrounding code.
+
+        * WebProcess/WebPage/mac/PlatformCAAnimationRemote.h:
+        * WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm:
+        (WebKit::PlatformCAAnimationRemote::copy):
+        (WebKit::PlatformCAAnimationRemote::copyTimingFunctionFrom):
+        (WebKit::PlatformCAAnimationRemote::copyFromValueFrom):
+        (WebKit::PlatformCAAnimationRemote::copyToValueFrom):
+        (WebKit::PlatformCAAnimationRemote::copyValuesFrom):
+        (WebKit::PlatformCAAnimationRemote::copyKeyTimesFrom):
+        (WebKit::PlatformCAAnimationRemote::copyTimingFunctionsFrom):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::addAnimationForKey):
+        (WebKit::PlatformCALayerRemote::animationStarted):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::commitTransientZoom):
+
 2014-10-14  Alexey Proskuryakov  <[email protected]>
 
         REGRESSION (r165356): Issues with Japanese text input

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCAAnimationRemote.h (174714 => 174715)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCAAnimationRemote.h	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCAAnimationRemote.h	2014-10-15 00:41:01 UTC (rev 174715)
@@ -75,7 +75,7 @@
     virtual void setFillMode(FillModeType) override;
 
     virtual void setTimingFunction(const WebCore::TimingFunction*, bool reverse = false) override;
-    void copyTimingFunctionFrom(const WebCore::PlatformCAAnimation*) override;
+    void copyTimingFunctionFrom(const WebCore::PlatformCAAnimation&) override;
 
     virtual bool isRemovedOnCompletion() const override;
     virtual void setRemovedOnCompletion(bool) override;
@@ -92,14 +92,14 @@
     virtual void setFromValue(const WebCore::FloatPoint3D&) override;
     virtual void setFromValue(const WebCore::Color&) override;
     virtual void setFromValue(const WebCore::FilterOperation*, int internalFilterPropertyIndex) override;
-    virtual void copyFromValueFrom(const WebCore::PlatformCAAnimation*) override;
+    virtual void copyFromValueFrom(const WebCore::PlatformCAAnimation&) override;
 
     virtual void setToValue(float) override;
     virtual void setToValue(const WebCore::TransformationMatrix&) override;
     virtual void setToValue(const WebCore::FloatPoint3D&) override;
     virtual void setToValue(const WebCore::Color&) override;
     virtual void setToValue(const WebCore::FilterOperation*, int internalFilterPropertyIndex) override;
-    virtual void copyToValueFrom(const WebCore::PlatformCAAnimation*) override;
+    virtual void copyToValueFrom(const WebCore::PlatformCAAnimation&) override;
 
     // Keyframe-animation properties.
     virtual void setValues(const Vector<float>&) override;
@@ -107,13 +107,13 @@
     virtual void setValues(const Vector<WebCore::FloatPoint3D>&) override;
     virtual void setValues(const Vector<WebCore::Color>&) override;
     virtual void setValues(const Vector<RefPtr<WebCore::FilterOperation>>&, int internalFilterPropertyIndex) override;
-    virtual void copyValuesFrom(const WebCore::PlatformCAAnimation*) override;
+    virtual void copyValuesFrom(const WebCore::PlatformCAAnimation&) override;
 
     virtual void setKeyTimes(const Vector<float>&) override;
-    virtual void copyKeyTimesFrom(const WebCore::PlatformCAAnimation*) override;
+    virtual void copyKeyTimesFrom(const WebCore::PlatformCAAnimation&) override;
 
     virtual void setTimingFunctions(const Vector<const WebCore::TimingFunction*>&, bool reverse = false) override;
-    virtual void copyTimingFunctionsFrom(const WebCore::PlatformCAAnimation*) override;
+    virtual void copyTimingFunctionsFrom(const WebCore::PlatformCAAnimation&) override;
 
     AnimationType animationType() const { return m_properties.animationType; }
     void setHasExplicitBeginTime(bool hasExplicitBeginTime) { m_properties.hasExplicitBeginTime = hasExplicitBeginTime; }
@@ -297,8 +297,8 @@
     Properties m_properties;
 };
 
-PLATFORM_CAANIMATION_TYPE_CASTS(PlatformCAAnimationRemote, isPlatformCAAnimationRemote())
-
 } // namespace WebKit
 
+SPECIALIZE_TYPE_TRAITS_CAANIMATION(WebKit::PlatformCAAnimationRemote, isPlatformCAAnimationRemote())
+
 #endif // PlatformCAAnimationRemote_h

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm (174714 => 174715)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm	2014-10-15 00:41:01 UTC (rev 174715)
@@ -295,19 +295,19 @@
     animation->setFillMode(fillMode());
     animation->setRemovedOnCompletion(isRemovedOnCompletion());
     animation->setAdditive(isAdditive());
-    animation->copyTimingFunctionFrom(this);
+    animation->copyTimingFunctionFrom(*this);
     animation->setValueFunction(valueFunction());
 
-    toPlatformCAAnimationRemote(animation.get())->setHasExplicitBeginTime(hasExplicitBeginTime());
+    downcast<PlatformCAAnimationRemote>(*animation).setHasExplicitBeginTime(hasExplicitBeginTime());
     
     // Copy the specific Basic or Keyframe values.
     if (animationType() == Keyframe) {
-        animation->copyValuesFrom(this);
-        animation->copyKeyTimesFrom(this);
-        animation->copyTimingFunctionsFrom(this);
+        animation->copyValuesFrom(*this);
+        animation->copyKeyTimesFrom(*this);
+        animation->copyTimingFunctionsFrom(*this);
     } else {
-        animation->copyFromValueFrom(this);
-        animation->copyToValueFrom(this);
+        animation->copyFromValueFrom(*this);
+        animation->copyToValueFrom(*this);
     }
     
     return animation;
@@ -411,7 +411,7 @@
     m_properties.reverseTimingFunctions = reverse;
 }
 
-void PlatformCAAnimationRemote::copyTimingFunctionFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationRemote::copyTimingFunctionFrom(const PlatformCAAnimation& value)
 {
     copyTimingFunctionsFrom(value);
 }
@@ -491,15 +491,15 @@
     m_properties.keyValues[0] = KeyframeValue(operation->clone());
 }
 
-void PlatformCAAnimationRemote::copyFromValueFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationRemote::copyFromValueFrom(const PlatformCAAnimation& value)
 {
-    const PlatformCAAnimationRemote* other = toPlatformCAAnimationRemote(value);
+    const PlatformCAAnimationRemote& other = downcast<PlatformCAAnimationRemote>(value);
 
-    if (other->m_properties.keyValues.isEmpty())
+    if (other.m_properties.keyValues.isEmpty())
         return;
     
     m_properties.keyValues.resize(2);
-    m_properties.keyValues[0] = other->m_properties.keyValues[0];
+    m_properties.keyValues[0] = other.m_properties.keyValues[0];
 }
 
 void PlatformCAAnimationRemote::setToValue(float value)
@@ -549,14 +549,14 @@
     m_properties.keyValues[1] = KeyframeValue(operation->clone());
 }
 
-void PlatformCAAnimationRemote::copyToValueFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationRemote::copyToValueFrom(const PlatformCAAnimation& value)
 {
-    const PlatformCAAnimationRemote* other = toPlatformCAAnimationRemote(value);
+    const PlatformCAAnimationRemote& other = downcast<PlatformCAAnimationRemote>(value);
 
-    if (other->m_properties.keyValues.size() < 2)
+    if (other.m_properties.keyValues.size() < 2)
         return;
     m_properties.keyValues.resize(2);
-    m_properties.keyValues[1] = other->m_properties.keyValues[1];
+    m_properties.keyValues[1] = other.m_properties.keyValues[1];
 }
 
 // Keyframe-animation properties.
@@ -632,10 +632,9 @@
     m_properties.keyValues = WTF::move(keyframes);
 }
 
-void PlatformCAAnimationRemote::copyValuesFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationRemote::copyValuesFrom(const PlatformCAAnimation& value)
 {
-    const PlatformCAAnimationRemote* other = toPlatformCAAnimationRemote(value);
-    m_properties.keyValues = other->m_properties.keyValues;
+    m_properties.keyValues = downcast<PlatformCAAnimationRemote>(value).m_properties.keyValues;
 }
 
 void PlatformCAAnimationRemote::setKeyTimes(const Vector<float>& keyTimes)
@@ -643,10 +642,9 @@
     m_properties.keyTimes = keyTimes;
 }
 
-void PlatformCAAnimationRemote::copyKeyTimesFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationRemote::copyKeyTimesFrom(const PlatformCAAnimation& value)
 {
-    const PlatformCAAnimationRemote* other = toPlatformCAAnimationRemote(value);
-    m_properties.keyTimes = other->m_properties.keyTimes;
+    m_properties.keyTimes = downcast<PlatformCAAnimationRemote>(value).m_properties.keyTimes;
 }
 
 void PlatformCAAnimationRemote::setTimingFunctions(const Vector<const TimingFunction*>& values, bool reverse)
@@ -661,12 +659,12 @@
     m_properties.reverseTimingFunctions = reverse;
 }
 
-void PlatformCAAnimationRemote::copyTimingFunctionsFrom(const PlatformCAAnimation* value)
+void PlatformCAAnimationRemote::copyTimingFunctionsFrom(const PlatformCAAnimation& value)
 {
-    const PlatformCAAnimationRemote* other = toPlatformCAAnimationRemote(value);
+    const PlatformCAAnimationRemote& other = downcast<PlatformCAAnimationRemote>(value);
 
-    m_properties.timingFunctions = other->m_properties.timingFunctions;
-    m_properties.reverseTimingFunctions = other->m_properties.reverseTimingFunctions;
+    m_properties.timingFunctions = other.m_properties.timingFunctions;
+    m_properties.reverseTimingFunctions = other.m_properties.reverseTimingFunctions;
 }
 
 static NSObject* animationValueFromKeyframeValue(const PlatformCAAnimationRemote::KeyframeValue& keyframeValue)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (174714 => 174715)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2014-10-15 00:41:01 UTC (rev 174715)
@@ -321,15 +321,15 @@
     setSublayers(layersToMove);
 }
 
-void PlatformCALayerRemote::addAnimationForKey(const String& key, PlatformCAAnimation* animation)
+void PlatformCALayerRemote::addAnimationForKey(const String& key, PlatformCAAnimation& animation)
 {
-    auto addResult = m_animations.set(key, animation);
+    auto addResult = m_animations.set(key, &animation);
     if (addResult.isNewEntry)
-        m_properties.addedAnimations.append(std::pair<String, PlatformCAAnimationRemote::Properties>(key, toPlatformCAAnimationRemote(animation)->properties()));
+        m_properties.addedAnimations.append(std::pair<String, PlatformCAAnimationRemote::Properties>(key, downcast<PlatformCAAnimationRemote>(animation).properties()));
     else {
         for (auto& keyAnimationPair : m_properties.addedAnimations) {
             if (keyAnimationPair.first == key) {
-                keyAnimationPair.second = toPlatformCAAnimationRemote(animation)->properties();
+                keyAnimationPair.second = downcast<PlatformCAAnimationRemote>(animation).properties();
                 break;
             }
         }
@@ -364,7 +364,7 @@
 {
     auto it = m_animations.find(key);
     if (it != m_animations.end())
-        toPlatformCAAnimationRemote(it->value.get())->didStart(beginTime);
+        downcast<PlatformCAAnimationRemote>(*it->value).didStart(beginTime);
     
     if (m_owner)
         m_owner->platformCALayerAnimationStarted(key, beginTime);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h (174714 => 174715)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2014-10-15 00:41:01 UTC (rev 174715)
@@ -66,7 +66,7 @@
     virtual const WebCore::PlatformCALayerList* customSublayers() const override { return nullptr; }
     virtual void adoptSublayers(WebCore::PlatformCALayer& source) override;
 
-    virtual void addAnimationForKey(const String& key, WebCore::PlatformCAAnimation*) override;
+    virtual void addAnimationForKey(const String& key, WebCore::PlatformCAAnimation&) override;
     virtual void removeAnimationForKey(const String& key) override;
     virtual PassRefPtr<WebCore::PlatformCAAnimation> animationForKey(const String& key) override;
     virtual void animationStarted(const String& key, CFTimeInterval beginTime) override;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (174714 => 174715)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2014-10-15 00:29:51 UTC (rev 174714)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2014-10-15 00:41:01 UTC (rev 174715)
@@ -673,7 +673,7 @@
             drawingArea->applyTransientZoomToPage(scale, origin);
     }];
 
-    zoomLayer->addAnimationForKey("transientZoomCommit", renderViewAnimation.get());
+    zoomLayer->addAnimationForKey("transientZoomCommit", *renderViewAnimation);
 
     if (shadowCALayer) {
         FloatRect shadowBounds = shadowLayerBoundsForFrame(frameView, scale);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to