summaryrefslogtreecommitdiffstats
path: root/chrome/browser/window_sizer.cc
diff options
context:
space:
mode:
authorjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-30 22:27:23 +0000
committerjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-30 22:27:23 +0000
commit82d14c4479bcfc8557679017e0f372577c22a43b (patch)
treea710360ae4a9cfc6a222602486980784fcf972a7 /chrome/browser/window_sizer.cc
parent336870f3ec778c3677edc16395aaaa042f05e140 (diff)
downloadchromium_src-82d14c4479bcfc8557679017e0f372577c22a43b.zip
chromium_src-82d14c4479bcfc8557679017e0f372577c22a43b.tar.gz
chromium_src-82d14c4479bcfc8557679017e0f372577c22a43b.tar.bz2
Add Mac-specific sizing rule with unit test.
Port rest of window_sizer_unittest.cc to non-Windows. Review URL: http://codereview.chromium.org/149035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19676 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/window_sizer.cc')
-rw-r--r--chrome/browser/window_sizer.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/browser/window_sizer.cc b/chrome/browser/window_sizer.cc
index 10e3cb9..897549e 100644
--- a/chrome/browser/window_sizer.cc
+++ b/chrome/browser/window_sizer.cc
@@ -254,6 +254,15 @@ void WindowSizer::AdjustBoundsToBeVisibleOnMonitorContaining(
bounds->set_height(std::max(kMinVisibleHeight, bounds->height()));
bounds->set_width(std::max(kMinVisibleWidth, bounds->width()));
+#if defined(OS_MACOSX)
+ // Limit the maximum height. On the Mac the sizer is on the
+ // bottom-right of the window, and a window cannot be moved "up"
+ // past the menubar. If the window is too tall you'll never be able
+ // to shrink it again. Windows does not have this limitation
+ // (e.g. can be resized from the top).
+ bounds->set_height(std::min(work_area.height(), bounds->height()));
+#endif // defined(OS_MACOSX)
+
// Ensure at least kMinVisibleWidth * kMinVisibleHeight is visible.
const int min_y = work_area.y() + kMinVisibleHeight - bounds->height();
const int min_x = work_area.x() + kMinVisibleWidth - bounds->width();