summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-04 23:01:05 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-04 23:01:05 +0000
commite1401f7d47c1e3fd64fc2a9088871d616be95405 (patch)
treecfbbf58922ae81e0532c3cf1e6cb811f344aa7eb /chrome
parent31eaf5a68a234438a5fd5421825c024a8ceea20f (diff)
downloadchromium_src-e1401f7d47c1e3fd64fc2a9088871d616be95405.zip
chromium_src-e1401f7d47c1e3fd64fc2a9088871d616be95405.tar.gz
chromium_src-e1401f7d47c1e3fd64fc2a9088871d616be95405.tar.bz2
Only send renderer resize messages for RWHV sizing caused by
TCV's size allocate message. This avoids a spurious size-allocate being sent to the renderers when creating a new tab. The extra size-allocate is called by the build-in GtkFixed's size allocate method. Another way to think of this is that we only size our RWH directly and decouple it's sizing from the GTK+ widget's sizing. BUG=26495 Review URL: http://codereview.chromium.org/363012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31031 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.cc17
-rw-r--r--chrome/browser/tab_contents/interstitial_page.cc4
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_gtk.cc9
3 files changed, 14 insertions, 16 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
index e89aef2..939c8f1 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -66,8 +66,6 @@ class RenderWidgetHostViewGtkWidget {
GDK_LEAVE_NOTIFY_MASK);
GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS);
- g_signal_connect(widget, "size-allocate",
- G_CALLBACK(SizeAllocate), host_view);
g_signal_connect(widget, "expose-event",
G_CALLBACK(ExposeEvent), host_view);
g_signal_connect(widget, "key-press-event",
@@ -100,14 +98,6 @@ class RenderWidgetHostViewGtkWidget {
}
private:
- static gboolean SizeAllocate(GtkWidget* widget, GtkAllocation* allocation,
- RenderWidgetHostViewGtk* host_view) {
- host_view->requested_size_ = gfx::Size(allocation->width,
- allocation->height);
- host_view->GetRenderWidgetHost()->WasResized();
- return FALSE;
- }
-
static gboolean ExposeEvent(GtkWidget* widget, GdkEventExpose* expose,
RenderWidgetHostViewGtk* host_view) {
const gfx::Rect damage_rect(expose->area);
@@ -417,8 +407,11 @@ void RenderWidgetHostViewGtk::SetSize(const gfx::Size& size) {
gtk_widget_set_size_request(view_.get(), width, height);
#endif
- requested_size_ = gfx::Size(width, height);
- host_->WasResized();
+ if (requested_size_.width() != width ||
+ requested_size_.height() != height) {
+ requested_size_ = gfx::Size(width, height);
+ host_->WasResized();
+ }
}
}
diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc
index b2dec89..34e008c 100644
--- a/chrome/browser/tab_contents/interstitial_page.cc
+++ b/chrome/browser/tab_contents/interstitial_page.cc
@@ -457,13 +457,13 @@ void InterstitialPage::DontProceed() {
}
void InterstitialPage::SetSize(const gfx::Size& size) {
-#if defined(OS_WIN)
+#if defined(OS_WIN) || defined(OS_LINUX)
// When a tab is closed, we might be resized after our view was NULLed
// (typically if there was an info-bar).
if (render_view_host_->view())
render_view_host_->view()->SetSize(size);
#else
- // TODO(port): do Mac or Linux need to SetSize?
+ // TODO(port): Does Mac need to SetSize?
NOTIMPLEMENTED();
#endif
}
diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/tab_contents/tab_contents_view_gtk.cc
index a51aa10..ede66bb 100644
--- a/chrome/browser/tab_contents/tab_contents_view_gtk.cc
+++ b/chrome/browser/tab_contents/tab_contents_view_gtk.cc
@@ -398,8 +398,6 @@ gboolean TabContentsViewGtk::OnSizeAllocate(GtkWidget* widget,
TabContentsViewGtk* view) {
int width = allocation->width;
int height = allocation->height;
- view->requested_size_.set_width(width);
- view->requested_size_.set_height(height);
// |delegate()| can be NULL here during browser teardown.
if (view->tab_contents()->delegate())
height += view->tab_contents()->delegate()->GetExtraRenderViewHeight();
@@ -407,6 +405,13 @@ gboolean TabContentsViewGtk::OnSizeAllocate(GtkWidget* widget,
view->requested_size_ = size;
gtk_container_foreach(GTK_CONTAINER(widget), SetSizeRequest, &size);
+ // We manually tell our RWHV to resize the renderer content. This avoids
+ // spurious resizes from GTK+.
+ if (view->tab_contents()->render_widget_host_view())
+ view->tab_contents()->render_widget_host_view()->SetSize(size);
+ if (view->tab_contents()->interstitial_page())
+ view->tab_contents()->interstitial_page()->SetSize(size);
+
return FALSE;
}