Reset property tree indices when layer is removed from layer tree
An orphaned layer has no relation to property trees, so it is an error
for it to have property tree indices.
BUG=489725
Review URL: https://codereview.chromium.org/1139573004
Cr-Commit-Position: refs/heads/master@{#330739}
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 6975e0c..46a4c950 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -208,6 +208,21 @@
SetNeedsPushProperties();
}
+void LayerImpl::SetTransformTreeIndex(int index) {
+ transform_tree_index_ = index;
+ SetNeedsPushProperties();
+}
+
+void LayerImpl::SetClipTreeIndex(int index) {
+ clip_tree_index_ = index;
+ SetNeedsPushProperties();
+}
+
+void LayerImpl::SetOpacityTreeIndex(int index) {
+ opacity_tree_index_ = index;
+ SetNeedsPushProperties();
+}
+
void LayerImpl::PassCopyRequests(ScopedPtrVector<CopyOutputRequest>* requests) {
if (requests->empty())
return;
@@ -552,9 +567,9 @@
layer->Set3dSortingContextId(sorting_context_id_);
layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_);
- layer->set_transform_tree_index(transform_tree_index_);
- layer->set_opacity_tree_index(opacity_tree_index_);
- layer->set_clip_tree_index(clip_tree_index_);
+ layer->SetTransformTreeIndex(transform_tree_index_);
+ layer->SetClipTreeIndex(clip_tree_index_);
+ layer->SetOpacityTreeIndex(opacity_tree_index_);
layer->set_offset_to_transform_parent(offset_to_transform_parent_);
LayerImpl* scroll_parent = nullptr;