| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 3844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3855 LayerTreeImpl* tree, | 3855 LayerTreeImpl* tree, |
| 3856 const gfx::ScrollOffset& scroll_offset) { | 3856 const gfx::ScrollOffset& scroll_offset) { |
| 3857 if (!tree) | 3857 if (!tree) |
| 3858 return; | 3858 return; |
| 3859 | 3859 |
| 3860 LayerImpl* layer = tree->LayerById(layer_id); | 3860 LayerImpl* layer = tree->LayerById(layer_id); |
| 3861 if (layer) | 3861 if (layer) |
| 3862 layer->OnScrollOffsetAnimated(scroll_offset); | 3862 layer->OnScrollOffsetAnimated(scroll_offset); |
| 3863 } | 3863 } |
| 3864 | 3864 |
| 3865 void LayerTreeHostImpl::TreeLayerTransformIsPotentiallyAnimatingChanged( | |
| 3866 int layer_id, | |
| 3867 LayerTreeImpl* tree, | |
| 3868 bool is_animating) { | |
| 3869 if (!tree) | |
| 3870 return; | |
| 3871 | |
| 3872 LayerImpl* layer = tree->LayerById(layer_id); | |
| 3873 if (layer) | |
| 3874 layer->OnTransformIsPotentiallyAnimatingChanged(is_animating); | |
| 3875 } | |
| 3876 | |
| 3877 bool LayerTreeHostImpl::AnimationsPreserveAxisAlignment( | 3865 bool LayerTreeHostImpl::AnimationsPreserveAxisAlignment( |
| 3878 const LayerImpl* layer) const { | 3866 const LayerImpl* layer) const { |
| 3879 return animation_host_->AnimationsPreserveAxisAlignment(layer->id()); | 3867 return animation_host_->AnimationsPreserveAxisAlignment(layer->id()); |
| 3880 } | 3868 } |
| 3881 | 3869 |
| 3882 void LayerTreeHostImpl::SetElementFilterMutated( | 3870 void LayerTreeHostImpl::SetElementFilterMutated( |
| 3883 ElementId element_id, | 3871 ElementId element_id, |
| 3884 ElementListType list_type, | 3872 ElementListType list_type, |
| 3885 const FilterOperations& filters) { | 3873 const FilterOperations& filters) { |
| 3886 if (list_type == ElementListType::ACTIVE) { | 3874 if (list_type == ElementListType::ACTIVE) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3919 ElementListType list_type, | 3907 ElementListType list_type, |
| 3920 const gfx::ScrollOffset& scroll_offset) { | 3908 const gfx::ScrollOffset& scroll_offset) { |
| 3921 if (list_type == ElementListType::ACTIVE) { | 3909 if (list_type == ElementListType::ACTIVE) { |
| 3922 SetTreeLayerScrollOffsetMutated(element_id, active_tree(), scroll_offset); | 3910 SetTreeLayerScrollOffsetMutated(element_id, active_tree(), scroll_offset); |
| 3923 } else { | 3911 } else { |
| 3924 SetTreeLayerScrollOffsetMutated(element_id, pending_tree(), scroll_offset); | 3912 SetTreeLayerScrollOffsetMutated(element_id, pending_tree(), scroll_offset); |
| 3925 SetTreeLayerScrollOffsetMutated(element_id, recycle_tree(), scroll_offset); | 3913 SetTreeLayerScrollOffsetMutated(element_id, recycle_tree(), scroll_offset); |
| 3926 } | 3914 } |
| 3927 } | 3915 } |
| 3928 | 3916 |
| 3929 void LayerTreeHostImpl::ElementTransformIsPotentiallyAnimatingChanged( | 3917 void LayerTreeHostImpl::ElementTransformIsAnimatingChanged( |
| 3930 ElementId element_id, | 3918 ElementId element_id, |
| 3931 ElementListType list_type, | 3919 ElementListType list_type, |
| 3920 AnimationChangeType change_type, |
| 3932 bool is_animating) { | 3921 bool is_animating) { |
| 3933 if (list_type == ElementListType::ACTIVE) { | 3922 LayerTreeImpl* tree = |
| 3934 TreeLayerTransformIsPotentiallyAnimatingChanged(element_id, active_tree(), | 3923 list_type == ElementListType::ACTIVE ? active_tree() : pending_tree(); |
| 3935 is_animating); | 3924 if (!tree) |
| 3936 } else { | 3925 return; |
| 3937 TreeLayerTransformIsPotentiallyAnimatingChanged(element_id, pending_tree(), | 3926 LayerImpl* layer = tree->LayerById(element_id); |
| 3938 is_animating); | 3927 if (layer) { |
| 3928 switch (change_type) { |
| 3929 case AnimationChangeType::POTENTIAL: |
| 3930 layer->OnTransformIsPotentiallyAnimatingChanged(is_animating); |
| 3931 break; |
| 3932 case AnimationChangeType::RUNNING: |
| 3933 layer->OnTransformIsCurrentlyAnimatingChanged(is_animating); |
| 3934 break; |
| 3935 case AnimationChangeType::BOTH: |
| 3936 layer->OnTransformIsPotentiallyAnimatingChanged(is_animating); |
| 3937 layer->OnTransformIsCurrentlyAnimatingChanged(is_animating); |
| 3938 break; |
| 3939 } |
| 3939 } | 3940 } |
| 3940 } | 3941 } |
| 3942 |
| 3941 void LayerTreeHostImpl::ElementOpacityIsAnimatingChanged( | 3943 void LayerTreeHostImpl::ElementOpacityIsAnimatingChanged( |
| 3942 ElementId element_id, | 3944 ElementId element_id, |
| 3943 ElementListType list_type, | 3945 ElementListType list_type, |
| 3944 AnimationChangeType change_type, | 3946 AnimationChangeType change_type, |
| 3945 bool is_animating) { | 3947 bool is_animating) { |
| 3946 LayerTreeImpl* tree = | 3948 LayerTreeImpl* tree = |
| 3947 list_type == ElementListType::ACTIVE ? active_tree() : pending_tree(); | 3949 list_type == ElementListType::ACTIVE ? active_tree() : pending_tree(); |
| 3948 if (!tree) | 3950 if (!tree) |
| 3949 return; | 3951 return; |
| 3950 LayerImpl* layer = tree->LayerById(element_id); | 3952 LayerImpl* layer = tree->LayerById(element_id); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3987 return task_runner_provider_->HasImplThread(); | 3989 return task_runner_provider_->HasImplThread(); |
| 3988 } | 3990 } |
| 3989 | 3991 |
| 3990 bool LayerTreeHostImpl::CommitToActiveTree() const { | 3992 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 3991 // In single threaded mode we skip the pending tree and commit directly to the | 3993 // In single threaded mode we skip the pending tree and commit directly to the |
| 3992 // active tree. | 3994 // active tree. |
| 3993 return !task_runner_provider_->HasImplThread(); | 3995 return !task_runner_provider_->HasImplThread(); |
| 3994 } | 3996 } |
| 3995 | 3997 |
| 3996 } // namespace cc | 3998 } // namespace cc |
| OLD | NEW |