[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 15:55:04 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit db8a979cf1506a487af87e8274115fe1843db890
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 16 17:31:30 2010 +0000

    2010-11-16  Carlos Garcia Campos  <cgarcia at 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):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72109 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index aa0c0da..5a844a7 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-16  Carlos Garcia Campos  <cgarcia at 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 at kldp.org>
 
         Reviewed by Antonio Gomes.
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index 6531ee1..9bdd4b7 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;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list