diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-18 18:52:43 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-18 18:52:43 +0000 |
commit | 167803ef100566b560c5df76ff4d952087401f37 (patch) | |
tree | b05ef656c4b1dbe14dc90e68db7049bc01731d8b /views/widget | |
parent | 902818085a2eca0e8f5e0b4cd2eb1cc2fb1329e6 (diff) | |
download | chromium_src-167803ef100566b560c5df76ff4d952087401f37.zip chromium_src-167803ef100566b560c5df76ff4d952087401f37.tar.gz chromium_src-167803ef100566b560c5df76ff4d952087401f37.tar.bz2 |
Call Layout directly from SetContentsView. In the case where the Widget is created with bounds, SetContentsView never causes a subsequent Layout because the bounds won't have changed.
Fixes interactive UI tests.
TBR=sky
BUG=none
TEST=interactive ui tests don't crash.
Review URL: http://codereview.chromium.org/132029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18729 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget')
-rw-r--r-- | views/widget/widget_gtk.cc | 6 | ||||
-rw-r--r-- | views/widget/widget_win.cc | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc index a430de7..8d274ea 100644 --- a/views/widget/widget_gtk.cc +++ b/views/widget/widget_gtk.cc @@ -236,7 +236,11 @@ void WidgetGtk::SetContentsView(View* view) { DCHECK(widget_); // Widget must have been created by now. - OnSizeAllocate(widget_, &(widget_->allocation)); + // Force a layout now, since the attached hierarchy won't be ready for the + // containing window's bounds. Note that we call Layout directly rather than + // calling OnSizeAllocate, since the RootView's bounds may not have changed, + // which will cause the Layout not to be done otherwise. + root_view_->Layout(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index 5cc8a79..1fe3416 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -226,10 +226,11 @@ void WidgetWin::SetContentsView(View* view) { root_view_->RemoveAllChildViews(true); root_view_->AddChildView(view); - // Manually size the window here to ensure the root view is laid out. - RECT wr; - GetWindowRect(&wr); - ChangeSize(0, CSize(wr.right - wr.left, wr.bottom - wr.top)); + // Force a layout now, since the attached hierarchy won't be ready for the + // containing window's bounds. Note that we call Layout directly rather than + // calling ChangeSize, since the RootView's bounds may not have changed, which + // will cause the Layout not to be done otherwise. + root_view_->Layout(); } /////////////////////////////////////////////////////////////////////////////// |