diff options
author | Russell Brenner <russellbrenner@google.com> | 2010-11-18 17:33:13 -0800 |
---|---|---|
committer | Russell Brenner <russellbrenner@google.com> | 2010-12-02 13:47:21 -0800 |
commit | 6b70adc33054f8aee8c54d0f460458a9df11b8a5 (patch) | |
tree | 103a13998c33944d6ab3b8318c509a037e639460 /WebKit/gtk | |
parent | bdf4ebc8e70b2d221b6ee7a65660918ecb1d33aa (diff) | |
download | external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.zip external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.gz external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.bz2 |
Merge WebKit at r72274: Initial merge by git.
Change-Id: Ie51f0b4a16da82942bd516dce59cfb79ebbe25fb
Diffstat (limited to 'WebKit/gtk')
-rw-r--r-- | WebKit/gtk/ChangeLog | 87 | ||||
-rw-r--r-- | WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp | 4 | ||||
-rw-r--r-- | WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp | 25 | ||||
-rw-r--r-- | WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h | 3 | ||||
-rw-r--r-- | WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp | 23 | ||||
-rw-r--r-- | WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp | 5 | ||||
-rw-r--r-- | WebKit/gtk/webkit/webkitprivate.h | 3 | ||||
-rw-r--r-- | WebKit/gtk/webkit/webkitwebview.cpp | 38 |
8 files changed, 162 insertions, 26 deletions
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog index 3a7e381..ae266e4 100644 --- a/WebKit/gtk/ChangeLog +++ b/WebKit/gtk/ChangeLog @@ -1,3 +1,90 @@ +2010-11-17 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Martin Robinson. + + Fix a typo that leads to emitting the wrong signal if it is done + by using the signals array. + + * webkit/webkitwebview.cpp: + (webkit_web_view_class_init): + +2010-11-16 Carlos Garcia Campos <cgarcia@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] Some key-press events can't be handled by WebView + https://bugs.webkit.org/show_bug.cgi?id=48986 + + The problem is that "popup-menu" and "show-help" signals are + handled by GtkTextView, as they are added to the key bindings set + of every widget in gtk_widget_class_init(). For all other bindings + handled by GtkTextView we are stopping the signal emission in + their callbacks, so we only need to do the same for "popup-menu" + and "show-help" signals. + + * WebCoreSupport/EditorClientGtk.cpp: + (WebKit::toggleOverwriteCallback): + (WebKit::popupMenuCallback): + (WebKit::showHelpCallback): + (WebKit::EditorClient::EditorClient): + +2010-11-16 Carlos Garcia Campos <cgarcia@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] Show default context menu for the currently focused element when activated with keyboard + https://bugs.webkit.org/show_bug.cgi?id=49376 + + * webkit/webkitwebview.cpp: + (webkit_web_view_popup_menu_handler): + +2010-11-11 Joone Hur <joone@kldp.org> + + Reviewed by Antonio Gomes. + + [GTK][DRT] Implement LayoutTestController::nodesFromRect + https://bugs.webkit.org/show_bug.cgi?id=46598 + + Support nodesFromRect in DRT + + * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: + (DumpRenderTreeSupportGtk::nodesFromRect): Added. + * WebCoreSupport/DumpRenderTreeSupportGtk.h: + +2010-11-11 Chang Shu <chang.shu@nokia.com> + + Reviewed by Antonio Gomes. + + [GTK] Replace "MoveForward"/"MoveBackward" with "MoveRight"/"MoveLeft" + to make spatial navigation work on input/textarea. + https://bugs.webkit.org/show_bug.cgi?id=49056 + + * WebCoreSupport/EditorClientGtk.cpp: + (WebKit::moveCursorCallback): + +2010-11-08 Nicolas Dufresne <nicolas.dufresne@collabora.co.uk> + + Reviewed by Martin Robinson. + + [GTK] Link with target name set does not work + https://bugs.webkit.org/show_bug.cgi?id=48865 + + When a new page is created with a name (target=myFrame), the new + mainFrame could not be found because they where not stored in the + same PageGroup. As PageGroup are not exposed externally so the + simpliest solution is to use a global page group name. This also fixes + issue with visited link coloration across pages. After this change the + private function webkit_web_view_set_group_name() was no longer used + so it was removed completly. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::closeWindowSoon): + * WebCoreSupport/InspectorClientGtk.cpp: + (WebKit::InspectorClient::openInspectorFrontend): + * webkit/webkitprivate.h: + * webkit/webkitwebview.cpp: + (webkit_web_view_init): + 2010-11-08 Alexey Proskuryakov <ap@apple.com> Reviewed by Darin Adler. diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp index d4ab7ab..d63317c 100644 --- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp @@ -255,10 +255,6 @@ void ChromeClient::closeWindowSoon() if (isHandled) return; - - // 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, ""); } bool ChromeClient::canTakeFocus(FocusDirection) diff --git a/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp index 8296206..f237e9d 100644 --- a/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp @@ -19,9 +19,17 @@ #include "config.h" #include "DumpRenderTreeSupportGtk.h" -#include "webkitwebview.h" +#include "APICast.h" +#include "Document.h" +#include "JSDocument.h" +#include "JSLock.h" +#include "JSNodeList.h" +#include "JSValue.h" +#include "NodeList.h" #include "webkitprivate.h" +#include "webkitwebview.h" +using namespace JSC; using namespace WebCore; bool DumpRenderTreeSupportGtk::s_drtRun = false; @@ -54,3 +62,18 @@ bool DumpRenderTreeSupportGtk::linksIncludedInFocusChain() return s_linksIncludedInTabChain; } +JSValueRef DumpRenderTreeSupportGtk::nodesFromRect(JSContextRef context, JSValueRef value, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping) +{ + JSLock lock(SilenceAssertionsOnly); + ExecState* exec = toJS(context); + if (!value) + return JSValueMakeUndefined(context); + JSValue jsValue = toJS(exec, value); + if (!jsValue.inherits(&JSDocument::s_info)) + return JSValueMakeUndefined(context); + + JSDocument* jsDocument = static_cast<JSDocument*>(asObject(jsValue)); + Document* document = jsDocument->impl(); + RefPtr<NodeList> nodes = document->nodesFromRect(x, y, top, right, bottom, left, ignoreClipping); + return toRef(exec, toJS(exec, jsDocument->globalObject(), nodes.get())); +} diff --git a/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h index 5b494ff..17e9f6d 100644 --- a/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h +++ b/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h @@ -19,6 +19,8 @@ #ifndef DumpRenderTreeSupportGtk_h #define DumpRenderTreeSupportGtk_h +#include "JSStringRef.h" + class DumpRenderTreeSupportGtk { public: @@ -30,6 +32,7 @@ public: static void setLinksIncludedInFocusChain(bool); static bool linksIncludedInFocusChain(); + static JSValueRef nodesFromRect(JSContextRef context, JSValueRef value, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping); private: static bool s_drtRun; diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp index 749efe9..e04b5f9 100644 --- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp @@ -122,13 +122,25 @@ static void pasteClipboardCallback(GtkWidget* widget, EditorClient* client) client->addPendingEditorCommand("Paste"); } -static void toggleOverwriteCallback(GtkWidget* widget, EditorClient* client) +static void toggleOverwriteCallback(GtkWidget* widget, EditorClient*) { // We don't support toggling the overwrite mode, but the default callback expects // the GtkTextView to have a layout, so we handle this signal just to stop it. g_signal_stop_emission_by_name(widget, "toggle-overwrite"); } +// GTK+ will still send these signals to the web view. So we can safely stop signal +// emission without breaking accessibility. +static void popupMenuCallback(GtkWidget* widget, EditorClient*) +{ + g_signal_stop_emission_by_name(widget, "popup-menu"); +} + +static void showHelpCallback(GtkWidget* widget, EditorClient*) +{ + g_signal_stop_emission_by_name(widget, "show-help"); +} + static const char* const gtkDeleteCommands[][2] = { { "DeleteBackward", "DeleteForward" }, // Characters { "DeleteWordBackward", "DeleteWordForward" }, // Word ends @@ -213,6 +225,13 @@ static void moveCursorCallback(GtkWidget* widget, GtkMovementStep step, gint cou if (!rawCommand) return; + if (isSpatialNavigationEnabled(core(client->webView())->focusController()->focusedOrMainFrame()) && step == 1) { + if (direction == 1) + rawCommand = "MoveRight"; + else if (!direction) + rawCommand = "MoveLeft"; + } + for (int i = 0; i < abs(count); i++) client->addPendingEditorCommand(rawCommand); } @@ -782,6 +801,8 @@ EditorClient::EditorClient(WebKitWebView* webView) g_signal_connect(m_nativeWidget.get(), "move-cursor", G_CALLBACK(moveCursorCallback), this); g_signal_connect(m_nativeWidget.get(), "delete-from-cursor", G_CALLBACK(deleteFromCursorCallback), this); g_signal_connect(m_nativeWidget.get(), "toggle-overwrite", G_CALLBACK(toggleOverwriteCallback), this); + g_signal_connect(m_nativeWidget.get(), "popup-menu", G_CALLBACK(popupMenuCallback), this); + g_signal_connect(m_nativeWidget.get(), "show-help", G_CALLBACK(showHelpCallback), this); } EditorClient::~EditorClient() diff --git a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp index 2c1ffab..312b8c8 100644 --- a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp +++ b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp @@ -78,7 +78,7 @@ void InspectorClient::openInspectorFrontend(InspectorController* controller) } webkit_web_inspector_set_web_view(webInspector, inspectorWebView); - + GOwnPtr<gchar> inspectorPath(g_build_filename(inspectorFilesPath(), "inspector.html", NULL)); GOwnPtr<gchar> inspectorURI(g_filename_to_uri(inspectorPath.get(), 0, 0)); webkit_web_view_load_uri(inspectorWebView, inspectorURI.get()); @@ -88,6 +88,9 @@ void InspectorClient::openInspectorFrontend(InspectorController* controller) m_frontendPage = core(inspectorWebView); m_frontendClient = new InspectorFrontendClient(m_inspectedWebView, inspectorWebView, webInspector, m_frontendPage, this); m_frontendPage->inspectorController()->setInspectorFrontendClient(m_frontendClient); + + // The inspector must be in it's own PageGroup to avoid deadlock while debugging. + m_frontendPage->setGroupName(""); } void InspectorClient::releaseFrontendPage() diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h index 3ac3563..7385677 100644 --- a/WebKit/gtk/webkit/webkitprivate.h +++ b/WebKit/gtk/webkit/webkitprivate.h @@ -388,9 +388,6 @@ extern "C" { webkit_web_view_get_selected_text (WebKitWebView* web_view); WEBKIT_API void - webkit_web_view_set_group_name(WebKitWebView* web_view, const gchar* group_name); - - WEBKIT_API void webkit_web_settings_add_extra_plugin_directory (WebKitWebView *web_view, const gchar* directory); GSList* diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp index 314da16..0dc19f3 100644 --- a/WebKit/gtk/webkit/webkitwebview.cpp +++ b/WebKit/gtk/webkit/webkitwebview.cpp @@ -245,6 +245,13 @@ static void PopupMenuPositionFunc(GtkMenu* menu, gint *x, gint *y, gboolean *pus *pushIn = FALSE; } +static Node* getFocusedNode(Frame* frame) +{ + if (Document* doc = frame->document()) + return doc->focusedNode(); + return 0; +} + static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webView, const PlatformMouseEvent& event) { Page* page = core(webView); @@ -340,9 +347,14 @@ static gboolean webkit_web_view_popup_menu_handler(GtkWidget* widget) IntPoint location; if (!start.node() || !end.node() - || (frame->selection()->selection().isCaret() && !frame->selection()->selection().isContentEditable())) - location = IntPoint(rightAligned ? view->contentsWidth() - contextMenuMargin : contextMenuMargin, contextMenuMargin); - else { + || (frame->selection()->selection().isCaret() && !frame->selection()->selection().isContentEditable())) { + // If there's a focused elment, use its location. + if (Node* focusedNode = getFocusedNode(frame)) { + IntRect focusedNodeRect = focusedNode->getRect(); + location = IntPoint(rightAligned ? focusedNodeRect.right() : focusedNodeRect.x(), focusedNodeRect.bottom()); + } else + location = IntPoint(rightAligned ? view->contentsWidth() - contextMenuMargin : contextMenuMargin, contextMenuMargin); + } else { RenderObject* renderer = start.node()->renderer(); if (!renderer) return FALSE; @@ -2057,7 +2069,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) * * When a #WebKitWebFrame receives an onload event this signal is emitted. */ - webkit_web_view_signals[LOAD_STARTED] = g_signal_new("onload-event", + webkit_web_view_signals[ONLOAD_EVENT] = g_signal_new("onload-event", G_TYPE_FROM_CLASS(webViewClass), (GSignalFlags)G_SIGNAL_RUN_LAST, 0, @@ -3248,6 +3260,12 @@ static void webkit_web_view_init(WebKitWebView* webView) pageClients.inspectorClient = new WebKit::InspectorClient(webView); priv->corePage = new Page(pageClients); + // Pages within a same session need to be linked together otherwise some functionalities such + // as visited link coloration (across pages) and changing popup window location will not work. + // To keep the default behavior simple (and because no PageGroup API exist in WebKitGTK at the + // time of writing this comment), we simply set all the pages to the same group. + priv->corePage->setGroupName("org.webkit.gtk.WebKitGTK"); + // We also add a simple wrapper class to provide the public // interface for the Web Inspector. priv->webInspector = adoptPlatformRef(WEBKIT_WEB_INSPECTOR(g_object_new(WEBKIT_TYPE_WEB_INSPECTOR, NULL))); @@ -4513,18 +4531,6 @@ void webkit_web_view_move_cursor(WebKitWebView* webView, GtkMovementStep step, g g_signal_emit(webView, webkit_web_view_signals[MOVE_CURSOR], 0, step, count, &handled); } -void webkit_web_view_set_group_name(WebKitWebView* webView, const gchar* groupName) -{ - g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); - - WebKitWebViewPrivate* priv = webView->priv; - - if (!priv->corePage) - return; - - priv->corePage->setGroupName(String::fromUTF8(groupName)); -} - /** * webkit_web_view_can_undo: * @webView: a #WebKitWebView |