Chromium Code Reviews| Index: cc/trees/layer_tree_impl.cc |
| diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc |
| index e39989515e1f56a5daf69755eee8a6368689320e..46ba2cb2e793fbefef29f98a8348a859e92c9211 100644 |
| --- a/cc/trees/layer_tree_impl.cc |
| +++ b/cc/trees/layer_tree_impl.cc |
| @@ -91,6 +91,7 @@ LayerTreeImpl::~LayerTreeImpl() { |
| // Need to explicitly clear the tree prior to destroying this so that |
| // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. |
| DCHECK(!root_layer_); |
| + DCHECK(layers_->empty()); |
| } |
| void LayerTreeImpl::Shutdown() { |
| @@ -923,7 +924,7 @@ bool LayerTreeImpl::UpdateDrawProperties(bool update_lcd_text) { |
| // Masks are used to draw the contributing surface, so should have |
| // the same occlusion as the surface (nothing inside the surface |
| // occludes them). |
| - if (LayerImpl* mask = it->mask_layer()) { |
| + if (LayerImpl* mask = it->render_surface()->MaskLayer()) { |
| Occlusion mask_occlusion = |
| inside_replica |
| ? Occlusion() |
| @@ -932,9 +933,10 @@ bool LayerTreeImpl::UpdateDrawProperties(bool update_lcd_text) { |
| it->DrawTransform()); |
| mask->draw_properties().occlusion_in_content_space = mask_occlusion; |
| } |
| - if (LayerImpl* replica = it->replica_layer()) { |
| - if (LayerImpl* mask = replica->mask_layer()) |
| - mask->draw_properties().occlusion_in_content_space = Occlusion(); |
| + if (LayerImpl* replica_mask = |
| + it->render_surface()->ReplicaMaskLayer()) { |
| + replica_mask->draw_properties().occlusion_in_content_space = |
| + Occlusion(); |
| } |
| } |
| @@ -1033,8 +1035,10 @@ gfx::SizeF LayerTreeImpl::ScrollableSize() const { |
| } |
| LayerImpl* LayerTreeImpl::LayerById(int id) const { |
| + if (id == Layer::INVALID_ID) |
| + return nullptr; |
|
jaydasika
2016/06/14 06:12:06
Is this required ? If we had invalid id, we would
ajuma
2016/06/14 12:45:26
Removed.
|
| LayerImplMap::const_iterator iter = layer_id_map_.find(id); |
| - return iter != layer_id_map_.end() ? iter->second : NULL; |
| + return iter != layer_id_map_.end() ? iter->second : nullptr; |
| } |
| void LayerTreeImpl::AddLayerShouldPushProperties(LayerImpl* layer) { |
| @@ -2076,7 +2080,8 @@ void LayerTreeImpl::ScrollAnimationAbort(bool needs_completion) { |
| void LayerTreeImpl::ResetAllChangeTracking() { |
| layers_that_should_push_properties_.clear(); |
| - for (auto* layer : *this) |
| + // Iterate over all layers, including masks and replicas. |
| + for (auto& layer : *layers_) |
| layer->ResetChangeTracking(); |
| property_trees_.ResetAllChangeTracking(); |
| } |