Title: [124218] trunk/Source/WebKit/blackberry
Revision
124218
Author
[email protected]
Date
2012-07-31 10:21:01 -0700 (Tue, 31 Jul 2012)

Log Message

Send an onContextMenu event to the page content
so that context menus can be prevented. We use
the node's event handler because we want to use
the fat finger's node. If we use  the EventHandler's
sendContextMenuEvent it will hit test with the mouse
position which may not be what we want.
PR #184032
https://bugs.webkit.org/show_bug.cgi?id=92766

Patch by Genevieve Mak <[email protected]> on 2012-07-31
Reviewed by Antonio Gomes.
Reviewed Internally by Antonio Gomes.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::webContext):
(BlackBerry::WebKit::WebPagePrivate::contextNode):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (124217 => 124218)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-07-31 17:16:24 UTC (rev 124217)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-07-31 17:21:01 UTC (rev 124218)
@@ -2356,6 +2356,20 @@
     if (!m_currentContextNode)
         return context;
 
+    // Send an onContextMenu event to the current context ndoe and get the result. Since we've already figured out
+    // which node we want, we can send it directly to the node and not do a hit test. The onContextMenu event doesn't require
+    // mouse positions so we just set the position at (0,0)
+    PlatformMouseEvent mouseEvent(IntPoint(), IntPoint(), PlatformEvent::MouseMoved, 0, NoButton, TouchScreen);
+    if (m_currentContextNode->dispatchMouseEvent(mouseEvent, eventNames().contextmenuEvent, 0)) {
+        context.setFlag(Platform::WebContext::IsOnContextMenuPrevented);
+        return context;
+    }
+
+    // Unpress the mouse button if we're actually getting context.
+    EventHandler* eventHandler = focusedOrMainFrame()->eventHandler();
+    if (eventHandler->mousePressed())
+        eventHandler->setMousePressed(false);
+
     requestLayoutIfNeeded();
 
     bool nodeAllowSelectionOverride = false;
@@ -2760,10 +2774,6 @@
     const FatFingersResult lastFatFingersResult = m_touchEventHandler->lastFatFingersResult();
     bool isTouching = lastFatFingersResult.isValid() && strategy == RectBased;
 
-    // Unpress the mouse button always.
-    if (eventHandler->mousePressed())
-        eventHandler->setMousePressed(false);
-
     // Check if we're using LinkToLink and the user is not touching the screen.
     if (m_webSettings->doesGetFocusNodeContext() && !isTouching) {
         RefPtr<Node> node;

Modified: trunk/Source/WebKit/blackberry/ChangeLog (124217 => 124218)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-07-31 17:16:24 UTC (rev 124217)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-07-31 17:21:01 UTC (rev 124218)
@@ -1,3 +1,21 @@
+2012-07-31  Genevieve Mak  <[email protected]>
+
+        Send an onContextMenu event to the page content
+        so that context menus can be prevented. We use
+        the node's event handler because we want to use
+        the fat finger's node. If we use  the EventHandler's
+        sendContextMenuEvent it will hit test with the mouse
+        position which may not be what we want.
+        PR #184032
+        https://bugs.webkit.org/show_bug.cgi?id=92766
+
+        Reviewed by Antonio Gomes.
+        Reviewed Internally by Antonio Gomes.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::webContext):
+        (BlackBerry::WebKit::WebPagePrivate::contextNode):
+
 2012-07-31  Arvid Nilsson  <[email protected]>
 
         [BlackBerry] Backing store output flickers when using WebPageCompositor
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to