summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-11 13:19:33 +0000
committerdeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-11 13:19:33 +0000
commit1dca0cbebf145b2982842798ea25808b81b81bee (patch)
treee2f11d55a892b788bfeebfabeb23f92c1608b21a
parente7d2a02b11156d6e7fc430ff0b5db40b375e8940 (diff)
downloadchromium_src-1dca0cbebf145b2982842798ea25808b81b81bee.zip
chromium_src-1dca0cbebf145b2982842798ea25808b81b81bee.tar.gz
chromium_src-1dca0cbebf145b2982842798ea25808b81b81bee.tar.bz2
Some improvements to the browser window resizing.
Previously, you could resize the window down to nothing, which makes WebKit start looking really bad. Additionally when I added plugin windows, the plugin windows would specify their size as a minimum during requisition. This prevented you from resizing the main browser window smaller than the plugin child window. The solution to both of these problems is simply to override the size requisition phase, and set a fixed minimum, 64x64. This still lets the GtkFixed requisition phase run, but just overwrites the requisition afterwards. Review URL: http://codereview.chromium.org/21210 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9563 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/tools/test_shell/webwidget_host_gtk.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/webkit/tools/test_shell/webwidget_host_gtk.cc b/webkit/tools/test_shell/webwidget_host_gtk.cc
index 8693cf1..19f25e3 100644
--- a/webkit/tools/test_shell/webwidget_host_gtk.cc
+++ b/webkit/tools/test_shell/webwidget_host_gtk.cc
@@ -58,6 +58,8 @@ class WebWidgetHostGtkWidget {
GDK_KEY_PRESS_MASK |
GDK_KEY_RELEASE_MASK);
GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS);
+ g_signal_connect(widget, "size-request",
+ G_CALLBACK(&HandleSizeRequest), host);
g_signal_connect(widget, "size-allocate",
G_CALLBACK(&HandleSizeAllocate), host);
g_signal_connect(widget, "configure-event",
@@ -89,6 +91,22 @@ class WebWidgetHostGtkWidget {
}
private:
+ // Our size was requested. We let the GtkFixed do its normal calculation,
+ // after which this callback is called. The GtkFixed will come up with a
+ // requisition based on its children, which include plugin windows. Since
+ // we don't want to prevent resizing smaller than a plugin window, we need to
+ // control the size ourself.
+ static void HandleSizeRequest(GtkWidget* widget,
+ GtkRequisition* req,
+ WebWidgetHost* host) {
+ // This is arbitrary, but the WebKit scrollbars try to shrink themselves
+ // if the browser window is too small. Give them some space.
+ static const int kMinWidthHeight = 64;
+
+ req->width = kMinWidthHeight;
+ req->height = kMinWidthHeight;
+ }
+
// Our size has changed.
static void HandleSizeAllocate(GtkWidget* widget,
GtkAllocation* allocation,