diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-04 21:18:47 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-04 21:18:47 +0000 |
commit | a812095af7cc9f0559743ab5153ea77fca86bfa2 (patch) | |
tree | df893a0678006e022312d4b11dec5c459e3f19aa /webkit | |
parent | c26c4e17e7d1d1672b537b3a503bd1c0ca08bbb6 (diff) | |
download | chromium_src-a812095af7cc9f0559743ab5153ea77fca86bfa2.zip chromium_src-a812095af7cc9f0559743ab5153ea77fca86bfa2.tar.gz chromium_src-a812095af7cc9f0559743ab5153ea77fca86bfa2.tar.bz2 |
Revert "linux: SizeTo() must synchronously size the content area."
This reverts svn://svn.chromium.org/chrome/trunk/src@17664 0039d316-1c4b-4281-b951-d872f2087c98
It broke linux test_shell_tests.
Review URL: http://codereview.chromium.org/119203
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17665 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/tools/test_shell/test_shell.h | 5 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_gtk.cc | 45 |
2 files changed, 12 insertions, 38 deletions
diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h index 1de2a9f..d6ac049 100644 --- a/webkit/tools/test_shell/test_shell.h +++ b/webkit/tools/test_shell/test_shell.h @@ -344,6 +344,11 @@ private: // Dump the stats table counters on exit. bool dump_stats_table_on_exit_; + +#if defined(OS_LINUX) + // The height of the non-rendering area of the main window, in pixels. + int top_chrome_height_; +#endif }; #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_H_ diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc index 8543664..6971a57 100644 --- a/webkit/tools/test_shell/test_shell_gtk.cc +++ b/webkit/tools/test_shell/test_shell_gtk.cc @@ -314,6 +314,7 @@ GtkWidget* CreateMenuBar(TestShell* shell) { bool TestShell::Initialize(const std::wstring& startingURL) { m_mainWnd = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); gtk_window_set_title(m_mainWnd, "Test Shell"); + gtk_window_set_default_size(m_mainWnd, 640, 480); g_signal_connect(G_OBJECT(m_mainWnd), "destroy", G_CALLBACK(MainWindowDestroyed), this); g_signal_connect(G_OBJECT(m_mainWnd), "focus-out-event", @@ -369,9 +370,11 @@ bool TestShell::Initialize(const std::wstring& startingURL) { gtk_container_add(GTK_CONTAINER(m_mainWnd), vbox); gtk_widget_show_all(GTK_WIDGET(m_mainWnd)); + top_chrome_height_ = toolbar->allocation.height + + menu_bar->allocation.height + 2 * gtk_box_get_spacing(GTK_BOX(vbox)); - // LoadURL will do a resize, so make sure we don't call LoadURL - // until we've completed all of our GTK setup. + // LoadURL will do a resize (which uses top_chrome_height_), so make + // sure we don't call LoadURL until we've completed all of our GTK setup. if (!startingURL.empty()) LoadURL(startingURL.c_str()); @@ -396,43 +399,9 @@ void TestShell::TestFinished() { MessageLoop::current()->Quit(); } -// Quit the current message loop. Used as a callback below. -static void QuitMessageLoop() { - MessageLoop::current()->Quit(); -} - void TestShell::SizeTo(int width, int height) { - // We've been asked to size the content area to a particular size. - // GTK works asynchronously: you request a size and then it eventually - // becomes that size. But for this request we need to be sure the resize - // has completed by the time SizeTo() returns. - // - // The fix is to attach to the actual sizing event, resize the widget, - // then block the message loop until that event comes through. - - GtkWidget* widget = m_webViewHost->view_handle(); - if (widget->allocation.width == width && - widget->allocation.height == height) { - // Nothing to do. - return; - } - - gulong handler = - g_signal_connect(G_OBJECT(widget), "size-allocate", - G_CALLBACK(QuitMessageLoop), NULL); - gtk_widget_set_size_request(m_webViewHost->view_handle(), width, height); - - if (widget->allocation.width > width || - widget->allocation.height > height) { - // We've been sized smaller. Shrink the window so it snaps back to the - // appropriate size. - gtk_window_resize(GTK_WINDOW(m_mainWnd), 1, 1); - } - - MessageLoop::current()->Run(); - - // Clean up our handler. - g_signal_handler_disconnect(G_OBJECT(m_webViewHost->view_handle()), handler); + gtk_window_resize(GTK_WINDOW(m_mainWnd), width, + height + top_chrome_height_); } static void AlarmHandler(int signatl) { |