diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-15 00:52:44 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-15 00:52:44 +0000 |
commit | 6db87803de31ac4412088b17748284977ea4a468 (patch) | |
tree | 5002db28b40f74a85d9f15d8f97ee8ea197e2aea /chrome/browser | |
parent | d02f41640fbc99ad55084a6b232285c3a44a9c1f (diff) | |
download | chromium_src-6db87803de31ac4412088b17748284977ea4a468.zip chromium_src-6db87803de31ac4412088b17748284977ea4a468.tar.gz chromium_src-6db87803de31ac4412088b17748284977ea4a468.tar.bz2 |
Fix missing backing store in Linux.
Issue: In the renderer host, the RenderWidgetHostView gets created before the ViewMsg_New gets sent. In the Linux code, gtk packing of the RenderWidgetHostView will cause a configure-event to happen, which leads to ViewHost_Resize getting sent before the ViewMsg_New gets sent. This eventually leads to the backing store never getting created. See the bug report for details.
Fix:
Add a SetChildSize() method to WebContentsView.
Windows and Mac keep their current flow of just calling SetSize() on the child.
Linux defers packing from the RenderWidgetHostView creation to the SetChildSize() call.
BUG=9830
Review URL: http://codereview.chromium.org/67044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13725 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
8 files changed, 24 insertions, 3 deletions
diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc index 45b4bbd..5ab0530 100644 --- a/chrome/browser/tab_contents/web_contents.cc +++ b/chrome/browser/tab_contents/web_contents.cc @@ -1546,7 +1546,7 @@ bool WebContents::CreateRenderViewForRenderManager( return false; // Now that the RenderView has been created, we need to tell it its size. - rwh_view->SetSize(view_->GetContainerSize()); + view_->SetChildSize(rwh_view); UpdateMaxPageIDIfNecessary(render_view_host->site_instance(), render_view_host); diff --git a/chrome/browser/tab_contents/web_contents_view.h b/chrome/browser/tab_contents/web_contents_view.h index ef20996..6f57690 100644 --- a/chrome/browser/tab_contents/web_contents_view.h +++ b/chrome/browser/tab_contents/web_contents_view.h @@ -35,7 +35,7 @@ class WaitableEvent; // that should be the same for all platforms. class WebContentsView : public RenderViewHostDelegate::View { public: - WebContentsView(WebContents* web_contents); + explicit WebContentsView(WebContents* web_contents); virtual ~WebContentsView() {} // Creates the appropriate type of WebContentsView for the current system. @@ -124,6 +124,10 @@ class WebContentsView : public RenderViewHostDelegate::View { // invoked, SetInitialFocus is invoked. virtual void RestoreFocus() = 0; + // Sets children's size. May involve packing them in order to get the + // toolkit to send them resize events. + virtual void SetChildSize(RenderWidgetHostView* rwh_view) = 0; + protected: WebContentsView() {} // Abstract interface. diff --git a/chrome/browser/tab_contents/web_contents_view_gtk.cc b/chrome/browser/tab_contents/web_contents_view_gtk.cc index 95d44e5..4187c38 100644 --- a/chrome/browser/tab_contents/web_contents_view_gtk.cc +++ b/chrome/browser/tab_contents/web_contents_view_gtk.cc @@ -101,7 +101,6 @@ RenderWidgetHostView* WebContentsViewGtk::CreateViewForWidget( g_signal_connect(view->native_view(), "button-press-event", G_CALLBACK(OnMouseDown), this); gfx::RemoveAllChildren(vbox_.get()); - gtk_box_pack_start(GTK_BOX(vbox_.get()), content_view_, TRUE, TRUE, 0); return view; } @@ -187,6 +186,12 @@ void WebContentsViewGtk::RestoreFocus() { NOTIMPLEMENTED() << " -- need to restore the focus position on this page."; } +void WebContentsViewGtk::SetChildSize(RenderWidgetHostView* rwh_view) { + // Packing the gtk widget in a container will cause a configure-event to be + // sent to the widget. + gtk_box_pack_start(GTK_BOX(vbox_.get()), content_view_, TRUE, TRUE, 0); +} + void WebContentsViewGtk::UpdateDragCursor(bool is_drop_target) { NOTIMPLEMENTED(); } diff --git a/chrome/browser/tab_contents/web_contents_view_gtk.h b/chrome/browser/tab_contents/web_contents_view_gtk.h index ab8c9b38..6b3707b 100644 --- a/chrome/browser/tab_contents/web_contents_view_gtk.h +++ b/chrome/browser/tab_contents/web_contents_view_gtk.h @@ -43,6 +43,7 @@ class WebContentsViewGtk : public WebContentsView { virtual void SetInitialFocus(); virtual void StoreFocus(); virtual void RestoreFocus(); + virtual void SetChildSize(RenderWidgetHostView* rwh_view); // Backend implementation of RenderViewHostDelegate::View. virtual void ShowContextMenu(const ContextMenuParams& params); @@ -55,6 +56,7 @@ class WebContentsViewGtk : public WebContentsView { const gfx::Rect& selection_rect, int active_match_ordinal, bool final_update); + private: // We keep track of the timestamp of the latest mousedown event. static gboolean OnMouseDown(GtkWidget* widget, diff --git a/chrome/browser/tab_contents/web_contents_view_mac.h b/chrome/browser/tab_contents/web_contents_view_mac.h index 2e33317..dde763a 100644 --- a/chrome/browser/tab_contents/web_contents_view_mac.h +++ b/chrome/browser/tab_contents/web_contents_view_mac.h @@ -58,6 +58,7 @@ class WebContentsViewMac : public WebContentsView, virtual void SetInitialFocus(); virtual void StoreFocus(); virtual void RestoreFocus(); + virtual void SetChildSize(RenderWidgetHostView* rwh_view); // Backend implementation of RenderViewHostDelegate::View. virtual RenderWidgetHostView* CreateNewWidgetInternal(int route_id, diff --git a/chrome/browser/tab_contents/web_contents_view_mac.mm b/chrome/browser/tab_contents/web_contents_view_mac.mm index 9feadc1..9e60298 100644 --- a/chrome/browser/tab_contents/web_contents_view_mac.mm +++ b/chrome/browser/tab_contents/web_contents_view_mac.mm @@ -160,6 +160,10 @@ void WebContentsViewMac::RestoreFocus() { // TODO(port) } +void WebContentsView::SetChildSize(RenderWidgetHostView* rwh_view) { + rwh_view->SetSize(GetContainerSize()); +} + void WebContentsViewMac::UpdateDragCursor(bool is_drop_target) { NOTIMPLEMENTED(); } diff --git a/chrome/browser/tab_contents/web_contents_view_win.cc b/chrome/browser/tab_contents/web_contents_view_win.cc index 863fa86..a4a24f3 100644 --- a/chrome/browser/tab_contents/web_contents_view_win.cc +++ b/chrome/browser/tab_contents/web_contents_view_win.cc @@ -312,6 +312,10 @@ void WebContentsViewWin::RestoreFocus() { } } +void WebContentsViewWin::SetChildSize(RenderWidgetHostView* rwh_view) { + rwh_view->SetSize(GetContainerSize()); +} + void WebContentsViewWin::UpdateDragCursor(bool is_drop_target) { drop_target_->set_is_drop_target(is_drop_target); } diff --git a/chrome/browser/tab_contents/web_contents_view_win.h b/chrome/browser/tab_contents/web_contents_view_win.h index c3a33e6..960747c 100644 --- a/chrome/browser/tab_contents/web_contents_view_win.h +++ b/chrome/browser/tab_contents/web_contents_view_win.h @@ -43,6 +43,7 @@ class WebContentsViewWin : public WebContentsView, virtual void SetInitialFocus(); virtual void StoreFocus(); virtual void RestoreFocus(); + virtual void SetChildSize(RenderWidgetHostView* rwh_view); // Backend implementation of RenderViewHostDelegate::View. virtual void ShowContextMenu(const ContextMenuParams& params); |