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

Side by Side Diff: ash/wm/window_animations.cc

Issue 1907363004: (Merge to M-51) Revise the shelf alignment locking mechanism. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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 unified diff | Download patch
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/window_animations.h" 5 #include "ash/wm/window_animations.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 return item_rect; 461 return item_rect;
462 462
463 // If both the icon width and height are 0, then there is no icon in the 463 // If both the icon width and height are 0, then there is no icon in the
464 // launcher for |window|. If the launcher is auto hidden, one of the height or 464 // launcher for |window|. If the launcher is auto hidden, one of the height or
465 // width will be 0 but the position in the launcher and the major dimension 465 // width will be 0 but the position in the launcher and the major dimension
466 // are still reported correctly and the window can be animated to the launcher 466 // are still reported correctly and the window can be animated to the launcher
467 // item's light bar. 467 // item's light bar.
468 if (item_rect.width() != 0 || item_rect.height() != 0) { 468 if (item_rect.width() != 0 || item_rect.height() != 0) {
469 if (shelf->shelf_layout_manager()->visibility_state() == SHELF_AUTO_HIDE) { 469 if (shelf->shelf_layout_manager()->visibility_state() == SHELF_AUTO_HIDE) {
470 gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen(); 470 gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen();
471 switch (shelf->alignment()) { 471 if (shelf->alignment() == SHELF_ALIGNMENT_LEFT)
472 case SHELF_ALIGNMENT_BOTTOM: 472 item_rect.set_x(shelf_bounds.right());
473 item_rect.set_y(shelf_bounds.y()); 473 else if (shelf->alignment() == SHELF_ALIGNMENT_RIGHT)
474 break; 474 item_rect.set_x(shelf_bounds.x());
475 case SHELF_ALIGNMENT_LEFT: 475 else
476 item_rect.set_x(shelf_bounds.right()); 476 item_rect.set_y(shelf_bounds.y());
477 break;
478 case SHELF_ALIGNMENT_RIGHT:
479 item_rect.set_x(shelf_bounds.x());
480 break;
481 }
482 return item_rect; 477 return item_rect;
483 } 478 }
484 } 479 }
485 480
486 // Coming here, there is no visible icon of that shelf item and we zoom back 481 // Coming here, there is no visible icon of that shelf item and we zoom back
487 // to the location of the application launcher (which is fixed as first item 482 // to the location of the application launcher (which is fixed as first item
488 // of the shelf). 483 // of the shelf).
489 gfx::Rect work_area = 484 gfx::Rect work_area =
490 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area(); 485 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area();
491 int ltr_adjusted_x = base::i18n::IsRTL() ? work_area.right() : work_area.x(); 486 int ltr_adjusted_x = base::i18n::IsRTL() ? work_area.right() : work_area.x();
492 return shelf->SelectValueForShelfAlignment( 487 return shelf->SelectValueForShelfAlignment(
493 gfx::Rect(ltr_adjusted_x, work_area.bottom(), 0, 0), 488 gfx::Rect(ltr_adjusted_x, work_area.bottom(), 0, 0),
494 gfx::Rect(work_area.x(), work_area.y(), 0, 0), 489 gfx::Rect(work_area.x(), work_area.y(), 0, 0),
495 gfx::Rect(work_area.right(), work_area.y(), 0, 0)); 490 gfx::Rect(work_area.right(), work_area.y(), 0, 0));
496 } 491 }
497 492
498 } // namespace ash 493 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/panels/panel_window_resizer.cc ('k') | chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698