diff options
author | Steve Block <steveblock@google.com> | 2009-10-08 17:19:54 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2009-10-20 00:41:58 +0100 |
commit | 231d4e3152a9c27a73b6ac7badbe6be673aa3ddf (patch) | |
tree | a6c7e2d6cd7bfa7011cc39abbb436142d7a4a7c8 /WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp | |
parent | e196732677050bd463301566a68a643b6d14b907 (diff) | |
download | external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.zip external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.gz external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.bz2 |
Merge webkit.org at R49305 : Automatic merge by git.
Change-Id: I8968561bc1bfd72b8923b7118d3728579c6dbcc7
Diffstat (limited to 'WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp')
-rw-r--r-- | WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp | 57 |
1 files changed, 49 insertions, 8 deletions
diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp index 1292e99..8d31af3 100644 --- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp @@ -215,6 +215,10 @@ void ChromeClient::setResizable(bool) void ChromeClient::closeWindowSoon() { + // We may not have a WebView as create-web-view can return NULL. + if (!m_webView) + return; + webkit_web_view_stop_loading(m_webView); gboolean isHandled = false; @@ -226,7 +230,6 @@ void ChromeClient::closeWindowSoon() // FIXME: should we clear the frame group name here explicitly? Mac does it. // But this gets cleared in Page's destructor anyway. // webkit_web_view_set_group_name(m_webView, ""); - g_object_unref(m_webView); } bool ChromeClient::canTakeFocus(FocusDirection) @@ -383,7 +386,7 @@ IntPoint ChromeClient::screenToWindow(const IntPoint& point) const return result; } -PlatformWidget ChromeClient::platformWindow() const +PlatformPageClient ChromeClient::platformPageClient() const { return GTK_WIDGET(m_webView); } @@ -399,6 +402,40 @@ void ChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const gtk_widget_queue_resize_no_redraw(widget); } +void ChromeClient::scrollbarsModeDidChange() const +{ + WebKitWebFrame* webFrame = webkit_web_view_get_main_frame(m_webView); + + g_object_notify(G_OBJECT(webFrame), "horizontal-scrollbar-policy"); + g_object_notify(G_OBJECT(webFrame), "vertical-scrollbar-policy"); + + gboolean isHandled; + g_signal_emit_by_name(webFrame, "scrollbars-policy-changed", &isHandled); + + if (isHandled) + return; + + GtkWidget* parent = gtk_widget_get_parent(GTK_WIDGET(m_webView)); + if (!parent || !GTK_IS_SCROLLED_WINDOW(parent)) + return; + + GtkPolicyType horizontalPolicy = webkit_web_frame_get_horizontal_scrollbar_policy(webFrame); + GtkPolicyType verticalPolicy = webkit_web_frame_get_vertical_scrollbar_policy(webFrame); + + // ScrolledWindow doesn't like to display only part of a widget if + // the scrollbars are completely disabled; We have a disparity + // here on what the policy requested by the web app is and what we + // can represent; the idea is not to show scrollbars, only. + if (horizontalPolicy == GTK_POLICY_NEVER) + horizontalPolicy = GTK_POLICY_AUTOMATIC; + + if (verticalPolicy == GTK_POLICY_NEVER) + verticalPolicy = GTK_POLICY_AUTOMATIC; + + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(parent), + horizontalPolicy, verticalPolicy); +} + void ChromeClient::mouseDidMoveOverElement(const HitTestResult& hit, unsigned modifierFlags) { // If a tooltip must be displayed it will be, afterwards, when @@ -459,13 +496,17 @@ void ChromeClient::print(Frame* frame) } #if ENABLE(DATABASE) -void ChromeClient::exceededDatabaseQuota(Frame* frame, const String&) +void ChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName) { - // Set to 5M for testing - // FIXME: Make this configurable - notImplemented(); - const unsigned long long defaultQuota = 5 * 1024 * 1024; + guint64 defaultQuota = webkit_get_default_web_database_quota(); DatabaseTracker::tracker().setQuota(frame->document()->securityOrigin(), defaultQuota); + + WebKitWebFrame* webFrame = kit(frame); + WebKitWebView* webView = getViewFromFrame(webFrame); + + WebKitSecurityOrigin* origin = webkit_web_frame_get_security_origin(webFrame); + WebKitWebDatabase* webDatabase = webkit_security_origin_get_web_database(origin, databaseName.utf8().data()); + g_signal_emit_by_name(webView, "database-quota-exceeded", webFrame, webDatabase); } #endif @@ -482,7 +523,7 @@ void ChromeClient::runOpenPanel(Frame*, PassRefPtr<FileChooser> prpFileChooser) RefPtr<FileChooser> chooser = prpFileChooser; GtkWidget* dialog = gtk_file_chooser_dialog_new(_("Upload File"), - GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(platformWindow()))), + GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(platformPageClient()))), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, |