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

Unified Diff: cc/layer_animation_controller.cc

Issue 12453010: Allow impl-only animations, and return opacity values via AnimationEvents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits, patch for submission. Created 7 years, 9 months 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
« no previous file with comments | « cc/layer_animation_controller.h ('k') | cc/layer_animation_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_animation_controller.cc
diff --git a/cc/layer_animation_controller.cc b/cc/layer_animation_controller.cc
index 0ec11e4fa5d06e49bc779cfbcbf9020ee6429920..c43c62ff34bf23fa743f802dfd6181e7dd15bacc 100644
--- a/cc/layer_animation_controller.cc
+++ b/cc/layer_animation_controller.cc
@@ -125,6 +125,35 @@ void LayerAnimationController::animate(double monotonicTime)
m_lastTickTime = monotonicTime;
}
+void LayerAnimationController::accumulatePropertyUpdates(double monotonicTime,
+ AnimationEventsVector* events)
+{
+ if (!events)
+ return;
+
+ for (size_t i = 0; i < m_activeAnimations.size(); ++i) {
+ Animation* animation = m_activeAnimations[i];
+ if (!animation->isImplOnly())
+ continue;
+
+ if (animation->targetProperty() == Animation::Opacity) {
+ AnimationEvent event(AnimationEvent::PropertyUpdate,
+ m_id, animation->group(),
+ Animation::Opacity, monotonicTime);
+ event.opacity = animation->curve()->toFloatAnimationCurve()->getValue(monotonicTime);
+
+ events->push_back(event);
+ }
+ else if (animation->targetProperty() == Animation::Transform) {
+ AnimationEvent event(AnimationEvent::PropertyUpdate,
+ m_id, animation->group(),
+ Animation::Transform, monotonicTime);
+ event.transform = animation->curve()->toTransformAnimationCurve()->getValue(monotonicTime);
+ events->push_back(event);
+ }
+ }
+}
+
void LayerAnimationController::updateState(AnimationEventsVector* events)
{
if (!hasActiveObserver())
@@ -136,6 +165,8 @@ void LayerAnimationController::updateState(AnimationEventsVector* events)
startAnimationsWaitingForTargetAvailability(m_lastTickTime);
promoteStartedAnimations(m_lastTickTime, events);
+ accumulatePropertyUpdates(m_lastTickTime, events);
+
updateActivation();
}
@@ -245,7 +276,10 @@ void LayerAnimationController::pushNewAnimationsToImplThread(LayerAnimationContr
struct IsCompleted {
IsCompleted(const LayerAnimationController& mainThreadController) : m_mainThreadController(mainThreadController) { }
- bool operator()(Animation* animation) const { return !m_mainThreadController.getAnimation(animation->group(), animation->targetProperty()); }
+ bool operator()(Animation* animation) const {
+ if (animation->isImplOnly())
+ return false;
+ return !m_mainThreadController.getAnimation(animation->group(), animation->targetProperty()); }
private:
const LayerAnimationController& m_mainThreadController;
};
« no previous file with comments | « cc/layer_animation_controller.h ('k') | cc/layer_animation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698