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_impl.h" | 5 #include "cc/trees/layer_tree_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 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 } | 1010 } |
1011 | 1011 |
1012 bool LayerTreeImpl::LayerNeedsPushPropertiesForTesting(LayerImpl* layer) { | 1012 bool LayerTreeImpl::LayerNeedsPushPropertiesForTesting(LayerImpl* layer) { |
1013 return layers_that_should_push_properties_.find(layer) != | 1013 return layers_that_should_push_properties_.find(layer) != |
1014 layers_that_should_push_properties_.end(); | 1014 layers_that_should_push_properties_.end(); |
1015 } | 1015 } |
1016 | 1016 |
1017 void LayerTreeImpl::RegisterLayer(LayerImpl* layer) { | 1017 void LayerTreeImpl::RegisterLayer(LayerImpl* layer) { |
1018 DCHECK(!LayerById(layer->id())); | 1018 DCHECK(!LayerById(layer->id())); |
1019 layer_id_map_[layer->id()] = layer; | 1019 layer_id_map_[layer->id()] = layer; |
1020 layer_tree_host_impl_->animation_host()->RegisterLayer( | 1020 layer_tree_host_impl_->animation_host()->RegisterElement( |
1021 layer->id(), | 1021 layer->id(), |
1022 IsActiveTree() ? LayerTreeType::ACTIVE : LayerTreeType::PENDING); | 1022 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING); |
1023 } | 1023 } |
1024 | 1024 |
1025 void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) { | 1025 void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) { |
1026 DCHECK(LayerById(layer->id())); | 1026 DCHECK(LayerById(layer->id())); |
1027 layer_tree_host_impl_->animation_host()->UnregisterLayer( | 1027 layer_tree_host_impl_->animation_host()->UnregisterElement( |
1028 layer->id(), | 1028 layer->id(), |
1029 IsActiveTree() ? LayerTreeType::ACTIVE : LayerTreeType::PENDING); | 1029 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING); |
1030 layer_id_map_.erase(layer->id()); | 1030 layer_id_map_.erase(layer->id()); |
1031 DCHECK_NE(root_layer_, layer); | 1031 DCHECK_NE(root_layer_, layer); |
1032 } | 1032 } |
1033 | 1033 |
1034 // These manage ownership of the LayerImpl. | 1034 // These manage ownership of the LayerImpl. |
1035 void LayerTreeImpl::AddLayer(std::unique_ptr<LayerImpl> layer) { | 1035 void LayerTreeImpl::AddLayer(std::unique_ptr<LayerImpl> layer) { |
1036 DCHECK(std::find(layers_->begin(), layers_->end(), layer) == layers_->end()); | 1036 DCHECK(std::find(layers_->begin(), layers_->end(), layer) == layers_->end()); |
1037 layers_->push_back(std::move(layer)); | 1037 layers_->push_back(std::move(layer)); |
1038 set_needs_update_draw_properties(); | 1038 set_needs_update_draw_properties(); |
1039 } | 1039 } |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1928 std::unique_ptr<PendingPageScaleAnimation> pending_animation) { | 1928 std::unique_ptr<PendingPageScaleAnimation> pending_animation) { |
1929 pending_page_scale_animation_ = std::move(pending_animation); | 1929 pending_page_scale_animation_ = std::move(pending_animation); |
1930 } | 1930 } |
1931 | 1931 |
1932 std::unique_ptr<PendingPageScaleAnimation> | 1932 std::unique_ptr<PendingPageScaleAnimation> |
1933 LayerTreeImpl::TakePendingPageScaleAnimation() { | 1933 LayerTreeImpl::TakePendingPageScaleAnimation() { |
1934 return std::move(pending_page_scale_animation_); | 1934 return std::move(pending_page_scale_animation_); |
1935 } | 1935 } |
1936 | 1936 |
1937 bool LayerTreeImpl::IsAnimatingFilterProperty(const LayerImpl* layer) const { | 1937 bool LayerTreeImpl::IsAnimatingFilterProperty(const LayerImpl* layer) const { |
1938 LayerTreeType tree_type = | 1938 ElementListType list_type = |
1939 IsActiveTree() ? LayerTreeType::ACTIVE : LayerTreeType::PENDING; | 1939 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
1940 return layer_tree_host_impl_->animation_host()->IsAnimatingFilterProperty( | 1940 return layer_tree_host_impl_->animation_host()->IsAnimatingFilterProperty( |
1941 layer->id(), tree_type); | 1941 layer->id(), list_type); |
1942 } | 1942 } |
1943 | 1943 |
1944 bool LayerTreeImpl::IsAnimatingOpacityProperty(const LayerImpl* layer) const { | 1944 bool LayerTreeImpl::IsAnimatingOpacityProperty(const LayerImpl* layer) const { |
1945 LayerTreeType tree_type = | 1945 ElementListType list_type = |
1946 IsActiveTree() ? LayerTreeType::ACTIVE : LayerTreeType::PENDING; | 1946 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
1947 return layer_tree_host_impl_->animation_host()->IsAnimatingOpacityProperty( | 1947 return layer_tree_host_impl_->animation_host()->IsAnimatingOpacityProperty( |
1948 layer->id(), tree_type); | 1948 layer->id(), list_type); |
1949 } | 1949 } |
1950 | 1950 |
1951 bool LayerTreeImpl::IsAnimatingTransformProperty(const LayerImpl* layer) const { | 1951 bool LayerTreeImpl::IsAnimatingTransformProperty(const LayerImpl* layer) const { |
1952 LayerTreeType tree_type = | 1952 ElementListType list_type = |
1953 IsActiveTree() ? LayerTreeType::ACTIVE : LayerTreeType::PENDING; | 1953 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
1954 return layer_tree_host_impl_->animation_host()->IsAnimatingTransformProperty( | 1954 return layer_tree_host_impl_->animation_host()->IsAnimatingTransformProperty( |
1955 layer->id(), tree_type); | 1955 layer->id(), list_type); |
1956 } | 1956 } |
1957 | 1957 |
1958 bool LayerTreeImpl::HasPotentiallyRunningFilterAnimation( | 1958 bool LayerTreeImpl::HasPotentiallyRunningFilterAnimation( |
1959 const LayerImpl* layer) const { | 1959 const LayerImpl* layer) const { |
1960 LayerTreeType tree_type = | 1960 ElementListType list_type = |
1961 IsActiveTree() ? LayerTreeType::ACTIVE : LayerTreeType::PENDING; | 1961 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
1962 return layer_tree_host_impl_->animation_host() | 1962 return layer_tree_host_impl_->animation_host() |
1963 ->HasPotentiallyRunningFilterAnimation(layer->id(), tree_type); | 1963 ->HasPotentiallyRunningFilterAnimation(layer->id(), list_type); |
1964 } | 1964 } |
1965 | 1965 |
1966 bool LayerTreeImpl::HasPotentiallyRunningOpacityAnimation( | 1966 bool LayerTreeImpl::HasPotentiallyRunningOpacityAnimation( |
1967 const LayerImpl* layer) const { | 1967 const LayerImpl* layer) const { |
1968 LayerTreeType tree_type = | 1968 ElementListType list_type = |
1969 IsActiveTree() ? LayerTreeType::ACTIVE : LayerTreeType::PENDING; | 1969 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
1970 return layer_tree_host_impl_->animation_host() | 1970 return layer_tree_host_impl_->animation_host() |
1971 ->HasPotentiallyRunningOpacityAnimation(layer->id(), tree_type); | 1971 ->HasPotentiallyRunningOpacityAnimation(layer->id(), list_type); |
1972 } | 1972 } |
1973 | 1973 |
1974 bool LayerTreeImpl::HasPotentiallyRunningTransformAnimation( | 1974 bool LayerTreeImpl::HasPotentiallyRunningTransformAnimation( |
1975 const LayerImpl* layer) const { | 1975 const LayerImpl* layer) const { |
1976 LayerTreeType tree_type = | 1976 ElementListType list_type = |
1977 IsActiveTree() ? LayerTreeType::ACTIVE : LayerTreeType::PENDING; | 1977 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
1978 return layer_tree_host_impl_->animation_host() | 1978 return layer_tree_host_impl_->animation_host() |
1979 ->HasPotentiallyRunningTransformAnimation(layer->id(), tree_type); | 1979 ->HasPotentiallyRunningTransformAnimation(layer->id(), list_type); |
1980 } | 1980 } |
1981 | 1981 |
1982 bool LayerTreeImpl::HasAnyAnimationTargetingProperty( | 1982 bool LayerTreeImpl::HasAnyAnimationTargetingProperty( |
1983 const LayerImpl* layer, | 1983 const LayerImpl* layer, |
1984 TargetProperty::Type property) const { | 1984 TargetProperty::Type property) const { |
1985 return layer_tree_host_impl_->animation_host() | 1985 return layer_tree_host_impl_->animation_host() |
1986 ->HasAnyAnimationTargetingProperty(layer->id(), property); | 1986 ->HasAnyAnimationTargetingProperty(layer->id(), property); |
1987 } | 1987 } |
1988 | 1988 |
1989 bool LayerTreeImpl::FilterIsAnimatingOnImplOnly(const LayerImpl* layer) const { | 1989 bool LayerTreeImpl::FilterIsAnimatingOnImplOnly(const LayerImpl* layer) const { |
(...skipping 18 matching lines...) Expand all Loading... |
2008 ->TransformIsAnimatingOnImplOnly(layer->id()); | 2008 ->TransformIsAnimatingOnImplOnly(layer->id()); |
2009 } | 2009 } |
2010 | 2010 |
2011 bool LayerTreeImpl::AnimationsPreserveAxisAlignment( | 2011 bool LayerTreeImpl::AnimationsPreserveAxisAlignment( |
2012 const LayerImpl* layer) const { | 2012 const LayerImpl* layer) const { |
2013 return layer_tree_host_impl_->animation_host() | 2013 return layer_tree_host_impl_->animation_host() |
2014 ->AnimationsPreserveAxisAlignment(layer->id()); | 2014 ->AnimationsPreserveAxisAlignment(layer->id()); |
2015 } | 2015 } |
2016 | 2016 |
2017 bool LayerTreeImpl::HasOnlyTranslationTransforms(const LayerImpl* layer) const { | 2017 bool LayerTreeImpl::HasOnlyTranslationTransforms(const LayerImpl* layer) const { |
2018 LayerTreeType tree_type = | 2018 ElementListType list_type = |
2019 IsActiveTree() ? LayerTreeType::ACTIVE : LayerTreeType::PENDING; | 2019 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
2020 return layer_tree_host_impl_->animation_host()->HasOnlyTranslationTransforms( | 2020 return layer_tree_host_impl_->animation_host()->HasOnlyTranslationTransforms( |
2021 layer->id(), tree_type); | 2021 layer->id(), list_type); |
2022 } | 2022 } |
2023 | 2023 |
2024 bool LayerTreeImpl::MaximumTargetScale(const LayerImpl* layer, | 2024 bool LayerTreeImpl::MaximumTargetScale(const LayerImpl* layer, |
2025 float* max_scale) const { | 2025 float* max_scale) const { |
2026 *max_scale = 0.f; | 2026 *max_scale = 0.f; |
2027 LayerTreeType tree_type = | 2027 ElementListType list_type = |
2028 IsActiveTree() ? LayerTreeType::ACTIVE : LayerTreeType::PENDING; | 2028 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
2029 return layer_tree_host_impl_->animation_host()->MaximumTargetScale( | 2029 return layer_tree_host_impl_->animation_host()->MaximumTargetScale( |
2030 layer->id(), tree_type, max_scale); | 2030 layer->id(), list_type, max_scale); |
2031 } | 2031 } |
2032 | 2032 |
2033 bool LayerTreeImpl::AnimationStartScale(const LayerImpl* layer, | 2033 bool LayerTreeImpl::AnimationStartScale(const LayerImpl* layer, |
2034 float* start_scale) const { | 2034 float* start_scale) const { |
2035 *start_scale = 0.f; | 2035 *start_scale = 0.f; |
2036 LayerTreeType tree_type = | 2036 ElementListType list_type = |
2037 IsActiveTree() ? LayerTreeType::ACTIVE : LayerTreeType::PENDING; | 2037 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
2038 return layer_tree_host_impl_->animation_host()->AnimationStartScale( | 2038 return layer_tree_host_impl_->animation_host()->AnimationStartScale( |
2039 layer->id(), tree_type, start_scale); | 2039 layer->id(), list_type, start_scale); |
2040 } | 2040 } |
2041 | 2041 |
2042 bool LayerTreeImpl::HasFilterAnimationThatInflatesBounds( | 2042 bool LayerTreeImpl::HasFilterAnimationThatInflatesBounds( |
2043 const LayerImpl* layer) const { | 2043 const LayerImpl* layer) const { |
2044 return layer_tree_host_impl_->animation_host() | 2044 return layer_tree_host_impl_->animation_host() |
2045 ->HasFilterAnimationThatInflatesBounds(layer->id()); | 2045 ->HasFilterAnimationThatInflatesBounds(layer->id()); |
2046 } | 2046 } |
2047 | 2047 |
2048 bool LayerTreeImpl::HasTransformAnimationThatInflatesBounds( | 2048 bool LayerTreeImpl::HasTransformAnimationThatInflatesBounds( |
2049 const LayerImpl* layer) const { | 2049 const LayerImpl* layer) const { |
(...skipping 28 matching lines...) Expand all Loading... |
2078 } | 2078 } |
2079 | 2079 |
2080 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) { | 2080 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) { |
2081 layers_that_should_push_properties_.clear(); | 2081 layers_that_should_push_properties_.clear(); |
2082 for (auto* layer : *this) | 2082 for (auto* layer : *this) |
2083 layer->ResetChangeTracking(); | 2083 layer->ResetChangeTracking(); |
2084 property_trees_.ResetAllChangeTracking(flag); | 2084 property_trees_.ResetAllChangeTracking(flag); |
2085 } | 2085 } |
2086 | 2086 |
2087 } // namespace cc | 2087 } // namespace cc |
OLD | NEW |