Title: [125469] trunk/Source
Revision
125469
Author
[email protected]
Date
2012-08-13 16:45:26 -0700 (Mon, 13 Aug 2012)

Log Message

[chromium] Make WebAnimation a pure virtual interface to hide implementation and avoid unresolved symbols
https://bugs.webkit.org/show_bug.cgi?id=93907

Reviewed by Darin Fisher.

Source/Platform:

This makes WebAnimation a pure virtual interface with instances returned by a factory function. Currently the
factory is a static function on WebAnimation, but it will likely move to a platform support interface. This
provides better isolation of the implementation from the interface and in particular allows for implementing the
WebAnimation interface outside of WebKit.dll without having unresolved external symbols in WebKit.dll.

* chromium/public/WebAnimation.h:
(WebKit::WebAnimation::~WebAnimation):
(WebAnimation):
* chromium/public/WebLayer.h:
(WebLayer):

Source/WebCore:

Updates WebAnimation users for interface changes.

* platform/graphics/chromium/AnimationTranslationUtil.cpp:
(WebCore::createWebAnimation):
* platform/graphics/chromium/GraphicsLayerChromium.cpp:
(WebCore::GraphicsLayerChromium::addAnimation):

Source/WebKit/chromium:

Adds a WebAnimationImpl implementation of the WebAnimation interface.

* WebKit.gyp:
* src/WebAnimationImpl.cpp: Renamed from Source/WebKit/chromium/src/WebAnimation.cpp.
(WebKit):
(WebKit::WebAnimation::create):
(WebKit::WebAnimationImpl::targetProperty):
(WebKit::WebAnimationImpl::iterations):
(WebKit::WebAnimationImpl::setIterations):
(WebKit::WebAnimationImpl::startTime):
(WebKit::WebAnimationImpl::setStartTime):
(WebKit::WebAnimationImpl::timeOffset):
(WebKit::WebAnimationImpl::setTimeOffset):
(WebKit::WebAnimationImpl::alternatesDirection):
(WebKit::WebAnimationImpl::setAlternatesDirection):
(WebKit::WebAnimationImpl::cloneToCCAnimation):
* src/WebAnimationImpl.h: Added.
(WebCore):
(WebKit):
(WebAnimationImpl):
(WebKit::WebAnimationImpl::WebAnimationImpl):
(WebKit::WebAnimationImpl::~WebAnimationImpl):
* src/WebLayer.cpp:
(WebKit::WebLayer::addAnimation):
* tests/WebAnimationTest.cpp:
(WebKit::TEST):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (125468 => 125469)


--- trunk/Source/Platform/ChangeLog	2012-08-13 23:41:07 UTC (rev 125468)
+++ trunk/Source/Platform/ChangeLog	2012-08-13 23:45:26 UTC (rev 125469)
@@ -1,3 +1,21 @@
+2012-08-13  James Robinson  <[email protected]>
+
+        [chromium] Make WebAnimation a pure virtual interface to hide implementation and avoid unresolved symbols
+        https://bugs.webkit.org/show_bug.cgi?id=93907
+
+        Reviewed by Darin Fisher.
+
+        This makes WebAnimation a pure virtual interface with instances returned by a factory function. Currently the
+        factory is a static function on WebAnimation, but it will likely move to a platform support interface. This
+        provides better isolation of the implementation from the interface and in particular allows for implementing the
+        WebAnimation interface outside of WebKit.dll without having unresolved external symbols in WebKit.dll.
+
+        * chromium/public/WebAnimation.h:
+        (WebKit::WebAnimation::~WebAnimation):
+        (WebAnimation):
+        * chromium/public/WebLayer.h:
+        (WebLayer):
+
 2012-08-10  James Robinson  <[email protected]>
 
         [chromium] Clean up dependencies for Canvas2DLayerBridgeTest and GraphicsLayerChromiumTest unit tests

Modified: trunk/Source/Platform/chromium/public/WebAnimation.h (125468 => 125469)


--- trunk/Source/Platform/chromium/public/WebAnimation.h	2012-08-13 23:41:07 UTC (rev 125468)
+++ trunk/Source/Platform/chromium/public/WebAnimation.h	2012-08-13 23:45:26 UTC (rev 125469)
@@ -42,60 +42,40 @@
 class WebAnimationCurve;
 
 // A compositor driven animation.
-class WebAnimation : public WebNonCopyable {
+class WebAnimation {
 public:
     enum TargetProperty {
         TargetPropertyTransform = 0,
         TargetPropertyOpacity
     };
 
-    WebAnimation(const WebAnimationCurve& curve, TargetProperty targetProperty)
-    {
-        initialize(curve, targetProperty);
-    }
+    // The caller takes ownership of the returned valuev
+    WEBKIT_EXPORT static WebAnimation* create(const WebAnimationCurve&, TargetProperty);
 
     // An animationId is effectively the animation's name, and it is not unique.
     // Animations with the same groupId are run at the same time. An animation
     // may be uniquely identified by a combination of groupId and target property.
-    WebAnimation(const WebAnimationCurve& curve, int animationId, int groupId, TargetProperty targetProperty)
-    {
-        initialize(curve, animationId, groupId, targetProperty);
-    }
+    WEBKIT_EXPORT static WebAnimation* create(const WebAnimationCurve&, int animationId, int groupId, TargetProperty);
 
-    ~WebAnimation()
-    {
-        destroy();
-    }
+    virtual ~WebAnimation() { }
 
-    WEBKIT_EXPORT TargetProperty targetProperty() const;
+    virtual TargetProperty targetProperty() const = 0;
 
     // This is the number of times that the animation will play. If this
     // value is zero the animation will not play. If it is negative, then
     // the animation will loop indefinitely.
-    WEBKIT_EXPORT int iterations() const;
-    WEBKIT_EXPORT void setIterations(int);
+    virtual int iterations() const = 0;
+    virtual void setIterations(int) = 0;
 
-    WEBKIT_EXPORT double startTime() const;
-    WEBKIT_EXPORT void setStartTime(double monotonicTime);
-    WEBKIT_EXPORT bool hasSetStartTime() const;
+    virtual double startTime() const = 0;
+    virtual void setStartTime(double monotonicTime) = 0;
 
-    WEBKIT_EXPORT double timeOffset() const;
-    WEBKIT_EXPORT void setTimeOffset(double monotonicTime);
+    virtual double timeOffset() const = 0;
+    virtual void setTimeOffset(double monotonicTime) = 0;
 
     // If alternatesDirection is true, on odd numbered iterations we reverse the curve.
-    WEBKIT_EXPORT bool alternatesDirection() const;
-    WEBKIT_EXPORT void setAlternatesDirection(bool);
-
-#if WEBKIT_IMPLEMENTATION
-    operator PassOwnPtr<WebCore::CCActiveAnimation>() const;
-#endif
-
-private:
-    WEBKIT_EXPORT void initialize(const WebAnimationCurve&, TargetProperty);
-    WEBKIT_EXPORT void initialize(const WebAnimationCurve&, int animationId, int groupId, TargetProperty);
-    WEBKIT_EXPORT void destroy();
-
-    WebPrivateOwnPtr<WebCore::CCActiveAnimation> m_private;
+    virtual bool alternatesDirection() const = 0;
+    virtual void setAlternatesDirection(bool) = 0;
 };
 
 } // namespace WebKit

Modified: trunk/Source/Platform/chromium/public/WebLayer.h (125468 => 125469)


--- trunk/Source/Platform/chromium/public/WebLayer.h	2012-08-13 23:41:07 UTC (rev 125468)
+++ trunk/Source/Platform/chromium/public/WebLayer.h	2012-08-13 23:45:26 UTC (rev 125469)
@@ -152,7 +152,7 @@
     WEBKIT_EXPORT void setAnimationDelegate(WebAnimationDelegate*);
 
     // Returns false if the animation cannot be added.
-    WEBKIT_EXPORT bool addAnimation(const WebAnimation&);
+    WEBKIT_EXPORT bool addAnimation(WebAnimation*);
 
     // Removes all animations with the given id.
     WEBKIT_EXPORT void removeAnimation(int animationId);

Modified: trunk/Source/WebCore/ChangeLog (125468 => 125469)


--- trunk/Source/WebCore/ChangeLog	2012-08-13 23:41:07 UTC (rev 125468)
+++ trunk/Source/WebCore/ChangeLog	2012-08-13 23:45:26 UTC (rev 125469)
@@ -1,3 +1,17 @@
+2012-08-13  James Robinson  <[email protected]>
+
+        [chromium] Make WebAnimation a pure virtual interface to hide implementation and avoid unresolved symbols
+        https://bugs.webkit.org/show_bug.cgi?id=93907
+
+        Reviewed by Darin Fisher.
+
+        Updates WebAnimation users for interface changes.
+
+        * platform/graphics/chromium/AnimationTranslationUtil.cpp:
+        (WebCore::createWebAnimation):
+        * platform/graphics/chromium/GraphicsLayerChromium.cpp:
+        (WebCore::GraphicsLayerChromium::addAnimation):
+
 2012-08-11  Raphael Kubo da Costa  <[email protected]>
 
         [CMake] Rewrite FindLibSoup2.cmake.

Modified: trunk/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp (125468 => 125469)


--- trunk/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp	2012-08-13 23:41:07 UTC (rev 125468)
+++ trunk/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp	2012-08-13 23:45:26 UTC (rev 125469)
@@ -272,7 +272,7 @@
             return nullptr;
     }
 
-    OwnPtr<WebKit::WebAnimation> anim(adoptPtr(new WebKit::WebAnimation(curve, animationId, groupId, targetProperty)));
+    OwnPtr<WebKit::WebAnimation> anim(adoptPtr(WebKit::WebAnimation::create(curve, animationId, groupId, targetProperty)));
 
     int iterations = (animation && animation->isIterationCountSet()) ? animation->iterationCount() : 1;
     anim->setIterations(iterations);

Modified: trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp (125468 => 125469)


--- trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp	2012-08-13 23:41:07 UTC (rev 125468)
+++ trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp	2012-08-13 23:45:26 UTC (rev 125469)
@@ -527,10 +527,10 @@
 
     OwnPtr<WebKit::WebAnimation> toAdd(createWebAnimation(values, animation, animationId, groupId, timeOffset, boxSize));
 
-    if (toAdd.get()) {
+    if (toAdd) {
         // Remove any existing animations with the same animation id and target property.
         primaryLayer().removeAnimation(animationId, toAdd->targetProperty());
-        return primaryLayer().addAnimation(*toAdd);
+        return primaryLayer().addAnimation(toAdd.get());
     }
 
     return false;

Modified: trunk/Source/WebKit/chromium/ChangeLog (125468 => 125469)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-08-13 23:41:07 UTC (rev 125468)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-08-13 23:45:26 UTC (rev 125469)
@@ -1,3 +1,37 @@
+2012-08-13  James Robinson  <[email protected]>
+
+        [chromium] Make WebAnimation a pure virtual interface to hide implementation and avoid unresolved symbols
+        https://bugs.webkit.org/show_bug.cgi?id=93907
+
+        Reviewed by Darin Fisher.
+
+        Adds a WebAnimationImpl implementation of the WebAnimation interface.
+
+        * WebKit.gyp:
+        * src/WebAnimationImpl.cpp: Renamed from Source/WebKit/chromium/src/WebAnimation.cpp.
+        (WebKit):
+        (WebKit::WebAnimation::create):
+        (WebKit::WebAnimationImpl::targetProperty):
+        (WebKit::WebAnimationImpl::iterations):
+        (WebKit::WebAnimationImpl::setIterations):
+        (WebKit::WebAnimationImpl::startTime):
+        (WebKit::WebAnimationImpl::setStartTime):
+        (WebKit::WebAnimationImpl::timeOffset):
+        (WebKit::WebAnimationImpl::setTimeOffset):
+        (WebKit::WebAnimationImpl::alternatesDirection):
+        (WebKit::WebAnimationImpl::setAlternatesDirection):
+        (WebKit::WebAnimationImpl::cloneToCCAnimation):
+        * src/WebAnimationImpl.h: Added.
+        (WebCore):
+        (WebKit):
+        (WebAnimationImpl):
+        (WebKit::WebAnimationImpl::WebAnimationImpl):
+        (WebKit::WebAnimationImpl::~WebAnimationImpl):
+        * src/WebLayer.cpp:
+        (WebKit::WebLayer::addAnimation):
+        * tests/WebAnimationTest.cpp:
+        (WebKit::TEST):
+
 2012-08-10  James Robinson  <[email protected]>
 
         [chromium] Clean up dependencies for Canvas2DLayerBridgeTest and GraphicsLayerChromiumTest unit tests

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (125468 => 125469)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2012-08-13 23:41:07 UTC (rev 125468)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2012-08-13 23:45:26 UTC (rev 125469)
@@ -470,7 +470,8 @@
                 'src/WebTextCheckingCompletionImpl.cpp',
                 'src/WebTextCheckingResult.cpp',
                 'src/WebAccessibilityObject.cpp',
-                'src/WebAnimation.cpp',
+                'src/WebAnimationImpl.cpp',
+                'src/WebAnimationImpl.h',
                 'src/WebAnimationControllerImpl.cpp',
                 'src/WebAnimationControllerImpl.h',
                 'src/WebAnimationCurveCommon.cpp',

Deleted: trunk/Source/WebKit/chromium/src/WebAnimation.cpp (125468 => 125469)


--- trunk/Source/WebKit/chromium/src/WebAnimation.cpp	2012-08-13 23:41:07 UTC (rev 125468)
+++ trunk/Source/WebKit/chromium/src/WebAnimation.cpp	2012-08-13 23:45:26 UTC (rev 125469)
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include <public/WebAnimation.h>
-
-#include "AnimationIdVendor.h"
-#include "cc/CCActiveAnimation.h"
-#include "cc/CCAnimationCurve.h"
-#include <public/WebAnimationCurve.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
-using WebCore::AnimationIdVendor;
-using WebCore::CCActiveAnimation;
-
-namespace WebKit {
-
-WebAnimation::TargetProperty WebAnimation::targetProperty() const
-{
-    return static_cast<WebAnimation::TargetProperty>(m_private->targetProperty());
-}
-
-int WebAnimation::iterations() const
-{
-    return m_private->iterations();
-}
-
-void WebAnimation::setIterations(int n)
-{
-    m_private->setIterations(n);
-}
-
-double WebAnimation::startTime() const
-{
-    return m_private->startTime();
-}
-
-void WebAnimation::setStartTime(double monotonicTime)
-{
-    m_private->setStartTime(monotonicTime);
-}
-
-double WebAnimation::timeOffset() const
-{
-    return m_private->timeOffset();
-}
-
-void WebAnimation::setTimeOffset(double monotonicTime)
-{
-    m_private->setTimeOffset(monotonicTime);
-}
-
-bool WebAnimation::alternatesDirection() const
-{
-    return m_private->alternatesDirection();
-}
-
-void WebAnimation::setAlternatesDirection(bool alternates)
-{
-    m_private->setAlternatesDirection(alternates);
-}
-
-WebAnimation::operator PassOwnPtr<WebCore::CCActiveAnimation>() const
-{
-    OwnPtr<WebCore::CCActiveAnimation> toReturn(m_private->cloneForImplThread());
-    toReturn->setNeedsSynchronizedStartTime(true);
-    return toReturn.release();
-}
-
-void WebAnimation::initialize(const WebAnimationCurve& curve, TargetProperty targetProperty)
-{
-    initialize(curve, AnimationIdVendor::getNextAnimationId(), AnimationIdVendor::getNextGroupId(), targetProperty);
-}
-
-void WebAnimation::initialize(const WebAnimationCurve& curve, int animationId, int groupId, TargetProperty targetProperty)
-{
-    m_private.reset(CCActiveAnimation::create(curve, animationId, groupId, static_cast<WebCore::CCActiveAnimation::TargetProperty>(targetProperty)).leakPtr());
-}
-
-void WebAnimation::destroy()
-{
-    m_private.reset(0);
-}
-
-} // namespace WebKit

Copied: trunk/Source/WebKit/chromium/src/WebAnimationImpl.cpp (from rev 125467, trunk/Source/WebKit/chromium/src/WebAnimation.cpp) (0 => 125469)


--- trunk/Source/WebKit/chromium/src/WebAnimationImpl.cpp	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/WebAnimationImpl.cpp	2012-08-13 23:45:26 UTC (rev 125469)
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "WebAnimationImpl.h"
+
+#include "AnimationIdVendor.h"
+#include "cc/CCActiveAnimation.h"
+#include "cc/CCAnimationCurve.h"
+#include <public/WebAnimation.h>
+#include <public/WebAnimationCurve.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+
+using WebCore::AnimationIdVendor;
+using WebCore::CCActiveAnimation;
+
+namespace WebKit {
+
+WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, TargetProperty targetProperty)
+{
+    return WebAnimation::create(curve, AnimationIdVendor::getNextAnimationId(), AnimationIdVendor::getNextGroupId(), targetProperty);
+}
+
+WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, int animationId, int groupId, TargetProperty targetProperty)
+{
+    return new WebAnimationImpl(CCActiveAnimation::create(curve, animationId, groupId, static_cast<WebCore::CCActiveAnimation::TargetProperty>(targetProperty)));
+}
+
+WebAnimation::TargetProperty WebAnimationImpl::targetProperty() const
+{
+    return static_cast<WebAnimationImpl::TargetProperty>(m_animation->targetProperty());
+}
+
+int WebAnimationImpl::iterations() const
+{
+    return m_animation->iterations();
+}
+
+void WebAnimationImpl::setIterations(int n)
+{
+    m_animation->setIterations(n);
+}
+
+double WebAnimationImpl::startTime() const
+{
+    return m_animation->startTime();
+}
+
+void WebAnimationImpl::setStartTime(double monotonicTime)
+{
+    m_animation->setStartTime(monotonicTime);
+}
+
+double WebAnimationImpl::timeOffset() const
+{
+    return m_animation->timeOffset();
+}
+
+void WebAnimationImpl::setTimeOffset(double monotonicTime)
+{
+    m_animation->setTimeOffset(monotonicTime);
+}
+
+bool WebAnimationImpl::alternatesDirection() const
+{
+    return m_animation->alternatesDirection();
+}
+
+void WebAnimationImpl::setAlternatesDirection(bool alternates)
+{
+    m_animation->setAlternatesDirection(alternates);
+}
+
+PassOwnPtr<WebCore::CCActiveAnimation> WebAnimationImpl::cloneToCCAnimation()
+{
+    OwnPtr<WebCore::CCActiveAnimation> toReturn(m_animation->cloneForImplThread());
+    toReturn->setNeedsSynchronizedStartTime(true);
+    return toReturn.release();
+}
+
+} // namespace WebKit

Property changes: trunk/Source/WebKit/chromium/src/WebAnimationImpl.cpp


Added: svn:eol-style

Added: trunk/Source/WebKit/chromium/src/WebAnimationImpl.h (0 => 125469)


--- trunk/Source/WebKit/chromium/src/WebAnimationImpl.h	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/WebAnimationImpl.h	2012-08-13 23:45:26 UTC (rev 125469)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebAnimationImpl_h
+#define WebAnimationImpl_h
+
+#include <public/WebAnimation.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+class CCActiveAnimation;
+}
+
+namespace WebKit {
+
+class WebAnimationImpl : public WebAnimation {
+public:
+    explicit WebAnimationImpl(PassOwnPtr<WebCore::CCActiveAnimation> animation)
+        : m_animation(animation)
+    {
+    }
+    virtual ~WebAnimationImpl() { }
+
+    // WebAnimation implementation
+    virtual TargetProperty targetProperty() const OVERRIDE;
+    virtual int iterations() const OVERRIDE;
+    virtual void setIterations(int) OVERRIDE;
+    virtual double startTime() const OVERRIDE;
+    virtual void setStartTime(double monotonicTime) OVERRIDE;
+    virtual double timeOffset() const OVERRIDE;
+    virtual void setTimeOffset(double monotonicTime) OVERRIDE;
+    virtual bool alternatesDirection() const OVERRIDE;
+    virtual void setAlternatesDirection(bool) OVERRIDE;
+
+    PassOwnPtr<WebCore::CCActiveAnimation> cloneToCCAnimation();
+private:
+    OwnPtr<WebCore::CCActiveAnimation> m_animation;
+};
+
+}
+
+#endif // WebAnimationImpl_h
+
Property changes on: trunk/Source/WebKit/chromium/src/WebAnimationImpl.h
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebKit/chromium/src/WebLayer.cpp (125468 => 125469)


--- trunk/Source/WebKit/chromium/src/WebLayer.cpp	2012-08-13 23:41:07 UTC (rev 125468)
+++ trunk/Source/WebKit/chromium/src/WebLayer.cpp	2012-08-13 23:45:26 UTC (rev 125469)
@@ -28,6 +28,7 @@
 
 #include "LayerChromium.h"
 #include "SkMatrix44.h"
+#include "WebAnimationImpl.h"
 #include "WebLayerImpl.h"
 #include <public/WebFilterOperations.h>
 #include <public/WebFloatPoint.h>
@@ -332,9 +333,9 @@
     m_private->setLayerAnimationDelegate(delegate);
 }
 
-bool WebLayer::addAnimation(const WebAnimation& animation)
+bool WebLayer::addAnimation(WebAnimation* animation)
 {
-    return m_private->addAnimation(animation);
+    return m_private->addAnimation(static_cast<WebAnimationImpl*>(animation)->cloneToCCAnimation());
 }
 
 void WebLayer::removeAnimation(int animationId)

Modified: trunk/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp (125468 => 125469)


--- trunk/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp	2012-08-13 23:41:07 UTC (rev 125468)
+++ trunk/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp	2012-08-13 23:45:26 UTC (rev 125469)
@@ -98,8 +98,8 @@
 
     WebFloatAnimationCurve curve;
     curve.add(WebFloatKeyframe(0.0, 0.0));
-    WebAnimation floatAnimation(curve, 1, 1, WebAnimation::TargetPropertyOpacity);
-    ASSERT_TRUE(m_platformLayer->addAnimation(floatAnimation));
+    OwnPtr<WebAnimation> floatAnimation(adoptPtr(WebAnimation::create(curve, 1, 1, WebAnimation::TargetPropertyOpacity)));
+    ASSERT_TRUE(m_platformLayer->addAnimation(floatAnimation.get()));
 
     ASSERT_TRUE(m_platformLayer->hasActiveAnimation());
 

Modified: trunk/Source/WebKit/chromium/tests/WebAnimationTest.cpp (125468 => 125469)


--- trunk/Source/WebKit/chromium/tests/WebAnimationTest.cpp	2012-08-13 23:41:07 UTC (rev 125468)
+++ trunk/Source/WebKit/chromium/tests/WebAnimationTest.cpp	2012-08-13 23:45:26 UTC (rev 125469)
@@ -47,13 +47,13 @@
 TEST(WebAnimationTest, MAYBE_DefaultSettings)
 {
     WebFloatAnimationCurve curve;
-    WebAnimation animation(curve, WebAnimation::TargetPropertyOpacity);
+    OwnPtr<WebAnimation> animation = adoptPtr(WebAnimation::create(curve, WebAnimation::TargetPropertyOpacity));
 
     // Ensure that the defaults are correct.
-    EXPECT_EQ(1, animation.iterations());
-    EXPECT_EQ(0, animation.startTime());
-    EXPECT_EQ(0, animation.timeOffset());
-    EXPECT_FALSE(animation.alternatesDirection());
+    EXPECT_EQ(1, animation->iterations());
+    EXPECT_EQ(0, animation->startTime());
+    EXPECT_EQ(0, animation->timeOffset());
+    EXPECT_FALSE(animation->alternatesDirection());
 }
 
 // Linux/Win bots failed on this test.
@@ -68,16 +68,16 @@
 TEST(WebAnimationTest, MAYBE_ModifiedSettings)
 {
     WebFloatAnimationCurve curve;
-    WebAnimation animation(curve, WebAnimation::TargetPropertyOpacity);
-    animation.setIterations(2);
-    animation.setStartTime(2);
-    animation.setTimeOffset(2);
-    animation.setAlternatesDirection(true);
+    OwnPtr<WebAnimation> animation = adoptPtr(WebAnimation::create(curve, WebAnimation::TargetPropertyOpacity));
+    animation->setIterations(2);
+    animation->setStartTime(2);
+    animation->setTimeOffset(2);
+    animation->setAlternatesDirection(true);
 
-    EXPECT_EQ(2, animation.iterations());
-    EXPECT_EQ(2, animation.startTime());
-    EXPECT_EQ(2, animation.timeOffset());
-    EXPECT_TRUE(animation.alternatesDirection());
+    EXPECT_EQ(2, animation->iterations());
+    EXPECT_EQ(2, animation->startTime());
+    EXPECT_EQ(2, animation->timeOffset());
+    EXPECT_TRUE(animation->alternatesDirection());
 }
 
 } // namespace
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to