summaryrefslogtreecommitdiffstats
path: root/cc/animation
diff options
context:
space:
mode:
authorajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-09 21:30:25 +0000
committerajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-09 21:30:25 +0000
commit8dec4d09a4b963fe41e8dc36584bea451c7b39fd (patch)
treed899f9f1e83d8f888ef894fe28f2e994bc9a850e /cc/animation
parentadd747d17d785bfbb8cebbcd5f34ee7d66e647c5 (diff)
downloadchromium_src-8dec4d09a4b963fe41e8dc36584bea451c7b39fd.zip
chromium_src-8dec4d09a4b963fe41e8dc36584bea451c7b39fd.tar.gz
chromium_src-8dec4d09a4b963fe41e8dc36584bea451c7b39fd.tar.bz2
Add monotonic time and target property to cc::AnimationDelegate notifications
This adds monotonic time and target property as arguments to cc::AnimationDelegate::NotifyAnimation{Started, Finished}. The existing wall clock time argument can be removed once Blink's legacy implementation of CSS animations and transitions is removed. The target property argument is needed so that Blink can distinguish between notifications for CSS animations/transitions and notifications for the scroll animations being added for the CSSOM View smooth scroll API. BUG=299945,243871 Review URL: https://codereview.chromium.org/99733003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239554 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/animation')
-rw-r--r--cc/animation/animation_delegate.h15
-rw-r--r--cc/animation/layer_animation_controller.cc16
-rw-r--r--cc/animation/layer_animation_controller_unittest.cc10
3 files changed, 33 insertions, 8 deletions
diff --git a/cc/animation/animation_delegate.h b/cc/animation/animation_delegate.h
index c9367b8..f1176a3 100644
--- a/cc/animation/animation_delegate.h
+++ b/cc/animation/animation_delegate.h
@@ -5,12 +5,23 @@
#ifndef CC_ANIMATION_ANIMATION_DELEGATE_H_
#define CC_ANIMATION_ANIMATION_DELEGATE_H_
+#include "base/time/time.h"
+#include "cc/animation/animation.h"
+
namespace cc {
class AnimationDelegate {
public:
- virtual void NotifyAnimationStarted(double time) = 0;
- virtual void NotifyAnimationFinished(double time) = 0;
+ // TODO(ajuma): Remove wall_clock_time once the legacy implementation of
+ // CSS animations and transitions in Blink is removed.
+ virtual void NotifyAnimationStarted(
+ double wall_clock_time,
+ base::TimeTicks monotonic_time,
+ Animation::TargetProperty target_property) = 0;
+ virtual void NotifyAnimationFinished(
+ double wall_clock_time,
+ base::TimeTicks monotonic_time,
+ Animation::TargetProperty target_property) = 0;
protected:
virtual ~AnimationDelegate() {}
diff --git a/cc/animation/layer_animation_controller.cc b/cc/animation/layer_animation_controller.cc
index d8c976a..43d680b 100644
--- a/cc/animation/layer_animation_controller.cc
+++ b/cc/animation/layer_animation_controller.cc
@@ -282,11 +282,14 @@ void LayerAnimationController::SetAnimationRegistrar(
void LayerAnimationController::NotifyAnimationStarted(
const AnimationEvent& event,
double wall_clock_time) {
+ base::TimeTicks monotonic_time = base::TimeTicks::FromInternalValue(
+ event.monotonic_time * base::Time::kMicrosecondsPerSecond);
if (event.is_impl_only) {
FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_,
OnAnimationStarted(event));
if (layer_animation_delegate_)
- layer_animation_delegate_->NotifyAnimationStarted(wall_clock_time);
+ layer_animation_delegate_->NotifyAnimationStarted(
+ wall_clock_time, monotonic_time, event.target_property);
return;
}
@@ -301,7 +304,8 @@ void LayerAnimationController::NotifyAnimationStarted(
FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_,
OnAnimationStarted(event));
if (layer_animation_delegate_)
- layer_animation_delegate_->NotifyAnimationStarted(wall_clock_time);
+ layer_animation_delegate_->NotifyAnimationStarted(
+ wall_clock_time, monotonic_time, event.target_property);
return;
}
@@ -311,9 +315,12 @@ void LayerAnimationController::NotifyAnimationStarted(
void LayerAnimationController::NotifyAnimationFinished(
const AnimationEvent& event,
double wall_clock_time) {
+ base::TimeTicks monotonic_time = base::TimeTicks::FromInternalValue(
+ event.monotonic_time * base::Time::kMicrosecondsPerSecond);
if (event.is_impl_only) {
if (layer_animation_delegate_)
- layer_animation_delegate_->NotifyAnimationFinished(wall_clock_time);
+ layer_animation_delegate_->NotifyAnimationFinished(
+ wall_clock_time, monotonic_time, event.target_property);
return;
}
@@ -322,7 +329,8 @@ void LayerAnimationController::NotifyAnimationFinished(
active_animations_[i]->target_property() == event.target_property) {
active_animations_[i]->set_received_finished_event(true);
if (layer_animation_delegate_)
- layer_animation_delegate_->NotifyAnimationFinished(wall_clock_time);
+ layer_animation_delegate_->NotifyAnimationFinished(
+ wall_clock_time, monotonic_time, event.target_property);
return;
}
diff --git a/cc/animation/layer_animation_controller_unittest.cc b/cc/animation/layer_animation_controller_unittest.cc
index 8ccfec8..47c714f 100644
--- a/cc/animation/layer_animation_controller_unittest.cc
+++ b/cc/animation/layer_animation_controller_unittest.cc
@@ -766,11 +766,17 @@ class FakeAnimationDelegate : public AnimationDelegate {
: started_(false),
finished_(false) {}
- virtual void NotifyAnimationStarted(double time) OVERRIDE {
+ virtual void NotifyAnimationStarted(
+ double wall_clock_time,
+ base::TimeTicks monotonic_time,
+ Animation::TargetProperty target_property) OVERRIDE {
started_ = true;
}
- virtual void NotifyAnimationFinished(double time) OVERRIDE {
+ virtual void NotifyAnimationFinished(
+ double wall_clock_time,
+ base::TimeTicks monotonic_time,
+ Animation::TargetProperty target_property) OVERRIDE {
finished_ = true;
}