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

Side by Side Diff: cc/layer_animation_controller.cc

Issue 11550035: Implement pinch-zoom scaling for main-frame scrollbars and pinch-zoom overlay scrollbars. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revision as per comments, animate scrollbars, fix slow-path PZ scrolling. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layer_animation_controller.h" 5 #include "cc/layer_animation_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/animation.h" 9 #include "cc/animation.h"
10 #include "cc/animation_registrar.h" 10 #include "cc/animation_registrar.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return; 118 return;
119 119
120 startAnimationsWaitingForNextTick(monotonicTime); 120 startAnimationsWaitingForNextTick(monotonicTime);
121 startAnimationsWaitingForStartTime(monotonicTime); 121 startAnimationsWaitingForStartTime(monotonicTime);
122 startAnimationsWaitingForTargetAvailability(monotonicTime); 122 startAnimationsWaitingForTargetAvailability(monotonicTime);
123 resolveConflicts(monotonicTime); 123 resolveConflicts(monotonicTime);
124 tickAnimations(monotonicTime); 124 tickAnimations(monotonicTime);
125 m_lastTickTime = monotonicTime; 125 m_lastTickTime = monotonicTime;
126 } 126 }
127 127
128 void LayerAnimationController::accumulatePropertyUpdates(double monotonicTime,
129 AnimationEventsVector* events)
130 {
131 for (size_t i = 0; i < m_activeAnimations.size(); ++i) {
132 if (m_activeAnimations[i]->targetProperty() == Animation::Opacity) {
133 Animation* animation = m_activeAnimations[i];
134 float opacity = animation->curve()->toFloatAnimationCurve()->getValu e(monotonicTime);
135 AnimationEvent event(AnimationEvent::PropertyUpdate,
136 m_id, animation->group(),
137 Animation::Opacity, monotonicTime,
138 opacity);
139 events->push_back(event);
140 }
141 }
142 }
143
128 void LayerAnimationController::updateState(AnimationEventsVector* events) 144 void LayerAnimationController::updateState(AnimationEventsVector* events)
129 { 145 {
130 if (!hasActiveObserver()) 146 if (!hasActiveObserver())
131 return; 147 return;
132 148
133 promoteStartedAnimations(m_lastTickTime, events); 149 promoteStartedAnimations(m_lastTickTime, events);
134 markFinishedAnimations(m_lastTickTime); 150 markFinishedAnimations(m_lastTickTime);
135 markAnimationsForDeletion(m_lastTickTime, events); 151 markAnimationsForDeletion(m_lastTickTime, events);
136 startAnimationsWaitingForTargetAvailability(m_lastTickTime); 152 startAnimationsWaitingForTargetAvailability(m_lastTickTime);
137 promoteStartedAnimations(m_lastTickTime, events); 153 promoteStartedAnimations(m_lastTickTime, events);
138 154
155 accumulatePropertyUpdates(m_lastTickTime, events);
156
139 updateActivation(); 157 updateActivation();
140 } 158 }
141 159
142 void LayerAnimationController::addAnimation(scoped_ptr<Animation> animation) 160 void LayerAnimationController::addAnimation(scoped_ptr<Animation> animation)
143 { 161 {
144 m_activeAnimations.push_back(animation.Pass()); 162 m_activeAnimations.push_back(animation.Pass());
145 updateActivation(); 163 updateActivation();
146 } 164 }
147 165
148 Animation* LayerAnimationController::getAnimation(int groupId, Animation::Target Property targetProperty) const 166 Animation* LayerAnimationController::getAnimation(int groupId, Animation::Target Property targetProperty) const
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 Animation::RunState initialRunState = Animation::WaitingForTargetAvailab ility; 256 Animation::RunState initialRunState = Animation::WaitingForTargetAvailab ility;
239 double startTime = 0; 257 double startTime = 0;
240 scoped_ptr<Animation> toAdd(m_activeAnimations[i]->cloneAndInitialize(An imation::ControllingInstance, initialRunState, startTime)); 258 scoped_ptr<Animation> toAdd(m_activeAnimations[i]->cloneAndInitialize(An imation::ControllingInstance, initialRunState, startTime));
241 DCHECK(!toAdd->needsSynchronizedStartTime()); 259 DCHECK(!toAdd->needsSynchronizedStartTime());
242 controllerImpl->addAnimation(toAdd.Pass()); 260 controllerImpl->addAnimation(toAdd.Pass());
243 } 261 }
244 } 262 }
245 263
246 struct IsCompleted { 264 struct IsCompleted {
247 IsCompleted(const LayerAnimationController& mainThreadController) : m_mainTh readController(mainThreadController) { } 265 IsCompleted(const LayerAnimationController& mainThreadController) : m_mainTh readController(mainThreadController) { }
248 bool operator()(Animation* animation) const { return !m_mainThreadController .getAnimation(animation->group(), animation->targetProperty()); } 266 bool operator()(Animation* animation) const {
267 if (animation->isImplAnimationOnly())
268 return false;
269 return !m_mainThreadController.getAnimation(animation->group(), animatio n->targetProperty()); }
249 private: 270 private:
250 const LayerAnimationController& m_mainThreadController; 271 const LayerAnimationController& m_mainThreadController;
251 }; 272 };
252 273
253 void LayerAnimationController::removeAnimationsCompletedOnMainThread(LayerAnimat ionController* controllerImpl) const 274 void LayerAnimationController::removeAnimationsCompletedOnMainThread(LayerAnimat ionController* controllerImpl) const
254 { 275 {
255 // Delete all impl thread animations for which there is no corresponding mai n thread animation. 276 // Delete all impl thread animations for which there is no corresponding mai n thread animation.
256 // Each iteration, controller->m_activeAnimations.size() is decremented or i is incremented 277 // Each iteration, controller->m_activeAnimations.size() is decremented or i is incremented
257 // guaranteeing progress towards loop termination. 278 // guaranteeing progress towards loop termination.
258 ScopedPtrVector<Animation>& animations = controllerImpl->m_activeAnimations; 279 ScopedPtrVector<Animation>& animations = controllerImpl->m_activeAnimations;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 ObserverListBase<LayerAnimationValueObserver>::Iterator it(m_observers); 517 ObserverListBase<LayerAnimationValueObserver>::Iterator it(m_observers);
497 LayerAnimationValueObserver* obs; 518 LayerAnimationValueObserver* obs;
498 while ((obs = it.GetNext()) != NULL) 519 while ((obs = it.GetNext()) != NULL)
499 if (obs->IsActive()) 520 if (obs->IsActive())
500 return true; 521 return true;
501 } 522 }
502 return false; 523 return false;
503 } 524 }
504 525
505 } // namespace cc 526 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_animation_controller.h ('k') | cc/layer_tree_host.h » ('j') | cc/layer_tree_host.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698