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.h" | 5 #include "cc/trees/layer_tree_host.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 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1285 Layer* layer = LayerByElementId(element_id); | 1285 Layer* layer = LayerByElementId(element_id); |
1286 DCHECK(layer); | 1286 DCHECK(layer); |
1287 layer->OnScrollOffsetAnimated(scroll_offset); | 1287 layer->OnScrollOffsetAnimated(scroll_offset); |
1288 } | 1288 } |
1289 | 1289 |
1290 void LayerTreeHost::ElementIsAnimatingChanged( | 1290 void LayerTreeHost::ElementIsAnimatingChanged( |
1291 ElementId element_id, | 1291 ElementId element_id, |
1292 ElementListType list_type, | 1292 ElementListType list_type, |
1293 const PropertyAnimationState& mask, | 1293 const PropertyAnimationState& mask, |
1294 const PropertyAnimationState& state) { | 1294 const PropertyAnimationState& state) { |
1295 Layer* layer = LayerByElementId(element_id); | 1295 DCHECK_EQ(ElementListType::ACTIVE, list_type); |
1296 if (layer) | 1296 |
1297 layer->OnIsAnimatingChanged(mask, state); | 1297 for (int property = TargetProperty::FIRST_TARGET_PROPERTY; |
1298 property <= TargetProperty::LAST_TARGET_PROPERTY; ++property) { | |
1299 if (!mask.currently_running[property] && | |
1300 !mask.potentially_animating[property]) | |
1301 continue; | |
1302 | |
1303 switch (property) { | |
1304 case TargetProperty::TRANSFORM: | |
1305 if (TransformNode* transform_node = | |
1306 property_trees()->transform_tree.FindNodeFromElementId( | |
1307 element_id)) { | |
1308 if (mask.currently_running[property]) | |
1309 transform_node->is_currently_animating = | |
1310 state.currently_running[property]; | |
1311 if (mask.potentially_animating[property]) { | |
1312 transform_node->has_potential_animation = | |
1313 state.potentially_animating[property]; | |
1314 transform_node->has_only_translation_animations = | |
1315 mutator_host()->HasOnlyTranslationTransforms(element_id, | |
1316 list_type); | |
1317 property_trees()->transform_tree.set_needs_update(true); | |
1318 } | |
1319 } else { | |
1320 DCHECK(property_trees()->needs_rebuild) | |
1321 << "Attempting to animate non existent transform node"; | |
1322 } | |
1323 break; | |
1324 case TargetProperty::OPACITY: | |
1325 if (EffectNode* effect_node = | |
1326 property_trees()->effect_tree.FindNodeFromElementId( | |
1327 element_id)) { | |
1328 if (mask.currently_running[property]) | |
1329 effect_node->is_currently_animating_opacity = | |
1330 state.currently_running[property]; | |
1331 if (mask.potentially_animating[property]) { | |
1332 effect_node->has_potential_opacity_animation = | |
1333 state.potentially_animating[property]; | |
1334 property_trees()->effect_tree.set_needs_update(true); | |
1335 } | |
1336 } else { | |
1337 DCHECK(property_trees()->needs_rebuild) | |
1338 << "Attempting to animate opacity on non existent effect node"; | |
1339 } | |
1340 break; | |
1341 case TargetProperty::FILTER: | |
1342 if (EffectNode* effect_node = | |
1343 property_trees()->effect_tree.FindNodeFromElementId( | |
1344 element_id)) { | |
1345 if (mask.currently_running[property]) | |
1346 effect_node->is_currently_animating_filter = | |
1347 state.currently_running[property]; | |
1348 if (mask.potentially_animating[property]) | |
1349 effect_node->has_potential_filter_animation = | |
1350 state.potentially_animating[property]; | |
wkorman
2017/03/20 21:59:57
Double checking, this case does not have the set_n
| |
1351 } else { | |
1352 DCHECK(property_trees()->needs_rebuild) | |
1353 << "Attempting to animate filter on non existent effect node"; | |
1354 } | |
1355 break; | |
1356 default: | |
1357 break; | |
1358 } | |
1359 } | |
1298 } | 1360 } |
1299 | 1361 |
1300 gfx::ScrollOffset LayerTreeHost::GetScrollOffsetForAnimation( | 1362 gfx::ScrollOffset LayerTreeHost::GetScrollOffsetForAnimation( |
1301 ElementId element_id) const { | 1363 ElementId element_id) const { |
1302 Layer* layer = LayerByElementId(element_id); | 1364 Layer* layer = LayerByElementId(element_id); |
1303 DCHECK(layer); | 1365 DCHECK(layer); |
1304 return layer->ScrollOffsetForAnimation(); | 1366 return layer->ScrollOffsetForAnimation(); |
1305 } | 1367 } |
1306 | 1368 |
1307 void LayerTreeHost::QueueImageDecode( | 1369 void LayerTreeHost::QueueImageDecode( |
(...skipping 19 matching lines...) Expand all Loading... | |
1327 LayerListReverseIterator<Layer> LayerTreeHost::rend() { | 1389 LayerListReverseIterator<Layer> LayerTreeHost::rend() { |
1328 return LayerListReverseIterator<Layer>(nullptr); | 1390 return LayerListReverseIterator<Layer>(nullptr); |
1329 } | 1391 } |
1330 | 1392 |
1331 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { | 1393 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { |
1332 for (auto* layer : *this) | 1394 for (auto* layer : *this) |
1333 layer->SetNeedsDisplay(); | 1395 layer->SetNeedsDisplay(); |
1334 } | 1396 } |
1335 | 1397 |
1336 } // namespace cc | 1398 } // namespace cc |
OLD | NEW |