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

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

Issue 584503005: Make scroll offset type of float in cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: link crbug to TODO Created 6 years, 2 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 <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
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);
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 } 882 }
883 883
884 case Animation::BackgroundColor: { 884 case Animation::BackgroundColor: {
885 // Not yet implemented. 885 // Not yet implemented.
886 break; 886 break;
887 } 887 }
888 888
889 case Animation::ScrollOffset: { 889 case Animation::ScrollOffset: {
890 const ScrollOffsetAnimationCurve* scroll_offset_animation_curve = 890 const ScrollOffsetAnimationCurve* scroll_offset_animation_curve =
891 animations_[i]->curve()->ToScrollOffsetAnimationCurve(); 891 animations_[i]->curve()->ToScrollOffsetAnimationCurve();
892 const gfx::Vector2dF scroll_offset = 892 const gfx::ScrollOffset scroll_offset =
893 scroll_offset_animation_curve->GetValue(trimmed); 893 scroll_offset_animation_curve->GetValue(trimmed);
894 NotifyObserversScrollOffsetAnimated( 894 NotifyObserversScrollOffsetAnimated(
895 scroll_offset, 895 scroll_offset,
896 animations_[i]->affects_active_observers(), 896 animations_[i]->affects_active_observers(),
897 animations_[i]->affects_pending_observers()); 897 animations_[i]->affects_pending_observers());
898 break; 898 break;
899 } 899 }
900 900
901 // Do nothing for sentinel value. 901 // Do nothing for sentinel value.
902 case Animation::TargetPropertyEnumSize: 902 case Animation::TargetPropertyEnumSize:
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 while ((obs = it.GetNext()) != NULL) { 970 while ((obs = it.GetNext()) != NULL) {
971 if ((notify_active_observers && notify_pending_observers) || 971 if ((notify_active_observers && notify_pending_observers) ||
972 (notify_active_observers && obs->IsActive()) || 972 (notify_active_observers && obs->IsActive()) ||
973 (notify_pending_observers && !obs->IsActive())) 973 (notify_pending_observers && !obs->IsActive()))
974 obs->OnFilterAnimated(filters); 974 obs->OnFilterAnimated(filters);
975 } 975 }
976 } 976 }
977 } 977 }
978 978
979 void LayerAnimationController::NotifyObserversScrollOffsetAnimated( 979 void LayerAnimationController::NotifyObserversScrollOffsetAnimated(
980 const gfx::Vector2dF& scroll_offset, 980 const gfx::ScrollOffset& scroll_offset,
981 bool notify_active_observers, 981 bool notify_active_observers,
982 bool notify_pending_observers) { 982 bool notify_pending_observers) {
983 if (value_observers_.might_have_observers()) { 983 if (value_observers_.might_have_observers()) {
984 ObserverListBase<LayerAnimationValueObserver>::Iterator it( 984 ObserverListBase<LayerAnimationValueObserver>::Iterator it(
985 value_observers_); 985 value_observers_);
986 LayerAnimationValueObserver* obs; 986 LayerAnimationValueObserver* obs;
987 while ((obs = it.GetNext()) != NULL) { 987 while ((obs = it.GetNext()) != NULL) {
988 if ((notify_active_observers && notify_pending_observers) || 988 if ((notify_active_observers && notify_pending_observers) ||
989 (notify_active_observers && obs->IsActive()) || 989 (notify_active_observers && obs->IsActive()) ||
990 (notify_pending_observers && !obs->IsActive())) 990 (notify_pending_observers && !obs->IsActive()))
(...skipping 23 matching lines...) Expand all
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
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