| 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 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 registrar_->DidDeactivateAnimationController(this); | 948 registrar_->DidDeactivateAnimationController(this); |
| 949 } | 949 } |
| 950 } | 950 } |
| 951 | 951 |
| 952 void LayerAnimationController::NotifyObserversOpacityAnimated( | 952 void LayerAnimationController::NotifyObserversOpacityAnimated( |
| 953 float opacity, | 953 float opacity, |
| 954 bool notify_active_observers, | 954 bool notify_active_observers, |
| 955 bool notify_pending_observers) { | 955 bool notify_pending_observers) { |
| 956 if (value_observers_.might_have_observers()) { | 956 if (value_observers_.might_have_observers()) { |
| 957 ObserverListBase<LayerAnimationValueObserver>::Iterator it( | 957 ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
| 958 value_observers_); | 958 &value_observers_); |
| 959 LayerAnimationValueObserver* obs; | 959 LayerAnimationValueObserver* obs; |
| 960 while ((obs = it.GetNext()) != nullptr) { | 960 while ((obs = it.GetNext()) != nullptr) { |
| 961 if ((notify_active_observers && notify_pending_observers) || | 961 if ((notify_active_observers && notify_pending_observers) || |
| 962 (notify_active_observers && obs->IsActive()) || | 962 (notify_active_observers && obs->IsActive()) || |
| 963 (notify_pending_observers && !obs->IsActive())) | 963 (notify_pending_observers && !obs->IsActive())) |
| 964 obs->OnOpacityAnimated(opacity); | 964 obs->OnOpacityAnimated(opacity); |
| 965 } | 965 } |
| 966 } | 966 } |
| 967 } | 967 } |
| 968 | 968 |
| 969 void LayerAnimationController::NotifyObserversTransformAnimated( | 969 void LayerAnimationController::NotifyObserversTransformAnimated( |
| 970 const gfx::Transform& transform, | 970 const gfx::Transform& transform, |
| 971 bool notify_active_observers, | 971 bool notify_active_observers, |
| 972 bool notify_pending_observers) { | 972 bool notify_pending_observers) { |
| 973 if (value_observers_.might_have_observers()) { | 973 if (value_observers_.might_have_observers()) { |
| 974 ObserverListBase<LayerAnimationValueObserver>::Iterator it( | 974 ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
| 975 value_observers_); | 975 &value_observers_); |
| 976 LayerAnimationValueObserver* obs; | 976 LayerAnimationValueObserver* obs; |
| 977 while ((obs = it.GetNext()) != nullptr) { | 977 while ((obs = it.GetNext()) != nullptr) { |
| 978 if ((notify_active_observers && notify_pending_observers) || | 978 if ((notify_active_observers && notify_pending_observers) || |
| 979 (notify_active_observers && obs->IsActive()) || | 979 (notify_active_observers && obs->IsActive()) || |
| 980 (notify_pending_observers && !obs->IsActive())) | 980 (notify_pending_observers && !obs->IsActive())) |
| 981 obs->OnTransformAnimated(transform); | 981 obs->OnTransformAnimated(transform); |
| 982 } | 982 } |
| 983 } | 983 } |
| 984 } | 984 } |
| 985 | 985 |
| 986 void LayerAnimationController::NotifyObserversFilterAnimated( | 986 void LayerAnimationController::NotifyObserversFilterAnimated( |
| 987 const FilterOperations& filters, | 987 const FilterOperations& filters, |
| 988 bool notify_active_observers, | 988 bool notify_active_observers, |
| 989 bool notify_pending_observers) { | 989 bool notify_pending_observers) { |
| 990 if (value_observers_.might_have_observers()) { | 990 if (value_observers_.might_have_observers()) { |
| 991 ObserverListBase<LayerAnimationValueObserver>::Iterator it( | 991 ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
| 992 value_observers_); | 992 &value_observers_); |
| 993 LayerAnimationValueObserver* obs; | 993 LayerAnimationValueObserver* obs; |
| 994 while ((obs = it.GetNext()) != nullptr) { | 994 while ((obs = it.GetNext()) != nullptr) { |
| 995 if ((notify_active_observers && notify_pending_observers) || | 995 if ((notify_active_observers && notify_pending_observers) || |
| 996 (notify_active_observers && obs->IsActive()) || | 996 (notify_active_observers && obs->IsActive()) || |
| 997 (notify_pending_observers && !obs->IsActive())) | 997 (notify_pending_observers && !obs->IsActive())) |
| 998 obs->OnFilterAnimated(filters); | 998 obs->OnFilterAnimated(filters); |
| 999 } | 999 } |
| 1000 } | 1000 } |
| 1001 } | 1001 } |
| 1002 | 1002 |
| 1003 void LayerAnimationController::NotifyObserversScrollOffsetAnimated( | 1003 void LayerAnimationController::NotifyObserversScrollOffsetAnimated( |
| 1004 const gfx::ScrollOffset& scroll_offset, | 1004 const gfx::ScrollOffset& scroll_offset, |
| 1005 bool notify_active_observers, | 1005 bool notify_active_observers, |
| 1006 bool notify_pending_observers) { | 1006 bool notify_pending_observers) { |
| 1007 if (value_observers_.might_have_observers()) { | 1007 if (value_observers_.might_have_observers()) { |
| 1008 ObserverListBase<LayerAnimationValueObserver>::Iterator it( | 1008 ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
| 1009 value_observers_); | 1009 &value_observers_); |
| 1010 LayerAnimationValueObserver* obs; | 1010 LayerAnimationValueObserver* obs; |
| 1011 while ((obs = it.GetNext()) != nullptr) { | 1011 while ((obs = it.GetNext()) != nullptr) { |
| 1012 if ((notify_active_observers && notify_pending_observers) || | 1012 if ((notify_active_observers && notify_pending_observers) || |
| 1013 (notify_active_observers && obs->IsActive()) || | 1013 (notify_active_observers && obs->IsActive()) || |
| 1014 (notify_pending_observers && !obs->IsActive())) | 1014 (notify_pending_observers && !obs->IsActive())) |
| 1015 obs->OnScrollOffsetAnimated(scroll_offset); | 1015 obs->OnScrollOffsetAnimated(scroll_offset); |
| 1016 } | 1016 } |
| 1017 } | 1017 } |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 void LayerAnimationController::NotifyObserversAnimationWaitingForDeletion() { | 1020 void LayerAnimationController::NotifyObserversAnimationWaitingForDeletion() { |
| 1021 FOR_EACH_OBSERVER(LayerAnimationValueObserver, | 1021 FOR_EACH_OBSERVER(LayerAnimationValueObserver, |
| 1022 value_observers_, | 1022 value_observers_, |
| 1023 OnAnimationWaitingForDeletion()); | 1023 OnAnimationWaitingForDeletion()); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 bool LayerAnimationController::HasValueObserver() { | 1026 bool LayerAnimationController::HasValueObserver() { |
| 1027 if (value_observers_.might_have_observers()) { | 1027 if (value_observers_.might_have_observers()) { |
| 1028 ObserverListBase<LayerAnimationValueObserver>::Iterator it( | 1028 ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
| 1029 value_observers_); | 1029 &value_observers_); |
| 1030 return it.GetNext() != nullptr; | 1030 return it.GetNext() != nullptr; |
| 1031 } | 1031 } |
| 1032 return false; | 1032 return false; |
| 1033 } | 1033 } |
| 1034 | 1034 |
| 1035 bool LayerAnimationController::HasActiveValueObserver() { | 1035 bool LayerAnimationController::HasActiveValueObserver() { |
| 1036 if (value_observers_.might_have_observers()) { | 1036 if (value_observers_.might_have_observers()) { |
| 1037 ObserverListBase<LayerAnimationValueObserver>::Iterator it( | 1037 ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
| 1038 value_observers_); | 1038 &value_observers_); |
| 1039 LayerAnimationValueObserver* obs; | 1039 LayerAnimationValueObserver* obs; |
| 1040 while ((obs = it.GetNext()) != nullptr) | 1040 while ((obs = it.GetNext()) != nullptr) |
| 1041 if (obs->IsActive()) | 1041 if (obs->IsActive()) |
| 1042 return true; | 1042 return true; |
| 1043 } | 1043 } |
| 1044 return false; | 1044 return false; |
| 1045 } | 1045 } |
| 1046 | 1046 |
| 1047 } // namespace cc | 1047 } // namespace cc |
| OLD | NEW |