Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Unified Diff: ui/compositor/layer_owner.cc

Issue 983933002: Reset the root layer on the compositor when recreating a root layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/compositor/layer_owner_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_owner.cc
diff --git a/ui/compositor/layer_owner.cc b/ui/compositor/layer_owner.cc
index cd614b37d8dca3e7e11326c2777d0e72cd80336d..86dd9d6ff7cc39fcb3611c279c88c52471ffa210 100644
--- a/ui/compositor/layer_owner.cc
+++ b/ui/compositor/layer_owner.cc
@@ -66,6 +66,15 @@ scoped_ptr<Layer> LayerOwner::RecreateLayer() {
new_layer->Add(child);
}
+ ui::Layer* root_layer = old_layer.get();
+ while (root_layer->parent())
+ root_layer = root_layer->parent();
sadrul 2015/03/06 14:33:49 You don't actually need to walk up to the root, ri
bruthig 2015/03/06 15:20:41 Done.
+
+ // If old_layer was the layer tree root then we need to move the Compositor
+ // over to the new root.
+ if (root_layer == old_layer.get() && old_layer->GetCompositor())
+ old_layer->GetCompositor()->SetRootLayer(new_layer);
+
// Install the delegate last so that the delegate isn't notified as we copy
// state to the new layer.
new_layer->set_delegate(old_delegate);
« no previous file with comments | « no previous file | ui/compositor/layer_owner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698