| 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/layers/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
| 13 #include "base/numerics/safe_conversions.h" | 13 #include "base/numerics/safe_conversions.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
| 16 #include "base/trace_event/trace_event_argument.h" | 16 #include "base/trace_event/trace_event_argument.h" |
| 17 #include "cc/animation/animation_host.h" | 17 #include "cc/animation/animation_host.h" |
| 18 #include "cc/animation/animation_registrar.h" | |
| 19 #include "cc/animation/mutable_properties.h" | 18 #include "cc/animation/mutable_properties.h" |
| 20 #include "cc/base/math_util.h" | 19 #include "cc/base/math_util.h" |
| 21 #include "cc/base/simple_enclosed_region.h" | 20 #include "cc/base/simple_enclosed_region.h" |
| 22 #include "cc/debug/debug_colors.h" | 21 #include "cc/debug/debug_colors.h" |
| 23 #include "cc/debug/layer_tree_debug_state.h" | 22 #include "cc/debug/layer_tree_debug_state.h" |
| 24 #include "cc/debug/micro_benchmark_impl.h" | 23 #include "cc/debug/micro_benchmark_impl.h" |
| 25 #include "cc/debug/traced_value.h" | 24 #include "cc/debug/traced_value.h" |
| 26 #include "cc/input/main_thread_scrolling_reason.h" | 25 #include "cc/input/main_thread_scrolling_reason.h" |
| 27 #include "cc/input/scroll_state.h" | 26 #include "cc/input/scroll_state.h" |
| 28 #include "cc/layers/layer.h" | 27 #include "cc/layers/layer.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 element_id_(0), | 87 element_id_(0), |
| 89 mutable_properties_(MutableProperty::kNone), | 88 mutable_properties_(MutableProperty::kNone), |
| 90 debug_info_(nullptr), | 89 debug_info_(nullptr), |
| 91 force_render_surface_(false), | 90 force_render_surface_(false), |
| 92 frame_timing_requests_dirty_(false), | 91 frame_timing_requests_dirty_(false), |
| 93 visited_(false), | 92 visited_(false), |
| 94 layer_or_descendant_is_drawn_(false), | 93 layer_or_descendant_is_drawn_(false), |
| 95 layer_or_descendant_has_touch_handler_(false), | 94 layer_or_descendant_has_touch_handler_(false), |
| 96 sorted_for_recursion_(false) { | 95 sorted_for_recursion_(false) { |
| 97 DCHECK_GT(layer_id_, 0); | 96 DCHECK_GT(layer_id_, 0); |
| 97 |
| 98 DCHECK(layer_tree_impl_); | 98 DCHECK(layer_tree_impl_); |
| 99 layer_tree_impl_->RegisterLayer(this); | 99 layer_tree_impl_->RegisterLayer(this); |
| 100 | |
| 101 if (!layer_tree_impl_->settings().use_compositor_animation_timelines) { | |
| 102 AnimationRegistrar* registrar = layer_tree_impl_->GetAnimationRegistrar(); | |
| 103 layer_animation_controller_ = | |
| 104 registrar->GetAnimationControllerForId(layer_id_); | |
| 105 layer_animation_controller_->AddValueObserver(this); | |
| 106 if (IsActive()) { | |
| 107 layer_animation_controller_->set_value_provider(this); | |
| 108 layer_animation_controller_->set_layer_animation_delegate(this); | |
| 109 } | |
| 110 } | |
| 111 | |
| 112 layer_tree_impl_->AddToElementMap(this); | 100 layer_tree_impl_->AddToElementMap(this); |
| 113 | 101 |
| 114 SetNeedsPushProperties(); | 102 SetNeedsPushProperties(); |
| 115 } | 103 } |
| 116 | 104 |
| 117 LayerImpl::~LayerImpl() { | 105 LayerImpl::~LayerImpl() { |
| 118 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); | 106 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); |
| 119 | 107 |
| 120 if (layer_animation_controller_) { | |
| 121 layer_animation_controller_->RemoveValueObserver(this); | |
| 122 layer_animation_controller_->remove_value_provider(this); | |
| 123 layer_animation_controller_->remove_layer_animation_delegate(this); | |
| 124 } | |
| 125 | |
| 126 if (!copy_requests_.empty() && layer_tree_impl_->IsActiveTree()) | 108 if (!copy_requests_.empty() && layer_tree_impl_->IsActiveTree()) |
| 127 layer_tree_impl()->RemoveLayerWithCopyOutputRequest(this); | 109 layer_tree_impl()->RemoveLayerWithCopyOutputRequest(this); |
| 128 layer_tree_impl_->UnregisterScrollLayer(this); | 110 layer_tree_impl_->UnregisterScrollLayer(this); |
| 129 layer_tree_impl_->UnregisterLayer(this); | 111 layer_tree_impl_->UnregisterLayer(this); |
| 130 layer_tree_impl_->RemoveLayerShouldPushProperties(this); | 112 layer_tree_impl_->RemoveLayerShouldPushProperties(this); |
| 131 | 113 |
| 132 layer_tree_impl_->RemoveFromElementMap(this); | 114 layer_tree_impl_->RemoveFromElementMap(this); |
| 133 | 115 |
| 134 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 116 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
| 135 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this); | 117 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this); |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 uint32_t main_thread_scrolling_reasons) { | 478 uint32_t main_thread_scrolling_reasons) { |
| 497 if (main_thread_scrolling_reasons_ == main_thread_scrolling_reasons) | 479 if (main_thread_scrolling_reasons_ == main_thread_scrolling_reasons) |
| 498 return; | 480 return; |
| 499 | 481 |
| 500 if (main_thread_scrolling_reasons & | 482 if (main_thread_scrolling_reasons & |
| 501 MainThreadScrollingReason::kHasNonLayerViewportConstrainedObjects && | 483 MainThreadScrollingReason::kHasNonLayerViewportConstrainedObjects && |
| 502 layer_tree_impl()) { | 484 layer_tree_impl()) { |
| 503 if (layer_tree_impl()->ScrollOffsetIsAnimatingOnImplOnly(this)) { | 485 if (layer_tree_impl()->ScrollOffsetIsAnimatingOnImplOnly(this)) { |
| 504 layer_tree_impl()->animation_host()->ScrollAnimationAbort( | 486 layer_tree_impl()->animation_host()->ScrollAnimationAbort( |
| 505 true /* needs_completion */); | 487 true /* needs_completion */); |
| 506 } else if (layer_animation_controller()) { | |
| 507 layer_animation_controller()->AbortAnimations( | |
| 508 TargetProperty::SCROLL_OFFSET); | |
| 509 } | 488 } |
| 510 } | 489 } |
| 511 | 490 |
| 512 main_thread_scrolling_reasons_ = main_thread_scrolling_reasons; | 491 main_thread_scrolling_reasons_ = main_thread_scrolling_reasons; |
| 513 } | 492 } |
| 514 | 493 |
| 515 void LayerImpl::PushPropertiesTo(LayerImpl* layer) { | 494 void LayerImpl::PushPropertiesTo(LayerImpl* layer) { |
| 516 layer->SetTransformOrigin(transform_origin_); | 495 layer->SetTransformOrigin(transform_origin_); |
| 517 layer->SetBackgroundColor(background_color_); | 496 layer->SetBackgroundColor(background_color_); |
| 518 layer->SetSafeOpaqueBackgroundColor(safe_opaque_background_color_); | 497 layer->SetSafeOpaqueBackgroundColor(safe_opaque_background_color_); |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 // layers in the pending tree will find out about these changes as a | 932 // layers in the pending tree will find out about these changes as a |
| 954 // result of the shared SyncedProperty. | 933 // result of the shared SyncedProperty. |
| 955 if (!IsActive()) | 934 if (!IsActive()) |
| 956 return; | 935 return; |
| 957 | 936 |
| 958 SetCurrentScrollOffset(scroll_offset); | 937 SetCurrentScrollOffset(scroll_offset); |
| 959 | 938 |
| 960 layer_tree_impl_->DidAnimateScrollOffset(); | 939 layer_tree_impl_->DidAnimateScrollOffset(); |
| 961 } | 940 } |
| 962 | 941 |
| 963 void LayerImpl::OnAnimationWaitingForDeletion() {} | |
| 964 | |
| 965 void LayerImpl::OnTransformIsPotentiallyAnimatingChanged(bool is_animating) { | 942 void LayerImpl::OnTransformIsPotentiallyAnimatingChanged(bool is_animating) { |
| 966 UpdatePropertyTreeTransformIsAnimated(is_animating); | 943 UpdatePropertyTreeTransformIsAnimated(is_animating); |
| 967 was_ever_ready_since_last_transform_animation_ = false; | 944 was_ever_ready_since_last_transform_animation_ = false; |
| 968 } | 945 } |
| 969 | 946 |
| 970 bool LayerImpl::IsActive() const { | 947 bool LayerImpl::IsActive() const { |
| 971 return layer_tree_impl_->IsActiveTree(); | 948 return layer_tree_impl_->IsActiveTree(); |
| 972 } | 949 } |
| 973 | 950 |
| 974 gfx::Size LayerImpl::bounds() const { | 951 gfx::Size LayerImpl::bounds() const { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1119 } | 1096 } |
| 1120 | 1097 |
| 1121 void LayerImpl::SetFilters(const FilterOperations& filters) { | 1098 void LayerImpl::SetFilters(const FilterOperations& filters) { |
| 1122 if (filters_ == filters) | 1099 if (filters_ == filters) |
| 1123 return; | 1100 return; |
| 1124 | 1101 |
| 1125 filters_ = filters; | 1102 filters_ = filters; |
| 1126 } | 1103 } |
| 1127 | 1104 |
| 1128 bool LayerImpl::FilterIsAnimating() const { | 1105 bool LayerImpl::FilterIsAnimating() const { |
| 1129 LayerAnimationController::ObserverType observer_type = | 1106 return layer_tree_impl_->IsAnimatingFilterProperty(this); |
| 1130 IsActive() ? LayerAnimationController::ObserverType::ACTIVE | |
| 1131 : LayerAnimationController::ObserverType::PENDING; | |
| 1132 return layer_animation_controller_ | |
| 1133 ? layer_animation_controller_->IsCurrentlyAnimatingProperty( | |
| 1134 TargetProperty::FILTER, observer_type) | |
| 1135 : layer_tree_impl_->IsAnimatingFilterProperty(this); | |
| 1136 } | 1107 } |
| 1137 | 1108 |
| 1138 bool LayerImpl::HasPotentiallyRunningFilterAnimation() const { | 1109 bool LayerImpl::HasPotentiallyRunningFilterAnimation() const { |
| 1139 LayerAnimationController::ObserverType observer_type = | 1110 return layer_tree_impl_->HasPotentiallyRunningFilterAnimation(this); |
| 1140 IsActive() ? LayerAnimationController::ObserverType::ACTIVE | |
| 1141 : LayerAnimationController::ObserverType::PENDING; | |
| 1142 return layer_animation_controller_ | |
| 1143 ? layer_animation_controller_->IsPotentiallyAnimatingProperty( | |
| 1144 TargetProperty::FILTER, observer_type) | |
| 1145 : layer_tree_impl_->HasPotentiallyRunningFilterAnimation(this); | |
| 1146 } | 1111 } |
| 1147 | 1112 |
| 1148 bool LayerImpl::FilterIsAnimatingOnImplOnly() const { | 1113 bool LayerImpl::FilterIsAnimatingOnImplOnly() const { |
| 1149 if (!layer_animation_controller_) | 1114 return layer_tree_impl_->FilterIsAnimatingOnImplOnly(this); |
| 1150 return layer_tree_impl_->FilterIsAnimatingOnImplOnly(this); | |
| 1151 | |
| 1152 Animation* filter_animation = | |
| 1153 layer_animation_controller_->GetAnimation(TargetProperty::FILTER); | |
| 1154 return filter_animation && filter_animation->is_impl_only(); | |
| 1155 } | 1115 } |
| 1156 | 1116 |
| 1157 void LayerImpl::SetBackgroundFilters( | 1117 void LayerImpl::SetBackgroundFilters( |
| 1158 const FilterOperations& filters) { | 1118 const FilterOperations& filters) { |
| 1159 if (background_filters_ == filters) | 1119 if (background_filters_ == filters) |
| 1160 return; | 1120 return; |
| 1161 | 1121 |
| 1162 background_filters_ = filters; | 1122 background_filters_ = filters; |
| 1163 NoteLayerPropertyChanged(); | 1123 NoteLayerPropertyChanged(); |
| 1164 } | 1124 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1182 return; | 1142 return; |
| 1183 | 1143 |
| 1184 opacity_ = opacity; | 1144 opacity_ = opacity; |
| 1185 } | 1145 } |
| 1186 | 1146 |
| 1187 float LayerImpl::EffectiveOpacity() const { | 1147 float LayerImpl::EffectiveOpacity() const { |
| 1188 return hide_layer_and_subtree_ ? 0.f : opacity_; | 1148 return hide_layer_and_subtree_ ? 0.f : opacity_; |
| 1189 } | 1149 } |
| 1190 | 1150 |
| 1191 bool LayerImpl::OpacityIsAnimating() const { | 1151 bool LayerImpl::OpacityIsAnimating() const { |
| 1192 LayerAnimationController::ObserverType observer_type = | 1152 return layer_tree_impl_->IsAnimatingOpacityProperty(this); |
| 1193 IsActive() ? LayerAnimationController::ObserverType::ACTIVE | |
| 1194 : LayerAnimationController::ObserverType::PENDING; | |
| 1195 return layer_animation_controller_ | |
| 1196 ? layer_animation_controller_->IsCurrentlyAnimatingProperty( | |
| 1197 TargetProperty::OPACITY, observer_type) | |
| 1198 : layer_tree_impl_->IsAnimatingOpacityProperty(this); | |
| 1199 } | 1153 } |
| 1200 | 1154 |
| 1201 bool LayerImpl::HasPotentiallyRunningOpacityAnimation() const { | 1155 bool LayerImpl::HasPotentiallyRunningOpacityAnimation() const { |
| 1202 LayerAnimationController::ObserverType observer_type = | 1156 return layer_tree_impl_->HasPotentiallyRunningOpacityAnimation(this); |
| 1203 IsActive() ? LayerAnimationController::ObserverType::ACTIVE | |
| 1204 : LayerAnimationController::ObserverType::PENDING; | |
| 1205 return layer_animation_controller_ | |
| 1206 ? layer_animation_controller_->IsPotentiallyAnimatingProperty( | |
| 1207 TargetProperty::OPACITY, observer_type) | |
| 1208 : layer_tree_impl_->HasPotentiallyRunningOpacityAnimation(this); | |
| 1209 } | 1157 } |
| 1210 | 1158 |
| 1211 bool LayerImpl::OpacityIsAnimatingOnImplOnly() const { | 1159 bool LayerImpl::OpacityIsAnimatingOnImplOnly() const { |
| 1212 if (!layer_animation_controller_) | 1160 return layer_tree_impl_->OpacityIsAnimatingOnImplOnly(this); |
| 1213 return layer_tree_impl_->OpacityIsAnimatingOnImplOnly(this); | |
| 1214 | |
| 1215 Animation* opacity_animation = | |
| 1216 layer_animation_controller_->GetAnimation(TargetProperty::OPACITY); | |
| 1217 return opacity_animation && opacity_animation->is_impl_only(); | |
| 1218 } | 1161 } |
| 1219 | 1162 |
| 1220 void LayerImpl::SetElementId(uint64_t element_id) { | 1163 void LayerImpl::SetElementId(uint64_t element_id) { |
| 1221 if (element_id == element_id_) | 1164 if (element_id == element_id_) |
| 1222 return; | 1165 return; |
| 1223 | 1166 |
| 1224 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), | 1167 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), |
| 1225 "LayerImpl::SetElementId", "id", element_id); | 1168 "LayerImpl::SetElementId", "id", element_id); |
| 1226 | 1169 |
| 1227 layer_tree_impl_->RemoveFromElementMap(this); | 1170 layer_tree_impl_->RemoveFromElementMap(this); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 if (transform_ == transform) { | 1256 if (transform_ == transform) { |
| 1314 DCHECK(transform_is_invertible_ == transform_is_invertible) | 1257 DCHECK(transform_is_invertible_ == transform_is_invertible) |
| 1315 << "Can't change invertibility if transform is unchanged"; | 1258 << "Can't change invertibility if transform is unchanged"; |
| 1316 return; | 1259 return; |
| 1317 } | 1260 } |
| 1318 transform_ = transform; | 1261 transform_ = transform; |
| 1319 transform_is_invertible_ = transform_is_invertible; | 1262 transform_is_invertible_ = transform_is_invertible; |
| 1320 } | 1263 } |
| 1321 | 1264 |
| 1322 bool LayerImpl::TransformIsAnimating() const { | 1265 bool LayerImpl::TransformIsAnimating() const { |
| 1323 LayerAnimationController::ObserverType observer_type = | 1266 return layer_tree_impl_->IsAnimatingTransformProperty(this); |
| 1324 IsActive() ? LayerAnimationController::ObserverType::ACTIVE | |
| 1325 : LayerAnimationController::ObserverType::PENDING; | |
| 1326 return layer_animation_controller_ | |
| 1327 ? layer_animation_controller_->IsCurrentlyAnimatingProperty( | |
| 1328 TargetProperty::TRANSFORM, observer_type) | |
| 1329 : layer_tree_impl_->IsAnimatingTransformProperty(this); | |
| 1330 } | 1267 } |
| 1331 | 1268 |
| 1332 bool LayerImpl::HasPotentiallyRunningTransformAnimation() const { | 1269 bool LayerImpl::HasPotentiallyRunningTransformAnimation() const { |
| 1333 LayerAnimationController::ObserverType observer_type = | 1270 return layer_tree_impl_->HasPotentiallyRunningTransformAnimation(this); |
| 1334 IsActive() ? LayerAnimationController::ObserverType::ACTIVE | |
| 1335 : LayerAnimationController::ObserverType::PENDING; | |
| 1336 return layer_animation_controller_ | |
| 1337 ? layer_animation_controller_->IsPotentiallyAnimatingProperty( | |
| 1338 TargetProperty::TRANSFORM, observer_type) | |
| 1339 : layer_tree_impl_->HasPotentiallyRunningTransformAnimation(this); | |
| 1340 } | 1271 } |
| 1341 | 1272 |
| 1342 bool LayerImpl::TransformIsAnimatingOnImplOnly() const { | 1273 bool LayerImpl::TransformIsAnimatingOnImplOnly() const { |
| 1343 if (!layer_animation_controller_) | 1274 return layer_tree_impl_->TransformIsAnimatingOnImplOnly(this); |
| 1344 return layer_tree_impl_->TransformIsAnimatingOnImplOnly(this); | |
| 1345 | |
| 1346 Animation* transform_animation = | |
| 1347 layer_animation_controller_->GetAnimation(TargetProperty::TRANSFORM); | |
| 1348 return transform_animation && transform_animation->is_impl_only(); | |
| 1349 } | 1275 } |
| 1350 | 1276 |
| 1351 bool LayerImpl::HasOnlyTranslationTransforms() const { | 1277 bool LayerImpl::HasOnlyTranslationTransforms() const { |
| 1352 if (!layer_animation_controller_) | 1278 return layer_tree_impl_->HasOnlyTranslationTransforms(this); |
| 1353 return layer_tree_impl_->HasOnlyTranslationTransforms(this); | |
| 1354 | |
| 1355 LayerAnimationController::ObserverType observer_type = | |
| 1356 IsActive() ? LayerAnimationController::ObserverType::ACTIVE | |
| 1357 : LayerAnimationController::ObserverType::PENDING; | |
| 1358 return layer_animation_controller_->HasOnlyTranslationTransforms( | |
| 1359 observer_type); | |
| 1360 } | 1279 } |
| 1361 | 1280 |
| 1362 bool LayerImpl::AnimationsPreserveAxisAlignment() const { | 1281 bool LayerImpl::AnimationsPreserveAxisAlignment() const { |
| 1363 return layer_animation_controller_ | 1282 return layer_tree_impl_->AnimationsPreserveAxisAlignment(this); |
| 1364 ? layer_animation_controller_->AnimationsPreserveAxisAlignment() | |
| 1365 : layer_tree_impl_->AnimationsPreserveAxisAlignment(this); | |
| 1366 } | 1283 } |
| 1367 | 1284 |
| 1368 bool LayerImpl::MaximumTargetScale(float* max_scale) const { | 1285 bool LayerImpl::MaximumTargetScale(float* max_scale) const { |
| 1369 if (!layer_animation_controller_) | 1286 return layer_tree_impl_->MaximumTargetScale(this, max_scale); |
| 1370 return layer_tree_impl_->MaximumTargetScale(this, max_scale); | |
| 1371 | |
| 1372 LayerAnimationController::ObserverType observer_type = | |
| 1373 IsActive() ? LayerAnimationController::ObserverType::ACTIVE | |
| 1374 : LayerAnimationController::ObserverType::PENDING; | |
| 1375 return layer_animation_controller_->MaximumTargetScale(observer_type, | |
| 1376 max_scale); | |
| 1377 } | 1287 } |
| 1378 | 1288 |
| 1379 bool LayerImpl::AnimationStartScale(float* start_scale) const { | 1289 bool LayerImpl::AnimationStartScale(float* start_scale) const { |
| 1380 if (!layer_animation_controller_) | 1290 return layer_tree_impl_->AnimationStartScale(this, start_scale); |
| 1381 return layer_tree_impl_->AnimationStartScale(this, start_scale); | |
| 1382 | |
| 1383 LayerAnimationController::ObserverType observer_type = | |
| 1384 IsActive() ? LayerAnimationController::ObserverType::ACTIVE | |
| 1385 : LayerAnimationController::ObserverType::PENDING; | |
| 1386 return layer_animation_controller_->AnimationStartScale(observer_type, | |
| 1387 start_scale); | |
| 1388 } | 1291 } |
| 1389 | 1292 |
| 1390 bool LayerImpl::HasAnyAnimationTargetingProperty( | 1293 bool LayerImpl::HasAnyAnimationTargetingProperty( |
| 1391 TargetProperty::Type property) const { | 1294 TargetProperty::Type property) const { |
| 1392 if (!layer_animation_controller_) | 1295 return layer_tree_impl_->HasAnyAnimationTargetingProperty(this, property); |
| 1393 return layer_tree_impl_->HasAnyAnimationTargetingProperty(this, property); | |
| 1394 | |
| 1395 return !!layer_animation_controller_->GetAnimation(property); | |
| 1396 } | 1296 } |
| 1397 | 1297 |
| 1398 bool LayerImpl::HasFilterAnimationThatInflatesBounds() const { | 1298 bool LayerImpl::HasFilterAnimationThatInflatesBounds() const { |
| 1399 if (!layer_animation_controller_) | 1299 return layer_tree_impl_->HasFilterAnimationThatInflatesBounds(this); |
| 1400 return layer_tree_impl_->HasFilterAnimationThatInflatesBounds(this); | |
| 1401 | |
| 1402 return layer_animation_controller_->HasFilterAnimationThatInflatesBounds(); | |
| 1403 } | 1300 } |
| 1404 | 1301 |
| 1405 bool LayerImpl::HasTransformAnimationThatInflatesBounds() const { | 1302 bool LayerImpl::HasTransformAnimationThatInflatesBounds() const { |
| 1406 if (!layer_animation_controller_) | 1303 return layer_tree_impl_->HasTransformAnimationThatInflatesBounds(this); |
| 1407 return layer_tree_impl_->HasTransformAnimationThatInflatesBounds(this); | |
| 1408 | |
| 1409 return layer_animation_controller_->HasTransformAnimationThatInflatesBounds(); | |
| 1410 } | 1304 } |
| 1411 | 1305 |
| 1412 bool LayerImpl::HasAnimationThatInflatesBounds() const { | 1306 bool LayerImpl::HasAnimationThatInflatesBounds() const { |
| 1413 if (!layer_animation_controller_) | 1307 return layer_tree_impl_->HasAnimationThatInflatesBounds(this); |
| 1414 return layer_tree_impl_->HasAnimationThatInflatesBounds(this); | |
| 1415 | |
| 1416 return layer_animation_controller_->HasAnimationThatInflatesBounds(); | |
| 1417 } | 1308 } |
| 1418 | 1309 |
| 1419 bool LayerImpl::FilterAnimationBoundsForBox(const gfx::BoxF& box, | 1310 bool LayerImpl::FilterAnimationBoundsForBox(const gfx::BoxF& box, |
| 1420 gfx::BoxF* bounds) const { | 1311 gfx::BoxF* bounds) const { |
| 1421 if (!layer_animation_controller_) | 1312 return layer_tree_impl_->FilterAnimationBoundsForBox(this, box, bounds); |
| 1422 return layer_tree_impl_->FilterAnimationBoundsForBox(this, box, bounds); | |
| 1423 | |
| 1424 return layer_animation_controller_->FilterAnimationBoundsForBox(box, bounds); | |
| 1425 } | 1313 } |
| 1426 | 1314 |
| 1427 bool LayerImpl::TransformAnimationBoundsForBox(const gfx::BoxF& box, | 1315 bool LayerImpl::TransformAnimationBoundsForBox(const gfx::BoxF& box, |
| 1428 gfx::BoxF* bounds) const { | 1316 gfx::BoxF* bounds) const { |
| 1429 if (!layer_animation_controller_) | 1317 return layer_tree_impl_->TransformAnimationBoundsForBox(this, box, bounds); |
| 1430 return layer_tree_impl_->TransformAnimationBoundsForBox(this, box, bounds); | |
| 1431 | |
| 1432 return layer_animation_controller_->TransformAnimationBoundsForBox(box, | |
| 1433 bounds); | |
| 1434 } | 1318 } |
| 1435 | 1319 |
| 1436 void LayerImpl::SetUpdateRect(const gfx::Rect& update_rect) { | 1320 void LayerImpl::SetUpdateRect(const gfx::Rect& update_rect) { |
| 1437 update_rect_ = update_rect; | 1321 update_rect_ = update_rect; |
| 1438 SetNeedsPushProperties(); | 1322 SetNeedsPushProperties(); |
| 1439 } | 1323 } |
| 1440 | 1324 |
| 1441 void LayerImpl::AddDamageRect(const gfx::Rect& damage_rect) { | 1325 void LayerImpl::AddDamageRect(const gfx::Rect& damage_rect) { |
| 1442 damage_rect_.Union(damage_rect); | 1326 damage_rect_.Union(damage_rect); |
| 1443 } | 1327 } |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1644 | 1528 |
| 1645 if (scroll_parent_) | 1529 if (scroll_parent_) |
| 1646 state->SetInteger("scroll_parent", scroll_parent_->id()); | 1530 state->SetInteger("scroll_parent", scroll_parent_->id()); |
| 1647 | 1531 |
| 1648 if (clip_parent_) | 1532 if (clip_parent_) |
| 1649 state->SetInteger("clip_parent", clip_parent_->id()); | 1533 state->SetInteger("clip_parent", clip_parent_->id()); |
| 1650 | 1534 |
| 1651 state->SetBoolean("can_use_lcd_text", can_use_lcd_text()); | 1535 state->SetBoolean("can_use_lcd_text", can_use_lcd_text()); |
| 1652 state->SetBoolean("contents_opaque", contents_opaque()); | 1536 state->SetBoolean("contents_opaque", contents_opaque()); |
| 1653 | 1537 |
| 1654 state->SetBoolean( | 1538 state->SetBoolean("has_animation_bounds", |
| 1655 "has_animation_bounds", | 1539 layer_tree_impl_->HasAnimationThatInflatesBounds(this)); |
| 1656 layer_animation_controller_ | |
| 1657 ? layer_animation_controller_->HasAnimationThatInflatesBounds() | |
| 1658 : layer_tree_impl_->HasAnimationThatInflatesBounds(this)); | |
| 1659 | 1540 |
| 1660 gfx::BoxF box; | 1541 gfx::BoxF box; |
| 1661 if (LayerUtils::GetAnimationBounds(*this, &box)) | 1542 if (LayerUtils::GetAnimationBounds(*this, &box)) |
| 1662 MathUtil::AddToTracedValue("animation_bounds", box, state); | 1543 MathUtil::AddToTracedValue("animation_bounds", box, state); |
| 1663 | 1544 |
| 1664 if (debug_info_) { | 1545 if (debug_info_) { |
| 1665 std::string str; | 1546 std::string str; |
| 1666 debug_info_->AppendAsTraceFormat(&str); | 1547 debug_info_->AppendAsTraceFormat(&str); |
| 1667 base::JSONReader json_reader; | 1548 base::JSONReader json_reader; |
| 1668 scoped_ptr<base::Value> debug_info_value(json_reader.ReadToValue(str)); | 1549 scoped_ptr<base::Value> debug_info_value(json_reader.ReadToValue(str)); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1701 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } | 1582 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } |
| 1702 | 1583 |
| 1703 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1584 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
| 1704 benchmark->RunOnLayer(this); | 1585 benchmark->RunOnLayer(this); |
| 1705 } | 1586 } |
| 1706 | 1587 |
| 1707 int LayerImpl::NumDescendantsThatDrawContent() const { | 1588 int LayerImpl::NumDescendantsThatDrawContent() const { |
| 1708 return num_descendants_that_draw_content_; | 1589 return num_descendants_that_draw_content_; |
| 1709 } | 1590 } |
| 1710 | 1591 |
| 1711 void LayerImpl::NotifyAnimationFinished(base::TimeTicks monotonic_time, | |
| 1712 TargetProperty::Type target_property, | |
| 1713 int group) { | |
| 1714 if (target_property == TargetProperty::SCROLL_OFFSET) | |
| 1715 layer_tree_impl_->InputScrollAnimationFinished(); | |
| 1716 } | |
| 1717 | |
| 1718 void LayerImpl::SetHasRenderSurface(bool should_have_render_surface) { | 1592 void LayerImpl::SetHasRenderSurface(bool should_have_render_surface) { |
| 1719 if (!!render_surface() == should_have_render_surface) | 1593 if (!!render_surface() == should_have_render_surface) |
| 1720 return; | 1594 return; |
| 1721 | 1595 |
| 1722 SetNeedsPushProperties(); | 1596 SetNeedsPushProperties(); |
| 1723 if (should_have_render_surface) { | 1597 if (should_have_render_surface) { |
| 1724 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this)); | 1598 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this)); |
| 1725 return; | 1599 return; |
| 1726 } | 1600 } |
| 1727 render_surface_.reset(); | 1601 render_surface_.reset(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1795 .layer_transforms_should_scale_layer_contents) { | 1669 .layer_transforms_should_scale_layer_contents) { |
| 1796 return default_scale; | 1670 return default_scale; |
| 1797 } | 1671 } |
| 1798 | 1672 |
| 1799 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1673 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
| 1800 DrawTransform(), default_scale); | 1674 DrawTransform(), default_scale); |
| 1801 return std::max(transform_scales.x(), transform_scales.y()); | 1675 return std::max(transform_scales.x(), transform_scales.y()); |
| 1802 } | 1676 } |
| 1803 | 1677 |
| 1804 } // namespace cc | 1678 } // namespace cc |
| OLD | NEW |