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 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "cc/animation/animation.h" | 10 #include "cc/animation/animation.h" |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 else if (!is_active_ && (was_active || force)) | 968 else if (!is_active_ && (was_active || force)) |
969 registrar_->DidDeactivateAnimationController(this); | 969 registrar_->DidDeactivateAnimationController(this); |
970 } | 970 } |
971 } | 971 } |
972 | 972 |
973 void LayerAnimationController::NotifyObserversOpacityAnimated( | 973 void LayerAnimationController::NotifyObserversOpacityAnimated( |
974 float opacity, | 974 float opacity, |
975 bool notify_active_observers, | 975 bool notify_active_observers, |
976 bool notify_pending_observers) { | 976 bool notify_pending_observers) { |
977 if (value_observers_.might_have_observers()) { | 977 if (value_observers_.might_have_observers()) { |
978 ObserverListBase<LayerAnimationValueObserver>::Iterator it( | 978 base::ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
979 &value_observers_); | 979 &value_observers_); |
980 LayerAnimationValueObserver* obs; | 980 LayerAnimationValueObserver* obs; |
981 while ((obs = it.GetNext()) != nullptr) { | 981 while ((obs = it.GetNext()) != nullptr) { |
982 if ((notify_active_observers && notify_pending_observers) || | 982 if ((notify_active_observers && notify_pending_observers) || |
983 (notify_active_observers && obs->IsActive()) || | 983 (notify_active_observers && obs->IsActive()) || |
984 (notify_pending_observers && !obs->IsActive())) | 984 (notify_pending_observers && !obs->IsActive())) |
985 obs->OnOpacityAnimated(opacity); | 985 obs->OnOpacityAnimated(opacity); |
986 } | 986 } |
987 } | 987 } |
988 } | 988 } |
989 | 989 |
990 void LayerAnimationController::NotifyObserversTransformAnimated( | 990 void LayerAnimationController::NotifyObserversTransformAnimated( |
991 const gfx::Transform& transform, | 991 const gfx::Transform& transform, |
992 bool notify_active_observers, | 992 bool notify_active_observers, |
993 bool notify_pending_observers) { | 993 bool notify_pending_observers) { |
994 if (value_observers_.might_have_observers()) { | 994 if (value_observers_.might_have_observers()) { |
995 ObserverListBase<LayerAnimationValueObserver>::Iterator it( | 995 base::ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
996 &value_observers_); | 996 &value_observers_); |
997 LayerAnimationValueObserver* obs; | 997 LayerAnimationValueObserver* obs; |
998 while ((obs = it.GetNext()) != nullptr) { | 998 while ((obs = it.GetNext()) != nullptr) { |
999 if ((notify_active_observers && notify_pending_observers) || | 999 if ((notify_active_observers && notify_pending_observers) || |
1000 (notify_active_observers && obs->IsActive()) || | 1000 (notify_active_observers && obs->IsActive()) || |
1001 (notify_pending_observers && !obs->IsActive())) | 1001 (notify_pending_observers && !obs->IsActive())) |
1002 obs->OnTransformAnimated(transform); | 1002 obs->OnTransformAnimated(transform); |
1003 } | 1003 } |
1004 } | 1004 } |
1005 } | 1005 } |
1006 | 1006 |
1007 void LayerAnimationController::NotifyObserversFilterAnimated( | 1007 void LayerAnimationController::NotifyObserversFilterAnimated( |
1008 const FilterOperations& filters, | 1008 const FilterOperations& filters, |
1009 bool notify_active_observers, | 1009 bool notify_active_observers, |
1010 bool notify_pending_observers) { | 1010 bool notify_pending_observers) { |
1011 if (value_observers_.might_have_observers()) { | 1011 if (value_observers_.might_have_observers()) { |
1012 ObserverListBase<LayerAnimationValueObserver>::Iterator it( | 1012 base::ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
1013 &value_observers_); | 1013 &value_observers_); |
1014 LayerAnimationValueObserver* obs; | 1014 LayerAnimationValueObserver* obs; |
1015 while ((obs = it.GetNext()) != nullptr) { | 1015 while ((obs = it.GetNext()) != nullptr) { |
1016 if ((notify_active_observers && notify_pending_observers) || | 1016 if ((notify_active_observers && notify_pending_observers) || |
1017 (notify_active_observers && obs->IsActive()) || | 1017 (notify_active_observers && obs->IsActive()) || |
1018 (notify_pending_observers && !obs->IsActive())) | 1018 (notify_pending_observers && !obs->IsActive())) |
1019 obs->OnFilterAnimated(filters); | 1019 obs->OnFilterAnimated(filters); |
1020 } | 1020 } |
1021 } | 1021 } |
1022 } | 1022 } |
1023 | 1023 |
1024 void LayerAnimationController::NotifyObserversScrollOffsetAnimated( | 1024 void LayerAnimationController::NotifyObserversScrollOffsetAnimated( |
1025 const gfx::ScrollOffset& scroll_offset, | 1025 const gfx::ScrollOffset& scroll_offset, |
1026 bool notify_active_observers, | 1026 bool notify_active_observers, |
1027 bool notify_pending_observers) { | 1027 bool notify_pending_observers) { |
1028 if (value_observers_.might_have_observers()) { | 1028 if (value_observers_.might_have_observers()) { |
1029 ObserverListBase<LayerAnimationValueObserver>::Iterator it( | 1029 base::ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
1030 &value_observers_); | 1030 &value_observers_); |
1031 LayerAnimationValueObserver* obs; | 1031 LayerAnimationValueObserver* obs; |
1032 while ((obs = it.GetNext()) != nullptr) { | 1032 while ((obs = it.GetNext()) != nullptr) { |
1033 if ((notify_active_observers && notify_pending_observers) || | 1033 if ((notify_active_observers && notify_pending_observers) || |
1034 (notify_active_observers && obs->IsActive()) || | 1034 (notify_active_observers && obs->IsActive()) || |
1035 (notify_pending_observers && !obs->IsActive())) | 1035 (notify_pending_observers && !obs->IsActive())) |
1036 obs->OnScrollOffsetAnimated(scroll_offset); | 1036 obs->OnScrollOffsetAnimated(scroll_offset); |
1037 } | 1037 } |
1038 } | 1038 } |
1039 } | 1039 } |
1040 | 1040 |
1041 void LayerAnimationController::NotifyObserversAnimationWaitingForDeletion() { | 1041 void LayerAnimationController::NotifyObserversAnimationWaitingForDeletion() { |
1042 FOR_EACH_OBSERVER(LayerAnimationValueObserver, | 1042 FOR_EACH_OBSERVER(LayerAnimationValueObserver, |
1043 value_observers_, | 1043 value_observers_, |
1044 OnAnimationWaitingForDeletion()); | 1044 OnAnimationWaitingForDeletion()); |
1045 } | 1045 } |
1046 | 1046 |
1047 bool LayerAnimationController::HasValueObserver() { | 1047 bool LayerAnimationController::HasValueObserver() { |
1048 if (value_observers_.might_have_observers()) { | 1048 if (value_observers_.might_have_observers()) { |
1049 ObserverListBase<LayerAnimationValueObserver>::Iterator it( | 1049 base::ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
1050 &value_observers_); | 1050 &value_observers_); |
1051 return it.GetNext() != nullptr; | 1051 return it.GetNext() != nullptr; |
1052 } | 1052 } |
1053 return false; | 1053 return false; |
1054 } | 1054 } |
1055 | 1055 |
1056 bool LayerAnimationController::HasActiveValueObserver() { | 1056 bool LayerAnimationController::HasActiveValueObserver() { |
1057 if (value_observers_.might_have_observers()) { | 1057 if (value_observers_.might_have_observers()) { |
1058 ObserverListBase<LayerAnimationValueObserver>::Iterator it( | 1058 base::ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
1059 &value_observers_); | 1059 &value_observers_); |
1060 LayerAnimationValueObserver* obs; | 1060 LayerAnimationValueObserver* obs; |
1061 while ((obs = it.GetNext()) != nullptr) | 1061 while ((obs = it.GetNext()) != nullptr) |
1062 if (obs->IsActive()) | 1062 if (obs->IsActive()) |
1063 return true; | 1063 return true; |
1064 } | 1064 } |
1065 return false; | 1065 return false; |
1066 } | 1066 } |
1067 | 1067 |
1068 } // namespace cc | 1068 } // namespace cc |
OLD | NEW |