summaryrefslogtreecommitdiffstats
path: root/webkit/renderer
diff options
context:
space:
mode:
authora.renevier@samsung.com <a.renevier@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-31 20:22:22 +0000
committera.renevier@samsung.com <a.renevier@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-31 20:22:22 +0000
commit978f5355315d66fb245b45bf3a9b146b847c712e (patch)
tree063f5aa252e777fcfc0b47e6b990a445cf353df0 /webkit/renderer
parent157552a5a5749f237699c7311f236a3e02e03d14 (diff)
downloadchromium_src-978f5355315d66fb245b45bf3a9b146b847c712e.zip
chromium_src-978f5355315d66fb245b45bf3a9b146b847c712e.tar.gz
chromium_src-978f5355315d66fb245b45bf3a9b146b847c712e.tar.bz2
Handle direction control in compositor Animations
This patch is the compositor side. The blink side is handled in issue #178263006 Handle reverse animations in the compositor. Currently, compositor only understand alternate direction. And in order to reverse an animation, it needs to be passed a reversed timing function. This patch introduces a Direction enum parameter in animation. BUG=348071 Review URL: https://codereview.chromium.org/180153010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260628 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/renderer')
-rw-r--r--webkit/renderer/compositor_bindings/web_animation_impl.cc39
-rw-r--r--webkit/renderer/compositor_bindings/web_animation_impl.h5
2 files changed, 42 insertions, 2 deletions
diff --git a/webkit/renderer/compositor_bindings/web_animation_impl.cc b/webkit/renderer/compositor_bindings/web_animation_impl.cc
index c401d5c..d910acf 100644
--- a/webkit/renderer/compositor_bindings/web_animation_impl.cc
+++ b/webkit/renderer/compositor_bindings/web_animation_impl.cc
@@ -95,13 +95,48 @@ void WebAnimationImpl::setTimeOffset(double monotonic_time) {
animation_->set_time_offset(monotonic_time);
}
+#if WEB_ANIMATION_SUPPORTS_FULL_DIRECTION
+blink::WebAnimation::Direction WebAnimationImpl::direction() const {
+ switch (animation_->direction()) {
+ case cc::Animation::Normal:
+ return DirectionNormal;
+ case cc::Animation::Reverse:
+ return DirectionReverse;
+ case cc::Animation::Alternate:
+ return DirectionAlternate;
+ case cc::Animation::AlternateReverse:
+ return DirectionAlternateReverse;
+ default:
+ NOTREACHED();
+ }
+ return DirectionNormal;
+}
+
+void WebAnimationImpl::setDirection(Direction direction) {
+ switch (direction) {
+ case DirectionNormal:
+ animation_->set_direction(cc::Animation::Normal);
+ break;
+ case DirectionReverse:
+ animation_->set_direction(cc::Animation::Reverse);
+ break;
+ case DirectionAlternate:
+ animation_->set_direction(cc::Animation::Alternate);
+ break;
+ case DirectionAlternateReverse:
+ animation_->set_direction(cc::Animation::AlternateReverse);
+ break;
+ }
+}
+#else
bool WebAnimationImpl::alternatesDirection() const {
- return animation_->alternates_direction();
+ return animation_->direction() == cc::Animation::Alternate;
}
void WebAnimationImpl::setAlternatesDirection(bool alternates) {
- animation_->set_alternates_direction(alternates);
+ return animation_->set_direction(cc::Animation::Alternate);
}
+#endif
scoped_ptr<cc::Animation> WebAnimationImpl::PassAnimation() {
animation_->set_needs_synchronized_start_time(true);
diff --git a/webkit/renderer/compositor_bindings/web_animation_impl.h b/webkit/renderer/compositor_bindings/web_animation_impl.h
index 0c248fc..07d72c7 100644
--- a/webkit/renderer/compositor_bindings/web_animation_impl.h
+++ b/webkit/renderer/compositor_bindings/web_animation_impl.h
@@ -33,8 +33,13 @@ class WebAnimationImpl : public blink::WebAnimation {
virtual void setStartTime(double monotonic_time);
virtual double timeOffset() const;
virtual void setTimeOffset(double monotonic_time);
+#if WEB_ANIMATION_SUPPORTS_FULL_DIRECTION
+ virtual Direction direction() const;
+ virtual void setDirection(Direction);
+#else
virtual bool alternatesDirection() const;
virtual void setAlternatesDirection(bool alternates);
+#endif
scoped_ptr<cc::Animation> PassAnimation();