diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-20 03:37:16 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-20 03:37:16 +0000 |
commit | ac8c9f8df904be7c51b37257861a0bb8dada3d86 (patch) | |
tree | 6a5542d3948d06c90d4d06c30a653ba87d43d744 | |
parent | c445765ca10d1b652c0aace3882554b5aaf41eee (diff) | |
download | chromium_src-ac8c9f8df904be7c51b37257861a0bb8dada3d86.zip chromium_src-ac8c9f8df904be7c51b37257861a0bb8dada3d86.tar.gz chromium_src-ac8c9f8df904be7c51b37257861a0bb8dada3d86.tar.bz2 |
Fixes regression in menu painting on windows. The regression happened
from a change that resulted in shrinking the client area one pixel
when it shouldn't have. I've changed the code to respect whether we
should shrink the client area by one pixel.
BUG=96505
TEST=make sure menus on windows aren't truncated anymore. Truncation
is most noticable over remote desktop.
R=ben@chromium.org
Review URL: http://codereview.chromium.org/7974001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101914 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | views/widget/native_widget_win.cc | 7 | ||||
-rw-r--r-- | views/widget/native_widget_win.h | 5 | ||||
-rw-r--r-- | views/widget/widget.cc | 8 | ||||
-rw-r--r-- | views/widget/widget.h | 3 |
4 files changed, 19 insertions, 4 deletions
diff --git a/views/widget/native_widget_win.cc b/views/widget/native_widget_win.cc index bd87744..a6ea951 100644 --- a/views/widget/native_widget_win.cc +++ b/views/widget/native_widget_win.cc @@ -391,7 +391,8 @@ NativeWidgetWin::NativeWidgetWin(internal::NativeWidgetDelegate* delegate) last_monitor_(NULL), is_right_mouse_pressed_on_caption_(false), restored_enabled_(false), - destroyed_(NULL) { + destroyed_(NULL), + has_non_client_view_(false) { } NativeWidgetWin::~NativeWidgetWin() { @@ -2099,7 +2100,7 @@ int NativeWidgetWin::GetShowState() const { gfx::Insets NativeWidgetWin::GetClientAreaInsets() const { // Returning an empty Insets object causes the default handling in // NativeWidgetWin::OnNCCalcSize() to be invoked. - if (GetWidget()->ShouldUseNativeFrame()) + if (!has_non_client_view_ || GetWidget()->ShouldUseNativeFrame()) return gfx::Insets(); if (IsMaximized()) { @@ -2271,6 +2272,8 @@ void NativeWidgetWin::SetInitParams(const Widget::InitParams& params) { set_initial_class_style(class_style); set_window_style(window_style() | style); set_window_ex_style(window_ex_style() | ex_style); + + has_non_client_view_ = Widget::RequiresNonClientView(params.type); } void NativeWidgetWin::RedrawInvalidRect() { diff --git a/views/widget/native_widget_win.h b/views/widget/native_widget_win.h index cb635f5..c433d9b 100644 --- a/views/widget/native_widget_win.h +++ b/views/widget/native_widget_win.h @@ -658,6 +658,11 @@ class VIEWS_EXPORT NativeWidgetWin : public ui::WindowImpl, // as unlocking the Window with a ScopedRedrawLock) after Widget destruction. bool* destroyed_; + // True if the widget is going to have a non_client_view. We cache this value + // rather than asking the Widget for the non_client_view so that we know at + // Init time, before the Widget has created the NonClientView. + bool has_non_client_view_; + DISALLOW_COPY_AND_ASSIGN(NativeWidgetWin); }; diff --git a/views/widget/widget.cc b/views/widget/widget.cc index 72c34b2..0f0ecd5 100644 --- a/views/widget/widget.cc +++ b/views/widget/widget.cc @@ -286,6 +286,11 @@ bool Widget::IsDebugPaintEnabled() { return debug_paint; } +// static +bool Widget::RequiresNonClientView(InitParams::Type type) { + return type == InitParams::TYPE_WINDOW || type == InitParams::TYPE_BUBBLE; +} + void Widget::Init(const InitParams& params) { is_top_level_ = params.top_level || (!params.child && @@ -304,8 +309,7 @@ void Widget::Init(const InitParams& params) { internal::NativeWidgetPrivate::IsMouseButtonDown(); } native_widget_->InitNativeWidget(params); - if (params.type == InitParams::TYPE_WINDOW || - params.type == InitParams::TYPE_BUBBLE) { + if (RequiresNonClientView(params.type)) { non_client_view_ = new NonClientView; non_client_view_->SetFrameView(CreateNonClientFrameView()); // Create the ClientView, add it to the NonClientView and add the diff --git a/views/widget/widget.h b/views/widget/widget.h index d739c42..d51dca3 100644 --- a/views/widget/widget.h +++ b/views/widget/widget.h @@ -232,6 +232,9 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, static void SetDebugPaintEnabled(bool enabled); static bool IsDebugPaintEnabled(); + // Returns true if the specified type requires a NonClientView. + static bool RequiresNonClientView(InitParams::Type type); + void Init(const InitParams& params); // Returns the gfx::NativeView associated with this Widget. |