OLD | NEW |
---|---|
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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "cc/animation/animation.h" | 9 #include "cc/animation/animation.h" |
10 #include "cc/animation/animation_delegate.h" | 10 #include "cc/animation/animation_delegate.h" |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
527 // necessarily mean that it needs to be copied over and started; it may | 527 // necessarily mean that it needs to be copied over and started; it may |
528 // have already finished. In this case, the impl thread animation will | 528 // have already finished. In this case, the impl thread animation will |
529 // have already notified that it has started and the main thread animation | 529 // have already notified that it has started and the main thread animation |
530 // will no longer need | 530 // will no longer need |
531 // a synchronized start time. | 531 // a synchronized start time. |
532 if (!animations_[i]->needs_synchronized_start_time()) | 532 if (!animations_[i]->needs_synchronized_start_time()) |
533 continue; | 533 continue; |
534 | 534 |
535 // Scroll animations always start at the current scroll offset. | 535 // Scroll animations always start at the current scroll offset. |
536 if (animations_[i]->target_property() == Animation::ScrollOffset) { | 536 if (animations_[i]->target_property() == Animation::ScrollOffset) { |
537 gfx::Vector2dF current_scroll_offset; | 537 gfx::ScrollOffset current_scroll_offset; |
538 if (controller_impl->value_provider_) { | 538 if (controller_impl->value_provider_) { |
539 current_scroll_offset = | 539 current_scroll_offset = |
540 controller_impl->value_provider_->ScrollOffsetForAnimation(); | 540 controller_impl->value_provider_->ScrollOffsetForAnimation(); |
541 } else { | 541 } else { |
542 // The owning layer isn't yet in the active tree, so the main thread | 542 // The owning layer isn't yet in the active tree, so the main thread |
543 // scroll offset will be up-to-date. | 543 // scroll offset will be up-to-date. |
544 current_scroll_offset = value_provider_->ScrollOffsetForAnimation(); | 544 current_scroll_offset = value_provider_->ScrollOffsetForAnimation(); |
545 } | 545 } |
546 animations_[i]->curve()->ToScrollOffsetAnimationCurve()->SetInitialValue( | 546 animations_[i]->curve()->ToScrollOffsetAnimationCurve()->SetInitialValue( |
547 current_scroll_offset); | 547 current_scroll_offset.ToVector2dF()); |
danakj
2014/09/25 22:01:26
ScrollOffsetAnimationCurve should be ScrollOffsets
Yufeng Shen (Slow to review)
2014/09/26 20:19:07
Done.
| |
548 } | 548 } |
549 | 549 |
550 // The new animation should be set to run as soon as possible. | 550 // The new animation should be set to run as soon as possible. |
551 Animation::RunState initial_run_state = | 551 Animation::RunState initial_run_state = |
552 Animation::WaitingForTargetAvailability; | 552 Animation::WaitingForTargetAvailability; |
553 scoped_ptr<Animation> to_add( | 553 scoped_ptr<Animation> to_add( |
554 animations_[i]->CloneAndInitialize(initial_run_state)); | 554 animations_[i]->CloneAndInitialize(initial_run_state)); |
555 DCHECK(!to_add->needs_synchronized_start_time()); | 555 DCHECK(!to_add->needs_synchronized_start_time()); |
556 to_add->set_affects_active_observers(false); | 556 to_add->set_affects_active_observers(false); |
557 controller_impl->AddAnimation(to_add.Pass()); | 557 controller_impl->AddAnimation(to_add.Pass()); |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1014 value_observers_); | 1014 value_observers_); |
1015 LayerAnimationValueObserver* obs; | 1015 LayerAnimationValueObserver* obs; |
1016 while ((obs = it.GetNext()) != NULL) | 1016 while ((obs = it.GetNext()) != NULL) |
1017 if (obs->IsActive()) | 1017 if (obs->IsActive()) |
1018 return true; | 1018 return true; |
1019 } | 1019 } |
1020 return false; | 1020 return false; |
1021 } | 1021 } |
1022 | 1022 |
1023 } // namespace cc | 1023 } // namespace cc |
OLD | NEW |