| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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.h" | 5 #include "cc/layers/layer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 replica_layer_->mask_layer_->reset_raster_scale_to_unknown(); | 240 replica_layer_->mask_layer_->reset_raster_scale_to_unknown(); |
| 241 } | 241 } |
| 242 | 242 |
| 243 void Layer::AddChild(scoped_refptr<Layer> child) { | 243 void Layer::AddChild(scoped_refptr<Layer> child) { |
| 244 InsertChild(child, children_.size()); | 244 InsertChild(child, children_.size()); |
| 245 } | 245 } |
| 246 | 246 |
| 247 void Layer::InsertChild(scoped_refptr<Layer> child, size_t index) { | 247 void Layer::InsertChild(scoped_refptr<Layer> child, size_t index) { |
| 248 DCHECK(IsPropertyChangeAllowed()); | 248 DCHECK(IsPropertyChangeAllowed()); |
| 249 child->RemoveFromParent(); | 249 child->RemoveFromParent(); |
| 250 AddDrawableDescendants(child->NumDescendantsThatDrawContent() + |
| 251 (child->DrawsContent() ? 1 : 0)); |
| 250 child->SetParent(this); | 252 child->SetParent(this); |
| 251 child->stacking_order_changed_ = true; | 253 child->stacking_order_changed_ = true; |
| 252 | 254 |
| 253 index = std::min(index, children_.size()); | 255 index = std::min(index, children_.size()); |
| 254 children_.insert(children_.begin() + index, child); | 256 children_.insert(children_.begin() + index, child); |
| 255 AddDrawableDescendants(child->NumDescendantsThatDrawContent() + | |
| 256 (child->DrawsContent() ? 1 : 0)); | |
| 257 SetNeedsFullTreeSync(); | 257 SetNeedsFullTreeSync(); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void Layer::RemoveFromParent() { | 260 void Layer::RemoveFromParent() { |
| 261 DCHECK(IsPropertyChangeAllowed()); | 261 DCHECK(IsPropertyChangeAllowed()); |
| 262 if (parent_) | 262 if (parent_) |
| 263 parent_->RemoveChildOrDependent(this); | 263 parent_->RemoveChildOrDependent(this); |
| 264 } | 264 } |
| 265 | 265 |
| 266 void Layer::RemoveChildOrDependent(Layer* child) { | 266 void Layer::RemoveChildOrDependent(Layer* child) { |
| (...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 | 1236 |
| 1237 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 1237 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
| 1238 benchmark->RunOnLayer(this); | 1238 benchmark->RunOnLayer(this); |
| 1239 } | 1239 } |
| 1240 | 1240 |
| 1241 bool Layer::HasDelegatedContent() const { | 1241 bool Layer::HasDelegatedContent() const { |
| 1242 return false; | 1242 return false; |
| 1243 } | 1243 } |
| 1244 | 1244 |
| 1245 } // namespace cc | 1245 } // namespace cc |
| OLD | NEW |