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

Unified Diff: ui/wm/core/window_util.cc

Issue 2383263002: Generalize layer mirroring for phantom windows (Closed)
Patch Set: Rebase Created 4 years, 2 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
« ui/compositor/layer.cc ('K') | « ui/wm/core/window_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/window_util.cc
diff --git a/ui/wm/core/window_util.cc b/ui/wm/core/window_util.cc
index 0dc44d50da993b8a289b2f4ce15f04b240662d9c..7d61450325110f572be1f6d84bb6b9dffe90822a 100644
--- a/ui/wm/core/window_util.cc
+++ b/ui/wm/core/window_util.cc
@@ -37,6 +37,23 @@ void CloneChildren(ui::Layer* to_clone,
}
}
+// Invokes Mirror() on all the children of |to_mirror|, adding the newly cloned
+// children to |parent|.
+//
+// WARNING: It is assumed that |parent| is ultimately owned by a LayerTreeOwner.
+void MirrorChildren(ui::Layer* to_mirror,
+ ui::Layer* parent,
+ wm::LayerDelegateFactory* factory) {
+ for (auto* child : to_mirror->children()) {
+ ui::Layer* mirror = child->Mirror().release();
+ mirror->set_sync_bounds(true);
+ if (factory && child->delegate())
+ mirror->set_delegate(factory->CreateDelegate(mirror, child));
+ parent->Add(mirror);
+ MirrorChildren(child, mirror, factory);
+ }
+}
+
} // namespace
namespace wm {
@@ -100,6 +117,19 @@ std::unique_ptr<ui::LayerTreeOwner> RecreateLayers(
return old_layer;
}
+std::unique_ptr<ui::LayerTreeOwner> MirrorLayers(
+ ui::LayerOwner* root,
+ LayerDelegateFactory* factory) {
+ std::unique_ptr<ui::LayerTreeOwner> mirror(
+ new ui::LayerTreeOwner(root->layer()->Mirror().release()));
sky 2016/10/13 19:21:33 MakeUnique. optional: using the release here is aw
Dominik Laskowski 2016/10/13 22:19:39 Done.
+ if (factory) {
+ mirror->root()->set_delegate(
+ factory->CreateDelegate(mirror->root(), root->layer()));
+ }
+ MirrorChildren(root->layer(), mirror->root(), factory);
+ return mirror;
+}
+
aura::Window* GetTransientParent(aura::Window* window) {
return const_cast<aura::Window*>(GetTransientParent(
const_cast<const aura::Window*>(window)));
« ui/compositor/layer.cc ('K') | « ui/wm/core/window_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698