Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: cc/layers/layer_impl.cc

Issue 1782433002: CC Animation: Erase old animation system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@erasetests
Patch Set: Format. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 uint32_t main_thread_scrolling_reasons) { 470 uint32_t main_thread_scrolling_reasons) {
489 if (main_thread_scrolling_reasons_ == main_thread_scrolling_reasons) 471 if (main_thread_scrolling_reasons_ == main_thread_scrolling_reasons)
490 return; 472 return;
491 473
492 if (main_thread_scrolling_reasons & 474 if (main_thread_scrolling_reasons &
493 MainThreadScrollingReason::kHasNonLayerViewportConstrainedObjects && 475 MainThreadScrollingReason::kHasNonLayerViewportConstrainedObjects &&
494 layer_tree_impl()) { 476 layer_tree_impl()) {
495 if (layer_tree_impl()->ScrollOffsetIsAnimatingOnImplOnly(this)) { 477 if (layer_tree_impl()->ScrollOffsetIsAnimatingOnImplOnly(this)) {
496 layer_tree_impl()->animation_host()->ScrollAnimationAbort( 478 layer_tree_impl()->animation_host()->ScrollAnimationAbort(
497 true /* needs_completion */); 479 true /* needs_completion */);
498 } else if (layer_animation_controller()) {
499 layer_animation_controller()->AbortAnimations(
500 TargetProperty::SCROLL_OFFSET);
501 } 480 }
502 } 481 }
503 482
504 main_thread_scrolling_reasons_ = main_thread_scrolling_reasons; 483 main_thread_scrolling_reasons_ = main_thread_scrolling_reasons;
505 } 484 }
506 485
507 void LayerImpl::PushPropertiesTo(LayerImpl* layer) { 486 void LayerImpl::PushPropertiesTo(LayerImpl* layer) {
508 layer->SetTransformOrigin(transform_origin_); 487 layer->SetTransformOrigin(transform_origin_);
509 layer->SetBackgroundColor(background_color_); 488 layer->SetBackgroundColor(background_color_);
510 layer->SetSafeOpaqueBackgroundColor(safe_opaque_background_color_); 489 layer->SetSafeOpaqueBackgroundColor(safe_opaque_background_color_);
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 // layers in the pending tree will find out about these changes as a 924 // layers in the pending tree will find out about these changes as a
946 // result of the shared SyncedProperty. 925 // result of the shared SyncedProperty.
947 if (!IsActive()) 926 if (!IsActive())
948 return; 927 return;
949 928
950 SetCurrentScrollOffset(scroll_offset); 929 SetCurrentScrollOffset(scroll_offset);
951 930
952 layer_tree_impl_->DidAnimateScrollOffset(); 931 layer_tree_impl_->DidAnimateScrollOffset();
953 } 932 }
954 933
955 void LayerImpl::OnAnimationWaitingForDeletion() {}
956
957 void LayerImpl::OnTransformIsPotentiallyAnimatingChanged(bool is_animating) { 934 void LayerImpl::OnTransformIsPotentiallyAnimatingChanged(bool is_animating) {
958 UpdatePropertyTreeTransformIsAnimated(is_animating); 935 UpdatePropertyTreeTransformIsAnimated(is_animating);
959 was_ever_ready_since_last_transform_animation_ = false; 936 was_ever_ready_since_last_transform_animation_ = false;
960 } 937 }
961 938
962 bool LayerImpl::IsActive() const { 939 bool LayerImpl::IsActive() const {
963 return layer_tree_impl_->IsActiveTree(); 940 return layer_tree_impl_->IsActiveTree();
964 } 941 }
965 942
966 gfx::Size LayerImpl::bounds() const { 943 gfx::Size LayerImpl::bounds() const {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 } 1088 }
1112 1089
1113 void LayerImpl::SetFilters(const FilterOperations& filters) { 1090 void LayerImpl::SetFilters(const FilterOperations& filters) {
1114 if (filters_ == filters) 1091 if (filters_ == filters)
1115 return; 1092 return;
1116 1093
1117 filters_ = filters; 1094 filters_ = filters;
1118 } 1095 }
1119 1096
1120 bool LayerImpl::FilterIsAnimating() const { 1097 bool LayerImpl::FilterIsAnimating() const {
1121 LayerAnimationController::ObserverType observer_type = 1098 return layer_tree_impl_->IsAnimatingFilterProperty(this);
1122 IsActive() ? LayerAnimationController::ObserverType::ACTIVE
1123 : LayerAnimationController::ObserverType::PENDING;
1124 return layer_animation_controller_
1125 ? layer_animation_controller_->IsCurrentlyAnimatingProperty(
1126 TargetProperty::FILTER, observer_type)
1127 : layer_tree_impl_->IsAnimatingFilterProperty(this);
1128 } 1099 }
1129 1100
1130 bool LayerImpl::HasPotentiallyRunningFilterAnimation() const { 1101 bool LayerImpl::HasPotentiallyRunningFilterAnimation() const {
1131 LayerAnimationController::ObserverType observer_type = 1102 return layer_tree_impl_->HasPotentiallyRunningFilterAnimation(this);
1132 IsActive() ? LayerAnimationController::ObserverType::ACTIVE
1133 : LayerAnimationController::ObserverType::PENDING;
1134 return layer_animation_controller_
1135 ? layer_animation_controller_->IsPotentiallyAnimatingProperty(
1136 TargetProperty::FILTER, observer_type)
1137 : layer_tree_impl_->HasPotentiallyRunningFilterAnimation(this);
1138 } 1103 }
1139 1104
1140 bool LayerImpl::FilterIsAnimatingOnImplOnly() const { 1105 bool LayerImpl::FilterIsAnimatingOnImplOnly() const {
1141 if (!layer_animation_controller_) 1106 return layer_tree_impl_->FilterIsAnimatingOnImplOnly(this);
1142 return layer_tree_impl_->FilterIsAnimatingOnImplOnly(this);
1143
1144 Animation* filter_animation =
1145 layer_animation_controller_->GetAnimation(TargetProperty::FILTER);
1146 return filter_animation && filter_animation->is_impl_only();
1147 } 1107 }
1148 1108
1149 void LayerImpl::SetBackgroundFilters( 1109 void LayerImpl::SetBackgroundFilters(
1150 const FilterOperations& filters) { 1110 const FilterOperations& filters) {
1151 if (background_filters_ == filters) 1111 if (background_filters_ == filters)
1152 return; 1112 return;
1153 1113
1154 background_filters_ = filters; 1114 background_filters_ = filters;
1155 NoteLayerPropertyChanged(); 1115 NoteLayerPropertyChanged();
1156 } 1116 }
(...skipping 17 matching lines...) Expand all
1174 return; 1134 return;
1175 1135
1176 opacity_ = opacity; 1136 opacity_ = opacity;
1177 } 1137 }
1178 1138
1179 float LayerImpl::EffectiveOpacity() const { 1139 float LayerImpl::EffectiveOpacity() const {
1180 return hide_layer_and_subtree_ ? 0.f : opacity_; 1140 return hide_layer_and_subtree_ ? 0.f : opacity_;
1181 } 1141 }
1182 1142
1183 bool LayerImpl::OpacityIsAnimating() const { 1143 bool LayerImpl::OpacityIsAnimating() const {
1184 LayerAnimationController::ObserverType observer_type = 1144 return layer_tree_impl_->IsAnimatingOpacityProperty(this);
1185 IsActive() ? LayerAnimationController::ObserverType::ACTIVE
1186 : LayerAnimationController::ObserverType::PENDING;
1187 return layer_animation_controller_
1188 ? layer_animation_controller_->IsCurrentlyAnimatingProperty(
1189 TargetProperty::OPACITY, observer_type)
1190 : layer_tree_impl_->IsAnimatingOpacityProperty(this);
1191 } 1145 }
1192 1146
1193 bool LayerImpl::HasPotentiallyRunningOpacityAnimation() const { 1147 bool LayerImpl::HasPotentiallyRunningOpacityAnimation() const {
1194 LayerAnimationController::ObserverType observer_type = 1148 return layer_tree_impl_->HasPotentiallyRunningOpacityAnimation(this);
1195 IsActive() ? LayerAnimationController::ObserverType::ACTIVE
1196 : LayerAnimationController::ObserverType::PENDING;
1197 return layer_animation_controller_
1198 ? layer_animation_controller_->IsPotentiallyAnimatingProperty(
1199 TargetProperty::OPACITY, observer_type)
1200 : layer_tree_impl_->HasPotentiallyRunningOpacityAnimation(this);
1201 } 1149 }
1202 1150
1203 bool LayerImpl::OpacityIsAnimatingOnImplOnly() const { 1151 bool LayerImpl::OpacityIsAnimatingOnImplOnly() const {
1204 if (!layer_animation_controller_) 1152 return layer_tree_impl_->OpacityIsAnimatingOnImplOnly(this);
1205 return layer_tree_impl_->OpacityIsAnimatingOnImplOnly(this);
1206
1207 Animation* opacity_animation =
1208 layer_animation_controller_->GetAnimation(TargetProperty::OPACITY);
1209 return opacity_animation && opacity_animation->is_impl_only();
1210 } 1153 }
1211 1154
1212 void LayerImpl::SetElementId(uint64_t element_id) { 1155 void LayerImpl::SetElementId(uint64_t element_id) {
1213 if (element_id == element_id_) 1156 if (element_id == element_id_)
1214 return; 1157 return;
1215 1158
1216 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), 1159 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
1217 "LayerImpl::SetElementId", "id", element_id); 1160 "LayerImpl::SetElementId", "id", element_id);
1218 1161
1219 layer_tree_impl_->RemoveFromElementMap(this); 1162 layer_tree_impl_->RemoveFromElementMap(this);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 if (transform_ == transform) { 1248 if (transform_ == transform) {
1306 DCHECK(transform_is_invertible_ == transform_is_invertible) 1249 DCHECK(transform_is_invertible_ == transform_is_invertible)
1307 << "Can't change invertibility if transform is unchanged"; 1250 << "Can't change invertibility if transform is unchanged";
1308 return; 1251 return;
1309 } 1252 }
1310 transform_ = transform; 1253 transform_ = transform;
1311 transform_is_invertible_ = transform_is_invertible; 1254 transform_is_invertible_ = transform_is_invertible;
1312 } 1255 }
1313 1256
1314 bool LayerImpl::TransformIsAnimating() const { 1257 bool LayerImpl::TransformIsAnimating() const {
1315 LayerAnimationController::ObserverType observer_type = 1258 return layer_tree_impl_->IsAnimatingTransformProperty(this);
1316 IsActive() ? LayerAnimationController::ObserverType::ACTIVE
1317 : LayerAnimationController::ObserverType::PENDING;
1318 return layer_animation_controller_
1319 ? layer_animation_controller_->IsCurrentlyAnimatingProperty(
1320 TargetProperty::TRANSFORM, observer_type)
1321 : layer_tree_impl_->IsAnimatingTransformProperty(this);
1322 } 1259 }
1323 1260
1324 bool LayerImpl::HasPotentiallyRunningTransformAnimation() const { 1261 bool LayerImpl::HasPotentiallyRunningTransformAnimation() const {
1325 LayerAnimationController::ObserverType observer_type = 1262 return layer_tree_impl_->HasPotentiallyRunningTransformAnimation(this);
1326 IsActive() ? LayerAnimationController::ObserverType::ACTIVE
1327 : LayerAnimationController::ObserverType::PENDING;
1328 return layer_animation_controller_
1329 ? layer_animation_controller_->IsPotentiallyAnimatingProperty(
1330 TargetProperty::TRANSFORM, observer_type)
1331 : layer_tree_impl_->HasPotentiallyRunningTransformAnimation(this);
1332 } 1263 }
1333 1264
1334 bool LayerImpl::TransformIsAnimatingOnImplOnly() const { 1265 bool LayerImpl::TransformIsAnimatingOnImplOnly() const {
1335 if (!layer_animation_controller_) 1266 return layer_tree_impl_->TransformIsAnimatingOnImplOnly(this);
1336 return layer_tree_impl_->TransformIsAnimatingOnImplOnly(this);
1337
1338 Animation* transform_animation =
1339 layer_animation_controller_->GetAnimation(TargetProperty::TRANSFORM);
1340 return transform_animation && transform_animation->is_impl_only();
1341 } 1267 }
1342 1268
1343 bool LayerImpl::HasOnlyTranslationTransforms() const { 1269 bool LayerImpl::HasOnlyTranslationTransforms() const {
1344 if (!layer_animation_controller_) 1270 return layer_tree_impl_->HasOnlyTranslationTransforms(this);
1345 return layer_tree_impl_->HasOnlyTranslationTransforms(this);
1346
1347 LayerAnimationController::ObserverType observer_type =
1348 IsActive() ? LayerAnimationController::ObserverType::ACTIVE
1349 : LayerAnimationController::ObserverType::PENDING;
1350 return layer_animation_controller_->HasOnlyTranslationTransforms(
1351 observer_type);
1352 } 1271 }
1353 1272
1354 bool LayerImpl::AnimationsPreserveAxisAlignment() const { 1273 bool LayerImpl::AnimationsPreserveAxisAlignment() const {
1355 return layer_animation_controller_ 1274 return layer_tree_impl_->AnimationsPreserveAxisAlignment(this);
1356 ? layer_animation_controller_->AnimationsPreserveAxisAlignment()
1357 : layer_tree_impl_->AnimationsPreserveAxisAlignment(this);
1358 } 1275 }
1359 1276
1360 bool LayerImpl::MaximumTargetScale(float* max_scale) const { 1277 bool LayerImpl::MaximumTargetScale(float* max_scale) const {
1361 if (!layer_animation_controller_) 1278 return layer_tree_impl_->MaximumTargetScale(this, max_scale);
1362 return layer_tree_impl_->MaximumTargetScale(this, max_scale);
1363
1364 LayerAnimationController::ObserverType observer_type =
1365 IsActive() ? LayerAnimationController::ObserverType::ACTIVE
1366 : LayerAnimationController::ObserverType::PENDING;
1367 return layer_animation_controller_->MaximumTargetScale(observer_type,
1368 max_scale);
1369 } 1279 }
1370 1280
1371 bool LayerImpl::AnimationStartScale(float* start_scale) const { 1281 bool LayerImpl::AnimationStartScale(float* start_scale) const {
1372 if (!layer_animation_controller_) 1282 return layer_tree_impl_->AnimationStartScale(this, start_scale);
1373 return layer_tree_impl_->AnimationStartScale(this, start_scale);
1374
1375 LayerAnimationController::ObserverType observer_type =
1376 IsActive() ? LayerAnimationController::ObserverType::ACTIVE
1377 : LayerAnimationController::ObserverType::PENDING;
1378 return layer_animation_controller_->AnimationStartScale(observer_type,
1379 start_scale);
1380 } 1283 }
1381 1284
1382 bool LayerImpl::HasAnyAnimationTargetingProperty( 1285 bool LayerImpl::HasAnyAnimationTargetingProperty(
1383 TargetProperty::Type property) const { 1286 TargetProperty::Type property) const {
1384 if (!layer_animation_controller_) 1287 return layer_tree_impl_->HasAnyAnimationTargetingProperty(this, property);
1385 return layer_tree_impl_->HasAnyAnimationTargetingProperty(this, property);
1386
1387 return !!layer_animation_controller_->GetAnimation(property);
1388 } 1288 }
1389 1289
1390 bool LayerImpl::HasFilterAnimationThatInflatesBounds() const { 1290 bool LayerImpl::HasFilterAnimationThatInflatesBounds() const {
1391 if (!layer_animation_controller_) 1291 return layer_tree_impl_->HasFilterAnimationThatInflatesBounds(this);
1392 return layer_tree_impl_->HasFilterAnimationThatInflatesBounds(this);
1393
1394 return layer_animation_controller_->HasFilterAnimationThatInflatesBounds();
1395 } 1292 }
1396 1293
1397 bool LayerImpl::HasTransformAnimationThatInflatesBounds() const { 1294 bool LayerImpl::HasTransformAnimationThatInflatesBounds() const {
1398 if (!layer_animation_controller_) 1295 return layer_tree_impl_->HasTransformAnimationThatInflatesBounds(this);
1399 return layer_tree_impl_->HasTransformAnimationThatInflatesBounds(this);
1400
1401 return layer_animation_controller_->HasTransformAnimationThatInflatesBounds();
1402 } 1296 }
1403 1297
1404 bool LayerImpl::HasAnimationThatInflatesBounds() const { 1298 bool LayerImpl::HasAnimationThatInflatesBounds() const {
1405 if (!layer_animation_controller_) 1299 return layer_tree_impl_->HasAnimationThatInflatesBounds(this);
1406 return layer_tree_impl_->HasAnimationThatInflatesBounds(this);
1407
1408 return layer_animation_controller_->HasAnimationThatInflatesBounds();
1409 } 1300 }
1410 1301
1411 bool LayerImpl::FilterAnimationBoundsForBox(const gfx::BoxF& box, 1302 bool LayerImpl::FilterAnimationBoundsForBox(const gfx::BoxF& box,
1412 gfx::BoxF* bounds) const { 1303 gfx::BoxF* bounds) const {
1413 if (!layer_animation_controller_) 1304 return layer_tree_impl_->FilterAnimationBoundsForBox(this, box, bounds);
1414 return layer_tree_impl_->FilterAnimationBoundsForBox(this, box, bounds);
1415
1416 return layer_animation_controller_->FilterAnimationBoundsForBox(box, bounds);
1417 } 1305 }
1418 1306
1419 bool LayerImpl::TransformAnimationBoundsForBox(const gfx::BoxF& box, 1307 bool LayerImpl::TransformAnimationBoundsForBox(const gfx::BoxF& box,
1420 gfx::BoxF* bounds) const { 1308 gfx::BoxF* bounds) const {
1421 if (!layer_animation_controller_) 1309 return layer_tree_impl_->TransformAnimationBoundsForBox(this, box, bounds);
1422 return layer_tree_impl_->TransformAnimationBoundsForBox(this, box, bounds);
1423
1424 return layer_animation_controller_->TransformAnimationBoundsForBox(box,
1425 bounds);
1426 } 1310 }
1427 1311
1428 void LayerImpl::SetUpdateRect(const gfx::Rect& update_rect) { 1312 void LayerImpl::SetUpdateRect(const gfx::Rect& update_rect) {
1429 update_rect_ = update_rect; 1313 update_rect_ = update_rect;
1430 SetNeedsPushProperties(); 1314 SetNeedsPushProperties();
1431 } 1315 }
1432 1316
1433 void LayerImpl::AddDamageRect(const gfx::Rect& damage_rect) { 1317 void LayerImpl::AddDamageRect(const gfx::Rect& damage_rect) {
1434 damage_rect_.Union(damage_rect); 1318 damage_rect_.Union(damage_rect);
1435 } 1319 }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 1520
1637 if (scroll_parent_) 1521 if (scroll_parent_)
1638 state->SetInteger("scroll_parent", scroll_parent_->id()); 1522 state->SetInteger("scroll_parent", scroll_parent_->id());
1639 1523
1640 if (clip_parent_) 1524 if (clip_parent_)
1641 state->SetInteger("clip_parent", clip_parent_->id()); 1525 state->SetInteger("clip_parent", clip_parent_->id());
1642 1526
1643 state->SetBoolean("can_use_lcd_text", can_use_lcd_text()); 1527 state->SetBoolean("can_use_lcd_text", can_use_lcd_text());
1644 state->SetBoolean("contents_opaque", contents_opaque()); 1528 state->SetBoolean("contents_opaque", contents_opaque());
1645 1529
1646 state->SetBoolean( 1530 state->SetBoolean("has_animation_bounds",
1647 "has_animation_bounds", 1531 layer_tree_impl_->HasAnimationThatInflatesBounds(this));
1648 layer_animation_controller_
1649 ? layer_animation_controller_->HasAnimationThatInflatesBounds()
1650 : layer_tree_impl_->HasAnimationThatInflatesBounds(this));
1651 1532
1652 gfx::BoxF box; 1533 gfx::BoxF box;
1653 if (LayerUtils::GetAnimationBounds(*this, &box)) 1534 if (LayerUtils::GetAnimationBounds(*this, &box))
1654 MathUtil::AddToTracedValue("animation_bounds", box, state); 1535 MathUtil::AddToTracedValue("animation_bounds", box, state);
1655 1536
1656 if (debug_info_) { 1537 if (debug_info_) {
1657 std::string str; 1538 std::string str;
1658 debug_info_->AppendAsTraceFormat(&str); 1539 debug_info_->AppendAsTraceFormat(&str);
1659 base::JSONReader json_reader; 1540 base::JSONReader json_reader;
1660 scoped_ptr<base::Value> debug_info_value(json_reader.ReadToValue(str)); 1541 scoped_ptr<base::Value> debug_info_value(json_reader.ReadToValue(str));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } 1574 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; }
1694 1575
1695 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { 1576 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) {
1696 benchmark->RunOnLayer(this); 1577 benchmark->RunOnLayer(this);
1697 } 1578 }
1698 1579
1699 int LayerImpl::NumDescendantsThatDrawContent() const { 1580 int LayerImpl::NumDescendantsThatDrawContent() const {
1700 return num_descendants_that_draw_content_; 1581 return num_descendants_that_draw_content_;
1701 } 1582 }
1702 1583
1703 void LayerImpl::NotifyAnimationFinished(base::TimeTicks monotonic_time,
loyso (OOO) 2016/03/09 06:17:03 Once again: This one is non obvious: Erased in fav
1704 TargetProperty::Type target_property,
1705 int group) {
1706 if (target_property == TargetProperty::SCROLL_OFFSET)
1707 layer_tree_impl_->InputScrollAnimationFinished();
1708 }
1709
1710 void LayerImpl::SetHasRenderSurface(bool should_have_render_surface) { 1584 void LayerImpl::SetHasRenderSurface(bool should_have_render_surface) {
1711 if (!!render_surface() == should_have_render_surface) 1585 if (!!render_surface() == should_have_render_surface)
1712 return; 1586 return;
1713 1587
1714 SetNeedsPushProperties(); 1588 SetNeedsPushProperties();
1715 if (should_have_render_surface) { 1589 if (should_have_render_surface) {
1716 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this)); 1590 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this));
1717 return; 1591 return;
1718 } 1592 }
1719 render_surface_.reset(); 1593 render_surface_.reset();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1787 .layer_transforms_should_scale_layer_contents) { 1661 .layer_transforms_should_scale_layer_contents) {
1788 return default_scale; 1662 return default_scale;
1789 } 1663 }
1790 1664
1791 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1665 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1792 DrawTransform(), default_scale); 1666 DrawTransform(), default_scale);
1793 return std::max(transform_scales.x(), transform_scales.y()); 1667 return std::max(transform_scales.x(), transform_scales.y());
1794 } 1668 }
1795 1669
1796 } // namespace cc 1670 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698