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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 } | 441 } |
442 | 442 |
443 LayerListReverseIterator<LayerImpl> LayerTreeImpl::rbegin() { | 443 LayerListReverseIterator<LayerImpl> LayerTreeImpl::rbegin() { |
444 return LayerListReverseIterator<LayerImpl>(root_layer_); | 444 return LayerListReverseIterator<LayerImpl>(root_layer_); |
445 } | 445 } |
446 | 446 |
447 LayerListReverseIterator<LayerImpl> LayerTreeImpl::rend() { | 447 LayerListReverseIterator<LayerImpl> LayerTreeImpl::rend() { |
448 return LayerListReverseIterator<LayerImpl>(nullptr); | 448 return LayerListReverseIterator<LayerImpl>(nullptr); |
449 } | 449 } |
450 | 450 |
| 451 void LayerTreeImpl::RegisterLayerForElementId(LayerImpl* layer) { |
| 452 DCHECK(layer->element_id()); |
| 453 ElementLayers& element_layers = element_id_to_layer_map_[layer->element_id()]; |
| 454 if (layer->scrollable()) { |
| 455 DCHECK(!element_layers.scroll); |
| 456 element_layers.scroll = layer; |
| 457 } else { |
| 458 DCHECK(!element_layers.main); |
| 459 element_layers.main = layer; |
| 460 } |
| 461 layer_tree_host_impl_->animation_host()->RegisterElement( |
| 462 layer->element_id(), |
| 463 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING); |
| 464 } |
| 465 |
| 466 void LayerTreeImpl::UnregisterLayerForElementId(LayerImpl* layer) { |
| 467 DCHECK(layer->element_id()); |
| 468 |
| 469 layer_tree_host_impl_->animation_host()->UnregisterElement( |
| 470 layer->element_id(), |
| 471 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING); |
| 472 |
| 473 auto iter = element_id_to_layer_map_.find(layer->element_id()); |
| 474 if (iter == element_id_to_layer_map_.end()) |
| 475 return; |
| 476 |
| 477 ElementLayers& element_layers = iter->second; |
| 478 if (layer->scrollable()) { |
| 479 DCHECK_EQ(element_layers.scroll, layer); |
| 480 element_layers.scroll = nullptr; |
| 481 } else { |
| 482 DCHECK_EQ(element_layers.main, layer); |
| 483 element_layers.main = nullptr; |
| 484 } |
| 485 |
| 486 if (!element_layers.main && !element_layers.scroll) |
| 487 element_id_to_layer_map_.erase(layer->element_id()); |
| 488 } |
| 489 |
451 void LayerTreeImpl::AddToElementMap(LayerImpl* layer) { | 490 void LayerTreeImpl::AddToElementMap(LayerImpl* layer) { |
452 if (!layer->element_id() || !layer->mutable_properties()) | 491 if (!layer->element_id() || !layer->mutable_properties()) |
453 return; | 492 return; |
454 | 493 |
455 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), | 494 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), |
456 "LayerTreeImpl::AddToElementMap", "element_id", | 495 "LayerTreeImpl::AddToElementMap", "element_id", |
457 layer->element_id(), "layer_id", layer->id()); | 496 layer->element_id(), "layer_id", layer->id()); |
458 | 497 |
459 ElementLayers& layers = element_layers_map_[layer->element_id()]; | 498 ElementLayers& layers = element_layers_map_[layer->element_id()]; |
460 if ((!layers.main || layer->IsActive()) && !layer->scrollable()) { | 499 if ((!layers.main || layer->IsActive()) && !layer->scrollable()) { |
(...skipping 17 matching lines...) Expand all Loading... |
478 if (!layer->scrollable()) | 517 if (!layer->scrollable()) |
479 layers.main = nullptr; | 518 layers.main = nullptr; |
480 if (layer->scrollable()) | 519 if (layer->scrollable()) |
481 layers.scroll = nullptr; | 520 layers.scroll = nullptr; |
482 | 521 |
483 if (!layers.main && !layers.scroll) | 522 if (!layers.main && !layers.scroll) |
484 element_layers_map_.erase(layer->element_id()); | 523 element_layers_map_.erase(layer->element_id()); |
485 } | 524 } |
486 | 525 |
487 LayerTreeImpl::ElementLayers LayerTreeImpl::GetMutableLayers( | 526 LayerTreeImpl::ElementLayers LayerTreeImpl::GetMutableLayers( |
488 uint64_t element_id) { | 527 ElementId element_id) { |
489 auto iter = element_layers_map_.find(element_id); | 528 auto iter = element_layers_map_.find(element_id); |
490 if (iter == element_layers_map_.end()) | 529 if (iter == element_layers_map_.end()) |
491 return ElementLayers(); | 530 return ElementLayers(); |
492 | 531 |
493 return iter->second; | 532 return iter->second; |
494 } | 533 } |
495 | 534 |
496 LayerImpl* LayerTreeImpl::InnerViewportContainerLayer() const { | 535 LayerImpl* LayerTreeImpl::InnerViewportContainerLayer() const { |
497 return InnerViewportScrollLayer() | 536 return InnerViewportScrollLayer() |
498 ? InnerViewportScrollLayer()->scroll_clip_layer() | 537 ? InnerViewportScrollLayer()->scroll_clip_layer() |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 | 1030 |
992 content_size.SetToMax(viewport_size); | 1031 content_size.SetToMax(viewport_size); |
993 return content_size; | 1032 return content_size; |
994 } | 1033 } |
995 | 1034 |
996 LayerImpl* LayerTreeImpl::LayerById(int id) const { | 1035 LayerImpl* LayerTreeImpl::LayerById(int id) const { |
997 LayerImplMap::const_iterator iter = layer_id_map_.find(id); | 1036 LayerImplMap::const_iterator iter = layer_id_map_.find(id); |
998 return iter != layer_id_map_.end() ? iter->second : NULL; | 1037 return iter != layer_id_map_.end() ? iter->second : NULL; |
999 } | 1038 } |
1000 | 1039 |
| 1040 LayerImpl* LayerTreeImpl::LayerForElementId(ElementId element_id) const { |
| 1041 auto iter = element_id_to_layer_map_.find(element_id); |
| 1042 return iter != element_id_to_layer_map_.end() ? iter->second.main : nullptr; |
| 1043 } |
| 1044 |
| 1045 LayerImpl* LayerTreeImpl::ScrollLayerForElementId(ElementId element_id) const { |
| 1046 auto iter = element_id_to_layer_map_.find(element_id); |
| 1047 return iter != element_id_to_layer_map_.end() ? iter->second.scroll : nullptr; |
| 1048 } |
| 1049 |
| 1050 bool LayerTreeImpl::HasAnyLayerForElementId(ElementId element_id) const { |
| 1051 return element_id_to_layer_map_.find(element_id) != |
| 1052 element_id_to_layer_map_.end(); |
| 1053 } |
| 1054 |
1001 void LayerTreeImpl::AddLayerShouldPushProperties(LayerImpl* layer) { | 1055 void LayerTreeImpl::AddLayerShouldPushProperties(LayerImpl* layer) { |
1002 layers_that_should_push_properties_.insert(layer); | 1056 layers_that_should_push_properties_.insert(layer); |
1003 } | 1057 } |
1004 | 1058 |
1005 void LayerTreeImpl::RemoveLayerShouldPushProperties(LayerImpl* layer) { | 1059 void LayerTreeImpl::RemoveLayerShouldPushProperties(LayerImpl* layer) { |
1006 layers_that_should_push_properties_.erase(layer); | 1060 layers_that_should_push_properties_.erase(layer); |
1007 } | 1061 } |
1008 | 1062 |
1009 std::unordered_set<LayerImpl*>& | 1063 std::unordered_set<LayerImpl*>& |
1010 LayerTreeImpl::LayersThatShouldPushProperties() { | 1064 LayerTreeImpl::LayersThatShouldPushProperties() { |
1011 return layers_that_should_push_properties_; | 1065 return layers_that_should_push_properties_; |
1012 } | 1066 } |
1013 | 1067 |
1014 bool LayerTreeImpl::LayerNeedsPushPropertiesForTesting(LayerImpl* layer) { | 1068 bool LayerTreeImpl::LayerNeedsPushPropertiesForTesting(LayerImpl* layer) { |
1015 return layers_that_should_push_properties_.find(layer) != | 1069 return layers_that_should_push_properties_.find(layer) != |
1016 layers_that_should_push_properties_.end(); | 1070 layers_that_should_push_properties_.end(); |
1017 } | 1071 } |
1018 | 1072 |
1019 void LayerTreeImpl::RegisterLayer(LayerImpl* layer) { | 1073 void LayerTreeImpl::RegisterLayer(LayerImpl* layer) { |
1020 DCHECK(!LayerById(layer->id())); | 1074 DCHECK(!LayerById(layer->id())); |
1021 layer_id_map_[layer->id()] = layer; | 1075 layer_id_map_[layer->id()] = layer; |
1022 layer_tree_host_impl_->animation_host()->RegisterElement( | |
1023 layer->id(), | |
1024 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING); | |
1025 } | 1076 } |
1026 | 1077 |
1027 void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) { | 1078 void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) { |
1028 DCHECK(LayerById(layer->id())); | 1079 DCHECK(LayerById(layer->id())); |
1029 layer_tree_host_impl_->animation_host()->UnregisterElement( | |
1030 layer->id(), | |
1031 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING); | |
1032 layer_id_map_.erase(layer->id()); | 1080 layer_id_map_.erase(layer->id()); |
1033 DCHECK_NE(root_layer_, layer); | 1081 DCHECK_NE(root_layer_, layer); |
1034 } | 1082 } |
1035 | 1083 |
1036 // These manage ownership of the LayerImpl. | 1084 // These manage ownership of the LayerImpl. |
1037 void LayerTreeImpl::AddLayer(std::unique_ptr<LayerImpl> layer) { | 1085 void LayerTreeImpl::AddLayer(std::unique_ptr<LayerImpl> layer) { |
1038 DCHECK(std::find(layers_->begin(), layers_->end(), layer) == layers_->end()); | 1086 DCHECK(std::find(layers_->begin(), layers_->end(), layer) == layers_->end()); |
1039 layers_->push_back(std::move(layer)); | 1087 layers_->push_back(std::move(layer)); |
1040 set_needs_update_draw_properties(); | 1088 set_needs_update_draw_properties(); |
1041 } | 1089 } |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1939 std::unique_ptr<PendingPageScaleAnimation> pending_animation) { | 1987 std::unique_ptr<PendingPageScaleAnimation> pending_animation) { |
1940 pending_page_scale_animation_ = std::move(pending_animation); | 1988 pending_page_scale_animation_ = std::move(pending_animation); |
1941 } | 1989 } |
1942 | 1990 |
1943 std::unique_ptr<PendingPageScaleAnimation> | 1991 std::unique_ptr<PendingPageScaleAnimation> |
1944 LayerTreeImpl::TakePendingPageScaleAnimation() { | 1992 LayerTreeImpl::TakePendingPageScaleAnimation() { |
1945 return std::move(pending_page_scale_animation_); | 1993 return std::move(pending_page_scale_animation_); |
1946 } | 1994 } |
1947 | 1995 |
1948 bool LayerTreeImpl::IsAnimatingFilterProperty(const LayerImpl* layer) const { | 1996 bool LayerTreeImpl::IsAnimatingFilterProperty(const LayerImpl* layer) const { |
| 1997 if (!layer->element_id()) |
| 1998 return false; |
| 1999 |
1949 ElementListType list_type = | 2000 ElementListType list_type = |
1950 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; | 2001 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
1951 return layer_tree_host_impl_->animation_host()->IsAnimatingFilterProperty( | 2002 return layer_tree_host_impl_->animation_host()->IsAnimatingFilterProperty( |
1952 layer->id(), list_type); | 2003 layer->element_id(), list_type); |
1953 } | 2004 } |
1954 | 2005 |
1955 bool LayerTreeImpl::IsAnimatingOpacityProperty(const LayerImpl* layer) const { | 2006 bool LayerTreeImpl::IsAnimatingOpacityProperty(const LayerImpl* layer) const { |
| 2007 if (!layer->element_id()) |
| 2008 return false; |
| 2009 |
1956 ElementListType list_type = | 2010 ElementListType list_type = |
1957 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; | 2011 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
1958 return layer_tree_host_impl_->animation_host()->IsAnimatingOpacityProperty( | 2012 return layer_tree_host_impl_->animation_host()->IsAnimatingOpacityProperty( |
1959 layer->id(), list_type); | 2013 layer->element_id(), list_type); |
1960 } | 2014 } |
1961 | 2015 |
1962 bool LayerTreeImpl::IsAnimatingTransformProperty(const LayerImpl* layer) const { | 2016 bool LayerTreeImpl::IsAnimatingTransformProperty(const LayerImpl* layer) const { |
| 2017 if (!layer->element_id()) |
| 2018 return false; |
| 2019 |
1963 ElementListType list_type = | 2020 ElementListType list_type = |
1964 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; | 2021 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
1965 return layer_tree_host_impl_->animation_host()->IsAnimatingTransformProperty( | 2022 return layer_tree_host_impl_->animation_host()->IsAnimatingTransformProperty( |
1966 layer->id(), list_type); | 2023 layer->element_id(), list_type); |
1967 } | 2024 } |
1968 | 2025 |
1969 bool LayerTreeImpl::HasPotentiallyRunningFilterAnimation( | 2026 bool LayerTreeImpl::HasPotentiallyRunningFilterAnimation( |
1970 const LayerImpl* layer) const { | 2027 const LayerImpl* layer) const { |
1971 ElementListType list_type = | 2028 if (!layer->element_id()) |
1972 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; | 2029 return false; |
1973 return layer_tree_host_impl_->animation_host() | 2030 |
1974 ->HasPotentiallyRunningFilterAnimation(layer->id(), list_type); | 2031 ElementListType list_type = |
| 2032 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
| 2033 return layer_tree_host_impl_->animation_host() |
| 2034 ->HasPotentiallyRunningFilterAnimation(layer->element_id(), list_type); |
1975 } | 2035 } |
1976 | 2036 |
1977 bool LayerTreeImpl::HasPotentiallyRunningOpacityAnimation( | 2037 bool LayerTreeImpl::HasPotentiallyRunningOpacityAnimation( |
1978 const LayerImpl* layer) const { | 2038 const LayerImpl* layer) const { |
1979 ElementListType list_type = | 2039 if (!layer->element_id()) |
1980 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; | 2040 return false; |
1981 return layer_tree_host_impl_->animation_host() | 2041 |
1982 ->HasPotentiallyRunningOpacityAnimation(layer->id(), list_type); | 2042 ElementListType list_type = |
| 2043 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
| 2044 return layer_tree_host_impl_->animation_host() |
| 2045 ->HasPotentiallyRunningOpacityAnimation(layer->element_id(), list_type); |
1983 } | 2046 } |
1984 | 2047 |
1985 bool LayerTreeImpl::HasPotentiallyRunningTransformAnimation( | 2048 bool LayerTreeImpl::HasPotentiallyRunningTransformAnimation( |
1986 const LayerImpl* layer) const { | 2049 const LayerImpl* layer) const { |
1987 ElementListType list_type = | 2050 if (!layer->element_id()) |
1988 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; | 2051 return false; |
1989 return layer_tree_host_impl_->animation_host() | 2052 |
1990 ->HasPotentiallyRunningTransformAnimation(layer->id(), list_type); | 2053 ElementListType list_type = |
| 2054 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
| 2055 return layer_tree_host_impl_->animation_host() |
| 2056 ->HasPotentiallyRunningTransformAnimation(layer->element_id(), list_type); |
1991 } | 2057 } |
1992 | 2058 |
1993 bool LayerTreeImpl::HasAnyAnimationTargetingProperty( | 2059 bool LayerTreeImpl::HasAnyAnimationTargetingProperty( |
1994 const LayerImpl* layer, | 2060 const LayerImpl* layer, |
1995 TargetProperty::Type property) const { | 2061 TargetProperty::Type property) const { |
1996 return layer_tree_host_impl_->animation_host() | 2062 if (!layer->element_id()) |
1997 ->HasAnyAnimationTargetingProperty(layer->id(), property); | 2063 return false; |
| 2064 |
| 2065 return layer_tree_host_impl_->animation_host() |
| 2066 ->HasAnyAnimationTargetingProperty(layer->element_id(), property); |
1998 } | 2067 } |
1999 | 2068 |
2000 bool LayerTreeImpl::FilterIsAnimatingOnImplOnly(const LayerImpl* layer) const { | 2069 bool LayerTreeImpl::FilterIsAnimatingOnImplOnly(const LayerImpl* layer) const { |
| 2070 if (!layer->element_id()) |
| 2071 return false; |
| 2072 |
2001 return layer_tree_host_impl_->animation_host()->FilterIsAnimatingOnImplOnly( | 2073 return layer_tree_host_impl_->animation_host()->FilterIsAnimatingOnImplOnly( |
2002 layer->id()); | 2074 layer->element_id()); |
2003 } | 2075 } |
2004 | 2076 |
2005 bool LayerTreeImpl::OpacityIsAnimatingOnImplOnly(const LayerImpl* layer) const { | 2077 bool LayerTreeImpl::OpacityIsAnimatingOnImplOnly(const LayerImpl* layer) const { |
| 2078 if (!layer->element_id()) |
| 2079 return false; |
| 2080 |
2006 return layer_tree_host_impl_->animation_host()->OpacityIsAnimatingOnImplOnly( | 2081 return layer_tree_host_impl_->animation_host()->OpacityIsAnimatingOnImplOnly( |
2007 layer->id()); | 2082 layer->element_id()); |
2008 } | 2083 } |
2009 | 2084 |
2010 bool LayerTreeImpl::ScrollOffsetIsAnimatingOnImplOnly( | 2085 bool LayerTreeImpl::ScrollOffsetIsAnimatingOnImplOnly( |
2011 const LayerImpl* layer) const { | 2086 const LayerImpl* layer) const { |
2012 return layer_tree_host_impl_->animation_host() | 2087 if (!layer->element_id()) |
2013 ->ScrollOffsetIsAnimatingOnImplOnly(layer->id()); | 2088 return false; |
| 2089 |
| 2090 return layer_tree_host_impl_->animation_host() |
| 2091 ->ScrollOffsetIsAnimatingOnImplOnly(layer->element_id()); |
2014 } | 2092 } |
2015 | 2093 |
2016 bool LayerTreeImpl::TransformIsAnimatingOnImplOnly( | 2094 bool LayerTreeImpl::TransformIsAnimatingOnImplOnly( |
2017 const LayerImpl* layer) const { | 2095 const LayerImpl* layer) const { |
2018 return layer_tree_host_impl_->animation_host() | 2096 if (!layer->element_id()) |
2019 ->TransformIsAnimatingOnImplOnly(layer->id()); | 2097 return false; |
| 2098 |
| 2099 return layer_tree_host_impl_->animation_host() |
| 2100 ->TransformIsAnimatingOnImplOnly(layer->element_id()); |
2020 } | 2101 } |
2021 | 2102 |
2022 bool LayerTreeImpl::AnimationsPreserveAxisAlignment( | 2103 bool LayerTreeImpl::AnimationsPreserveAxisAlignment( |
2023 const LayerImpl* layer) const { | 2104 const LayerImpl* layer) const { |
2024 return layer_tree_host_impl_->animation_host() | 2105 if (!layer->element_id()) |
2025 ->AnimationsPreserveAxisAlignment(layer->id()); | 2106 return true; |
| 2107 |
| 2108 return layer_tree_host_impl_->animation_host() |
| 2109 ->AnimationsPreserveAxisAlignment(layer->element_id()); |
2026 } | 2110 } |
2027 | 2111 |
2028 bool LayerTreeImpl::HasOnlyTranslationTransforms(const LayerImpl* layer) const { | 2112 bool LayerTreeImpl::HasOnlyTranslationTransforms(const LayerImpl* layer) const { |
| 2113 if (!layer->element_id()) |
| 2114 return true; |
| 2115 |
2029 ElementListType list_type = | 2116 ElementListType list_type = |
2030 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; | 2117 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
2031 return layer_tree_host_impl_->animation_host()->HasOnlyTranslationTransforms( | 2118 return layer_tree_host_impl_->animation_host()->HasOnlyTranslationTransforms( |
2032 layer->id(), list_type); | 2119 layer->element_id(), list_type); |
2033 } | 2120 } |
2034 | 2121 |
2035 bool LayerTreeImpl::MaximumTargetScale(const LayerImpl* layer, | 2122 bool LayerTreeImpl::MaximumTargetScale(const LayerImpl* layer, |
2036 float* max_scale) const { | 2123 float* max_scale) const { |
2037 *max_scale = 0.f; | 2124 *max_scale = 0.f; |
| 2125 if (!layer->element_id()) |
| 2126 return true; |
| 2127 |
2038 ElementListType list_type = | 2128 ElementListType list_type = |
2039 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; | 2129 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
2040 return layer_tree_host_impl_->animation_host()->MaximumTargetScale( | 2130 return layer_tree_host_impl_->animation_host()->MaximumTargetScale( |
2041 layer->id(), list_type, max_scale); | 2131 layer->element_id(), list_type, max_scale); |
2042 } | 2132 } |
2043 | 2133 |
2044 bool LayerTreeImpl::AnimationStartScale(const LayerImpl* layer, | 2134 bool LayerTreeImpl::AnimationStartScale(const LayerImpl* layer, |
2045 float* start_scale) const { | 2135 float* start_scale) const { |
2046 *start_scale = 0.f; | 2136 *start_scale = 0.f; |
| 2137 if (!layer->element_id()) |
| 2138 return true; |
| 2139 |
2047 ElementListType list_type = | 2140 ElementListType list_type = |
2048 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; | 2141 IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING; |
2049 return layer_tree_host_impl_->animation_host()->AnimationStartScale( | 2142 return layer_tree_host_impl_->animation_host()->AnimationStartScale( |
2050 layer->id(), list_type, start_scale); | 2143 layer->element_id(), list_type, start_scale); |
2051 } | 2144 } |
2052 | 2145 |
2053 bool LayerTreeImpl::HasFilterAnimationThatInflatesBounds( | 2146 bool LayerTreeImpl::HasFilterAnimationThatInflatesBounds( |
2054 const LayerImpl* layer) const { | 2147 const LayerImpl* layer) const { |
2055 return layer_tree_host_impl_->animation_host() | 2148 if (!layer->element_id()) |
2056 ->HasFilterAnimationThatInflatesBounds(layer->id()); | 2149 return false; |
| 2150 |
| 2151 return layer_tree_host_impl_->animation_host() |
| 2152 ->HasFilterAnimationThatInflatesBounds(layer->element_id()); |
2057 } | 2153 } |
2058 | 2154 |
2059 bool LayerTreeImpl::HasTransformAnimationThatInflatesBounds( | 2155 bool LayerTreeImpl::HasTransformAnimationThatInflatesBounds( |
2060 const LayerImpl* layer) const { | 2156 const LayerImpl* layer) const { |
2061 return layer_tree_host_impl_->animation_host() | 2157 if (!layer->element_id()) |
2062 ->HasTransformAnimationThatInflatesBounds(layer->id()); | 2158 return false; |
| 2159 |
| 2160 return layer_tree_host_impl_->animation_host() |
| 2161 ->HasTransformAnimationThatInflatesBounds(layer->element_id()); |
2063 } | 2162 } |
2064 | 2163 |
2065 bool LayerTreeImpl::HasAnimationThatInflatesBounds( | 2164 bool LayerTreeImpl::HasAnimationThatInflatesBounds( |
2066 const LayerImpl* layer) const { | 2165 const LayerImpl* layer) const { |
2067 return layer_tree_host_impl_->animation_host() | 2166 if (!layer->element_id()) |
2068 ->HasAnimationThatInflatesBounds(layer->id()); | 2167 return false; |
| 2168 |
| 2169 return layer_tree_host_impl_->animation_host() |
| 2170 ->HasAnimationThatInflatesBounds(layer->element_id()); |
2069 } | 2171 } |
2070 | 2172 |
2071 bool LayerTreeImpl::FilterAnimationBoundsForBox(const LayerImpl* layer, | 2173 bool LayerTreeImpl::FilterAnimationBoundsForBox(const LayerImpl* layer, |
2072 const gfx::BoxF& box, | 2174 const gfx::BoxF& box, |
2073 gfx::BoxF* bounds) const { | 2175 gfx::BoxF* bounds) const { |
| 2176 if (!layer->element_id()) |
| 2177 return false; |
| 2178 |
2074 return layer_tree_host_impl_->animation_host()->FilterAnimationBoundsForBox( | 2179 return layer_tree_host_impl_->animation_host()->FilterAnimationBoundsForBox( |
2075 layer->id(), box, bounds); | 2180 layer->element_id(), box, bounds); |
2076 } | 2181 } |
2077 | 2182 |
2078 bool LayerTreeImpl::TransformAnimationBoundsForBox(const LayerImpl* layer, | 2183 bool LayerTreeImpl::TransformAnimationBoundsForBox(const LayerImpl* layer, |
2079 const gfx::BoxF& box, | 2184 const gfx::BoxF& box, |
2080 gfx::BoxF* bounds) const { | 2185 gfx::BoxF* bounds) const { |
2081 *bounds = gfx::BoxF(); | 2186 *bounds = gfx::BoxF(); |
2082 return layer_tree_host_impl_->animation_host() | 2187 if (!layer->element_id()) |
2083 ->TransformAnimationBoundsForBox(layer->id(), box, bounds); | 2188 return true; |
| 2189 |
| 2190 return layer_tree_host_impl_->animation_host() |
| 2191 ->TransformAnimationBoundsForBox(layer->element_id(), box, bounds); |
2084 } | 2192 } |
2085 | 2193 |
2086 void LayerTreeImpl::ScrollAnimationAbort(bool needs_completion) { | 2194 void LayerTreeImpl::ScrollAnimationAbort(bool needs_completion) { |
2087 layer_tree_host_impl_->animation_host()->ScrollAnimationAbort( | 2195 layer_tree_host_impl_->animation_host()->ScrollAnimationAbort( |
2088 needs_completion); | 2196 needs_completion); |
2089 } | 2197 } |
2090 | 2198 |
2091 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) { | 2199 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) { |
2092 layers_that_should_push_properties_.clear(); | 2200 layers_that_should_push_properties_.clear(); |
2093 for (auto* layer : *this) | 2201 for (auto* layer : *this) |
2094 layer->ResetChangeTracking(); | 2202 layer->ResetChangeTracking(); |
2095 property_trees_.ResetAllChangeTracking(flag); | 2203 property_trees_.ResetAllChangeTracking(flag); |
2096 } | 2204 } |
2097 | 2205 |
2098 } // namespace cc | 2206 } // namespace cc |
OLD | NEW |