summaryrefslogtreecommitdiffstats
path: root/chrome/views
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-27 17:24:49 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-27 17:24:49 +0000
commit5f46418438b0cd2570318fdcf03bb2e1e7855d9e (patch)
treeeebcfc8997a36c08fbc72a11d8d5bddb97578aea /chrome/views
parentfc6536ff4a94bccc3df5c821922bdb4603283fd1 (diff)
downloadchromium_src-5f46418438b0cd2570318fdcf03bb2e1e7855d9e.zip
chromium_src-5f46418438b0cd2570318fdcf03bb2e1e7855d9e.tar.gz
chromium_src-5f46418438b0cd2570318fdcf03bb2e1e7855d9e.tar.bz2
Don't allow the browser window to be resized so small that layout starts breaking horribly. When it _is_ small, draw the frame correctly.
This is an incomplete fix; only non-Aero main/popup/app windows are handled so far, but this was becoming hairy enough I wanted to checkpoint it. BUG=9885 Review URL: http://codereview.chromium.org/100005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14618 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
-rw-r--r--chrome/views/widget/widget_win.h4
-rw-r--r--chrome/views/window/custom_frame_view.cc1
-rw-r--r--chrome/views/window/non_client_view.cc7
-rw-r--r--chrome/views/window/non_client_view.h1
-rw-r--r--chrome/views/window/window_win.cc7
-rw-r--r--chrome/views/window/window_win.h1
6 files changed, 20 insertions, 1 deletions
diff --git a/chrome/views/widget/widget_win.h b/chrome/views/widget/widget_win.h
index ede4252..110a0b4 100644
--- a/chrome/views/widget/widget_win.h
+++ b/chrome/views/widget/widget_win.h
@@ -178,6 +178,7 @@ class WidgetWin : public Widget,
MSG_WM_ENDSESSION(OnEndSession)
MSG_WM_ENTERSIZEMOVE(OnEnterSizeMove)
MSG_WM_EXITMENULOOP(OnExitMenuLoop)
+ MSG_WM_GETMINMAXINFO(OnGetMinMaxInfo)
MSG_WM_HSCROLL(OnHScroll)
MSG_WM_INITMENU(OnInitMenu)
MSG_WM_INITMENUPOPUP(OnInitMenuPopup)
@@ -376,6 +377,9 @@ class WidgetWin : public Widget,
}
virtual LRESULT OnEraseBkgnd(HDC dc);
virtual LRESULT OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param);
+ virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info) {
+ SetMsgHandled(FALSE);
+ }
virtual void OnHScroll(int scroll_type, short position, HWND scrollbar) {
SetMsgHandled(FALSE);
}
diff --git a/chrome/views/window/custom_frame_view.cc b/chrome/views/window/custom_frame_view.cc
index b1ef417..9c07817 100644
--- a/chrome/views/window/custom_frame_view.cc
+++ b/chrome/views/window/custom_frame_view.cc
@@ -370,7 +370,6 @@ void CustomFrameView::Layout() {
gfx::Size CustomFrameView::GetPreferredSize() {
gfx::Size pref = frame_->GetClientView()->GetPreferredSize();
- DCHECK(pref.width() > 0 && pref.height() > 0);
gfx::Rect bounds(0, 0, pref.width(), pref.height());
return frame_->GetNonClientView()->GetWindowBoundsForClientBounds(
bounds).size();
diff --git a/chrome/views/window/non_client_view.cc b/chrome/views/window/non_client_view.cc
index bc69587..29daf06 100644
--- a/chrome/views/window/non_client_view.cc
+++ b/chrome/views/window/non_client_view.cc
@@ -131,10 +131,17 @@ void NonClientView::LayoutFrameView() {
// NonClientView, View overrides:
gfx::Size NonClientView::GetPreferredSize() {
+ // TODO(pkasting): This should probably be made to look similar to
+ // GetMinimumSize() below. This will require implementing GetPreferredSize()
+ // better in the various frame views.
gfx::Rect client_bounds(gfx::Point(), client_view_->GetPreferredSize());
return GetWindowBoundsForClientBounds(client_bounds).size();
}
+gfx::Size NonClientView::GetMinimumSize() {
+ return frame_view_->GetMinimumSize();
+}
+
void NonClientView::Layout() {
LayoutFrameView();
diff --git a/chrome/views/window/non_client_view.h b/chrome/views/window/non_client_view.h
index 0481cfd..e82ec77 100644
--- a/chrome/views/window/non_client_view.h
+++ b/chrome/views/window/non_client_view.h
@@ -192,6 +192,7 @@ class NonClientView : public View {
// NonClientView, View overrides:
virtual gfx::Size GetPreferredSize();
+ virtual gfx::Size GetMinimumSize();
virtual void Layout();
protected:
diff --git a/chrome/views/window/window_win.cc b/chrome/views/window/window_win.cc
index 3d2c74f..8c03219 100644
--- a/chrome/views/window/window_win.cc
+++ b/chrome/views/window/window_win.cc
@@ -640,6 +640,13 @@ void WindowWin::OnFinalMessage(HWND window) {
WidgetWin::OnFinalMessage(window);
}
+void WindowWin::OnGetMinMaxInfo(MINMAXINFO* minmax_info) {
+ gfx::Size min_window_size(GetNonClientView()->GetMinimumSize());
+ minmax_info->ptMinTrackSize.x = min_window_size.width();
+ minmax_info->ptMinTrackSize.y = min_window_size.height();
+ WidgetWin::OnGetMinMaxInfo(minmax_info);
+}
+
namespace {
static void EnableMenuItem(HMENU menu, UINT command, bool enabled) {
UINT flags = MF_BYCOMMAND | (enabled ? MF_ENABLED : MF_DISABLED | MF_GRAYED);
diff --git a/chrome/views/window/window_win.h b/chrome/views/window/window_win.h
index cd7bd50..222ac52 100644
--- a/chrome/views/window/window_win.h
+++ b/chrome/views/window/window_win.h
@@ -129,6 +129,7 @@ class WindowWin : public WidgetWin,
virtual LRESULT OnDwmCompositionChanged(UINT msg, WPARAM w_param,
LPARAM l_param);
virtual void OnFinalMessage(HWND window);
+ virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info);
virtual void OnInitMenu(HMENU menu);
virtual void OnMouseLeave();
virtual LRESULT OnNCActivate(BOOL active);