| 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 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 | 917 |
| 918 void LayerAnimationController::NotifyObserversOpacityAnimated( | 918 void LayerAnimationController::NotifyObserversOpacityAnimated( |
| 919 float opacity, | 919 float opacity, |
| 920 bool notify_active_observers, | 920 bool notify_active_observers, |
| 921 bool notify_pending_observers) { | 921 bool notify_pending_observers) { |
| 922 if (value_observers_.might_have_observers()) { | 922 if (value_observers_.might_have_observers()) { |
| 923 ObserverListBase<LayerAnimationValueObserver>::Iterator it( | 923 ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
| 924 value_observers_); | 924 value_observers_); |
| 925 LayerAnimationValueObserver* obs; | 925 LayerAnimationValueObserver* obs; |
| 926 while ((obs = it.GetNext()) != NULL) { | 926 while ((obs = it.GetNext()) != NULL) { |
| 927 if ((notify_active_observers && obs->IsActive()) || | 927 if ((notify_active_observers && notify_pending_observers) || |
| 928 (notify_active_observers && obs->IsActive()) || |
| 928 (notify_pending_observers && !obs->IsActive())) | 929 (notify_pending_observers && !obs->IsActive())) |
| 929 obs->OnOpacityAnimated(opacity); | 930 obs->OnOpacityAnimated(opacity); |
| 930 } | 931 } |
| 931 } | 932 } |
| 932 } | 933 } |
| 933 | 934 |
| 934 void LayerAnimationController::NotifyObserversTransformAnimated( | 935 void LayerAnimationController::NotifyObserversTransformAnimated( |
| 935 const gfx::Transform& transform, | 936 const gfx::Transform& transform, |
| 936 bool notify_active_observers, | 937 bool notify_active_observers, |
| 937 bool notify_pending_observers) { | 938 bool notify_pending_observers) { |
| 938 if (value_observers_.might_have_observers()) { | 939 if (value_observers_.might_have_observers()) { |
| 939 ObserverListBase<LayerAnimationValueObserver>::Iterator it( | 940 ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
| 940 value_observers_); | 941 value_observers_); |
| 941 LayerAnimationValueObserver* obs; | 942 LayerAnimationValueObserver* obs; |
| 942 while ((obs = it.GetNext()) != NULL) { | 943 while ((obs = it.GetNext()) != NULL) { |
| 943 if ((notify_active_observers && obs->IsActive()) || | 944 if ((notify_active_observers && notify_pending_observers) || |
| 945 (notify_active_observers && obs->IsActive()) || |
| 944 (notify_pending_observers && !obs->IsActive())) | 946 (notify_pending_observers && !obs->IsActive())) |
| 945 obs->OnTransformAnimated(transform); | 947 obs->OnTransformAnimated(transform); |
| 946 } | 948 } |
| 947 } | 949 } |
| 948 } | 950 } |
| 949 | 951 |
| 950 void LayerAnimationController::NotifyObserversFilterAnimated( | 952 void LayerAnimationController::NotifyObserversFilterAnimated( |
| 951 const FilterOperations& filters, | 953 const FilterOperations& filters, |
| 952 bool notify_active_observers, | 954 bool notify_active_observers, |
| 953 bool notify_pending_observers) { | 955 bool notify_pending_observers) { |
| 954 if (value_observers_.might_have_observers()) { | 956 if (value_observers_.might_have_observers()) { |
| 955 ObserverListBase<LayerAnimationValueObserver>::Iterator it( | 957 ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
| 956 value_observers_); | 958 value_observers_); |
| 957 LayerAnimationValueObserver* obs; | 959 LayerAnimationValueObserver* obs; |
| 958 while ((obs = it.GetNext()) != NULL) { | 960 while ((obs = it.GetNext()) != NULL) { |
| 959 if ((notify_active_observers && obs->IsActive()) || | 961 if ((notify_active_observers && notify_pending_observers) || |
| 962 (notify_active_observers && obs->IsActive()) || |
| 960 (notify_pending_observers && !obs->IsActive())) | 963 (notify_pending_observers && !obs->IsActive())) |
| 961 obs->OnFilterAnimated(filters); | 964 obs->OnFilterAnimated(filters); |
| 962 } | 965 } |
| 963 } | 966 } |
| 964 } | 967 } |
| 965 | 968 |
| 966 void LayerAnimationController::NotifyObserversScrollOffsetAnimated( | 969 void LayerAnimationController::NotifyObserversScrollOffsetAnimated( |
| 967 const gfx::Vector2dF& scroll_offset, | 970 const gfx::Vector2dF& scroll_offset, |
| 968 bool notify_active_observers, | 971 bool notify_active_observers, |
| 969 bool notify_pending_observers) { | 972 bool notify_pending_observers) { |
| 970 if (value_observers_.might_have_observers()) { | 973 if (value_observers_.might_have_observers()) { |
| 971 ObserverListBase<LayerAnimationValueObserver>::Iterator it( | 974 ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
| 972 value_observers_); | 975 value_observers_); |
| 973 LayerAnimationValueObserver* obs; | 976 LayerAnimationValueObserver* obs; |
| 974 while ((obs = it.GetNext()) != NULL) { | 977 while ((obs = it.GetNext()) != NULL) { |
| 975 if ((notify_active_observers && obs->IsActive()) || | 978 if ((notify_active_observers && notify_pending_observers) || |
| 979 (notify_active_observers && obs->IsActive()) || |
| 976 (notify_pending_observers && !obs->IsActive())) | 980 (notify_pending_observers && !obs->IsActive())) |
| 977 obs->OnScrollOffsetAnimated(scroll_offset); | 981 obs->OnScrollOffsetAnimated(scroll_offset); |
| 978 } | 982 } |
| 979 } | 983 } |
| 980 } | 984 } |
| 981 | 985 |
| 982 void LayerAnimationController::NotifyObserversAnimationWaitingForDeletion() { | 986 void LayerAnimationController::NotifyObserversAnimationWaitingForDeletion() { |
| 983 FOR_EACH_OBSERVER(LayerAnimationValueObserver, | 987 FOR_EACH_OBSERVER(LayerAnimationValueObserver, |
| 984 value_observers_, | 988 value_observers_, |
| 985 OnAnimationWaitingForDeletion()); | 989 OnAnimationWaitingForDeletion()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1000 value_observers_); | 1004 value_observers_); |
| 1001 LayerAnimationValueObserver* obs; | 1005 LayerAnimationValueObserver* obs; |
| 1002 while ((obs = it.GetNext()) != NULL) | 1006 while ((obs = it.GetNext()) != NULL) |
| 1003 if (obs->IsActive()) | 1007 if (obs->IsActive()) |
| 1004 return true; | 1008 return true; |
| 1005 } | 1009 } |
| 1006 return false; | 1010 return false; |
| 1007 } | 1011 } |
| 1008 | 1012 |
| 1009 } // namespace cc | 1013 } // namespace cc |
| OLD | NEW |