From e069739561c16092f24df33eafd54f8ab9e5697f Mon Sep 17 00:00:00 2001 From: "dpolukhin@google.com" Date: Mon, 15 Mar 2010 10:39:19 +0000 Subject: Return back all changes in tab_contents_view_win.cc about root view layout. BUG=37533,36280 TEST=In RTL layout drop down menues should be within Chrome window. Review URL: http://codereview.chromium.org/782006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41575 0039d316-1c4b-4281-b951-d872f2087c98 --- .../views/tab_contents/tab_contents_view_win.cc | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'chrome') diff --git a/chrome/browser/views/tab_contents/tab_contents_view_win.cc b/chrome/browser/views/tab_contents/tab_contents_view_win.cc index d1c3bfe..5af44c6 100644 --- a/chrome/browser/views/tab_contents/tab_contents_view_win.cc +++ b/chrome/browser/views/tab_contents/tab_contents_view_win.cc @@ -171,7 +171,11 @@ void TabContentsViewWin::OnTabCrashed() { void TabContentsViewWin::SizeContents(const gfx::Size& size) { // TODO(brettw) this is a hack and should be removed. See tab_contents_view.h. - WasSized(size); + + // Set new window size. It will fire OnWindowPosChanged and we will do + // the rest in WasSized. + UINT swp_flags = SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE; + SetWindowPos(NULL, 0, 0, size.width(), size.height(), swp_flags); } void TabContentsViewWin::Focus() { @@ -451,7 +455,12 @@ void TabContentsViewWin::OnWindowPosChanged(WINDOWPOS* window_pos) { } void TabContentsViewWin::OnSize(UINT param, const CSize& size) { - WidgetWin::OnSize(param, size); + // NOTE: Because TabContentsViewWin handles OnWindowPosChanged without calling + // DefWindowProc, OnSize is NOT called on window resize. This handler + // is called only once when the window is created. + + // Don't call base class OnSize to avoid useless layout for 0x0 size. + // We will get OnWindowPosChanged later and layout root view in WasSized. // Hack for thinkpad touchpad driver. // Set fake scrollbars so that we can get scroll messages, @@ -502,13 +511,17 @@ void TabContentsViewWin::WasShown() { } void TabContentsViewWin::WasSized(const gfx::Size& size) { - UINT swp_flags = SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE; - SetWindowPos(NULL, 0, 0, size.width(), size.height(), swp_flags); if (tab_contents()->interstitial_page()) tab_contents()->interstitial_page()->SetSize(size); RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); if (rwhv) rwhv->SetSize(size); + + // We have to layout root view here because we handle OnWindowPosChanged + // without calling DefWindowProc (it sends OnSize and OnMove) so we don't + // receive OnSize. For performance reasons call SetBounds instead of + // LayoutRootView, we actually don't need paint event and we know new size. + GetRootView()->SetBounds(0, 0, size.width(), size.height()); } bool TabContentsViewWin::ScrollZoom(int scroll_type) { -- cgit v1.1