Title: [98027] trunk/Source
Revision
98027
Author
a...@apple.com
Date
2011-10-20 15:25:23 -0700 (Thu, 20 Oct 2011)

Log Message

REGRESSION (r96823): Contextual menu closes immediately when control-clicking in Flash plug-in
https://bugs.webkit.org/show_bug.cgi?id=70534
<rdar://problem/10308827>

Reviewed by Darin Adler.

Source/WebCore:

* plugins/PluginView.cpp: (WebCore::PluginView::handleEvent): Return true for contextmenu
event, so that plug-ins won't get a default WebKit context menu. We can't know if the
plug-in is handling mousedown (or even mouseup) by displaying a menu.

Source/WebKit/mac:

* WebCoreSupport/WebFrameLoaderClient.mm: (NetscapePluginWidget::handleEvent): Return true
for contextmenu event, so that plug-ins won't get a default WebKit context menu. We can't
know if the plug-in is handling mousedown (or even mouseup) by displaying a menu.

Source/WebKit2:

* WebProcess/Plugins/Netscape/NetscapePlugin.cpp: (WebKit::NetscapePlugin::handleContextMenuEvent):
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/Plugin.h:
* WebProcess/Plugins/PluginProxy.cpp: (WebKit::PluginProxy::handleContextMenuEvent):
* WebProcess/Plugins/PluginProxy.h:
* WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::handleEvent):
Return true when handling contextmenu event, so that plug-ins won't get a default WebKit
context menu. We can't know if the plug-in is handling mousedown (or even mouseup) by
displaying a menu.

* WebProcess/Plugins/PDF/BuiltInPDFView.h:
* WebProcess/Plugins/PDF/BuiltInPDFView.cpp: (WebKit::BuiltInPDFView::handleContextMenuEvent):
PDF is the only "plug-in" that wants default WebKit menu now.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (98026 => 98027)


--- trunk/Source/WebCore/ChangeLog	2011-10-20 22:24:07 UTC (rev 98026)
+++ trunk/Source/WebCore/ChangeLog	2011-10-20 22:25:23 UTC (rev 98027)
@@ -1,3 +1,15 @@
+2011-10-20  Alexey Proskuryakov  <a...@apple.com>
+
+        REGRESSION (r96823): Contextual menu closes immediately when control-clicking in Flash plug-in
+        https://bugs.webkit.org/show_bug.cgi?id=70534
+        <rdar://problem/10308827>
+
+        Reviewed by Darin Adler.
+
+        * plugins/PluginView.cpp: (WebCore::PluginView::handleEvent): Return true for contextmenu
+        event, so that plug-ins won't get a default WebKit context menu. We can't know if the
+        plug-in is handling mousedown (or even mouseup) by displaying a menu.
+
 2011-10-17  Nat Duca  <nd...@chromium.org>
 
         [chromium] Allow CCLayerTreeHostImpl to call back to proxy via CCLayerTreeHostImplClient

Modified: trunk/Source/WebCore/plugins/PluginView.cpp (98026 => 98027)


--- trunk/Source/WebCore/plugins/PluginView.cpp	2011-10-20 22:24:07 UTC (rev 98026)
+++ trunk/Source/WebCore/plugins/PluginView.cpp	2011-10-20 22:25:23 UTC (rev 98027)
@@ -170,6 +170,8 @@
         handleMouseEvent(static_cast<MouseEvent*>(event));
     else if (event->isKeyboardEvent())
         handleKeyboardEvent(static_cast<KeyboardEvent*>(event));
+    else if (event->type() == eventNames().contextmenuEvent)
+        event->setDefaultHandled(); // We don't know if the plug-in has handled mousedown event by displaying a context menu, so we never want WebKit to show a default one.
 #if defined(XP_UNIX) && ENABLE(NETSCAPE_PLUGIN_API)
     else if (event->type() == eventNames().focusoutEvent)
         handleFocusOutEvent();

Modified: trunk/Source/WebKit/mac/ChangeLog (98026 => 98027)


--- trunk/Source/WebKit/mac/ChangeLog	2011-10-20 22:24:07 UTC (rev 98026)
+++ trunk/Source/WebKit/mac/ChangeLog	2011-10-20 22:25:23 UTC (rev 98027)
@@ -1,3 +1,15 @@
+2011-10-20  Alexey Proskuryakov  <a...@apple.com>
+
+        REGRESSION (r96823): Contextual menu closes immediately when control-clicking in Flash plug-in
+        https://bugs.webkit.org/show_bug.cgi?id=70534
+        <rdar://problem/10308827>
+
+        Reviewed by Darin Adler.
+
+        * WebCoreSupport/WebFrameLoaderClient.mm: (NetscapePluginWidget::handleEvent): Return true
+        for contextmenu event, so that plug-ins won't get a default WebKit context menu. We can't
+        know if the plug-in is handling mousedown (or even mouseup) by displaying a menu.
+
 2011-10-19  Beth Dakin  <bda...@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=70396

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (98026 => 98027)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2011-10-20 22:24:07 UTC (rev 98026)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2011-10-20 22:25:23 UTC (rev 98027)
@@ -1621,6 +1621,8 @@
             [(WebBaseNetscapePluginView *)platformWidget() handleMouseEntered:currentNSEvent];
         else if (event->type() == eventNames().mouseoutEvent)
             [(WebBaseNetscapePluginView *)platformWidget() handleMouseExited:currentNSEvent];
+        else if (event->type() == eventNames().contextmenuEvent)
+            event->setDefaultHandled(); // We don't know if the plug-in has handled mousedown event by displaying a context menu, so we never want WebKit to show a default one.
     }
 
 private:

Modified: trunk/Source/WebKit2/ChangeLog (98026 => 98027)


--- trunk/Source/WebKit2/ChangeLog	2011-10-20 22:24:07 UTC (rev 98026)
+++ trunk/Source/WebKit2/ChangeLog	2011-10-20 22:25:23 UTC (rev 98027)
@@ -1,3 +1,25 @@
+2011-10-20  Alexey Proskuryakov  <a...@apple.com>
+
+        REGRESSION (r96823): Contextual menu closes immediately when control-clicking in Flash plug-in
+        https://bugs.webkit.org/show_bug.cgi?id=70534
+        <rdar://problem/10308827>
+
+        Reviewed by Darin Adler.
+
+        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: (WebKit::NetscapePlugin::handleContextMenuEvent):
+        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+        * WebProcess/Plugins/Plugin.h:
+        * WebProcess/Plugins/PluginProxy.cpp: (WebKit::PluginProxy::handleContextMenuEvent):
+        * WebProcess/Plugins/PluginProxy.h:
+        * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::handleEvent):
+        Return true when handling contextmenu event, so that plug-ins won't get a default WebKit
+        context menu. We can't know if the plug-in is handling mousedown (or even mouseup) by
+        displaying a menu.
+
+        * WebProcess/Plugins/PDF/BuiltInPDFView.h:
+        * WebProcess/Plugins/PDF/BuiltInPDFView.cpp: (WebKit::BuiltInPDFView::handleContextMenuEvent):
+        PDF is the only "plug-in" that wants default WebKit menu now.
+
 2011-10-20  Sam Weinig  <s...@webkit.org>
 
         Put the WebKit2 C SPI in PrivateHeaders

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (98026 => 98027)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2011-10-20 22:24:07 UTC (rev 98026)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2011-10-20 22:25:23 UTC (rev 98027)
@@ -822,6 +822,12 @@
     return platformHandleMouseLeaveEvent(mouseEvent);
 }
 
+bool NetscapePlugin::handleContextMenuEvent(const WebMouseEvent&)
+{
+    // We don't know if the plug-in has handled mousedown event by displaying a context menu, so we never want WebKit to show a default one.
+    return true;
+}
+
 bool NetscapePlugin::handleKeyboardEvent(const WebKeyboardEvent& keyboardEvent)
 {
     ASSERT(m_isStarted);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (98026 => 98027)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-10-20 22:24:07 UTC (rev 98026)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2011-10-20 22:25:23 UTC (rev 98027)
@@ -187,6 +187,7 @@
     virtual bool handleWheelEvent(const WebWheelEvent&);
     virtual bool handleMouseEnterEvent(const WebMouseEvent&);
     virtual bool handleMouseLeaveEvent(const WebMouseEvent&);
+    virtual bool handleContextMenuEvent(const WebMouseEvent&);
     virtual bool handleKeyboardEvent(const WebKeyboardEvent&);
     virtual void setFocus(bool);
     virtual NPObject* pluginScriptableNPObject();

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp (98026 => 98027)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp	2011-10-20 22:24:07 UTC (rev 98026)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp	2011-10-20 22:25:23 UTC (rev 98027)
@@ -472,6 +472,12 @@
     return false;
 }
 
+bool BuiltInPDFView::handleContextMenuEvent(const WebMouseEvent&)
+{
+    // Use default WebKit context menu.
+    return false;
+}
+
 bool BuiltInPDFView::handleKeyboardEvent(const WebKeyboardEvent&)
 {
     return false;

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h (98026 => 98027)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2011-10-20 22:24:07 UTC (rev 98026)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2011-10-20 22:25:23 UTC (rev 98027)
@@ -96,6 +96,7 @@
     virtual bool handleWheelEvent(const WebWheelEvent&);
     virtual bool handleMouseEnterEvent(const WebMouseEvent&);
     virtual bool handleMouseLeaveEvent(const WebMouseEvent&);
+    virtual bool handleContextMenuEvent(const WebMouseEvent&);
     virtual bool handleKeyboardEvent(const WebKeyboardEvent&);
     virtual void setFocus(bool);
     virtual NPObject* pluginScriptableNPObject();

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h (98026 => 98027)


--- trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h	2011-10-20 22:24:07 UTC (rev 98026)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h	2011-10-20 22:25:23 UTC (rev 98027)
@@ -169,6 +169,9 @@
     // Tells the plug-in to handle the passed in mouse leave event. The plug-in should return true if it processed the event.
     virtual bool handleMouseLeaveEvent(const WebMouseEvent&) = 0;
 
+    // Tells the plug-in to handle the passed in context menu event. The plug-in should return true if it processed the event.
+    virtual bool handleContextMenuEvent(const WebMouseEvent&) = 0;
+
     // Tells the plug-in to handle the passed in keyboard event. The plug-in should return true if it processed the event.
     virtual bool handleKeyboardEvent(const WebKeyboardEvent&) = 0;
     

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp (98026 => 98027)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-10-20 22:24:07 UTC (rev 98026)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2011-10-20 22:25:23 UTC (rev 98027)
@@ -313,6 +313,12 @@
     return handled;
 }
 
+bool PluginProxy::handleContextMenuEvent(const WebMouseEvent&)
+{
+    // We don't know if the plug-in has handled mousedown event by displaying a context menu, so we never want WebKit to show a default one.
+    return true;
+}
+
 bool PluginProxy::handleKeyboardEvent(const WebKeyboardEvent& keyboardEvent)
 {
     bool handled = false;

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h (98026 => 98027)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2011-10-20 22:24:07 UTC (rev 98026)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2011-10-20 22:25:23 UTC (rev 98027)
@@ -89,6 +89,7 @@
     virtual bool handleWheelEvent(const WebWheelEvent&);
     virtual bool handleMouseEnterEvent(const WebMouseEvent&);
     virtual bool handleMouseLeaveEvent(const WebMouseEvent&);
+    virtual bool handleContextMenuEvent(const WebMouseEvent&);
     virtual bool handleKeyboardEvent(const WebKeyboardEvent&);
     virtual void setFocus(bool);
     virtual NPObject* pluginScriptableNPObject();

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (98026 => 98027)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2011-10-20 22:24:07 UTC (rev 98026)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2011-10-20 22:25:23 UTC (rev 98027)
@@ -629,6 +629,9 @@
     } else if (event->type() == eventNames().mouseoutEvent && currentEvent->type() == WebEvent::MouseMove) {
         // We have a mouse leave event.
         didHandleEvent = m_plugin->handleMouseLeaveEvent(static_cast<const WebMouseEvent&>(*currentEvent));
+    } else if (event->type() == eventNames().contextmenuEvent && currentEvent->type() == WebEvent::MouseDown) {
+        // We have a context menu event.
+        didHandleEvent = m_plugin->handleContextMenuEvent(static_cast<const WebMouseEvent&>(*currentEvent));
     } else if ((event->type() == eventNames().keydownEvent && currentEvent->type() == WebEvent::KeyDown)
                || (event->type() == eventNames().keyupEvent && currentEvent->type() == WebEvent::KeyUp)) {
         // We have a keyboard event.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to