diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-01 02:05:07 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-01 02:05:07 +0000 |
commit | 7f5e84dd9a86e0efcbdd0bf6c35b4f0ecaff58d9 (patch) | |
tree | ad15eba0d1f291c352a4ce0ddc5fed5ca0f8d61c | |
parent | a2ebc68fd35bf1cfb955a6185b9af84acb1a79a3 (diff) | |
download | chromium_src-7f5e84dd9a86e0efcbdd0bf6c35b4f0ecaff58d9.zip chromium_src-7f5e84dd9a86e0efcbdd0bf6c35b4f0ecaff58d9.tar.gz chromium_src-7f5e84dd9a86e0efcbdd0bf6c35b4f0ecaff58d9.tar.bz2 |
Fix distributor logo placement on glass frame when window is restored from fullscreen.
Force a layout in WM_NCCALCSIZE since NC metrics can change as a result of handling this message.
http://crbug.com/8511
Review URL: http://codereview.chromium.org/56086
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12930 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/views/frame/browser_frame.cc | 9 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 1 | ||||
-rw-r--r-- | chrome/views/window/non_client_view.cc | 22 | ||||
-rw-r--r-- | chrome/views/window/non_client_view.h | 5 |
4 files changed, 28 insertions, 9 deletions
diff --git a/chrome/browser/views/frame/browser_frame.cc b/chrome/browser/views/frame/browser_frame.cc index b837c4b..8255372 100644 --- a/chrome/browser/views/frame/browser_frame.cc +++ b/chrome/browser/views/frame/browser_frame.cc @@ -165,6 +165,15 @@ LRESULT BrowserFrame::OnNCCalcSize(BOOL mode, LPARAM l_param) { UpdateDWMFrame(); + // Non-client metrics such as the window control positions may change as a + // result of us processing this message so we need to re-layout the frame view + // which may position items (such as the distributor logo) based on these + // metrics. We only do this once the non-client view has been properly + // initialized and added to the view hierarchy. + views::NonClientView* non_client_view = GetNonClientView(); + if (non_client_view && non_client_view->GetParent()) + non_client_view->LayoutFrameView(); + // We'd like to return WVR_REDRAW in some cases here, but because we almost // always have nonclient area (except in fullscreen mode, where it doesn't // matter), we can't. See comments in window.cc:OnNCCalcSize() for more info. diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 79a1978..d0c3e07 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -204,6 +204,7 @@ BrowserView::BrowserView(Browser* browser) browser_(browser), active_bookmark_bar_(NULL), active_download_shelf_(NULL), + tabstrip_(NULL), toolbar_(NULL), infobar_container_(NULL), find_bar_y_(0), diff --git a/chrome/views/window/non_client_view.cc b/chrome/views/window/non_client_view.cc index 327656b..bc69587 100644 --- a/chrome/views/window/non_client_view.cc +++ b/chrome/views/window/non_client_view.cc @@ -112,15 +112,7 @@ void NonClientView::ResetWindowControls() { frame_view_->ResetWindowControls(); } -//////////////////////////////////////////////////////////////////////////////// -// NonClientView, View overrides: - -gfx::Size NonClientView::GetPreferredSize() { - gfx::Rect client_bounds(gfx::Point(), client_view_->GetPreferredSize()); - return GetWindowBoundsForClientBounds(client_bounds).size(); -} - -void NonClientView::Layout() { +void NonClientView::LayoutFrameView() { // First layout the NonClientFrameView, which determines the size of the // ClientView... frame_view_->SetBounds(0, 0, width(), height()); @@ -133,6 +125,18 @@ void NonClientView::Layout() { // to do nothing so that SetBounds above doesn't cause Layout to be called // twice. frame_view_->Layout(); +} + +//////////////////////////////////////////////////////////////////////////////// +// NonClientView, View overrides: + +gfx::Size NonClientView::GetPreferredSize() { + gfx::Rect client_bounds(gfx::Point(), client_view_->GetPreferredSize()); + return GetWindowBoundsForClientBounds(client_bounds).size(); +} + +void NonClientView::Layout() { + LayoutFrameView(); // Then layout the ClientView, using those bounds. client_view_->SetBounds(frame_view_->GetBoundsForClientView()); diff --git a/chrome/views/window/non_client_view.h b/chrome/views/window/non_client_view.h index 45a089f..0481cfd 100644 --- a/chrome/views/window/non_client_view.h +++ b/chrome/views/window/non_client_view.h @@ -185,6 +185,11 @@ class NonClientView : public View { client_view_ = client_view; } + // Layout just the frame view. This is necessary on Windows when non-client + // metrics such as the position of the window controls changes independently + // of a window resize message. + void LayoutFrameView(); + // NonClientView, View overrides: virtual gfx::Size GetPreferredSize(); virtual void Layout(); |