[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 02:06:00 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit e53260ade6d19637f58bb326dd71ccae8a4d2a29
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Mar 2 01:12:16 2010 +0000

    2010-03-01  José Millán Soto  <jmillan at igalia.com>
    
            Reviewed by Gustavo Noronha Silva.
    
            [GTK] Right click does not activate text entry
            https://bugs.webkit.org/show_bug.cgi?id=29177
    
            Stop skipping some tests which where failing because of right click
            not being correct handled.
    
            * platform/gtk/Skipped:
    2010-03-01  José Millán Soto  <jmillan at igalia.com>
    
            Reviewed by Gustavo Noronha Silva.
    
            [GTK] Right click does not activate text entry
            https://bugs.webkit.org/show_bug.cgi?id=29177
    
            Makes the frame handle the mouse click event before sending the
            context menu event.
    
            * webkit/webkitwebview.cpp:
            (PopupMenuPositionFunc):
            Function created to make the popup menu appear in the correct position, especially
            when invoked from the keyboard.
            (webkit_web_view_forward_context_menu_event):
            Mouse click event is sent to frame before creating context menu,
            PopupMenuPositionFunc used to determine the position where the menu should appear.
            (webkit_web_view_popup_menu_handler):
            Improved focused node position detection. Event button set to right button.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55389 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c4af624..a6e1f68 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-03-01  José Millán Soto  <jmillan at igalia.com>
+
+        Reviewed by Gustavo Noronha Silva.
+
+        [GTK] Right click does not activate text entry
+        https://bugs.webkit.org/show_bug.cgi?id=29177
+
+        Stop skipping some tests which where failing because of right click
+        not being correct handled.
+
+        * platform/gtk/Skipped:
+
 2010-03-01  Alex Milowski  <alex at milowski.com>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index b8457e7..2232d11 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -1336,7 +1336,6 @@ fast/events/drag-in-frames.html
 fast/events/frame-tab-focus.html
 fast/events/js-keyboard-event-creation.html
 fast/events/mouse-click-events.html
-fast/events/mouseclick-target-and-positioning.html
 fast/events/mouseup-from-button2.html
 fast/events/offsetX-offsetY.html
 fast/events/onchange-passwordfield.html
@@ -1351,7 +1350,6 @@ fast/events/option-tab.html
 fast/events/pageshow-pagehide-on-back-cached-with-frames.html
 fast/events/pointer-events-2.html
 fast/events/popup-blocking-click-in-iframe.html
-fast/events/right-click-focus.html
 fast/events/scrollbar-double-click.html
 fast/events/stop-load-in-unload-handler-using-document-write.html
 fast/events/stop-load-in-unload-handler-using-window-stop.html
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index c7cfab3..3b100be 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,23 @@
+2010-03-01  José Millán Soto  <jmillan at igalia.com>
+
+        Reviewed by Gustavo Noronha Silva.
+
+        [GTK] Right click does not activate text entry
+        https://bugs.webkit.org/show_bug.cgi?id=29177
+
+        Makes the frame handle the mouse click event before sending the
+        context menu event.
+
+        * webkit/webkitwebview.cpp:
+        (PopupMenuPositionFunc):
+        Function created to make the popup menu appear in the correct position, especially
+        when invoked from the keyboard.
+        (webkit_web_view_forward_context_menu_event):
+        Mouse click event is sent to frame before creating context menu,
+        PopupMenuPositionFunc used to determine the position where the menu should appear.
+        (webkit_web_view_popup_menu_handler):
+        Improved focused node position detection. Event button set to right button.
+
 2010-03-01  Jakob Petsovits  <jpetsovits at rim.com>
 
         Reviewed by Adam Barth.
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index 9e7b382..671271f 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -202,33 +202,69 @@ static void destroy_menu_cb(GtkObject* object, gpointer data)
     priv->currentMenu = NULL;
 }
 
+static void PopupMenuPositionFunc(GtkMenu* menu, gint *x, gint *y, gboolean *pushIn, gpointer userData)
+{
+    WebKitWebView* view = WEBKIT_WEB_VIEW(userData);
+    WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(view);
+    GdkScreen* screen = gtk_widget_get_screen(GTK_WIDGET(view));
+    GtkRequisition menuSize;
+
+    gtk_widget_size_request(GTK_WIDGET(menu), &menuSize);
+
+    *x = priv->lastPopupXPosition;
+    if ((*x + menuSize.width) >= gdk_screen_get_width(screen))
+      *x -= menuSize.width;
+
+    *y = priv->lastPopupYPosition;
+    if ((*y + menuSize.height) >= gdk_screen_get_height(screen))
+      *y -= menuSize.height;
+
+    *pushIn = FALSE;
+}
+
 static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webView, const PlatformMouseEvent& event)
 {
     Page* page = core(webView);
     page->contextMenuController()->clearContextMenu();
-    Frame* focusedFrame = page->focusController()->focusedOrMainFrame();
+    Frame* focusedFrame;
+    Frame* mainFrame = page->mainFrame();
+    gboolean mousePressEventResult = FALSE;
 
-    if (!focusedFrame->view())
+    if (!mainFrame->view())
         return FALSE;
 
-    focusedFrame->view()->setCursor(pointerCursor());
+    mainFrame->view()->setCursor(pointerCursor());
+    if (page->frameCount()) {
+        HitTestRequest request(HitTestRequest::Active);
+        IntPoint point = mainFrame->view()->windowToContents(event.pos());
+        MouseEventWithHitTestResults mev = mainFrame->document()->prepareMouseEvent(request, point, event);
+
+        Frame* targetFrame = EventHandler::subframeForTargetNode(mev.targetNode());
+        if (!targetFrame)
+            targetFrame = mainFrame;
+
+        focusedFrame = page->focusController()->focusedOrMainFrame();
+        if (targetFrame != focusedFrame) {
+            page->focusController()->setFocusedFrame(targetFrame);
+            focusedFrame = targetFrame;
+        }
+    } else
+        focusedFrame = mainFrame;
+
+    if (focusedFrame->view() && focusedFrame->eventHandler()->handleMousePressEvent(event))
+        mousePressEventResult = TRUE;
+
+
     bool handledEvent = focusedFrame->eventHandler()->sendContextMenuEvent(event);
     if (!handledEvent)
         return FALSE;
 
     // If coreMenu is NULL, this means WebCore decided to not create
-    // the default context menu; this may still mean that the frame
-    // wants to consume the event - this happens when the page is
-    // handling the right-click for reasons other than a context menu,
-    // so we give it to it.
+    // the default context menu; this may happen when the page is
+    // handling the right-click for reasons other than the context menu.
     ContextMenu* coreMenu = page->contextMenuController()->contextMenu();
-    if (!coreMenu) {
-        Frame* frame = core(webView)->mainFrame();
-        if (frame->view() && frame->eventHandler()->handleMousePressEvent(PlatformMouseEvent(event)))
-            return TRUE;
-
-        return FALSE;
-    }
+    if (!coreMenu)
+        return mousePressEventResult;
 
     // If we reach here, it's because WebCore is going to show the
     // default context menu. We check our setting to figure out
@@ -262,8 +298,8 @@ static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webVie
                      NULL);
 
     gtk_menu_popup(menu, NULL, NULL,
-                   NULL,
-                   priv, event.button() + 1, gtk_get_current_event_time());
+                   &PopupMenuPositionFunc,
+                   webView, event.button() + 1, gtk_get_current_event_time());
     return TRUE;
 }
 
@@ -273,17 +309,19 @@ static gboolean webkit_web_view_popup_menu_handler(GtkWidget* widget)
 
     // The context menu event was generated from the keyboard, so show the context menu by the current selection.
     Page* page = core(WEBKIT_WEB_VIEW(widget));
-    FrameView* view = page->mainFrame()->view();
+    Frame* frame = page->focusController()->focusedOrMainFrame();
+    FrameView* view = frame->view();
     if (!view)
         return FALSE;    
 
-    Position start = page->mainFrame()->selection()->selection().start();
-    Position end = page->mainFrame()->selection()->selection().end();
+    Position start = frame->selection()->selection().start();
+    Position end = frame->selection()->selection().end();
 
     int rightAligned = FALSE;
     IntPoint location;
 
-    if (!start.node() || !end.node())
+    if (!start.node() || !end.node()
+        || (frame->selection()->selection().isCaret() && !frame->selection()->selection().isContentEditable()))
         location = IntPoint(rightAligned ? view->contentsWidth() - contextMenuMargin : contextMenuMargin, contextMenuMargin);
     else {
         RenderObject* renderer = start.node()->renderer();
@@ -329,8 +367,17 @@ static gboolean webkit_web_view_popup_menu_handler(GtkWidget* widget)
     // FIXME: The IntSize(0, -1) is a hack to get the hit-testing to result in the selected element.
     // Ideally we'd have the position of a context menu event be separate from its target node.
     location = view->contentsToWindow(location) + IntSize(0, -1);
+    if (location.y() < 0)
+        location.setY(contextMenuMargin);
+    else if (location.y() > view->height())
+        location.setY(view->height() - contextMenuMargin);
+    if (location.x() < 0)
+        location.setX(contextMenuMargin);
+    else if (location.x() > view->width())
+        location.setX(view->width() - contextMenuMargin);
     IntPoint global = location + IntSize(x, y);
-    PlatformMouseEvent event(location, global, NoButton, MouseEventPressed, 0, false, false, false, false, gtk_get_current_event_time());
+
+    PlatformMouseEvent event(location, global, RightButton, MouseEventPressed, 0, false, false, false, false, gtk_get_current_event_time());
 
     return webkit_web_view_forward_context_menu_event(WEBKIT_WEB_VIEW(widget), event);
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list