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

Side by Side Diff: ash/wm/workspace/workspace_window_resizer.cc

Issue 11369017: Use correct restore bounds in resizer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/workspace/workspace_window_resizer.h" 5 #include "ash/wm/workspace/workspace_window_resizer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 return; 321 return;
322 322
323 // When the window is not in the normal show state, we do not snap thw window. 323 // When the window is not in the normal show state, we do not snap thw window.
324 // This happens when the user minimizes or maximizes the window by keyboard 324 // This happens when the user minimizes or maximizes the window by keyboard
325 // shortcut while dragging it. If the window is the result of dragging a tab 325 // shortcut while dragging it. If the window is the result of dragging a tab
326 // out of a maximized window, it's already in the normal show state when this 326 // out of a maximized window, it's already in the normal show state when this
327 // is called, so it does not matter. 327 // is called, so it does not matter.
328 if (wm::IsWindowNormal(window()) && 328 if (wm::IsWindowNormal(window()) &&
329 (snap_type_ == SNAP_LEFT_EDGE || snap_type_ == SNAP_RIGHT_EDGE)) { 329 (snap_type_ == SNAP_LEFT_EDGE || snap_type_ == SNAP_RIGHT_EDGE)) {
330 if (!GetRestoreBoundsInScreen(window())) 330 if (!GetRestoreBoundsInScreen(window()))
331 SetRestoreBoundsInParent(window(), details_.restore_bounds.IsEmpty() ? 331 SetRestoreBoundsInScreen(window(), details_.restore_bounds.IsEmpty() ?
332 details_.initial_bounds : 332 details_.initial_bounds :
333 details_.restore_bounds); 333 details_.restore_bounds);
334 window()->SetBounds(snap_sizer_->target_bounds()); 334 window()->SetBounds(snap_sizer_->target_bounds());
335 return; 335 return;
336 } 336 }
337 337
338 gfx::Rect bounds(GetFinalBounds(window()->bounds())); 338 gfx::Rect bounds(GetFinalBounds(window()->bounds()));
339 339
340 // Check if the destination is another display. 340 // Check if the destination is another display.
341 gfx::Point last_mouse_location_in_screen = last_mouse_location_; 341 gfx::Point last_mouse_location_in_screen = last_mouse_location_;
342 wm::ConvertPointToScreen(window()->parent(), &last_mouse_location_in_screen); 342 wm::ConvertPointToScreen(window()->parent(), &last_mouse_location_in_screen);
343 gfx::Screen* screen = Shell::GetScreen(); 343 gfx::Screen* screen = Shell::GetScreen();
(...skipping 11 matching lines...) Expand all
355 355
356 void WorkspaceWindowResizer::RevertDrag() { 356 void WorkspaceWindowResizer::RevertDrag() {
357 window()->layer()->SetOpacity(details_.initial_opacity); 357 window()->layer()->SetOpacity(details_.initial_opacity);
358 drag_phantom_window_controller_.reset(); 358 drag_phantom_window_controller_.reset();
359 snap_phantom_window_controller_.reset(); 359 snap_phantom_window_controller_.reset();
360 Shell::GetInstance()->mouse_cursor_filter()->HideSharedEdgeIndicator(); 360 Shell::GetInstance()->mouse_cursor_filter()->HideSharedEdgeIndicator();
361 361
362 if (!did_move_or_resize_) 362 if (!did_move_or_resize_)
363 return; 363 return;
364 364
365 window()->SetBounds(details_.initial_bounds); 365 window()->SetBounds(details_.initial_bounds_in_parent);
366
366 if (!details_.restore_bounds.IsEmpty()) 367 if (!details_.restore_bounds.IsEmpty())
367 SetRestoreBoundsInScreen(details_.window, details_.restore_bounds); 368 SetRestoreBoundsInScreen(details_.window, details_.restore_bounds);
368 369
369 if (details_.window_component == HTRIGHT) { 370 if (details_.window_component == HTRIGHT) {
370 int last_x = details_.initial_bounds.right(); 371 int last_x = details_.initial_bounds_in_parent.right();
371 for (size_t i = 0; i < attached_windows_.size(); ++i) { 372 for (size_t i = 0; i < attached_windows_.size(); ++i) {
372 gfx::Rect bounds(attached_windows_[i]->bounds()); 373 gfx::Rect bounds(attached_windows_[i]->bounds());
373 bounds.set_x(last_x); 374 bounds.set_x(last_x);
374 bounds.set_width(initial_size_[i]); 375 bounds.set_width(initial_size_[i]);
375 attached_windows_[i]->SetBounds(bounds); 376 attached_windows_[i]->SetBounds(bounds);
376 last_x = attached_windows_[i]->bounds().right(); 377 last_x = attached_windows_[i]->bounds().right();
377 } 378 }
378 } else { 379 } else {
379 int last_y = details_.initial_bounds.bottom(); 380 int last_y = details_.initial_bounds_in_parent.bottom();
380 for (size_t i = 0; i < attached_windows_.size(); ++i) { 381 for (size_t i = 0; i < attached_windows_.size(); ++i) {
381 gfx::Rect bounds(attached_windows_[i]->bounds()); 382 gfx::Rect bounds(attached_windows_[i]->bounds());
382 bounds.set_y(last_y); 383 bounds.set_y(last_y);
383 bounds.set_height(initial_size_[i]); 384 bounds.set_height(initial_size_[i]);
384 attached_windows_[i]->SetBounds(bounds); 385 attached_windows_[i]->SetBounds(bounds);
385 last_y = attached_windows_[i]->bounds().bottom(); 386 last_y = attached_windows_[i]->bounds().bottom();
386 } 387 }
387 } 388 }
388 } 389 }
389 390
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 gfx::Rect layer_bounds = layer_->bounds(); 829 gfx::Rect layer_bounds = layer_->bounds();
829 layer_bounds.set_origin(gfx::Point(0, 0)); 830 layer_bounds.set_origin(gfx::Point(0, 0));
830 layer_->SetBounds(layer_bounds); 831 layer_->SetBounds(layer_bounds);
831 layer_->SetVisible(false); 832 layer_->SetVisible(false);
832 // Detach it from the current container. 833 // Detach it from the current container.
833 layer_->parent()->Remove(layer_); 834 layer_->parent()->Remove(layer_);
834 } 835 }
835 836
836 } // namespace internal 837 } // namespace internal
837 } // namespace ash 838 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698