diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-23 07:12:26 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-23 07:12:26 +0000 |
commit | c38ba0250a72f17c2b5caed4dc96dcca8db927b2 (patch) | |
tree | 2b96576c37cb39ef75d2d4f30d69c4cc049527a4 /views/widget | |
parent | 1c12ae7b1d3af2578e0fa8411bf70e5e627eebfe (diff) | |
download | chromium_src-c38ba0250a72f17c2b5caed4dc96dcca8db927b2.zip chromium_src-c38ba0250a72f17c2b5caed4dc96dcca8db927b2.tar.gz chromium_src-c38ba0250a72f17c2b5caed4dc96dcca8db927b2.tar.bz2 |
Make sure the RootView is sized to the correct bounds when the opaque frame is maximized.It seems that now, when an opaque frame is maximized we also need to add the SM_CXSIZEFRAME to the top of the client rect. I don't know why, it's just is.I reworked the way Widget allows subclasses to handle sizing of the RootView... I delegate responsibility for determining the RootView's bounds to a helper virtual function which BrowserFrameWin overrides. This seems cleaner to me. I make sure this handling only occurs when the window is not maximized.http://crbug.com/25227TEST=use to a theme or switch off glass on vista or use Xp. Maximize the browser window. The tabs should be entirely visible.
Review URL: http://codereview.chromium.org/304007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29882 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget')
-rw-r--r-- | views/widget/widget_win.cc | 29 | ||||
-rw-r--r-- | views/widget/widget_win.h | 10 |
2 files changed, 20 insertions, 19 deletions
diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index 485f1ae..15a10f2 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -834,6 +834,16 @@ void WidgetWin::OnWindowPosChanged(WINDOWPOS* window_pos) { SetMsgHandled(FALSE); } +gfx::Size WidgetWin::GetRootViewSize() const { + CRect rect; + if (use_layered_buffer_) + GetWindowRect(&rect); + else + GetClientRect(&rect); + + return gfx::Size(rect.Width(), rect.Height()); +} + /////////////////////////////////////////////////////////////////////////////// // WidgetWin, protected: @@ -950,23 +960,18 @@ void WidgetWin::ProcessMouseExited() { } void WidgetWin::LayoutRootView() { - CRect rect; - if (SizeRootViewToWindowRect() || use_layered_buffer_) { - GetWindowRect(&rect); - } else { - GetClientRect(&rect); - } + gfx::Size size(GetRootViewSize()); if (use_layered_buffer_) - SizeContents(rect); + SizeContents(size); // Resizing changes the size of the view hierarchy and thus forces a // complete relayout. - root_view_->SetBounds(0, 0, rect.Width(), rect.Height()); + root_view_->SetBounds(0, 0, size.width(), size.height()); root_view_->SchedulePaint(); if (use_layered_buffer_) - PaintNow(gfx::Rect(rect)); + PaintNow(gfx::Rect(0, 0, size.width(), size.height())); } bool WidgetWin::ReleaseCaptureOnMouseReleased() { @@ -995,9 +1000,9 @@ Window* WidgetWin::GetWindowImpl(HWND hwnd) { return NULL; } -void WidgetWin::SizeContents(const CRect& window_rect) { - contents_.reset(new gfx::Canvas(window_rect.Width(), - window_rect.Height(), +void WidgetWin::SizeContents(const gfx::Size& window_size) { + contents_.reset(new gfx::Canvas(window_size.width(), + window_size.height(), false)); } diff --git a/views/widget/widget_win.h b/views/widget/widget_win.h index f8ba2a5..4f79a76 100644 --- a/views/widget/widget_win.h +++ b/views/widget/widget_win.h @@ -387,12 +387,8 @@ class WidgetWin : public app::WindowImpl, // behavior. virtual void OnFinalMessage(HWND window); - // Returns true if the RootView should be sized to the window rect instead of - // the client rect when the widget is resized. This is true if the widget's - // WM_NCCALCSIZE handler returns a client rect that differs from the window - // rect but the painted content of the window should still fill the entire - // visible window. - virtual bool SizeRootViewToWindowRect() const { return false; } + // Returns the size that the RootView should be set to in LayoutRootView(). + virtual gfx::Size GetRootViewSize() const; // Start tracking all mouse events so that this window gets sent mouse leave // messages too. @@ -459,7 +455,7 @@ class WidgetWin : public app::WindowImpl, // Resize the bitmap used to contain the contents of the layered window. This // recreates the entire bitmap. - void SizeContents(const CRect& window_rect); + void SizeContents(const gfx::Size& window_size); // Paint into a DIB and then update the layered window with its contents. void PaintLayeredWindow(); |