Index: services/ui/ws/server_window.cc |
diff --git a/services/ui/ws/server_window.cc b/services/ui/ws/server_window.cc |
index 8ca546123ef56e2dfa22452edc5c583a039fb61c..1bc57d32b514bc7a3d6bb4a391c17d36aa92807d 100644 |
--- a/services/ui/ws/server_window.cc |
+++ b/services/ui/ws/server_window.cc |
@@ -15,7 +15,6 @@ |
#include "services/ui/ws/server_window_observer.h" |
namespace ui { |
- |
namespace ws { |
ServerWindow::ServerWindow(ServerWindowDelegate* delegate, const WindowId& id) |
@@ -115,12 +114,18 @@ void ServerWindow::Add(ServerWindow* child) { |
for (auto& observer : child->observers_) |
observer.OnWillChangeWindowHierarchy(child, this, old_parent); |
+ ServerWindow* old_root = child->GetRoot(); |
+ ServerWindow* new_root = GetRoot(); |
+ |
if (child->parent()) |
child->parent()->RemoveImpl(child); |
child->parent_ = this; |
children_.push_back(child); |
+ if (old_root != new_root) |
+ child->ProcessRootChanged(old_root, new_root); |
+ |
// Stack the child properly if it is a transient child of a sibling. |
if (child->transient_parent_ && child->transient_parent_->parent() == this) |
RestackTransientDescendants(child->transient_parent_, &GetStackingTarget, |
@@ -419,6 +424,14 @@ void ServerWindow::RemoveImpl(ServerWindow* window) { |
children_.erase(std::find(children_.begin(), children_.end(), window)); |
} |
+void ServerWindow::ProcessRootChanged(ServerWindow* old_root, |
+ ServerWindow* new_root) { |
+ if (compositor_frame_sink_manager_) |
+ compositor_frame_sink_manager_->OnRootChanged(old_root, new_root); |
+ for (ServerWindow* child : children_) |
+ child->ProcessRootChanged(old_root, new_root); |
+} |
+ |
void ServerWindow::OnStackingChanged() { |
if (stacking_target_) { |
Windows::const_iterator window_i = std::find( |
@@ -467,5 +480,4 @@ ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) { |
} |
} // namespace ws |
- |
} // namespace ui |