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

Side by Side Diff: cc/animation/layer_animation_controller.cc

Issue 1898683002: CC Animation: Erase LayerAnimationEventObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@eventobserver
Patch Set: Created 4 years, 8 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
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/animation/layer_animation_controller.h" 5 #include "cc/animation/layer_animation_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 10 matching lines...) Expand all
21 #include "cc/output/filter_operations.h" 21 #include "cc/output/filter_operations.h"
22 #include "ui/gfx/geometry/box_f.h" 22 #include "ui/gfx/geometry/box_f.h"
23 #include "ui/gfx/transform.h" 23 #include "ui/gfx/transform.h"
24 24
25 namespace cc { 25 namespace cc {
26 26
27 LayerAnimationController::LayerAnimationController(int id) 27 LayerAnimationController::LayerAnimationController(int id)
28 : host_(0), 28 : host_(0),
29 id_(id), 29 id_(id),
30 is_active_(false), 30 is_active_(false),
31 event_observer_(nullptr),
32 value_observer_(nullptr), 31 value_observer_(nullptr),
33 value_provider_(nullptr), 32 value_provider_(nullptr),
34 layer_animation_delegate_(nullptr), 33 layer_animation_delegate_(nullptr),
35 needs_active_value_observations_(false), 34 needs_active_value_observations_(false),
36 needs_pending_value_observations_(false), 35 needs_pending_value_observations_(false),
37 needs_to_start_animations_(false), 36 needs_to_start_animations_(false),
38 scroll_offset_animation_was_interrupted_(false), 37 scroll_offset_animation_was_interrupted_(false),
39 potentially_animating_transform_for_active_observers_(false), 38 potentially_animating_transform_for_active_observers_(false),
40 potentially_animating_transform_for_pending_observers_(false) {} 39 potentially_animating_transform_for_pending_observers_(false) {}
41 40
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 host_ = host; 383 host_ = host;
385 if (host_) 384 if (host_)
386 host_->RegisterAnimationController(this); 385 host_->RegisterAnimationController(this);
387 386
388 UpdateActivation(FORCE_ACTIVATION); 387 UpdateActivation(FORCE_ACTIVATION);
389 } 388 }
390 389
391 void LayerAnimationController::NotifyAnimationStarted( 390 void LayerAnimationController::NotifyAnimationStarted(
392 const AnimationEvent& event) { 391 const AnimationEvent& event) {
393 if (event.is_impl_only) { 392 if (event.is_impl_only) {
394 if (event_observer_)
395 event_observer_->OnAnimationStarted(event);
396 if (layer_animation_delegate_) 393 if (layer_animation_delegate_)
397 layer_animation_delegate_->NotifyAnimationStarted( 394 layer_animation_delegate_->NotifyAnimationStarted(
398 event.monotonic_time, event.target_property, event.group_id); 395 event.monotonic_time, event.target_property, event.group_id);
399 return; 396 return;
400 } 397 }
401 398
402 for (size_t i = 0; i < animations_.size(); ++i) { 399 for (size_t i = 0; i < animations_.size(); ++i) {
403 if (animations_[i]->group() == event.group_id && 400 if (animations_[i]->group() == event.group_id &&
404 animations_[i]->target_property() == event.target_property && 401 animations_[i]->target_property() == event.target_property &&
405 animations_[i]->needs_synchronized_start_time()) { 402 animations_[i]->needs_synchronized_start_time()) {
406 animations_[i]->set_needs_synchronized_start_time(false); 403 animations_[i]->set_needs_synchronized_start_time(false);
407 if (!animations_[i]->has_set_start_time()) 404 if (!animations_[i]->has_set_start_time())
408 animations_[i]->set_start_time(event.monotonic_time); 405 animations_[i]->set_start_time(event.monotonic_time);
409 406
410 if (event_observer_)
411 event_observer_->OnAnimationStarted(event);
412 if (layer_animation_delegate_) 407 if (layer_animation_delegate_)
413 layer_animation_delegate_->NotifyAnimationStarted( 408 layer_animation_delegate_->NotifyAnimationStarted(
414 event.monotonic_time, event.target_property, event.group_id); 409 event.monotonic_time, event.target_property, event.group_id);
415 410
416 return; 411 return;
417 } 412 }
418 } 413 }
419 } 414 }
420 415
421 void LayerAnimationController::NotifyAnimationFinished( 416 void LayerAnimationController::NotifyAnimationFinished(
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 break; 477 break;
483 case TargetProperty::TRANSFORM: 478 case TargetProperty::TRANSFORM:
484 NotifyObserversTransformAnimated( 479 NotifyObserversTransformAnimated(
485 event.transform, notify_active_observers, notify_pending_observers); 480 event.transform, notify_active_observers, notify_pending_observers);
486 break; 481 break;
487 default: 482 default:
488 NOTREACHED(); 483 NOTREACHED();
489 } 484 }
490 } 485 }
491 486
492 void LayerAnimationController::SetEventObserver(
493 LayerAnimationEventObserver* observer) {
494 event_observer_ = observer;
495 }
496
497 bool LayerAnimationController::HasFilterAnimationThatInflatesBounds() const { 487 bool LayerAnimationController::HasFilterAnimationThatInflatesBounds() const {
498 for (size_t i = 0; i < animations_.size(); ++i) { 488 for (size_t i = 0; i < animations_.size(); ++i) {
499 if (!animations_[i]->is_finished() && 489 if (!animations_[i]->is_finished() &&
500 animations_[i]->target_property() == TargetProperty::FILTER && 490 animations_[i]->target_property() == TargetProperty::FILTER &&
501 animations_[i] 491 animations_[i]
502 ->curve() 492 ->curve()
503 ->ToFilterAnimationCurve() 493 ->ToFilterAnimationCurve()
504 ->HasFilterThatMovesPixels()) 494 ->HasFilterThatMovesPixels())
505 return true; 495 return true;
506 } 496 }
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 needs_pending_value_observations(); 1233 needs_pending_value_observations();
1244 } 1234 }
1245 1235
1246 bool LayerAnimationController::HasActiveValueObserver() { 1236 bool LayerAnimationController::HasActiveValueObserver() {
1247 if (!value_observer_) 1237 if (!value_observer_)
1248 return false; 1238 return false;
1249 return needs_active_value_observations(); 1239 return needs_active_value_observations();
1250 } 1240 }
1251 1241
1252 } // namespace cc 1242 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/layer_animation_controller.h ('k') | cc/animation/layer_animation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698