Chromium Code Reviews| 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 477 ElementLayers& layers = element_layers_map_[layer->element_id()]; | 477 ElementLayers& layers = element_layers_map_[layer->element_id()]; |
| 478 if (!layer->scrollable()) | 478 if (!layer->scrollable()) |
| 479 layers.main = nullptr; | 479 layers.main = nullptr; |
| 480 if (layer->scrollable()) | 480 if (layer->scrollable()) |
| 481 layers.scroll = nullptr; | 481 layers.scroll = nullptr; |
| 482 | 482 |
| 483 if (!layers.main && !layers.scroll) | 483 if (!layers.main && !layers.scroll) |
| 484 element_layers_map_.erase(layer->element_id()); | 484 element_layers_map_.erase(layer->element_id()); |
| 485 } | 485 } |
| 486 | 486 |
| 487 void LayerTreeImpl::AddToOpacityAnimationsMap(int id, float opacity) { | |
| 488 opacity_animations_map_[id] = opacity; | |
| 489 } | |
| 490 | |
| 487 LayerTreeImpl::ElementLayers LayerTreeImpl::GetMutableLayers( | 491 LayerTreeImpl::ElementLayers LayerTreeImpl::GetMutableLayers( |
| 488 uint64_t element_id) { | 492 uint64_t element_id) { |
| 489 auto iter = element_layers_map_.find(element_id); | 493 auto iter = element_layers_map_.find(element_id); |
| 490 if (iter == element_layers_map_.end()) | 494 if (iter == element_layers_map_.end()) |
| 491 return ElementLayers(); | 495 return ElementLayers(); |
| 492 | 496 |
| 493 return iter->second; | 497 return iter->second; |
| 494 } | 498 } |
| 495 | 499 |
| 496 LayerImpl* LayerTreeImpl::InnerViewportContainerLayer() const { | 500 LayerImpl* LayerTreeImpl::InnerViewportContainerLayer() const { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 555 | 559 |
| 556 void LayerTreeImpl::UpdatePropertyTreeScrollingAndAnimationFromMainThread() { | 560 void LayerTreeImpl::UpdatePropertyTreeScrollingAndAnimationFromMainThread() { |
| 557 // TODO(enne): This should get replaced by pulling out scrolling and | 561 // TODO(enne): This should get replaced by pulling out scrolling and |
| 558 // animations into their own trees. Then scrolls and animations would have | 562 // animations into their own trees. Then scrolls and animations would have |
| 559 // their own ways of synchronizing across commits. This occurs to push | 563 // their own ways of synchronizing across commits. This occurs to push |
| 560 // updates from scrolling deltas on the compositor thread that have occurred | 564 // updates from scrolling deltas on the compositor thread that have occurred |
| 561 // after begin frame and updates from animations that have ticked since begin | 565 // after begin frame and updates from animations that have ticked since begin |
| 562 // frame to a newly-committed property tree. | 566 // frame to a newly-committed property tree. |
| 563 if (!root_layer()) | 567 if (!root_layer()) |
| 564 return; | 568 return; |
| 569 for (auto& layer_id_to_opacity : opacity_animations_map_) { | |
| 570 if (LayerImpl* layer = LayerById(layer_id_to_opacity.first)) { | |
|
ajuma
2016/05/11 00:10:59
We'll need a map from layer ids to node ids (which
jaydasika
2016/05/11 01:00:54
Acknowledged.
| |
| 571 EffectNode* node = | |
| 572 property_trees_.effect_tree.Node(layer->effect_tree_index()); | |
| 573 if (node->owner_id != layer->id() || | |
| 574 !node->data.is_currently_animating_opacity) | |
| 575 continue; | |
| 576 DCHECK_EQ(layer->opacity(), layer_id_to_opacity.second); | |
| 577 node->data.opacity = layer_id_to_opacity.second; | |
| 578 property_trees_.effect_tree.set_needs_update(true); | |
| 579 } | |
| 580 } | |
| 581 opacity_animations_map_.clear(); | |
|
ajuma
2016/05/11 00:11:00
What kind of test coverage do we have for this log
jaydasika
2016/05/11 01:00:54
There is only one unit test hitting this path : La
| |
| 565 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [](LayerImpl* layer) { | 582 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [](LayerImpl* layer) { |
| 566 layer->UpdatePropertyTreeForScrollingAndAnimationIfNeeded(); | 583 layer->UpdatePropertyTreeForScrollingAndAnimationIfNeeded(); |
| 567 }); | 584 }); |
| 568 } | 585 } |
| 569 | 586 |
| 570 void LayerTreeImpl::SetPageScaleOnActiveTree(float active_page_scale) { | 587 void LayerTreeImpl::SetPageScaleOnActiveTree(float active_page_scale) { |
| 571 DCHECK(IsActiveTree()); | 588 DCHECK(IsActiveTree()); |
| 572 if (page_scale_factor()->SetCurrent( | 589 if (page_scale_factor()->SetCurrent( |
| 573 ClampPageScaleFactorToLimits(active_page_scale))) { | 590 ClampPageScaleFactorToLimits(active_page_scale))) { |
| 574 DidUpdatePageScale(); | 591 DidUpdatePageScale(); |
| (...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2089 } | 2106 } |
| 2090 | 2107 |
| 2091 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) { | 2108 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) { |
| 2092 layers_that_should_push_properties_.clear(); | 2109 layers_that_should_push_properties_.clear(); |
| 2093 for (auto* layer : *this) | 2110 for (auto* layer : *this) |
| 2094 layer->ResetChangeTracking(); | 2111 layer->ResetChangeTracking(); |
| 2095 property_trees_.ResetAllChangeTracking(flag); | 2112 property_trees_.ResetAllChangeTracking(flag); |
| 2096 } | 2113 } |
| 2097 | 2114 |
| 2098 } // namespace cc | 2115 } // namespace cc |
| OLD | NEW |