Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1239)

Unified Diff: cc/animation/animation_player.h

Issue 2538973002: CC Animation: Make AnimationPlayer to be a unit of activation. (Closed)
Patch Set: Move ScrollOffsetAnimationWasInterrupted to AnimationPlayer Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/animation/animation_player.h
diff --git a/cc/animation/animation_player.h b/cc/animation/animation_player.h
index 99a8d985a647f7d5ff67eeba166fabe52704cd77..62c9d54b2b2412a8886e538fcfce249a945a3178 100644
--- a/cc/animation/animation_player.h
+++ b/cc/animation/animation_player.h
@@ -19,6 +19,7 @@
namespace cc {
class AnimationDelegate;
+class AnimationEvents;
class AnimationHost;
class AnimationTimeline;
struct AnimationEvent;
@@ -75,6 +76,12 @@ class CC_ANIMATION_EXPORT AnimationPlayer
void PushPropertiesTo(AnimationPlayer* player_impl);
+ void Animate(base::TimeTicks monotonic_time);
+ void UpdateState(bool start_ready_animations, AnimationEvents* events);
+
+ void UpdateActivation(ActivationType type);
+ void Deactivate();
+
// AnimationDelegate routing.
bool NotifyAnimationStarted(const AnimationEvent& event);
bool NotifyAnimationFinished(const AnimationEvent& event);
@@ -152,6 +159,17 @@ class CC_ANIMATION_EXPORT AnimationPlayer
void GetPropertyAnimationState(PropertyAnimationState* pending_state,
PropertyAnimationState* active_state) const;
+ // When a scroll animation is removed on the main thread, its compositor
+ // thread counterpart continues producing scroll deltas until activation.
+ // These scroll deltas need to be cleared at activation, so that the active
+ // element's scroll offset matches the offset provided by the main thread
+ // rather than a combination of this offset and scroll deltas produced by
+ // the removed animation. This is to provide the illusion of synchronicity to
+ // JS that simultaneously removes an animation and sets the scroll offset.
+ bool scroll_offset_animation_was_interrupted() const {
+ return scroll_offset_animation_was_interrupted_;
+ }
+
private:
friend class base::RefCounted<AnimationPlayer>;
@@ -195,6 +213,11 @@ class CC_ANIMATION_EXPORT AnimationPlayer
// previous attempt at starting animations failed to start all animations.
bool needs_to_start_animations_;
+ // This is used to ensure that we don't spam the animation host.
+ bool is_active_;
+
+ bool scroll_offset_animation_was_interrupted_;
+
DISALLOW_COPY_AND_ASSIGN(AnimationPlayer);
};

Powered by Google App Engine
This is Rietveld 408576698