diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-20 13:01:08 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-20 13:01:08 +0200 |
commit | 49233e234e5c787396cadb2cea33b31ae0cd65c1 (patch) | |
tree | 5410cb9a8fd53168bb60d62c54b654d86f03c38d /Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp | |
parent | b211c645d8ab690f713515dfdc84d80b11c27d2c (diff) | |
download | qtwebkit-49233e234e5c787396cadb2cea33b31ae0cd65c1.tar.gz |
Imported WebKit commit 3a8c29f35d00659d2ce7a0ccdfa8304f14e82327 (http://svn.webkit.org/repository/webkit/trunk@120813)
New snapshot with Windows build fixes
Diffstat (limited to 'Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp')
-rw-r--r-- | Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp b/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp index 0e8c1a401..854595380 100644 --- a/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCAnimationTestCommon.cpp @@ -29,9 +29,12 @@ #include "GraphicsLayer.h" #include "LayerChromium.h" #include "TranslateTransformOperation.h" +#include "cc/CCKeyframedAnimationCurve.h" #include "cc/CCLayerAnimationController.h" #include "cc/CCLayerImpl.h" +#include <public/WebTransformOperations.h> + using namespace WebCore; namespace { @@ -39,38 +42,38 @@ namespace { template <class Target> void addOpacityTransition(Target& target, double duration, float startOpacity, float endOpacity, bool useTimingFunction) { - WebCore::KeyframeValueList values(AnimatedPropertyOpacity); - if (duration > 0) - values.insert(new FloatAnimationValue(0, startOpacity)); - values.insert(new FloatAnimationValue(duration, endOpacity)); + OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); - RefPtr<Animation> animation = Animation::create(); - animation->setDuration(duration); - - if (useTimingFunction) - animation->setTimingFunction(LinearTimingFunction::create()); + if (duration > 0) + curve->addKeyframe(CCFloatKeyframe::create(0, startOpacity, useTimingFunction ? nullptr : CCEaseTimingFunction::create())); + curve->addKeyframe(CCFloatKeyframe::create(duration, endOpacity, nullptr)); - IntSize boxSize; + OwnPtr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.release(), 0, 0, CCActiveAnimation::Opacity)); + animation->setNeedsSynchronizedStartTime(true); - target.addAnimation(values, boxSize, animation.get(), 0, 0, 0); + target.addAnimation(animation.release()); } template <class Target> void addAnimatedTransform(Target& target, double duration, int deltaX, int deltaY) { static int id = 0; - WebCore::KeyframeValueList values(AnimatedPropertyWebkitTransform); + OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); - TransformOperations operations; - operations.operations().append(TranslateTransformOperation::create(Length(deltaX, WebCore::Fixed), Length(deltaY, WebCore::Fixed), TransformOperation::TRANSLATE_X)); - values.insert(new TransformAnimationValue(0, &operations)); + if (duration > 0) { + WebKit::WebTransformOperations startOperations; + startOperations.appendTranslate(deltaX, deltaY, 0); + curve->addKeyframe(CCTransformKeyframe::create(0, startOperations, nullptr)); + } - RefPtr<Animation> animation = Animation::create(); - animation->setDuration(duration); + WebKit::WebTransformOperations operations; + operations.appendTranslate(deltaX, deltaY, 0); + curve->addKeyframe(CCTransformKeyframe::create(duration, operations, nullptr)); - IntSize boxSize; + OwnPtr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.release(), id++, 0, CCActiveAnimation::Transform)); + animation->setNeedsSynchronizedStartTime(true); - target.addAnimation(values, boxSize, animation.get(), ++id, 0, 0); + target.addAnimation(animation.release()); } } // namespace @@ -99,7 +102,7 @@ FakeTransformTransition::~FakeTransformTransition() { } -WebKit::WebTransformationMatrix FakeTransformTransition::getValue(double time, const WebCore::IntSize& size) const +WebKit::WebTransformationMatrix FakeTransformTransition::getValue(double time) const { return WebKit::WebTransformationMatrix(); } |