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

Unified Diff: chrome/browser/ui/window_sizer_aura.cc

Issue 9969164: Ignoring alignment when it pushes a window out of the screen (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Moving align to grid functionality into WindowPositioner / WindowSizer Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/window_sizer_aura.cc
diff --git a/chrome/browser/ui/window_sizer_aura.cc b/chrome/browser/ui/window_sizer_aura.cc
index ce7a94bbead82b9a4bd246a9506476dd3e66b944..f92de71085fe01c55487fca29658a4bf7de6dede 100644
--- a/chrome/browser/ui/window_sizer_aura.cc
+++ b/chrome/browser/ui/window_sizer_aura.cc
@@ -118,10 +118,17 @@ void WindowSizer::GetDefaultWindowBounds(gfx::Rect* default_bounds) const {
// There should also be a 'desktop' border around the window at the top.
// Since the workspace excludes the tray area we only need one border size.
int default_height = work_area.height() - kDesktopBorderSize;
+ // We align the size to the grid size to avoid any surprise when the
+ // monitor height isn't divide-able by our alignment factor.
+ default_width -= default_width % kDesktopBorderSize;
+ default_height -= default_height % kDesktopBorderSize;
int offset_x = kDesktopBorderSize;
int maximum_window_width = 1280;
if (default_width > maximum_window_width) {
// The window should get centered on the screen as well.
+ // Note: It is highly unlikely but not impossible that this will bring the
sky 2012/04/13 19:44:02 This could happen if the launcher is aligned to th
Mr4D (OOO till 08-26) 2012/04/13 20:47:39 Okay, changed the comment.
+ // window into an unaligned X position. However - in this case we'd rather
+ // want the window to be centered.
offset_x = (work_area.width() - maximum_window_width) / 2;
// Never make a window wider then 1280.
default_width = maximum_window_width;

Powered by Google App Engine
This is Rietveld 408576698