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

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

Issue 2517853002: Fixes bug in handling restacking because of transients (Closed)
Patch Set: feedback Created 4 years, 1 month 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/window_tree.cc
diff --git a/services/ui/ws/window_tree.cc b/services/ui/ws/window_tree.cc
index 3945ae7cd2a45c3f79c77cff0003443008e94fef..fdb309f99196158b5ad854a4373d90e3bfecb029 100644
--- a/services/ui/ws/window_tree.cc
+++ b/services/ui/ws/window_tree.cc
@@ -859,14 +859,29 @@ WindowId WindowTree::GenerateNewWindowId() {
bool WindowTree::CanReorderWindow(const ServerWindow* window,
const ServerWindow* relative_window,
mojom::OrderDirection direction) const {
- if (!window || !relative_window)
+ if (!window) {
+ DVLOG(1) << "reorder failing: invalid window";
+ return false;
+ }
+ if (!relative_window) {
+ DVLOG(1) << "reorder failing: invalid relative window";
return false;
+ }
- if (!window->parent() || window->parent() != relative_window->parent())
+ if (!window->parent()) {
+ DVLOG(1) << "reorder failing: no parent";
return false;
+ }
- if (!access_policy_->CanReorderWindow(window, relative_window, direction))
+ if (window->parent() != relative_window->parent()) {
+ DVLOG(1) << "reorder failing: parents differ";
return false;
+ }
+
+ if (!access_policy_->CanReorderWindow(window, relative_window, direction)) {
+ DVLOG(1) << "reorder failing: access policy denied";
+ return false;
+ }
const ServerWindow::Windows& children = window->parent()->children();
const size_t child_i =
@@ -876,6 +891,7 @@ bool WindowTree::CanReorderWindow(const ServerWindow* window,
children.begin();
if ((direction == mojom::OrderDirection::ABOVE && child_i == target_i + 1) ||
(direction == mojom::OrderDirection::BELOW && child_i + 1 == target_i)) {
+ DVLOG(1) << "reorder failing: already in position";
return false;
}
@@ -1252,6 +1268,13 @@ void WindowTree::ReorderWindow(uint32_t change_id,
ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
ServerWindow* relative_window =
GetWindowByClientId(ClientWindowId(relative_window_id));
+ DVLOG(3) << "reorder client=" << id_ << " client window_id=" << window_id
+ << " global window_id="
+ << (window ? WindowIdToTransportId(window->id()) : 0)
+ << " relative client window_id=" << relative_window_id
+ << " relative global window_id="
+ << (relative_window ? WindowIdToTransportId(relative_window->id())
+ : 0);
if (CanReorderWindow(window, relative_window, direction)) {
success = true;
Operation op(this, window_server_, OperationType::REORDER_WINDOW);
« no previous file with comments | « no previous file | ui/aura/client/transient_window_client_observer.h » ('j') | ui/aura/client/transient_window_client_observer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698