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/webkit | |
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/webkit')
-rw-r--r-- | WebKit/gtk/webkit/webkitprivate.h | 3 | ||||
-rw-r--r-- | WebKit/gtk/webkit/webkitwebview.cpp | 38 |
2 files changed, 22 insertions, 19 deletions
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 |