2010-12-09 Maciej Stachowiak <mjs@apple.com>
[WebKit.git] / WebKit2 / WebProcess / WebPage / WebPage.cpp
index e72546664c018ee26fc57bbc092455bb31f60328..59fdc63cdc81c92b7a61d62c304d6a41e7bd5af2 100644 (file)
@@ -627,6 +627,20 @@ private:
     const WebEvent* m_previousCurrentEvent;
 };
 
+static bool isContextClick(const PlatformMouseEvent& event)
+{
+    if (event.button() == WebCore::RightButton)
+        return true;
+
+#if PLATFORM(MAC)
+    // FIXME: this really should be about OSX-style UI, not about the Mac port
+    if (event.button() == WebCore::LeftButton && event.ctrlKey())
+        return true;
+#endif
+
+    return false;
+}
+
 static bool handleMouseEvent(const WebMouseEvent& mouseEvent, Page* page)
 {
     Frame* frame = page->mainFrame();
@@ -638,12 +652,12 @@ static bool handleMouseEvent(const WebMouseEvent& mouseEvent, Page* page)
     switch (platformMouseEvent.eventType()) {
         case WebCore::MouseEventPressed:
         {
-            if (platformMouseEvent.button() == WebCore::RightButton)
+            if (isContextClick(platformMouseEvent))
                 page->contextMenuController()->clearContextMenu();
             
             bool handled = frame->eventHandler()->handleMousePressEvent(platformMouseEvent);
             
-            if (platformMouseEvent.button() == WebCore::RightButton) {
+            if (isContextClick(platformMouseEvent)) {
                 handled = frame->eventHandler()->sendContextMenuEvent(platformMouseEvent);
                 if (handled)
                     page->chrome()->showContextMenu();