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

Unified Diff: services/ui/ws/server_window.cc

Issue 2580703005: Fixes bug in ServerWindowCompositorFrameSinkManager (Closed)
Patch Set: merge Created 4 years 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
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

Powered by Google App Engine
This is Rietveld 408576698