Move ChromeClient::showContextMenu() to ContextMenuClient
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Feb 2012 06:31:00 +0000 (06:31 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Feb 2012 06:31:00 +0000 (06:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=79427

Patch by Hajime Morrita <morrita@chromium.org> on 2012-02-26
Reviewed by Adam Barth.

Source/JavaScriptCore:

Added ACCESSIBILITY_CONTEXT_MENUS.

* wtf/Platform.h:

Source/WebCore:

- Removed ChromeClient::showContextMenu(), Chrome::showContextMenu()
- Added ContextMenuController::showContextMenuAt(), ContextMenuClient::showContextMenu()
- Hided showContextMenu() behind ACCESSIBILITY_CONTEXT_MENUS

This change localizes context menu related code and will make it easy to
modularize CONTEXT_MENUS code.

Refactoring. No new tests.

* WebCore.exp.in:
* accessibility/mac/WebAccessibilityObjectWrapper.mm:
(-[WebAccessibilityObjectWrapper accessibilityShowContextMenu]):
* loader/EmptyClients.h:
(EmptyContextMenuClient):
(WebCore::EmptyContextMenuClient::showContextMenu):
* page/ContextMenuClient.h:
(ContextMenuClient):
* page/ContextMenuController.cpp:
(WebCore):
(WebCore::ContextMenuController::showContextMenuAt):
* page/ContextMenuController.h:
(ContextMenuController):
* page/Chrome.cpp:
* page/Chrome.h:
(Chrome):
* page/ChromeClient.h:
(ChromeClient):

Source/WebKit/blackberry:

* WebCoreSupport/ChromeClientBlackBerry.h:
(ChromeClientBlackBerry):

Source/WebKit/chromium:

* src/ChromeClientImpl.h:
(ChromeClientImpl):

Source/WebKit/efl:

* WebCoreSupport/ChromeClientEfl.h:
(ChromeClientEfl):

Source/WebKit/gtk:

* WebCoreSupport/ChromeClientGtk.h:
(ChromeClient):

Source/WebKit/mac:

* WebCoreSupport/WebContextMenuClient.h:
(WebContextMenuClient):
* WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::showContextMenu): Moved from WebChromeClient
* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:

Source/WebKit/qt:

* WebCoreSupport/ChromeClientQt.h:
(ChromeClientQt):

Source/WebKit/win:

* WebCoreSupport/WebChromeClient.h:
(WebChromeClient):

Source/WebKit/wince:

* WebCoreSupport/ChromeClientWinCE.h:
(ChromeClientWinCE):

Source/WebKit/wx:

* WebKitSupport/ChromeClientWx.h:
(ChromeClientWx):

Source/WebKit2:

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
* WebProcess/WebCoreSupport/WebChromeClient.h:
(WebChromeClient):
* WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
(WebKit):
(WebKit::WebContextMenuClient::showContextMenu): Moved from WebChromeClient
* WebProcess/WebCoreSupport/WebContextMenuClient.h:
(WebContextMenuClient):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::handleContextMenuEvent):
(WebKit::handleMouseEvent):
(WebKit::WebPage::mouseEvent):
(WebKit::WebPage::mouseEventSyncForTesting):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@108957 268f45cc-cd09-0410-ab3c-d52691b4dbfc

39 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/wtf/Platform.h
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm
Source/WebCore/loader/EmptyClients.h
Source/WebCore/page/Chrome.cpp
Source/WebCore/page/Chrome.h
Source/WebCore/page/ChromeClient.h
Source/WebCore/page/ContextMenuClient.h
Source/WebCore/page/ContextMenuController.cpp
Source/WebCore/page/ContextMenuController.h
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/ChromeClientImpl.h
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebChromeClient.h
Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.h
Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreSupport/WebChromeClient.h
Source/WebKit/wince/ChangeLog
Source/WebKit/wince/WebCoreSupport/ChromeClientWinCE.h
Source/WebKit/wx/ChangeLog
Source/WebKit/wx/WebKitSupport/ChromeClientWx.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 186e357970dd8901d3606aafca2f098a81f86abb..bd3cc8271ff671045ca8a66563b7629b601db036 100644 (file)
@@ -1,3 +1,14 @@
+2012-02-26  Hajime Morrita  <morrita@chromium.org>
+
+        Move ChromeClient::showContextMenu() to ContextMenuClient
+        https://bugs.webkit.org/show_bug.cgi?id=79427
+
+        Reviewed by Adam Barth.
+
+        Added ACCESSIBILITY_CONTEXT_MENUS.
+
+        * wtf/Platform.h:
+
 2012-02-26  Filip Pizlo  <fpizlo@apple.com>
 
         LayoutTests/fast/xpath/xpath-functional-test.html is crashing in the DFG
index 794db09dbc1325273d8d8897608932f0c9bc37b6..4a259813a9030c7172458f5b30cc75d2aac3cd90 100644 (file)
 #define WTF_USE_CROSS_PLATFORM_CONTEXT_MENUS 1
 #endif
 
+#if PLATFORM(MAC) && HAVE(ACCESSIBILITY)
+#define WTF_USE_ACCESSIBILITY_CONTEXT_MENUS 1
+#endif
+
 /* Geolocation request policy. pre-emptive policy is to acquire user permission before acquiring location.
    Client based implementations will have option to choose between pre-emptive and nonpre-emptive permission policy.
    pre-emptive permission policy is enabled by default for all client-based implementations. */
index 3d1f61027979b27bb7170b6406e8fc2df1269aa1..e376bb1c1e7897657207bce87ed9e362a7b06050 100644 (file)
@@ -1,3 +1,38 @@
+2012-02-26  Hajime Morrita  <morrita@chromium.org>
+
+        Move ChromeClient::showContextMenu() to ContextMenuClient
+        https://bugs.webkit.org/show_bug.cgi?id=79427
+
+        Reviewed by Adam Barth.
+
+        - Removed ChromeClient::showContextMenu(), Chrome::showContextMenu()
+        - Added ContextMenuController::showContextMenuAt(), ContextMenuClient::showContextMenu()
+        - Hided showContextMenu() behind ACCESSIBILITY_CONTEXT_MENUS
+
+        This change localizes context menu related code and will make it easy to
+        modularize CONTEXT_MENUS code.
+
+        Refactoring. No new tests.
+
+        * WebCore.exp.in:
+        * accessibility/mac/WebAccessibilityObjectWrapper.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityShowContextMenu]):
+        * loader/EmptyClients.h:
+        (EmptyContextMenuClient):
+        (WebCore::EmptyContextMenuClient::showContextMenu):
+        * page/ContextMenuClient.h:
+        (ContextMenuClient):
+        * page/ContextMenuController.cpp:
+        (WebCore):
+        (WebCore::ContextMenuController::showContextMenuAt):
+        * page/ContextMenuController.h:
+        (ContextMenuController):
+        * page/Chrome.cpp:
+        * page/Chrome.h:
+        (Chrome):
+        * page/ChromeClient.h:
+        (ChromeClient):
+
 2012-02-26  Benjamin Poulain  <bpoulain@apple.com>
 
         [Mac] Release localized Strings instead of AutoRelease
index 3054aa2736c8dadc9fae2b74701e464cd23ea810..84e9661fcda7c89f7eef32825f1fbd878dcb39ac 100644 (file)
@@ -1669,7 +1669,6 @@ __ZNK7WebCore21ContextMenuController21checkOrEnableIfNeededERNS_15ContextMenuIte
 __ZN7WebCore21ContextMenuController23contextMenuItemSelectedEPNS_15ContextMenuItemE
 __ZN7WebCore21contextMenuItemVectorEP14NSMutableArray
 __ZN7WebCore23platformMenuDescriptionERN3WTF6VectorINS_15ContextMenuItemELm0EEE
-__ZN7WebCore6Chrome15showContextMenuEv
 __ZNK7WebCore11ContextMenu19platformDescriptionEv
 __ZNK7WebCore15ContextMenuItem15platformSubMenuEv
 __ZNK7WebCore15ContextMenuItem4typeEv
index 6bc4c63ebe904f58d09dc725d9ba2691348803f4..edd72236c87eeb5ff06705ed75337c623bc1395f 100644 (file)
@@ -44,6 +44,7 @@
 #import "AccessibilityTableRow.h"
 #import "Chrome.h"
 #import "ColorMac.h"
+#import "ContextMenuController.h"
 #import "Frame.h"
 #import "FrameLoaderClient.h"
 #import "FrameSelection.h"
@@ -2614,14 +2615,7 @@ static NSString* roleValueToNSString(AccessibilityRole value)
     Page* page = frame->page();
     if (!page)
         return;
-
-    // Simulate a click in the middle of the object.
-    IntPoint clickPoint = m_object->clickPoint();
-    
-    PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime());
-    bool handled = frame->eventHandler()->sendContextMenuEvent(mouseEvent);
-    if (handled)
-        page->chrome()->showContextMenu();
+    page->contextMenuController()->showContextMenuAt(frame, m_object->clickPoint());
 }
 
 - (void)accessibilityPerformAction:(NSString*)action
index 8c4f00a520520a667f8e57565eae62bb0ca3fa0f..71aeafdfc69eb94a28ac8ba31e1fb8004410498b 100644 (file)
@@ -152,10 +152,6 @@ public:
     virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const { return adoptRef(new EmptyPopupMenu()); }
     virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const { return adoptRef(new EmptySearchPopupMenu()); }
 
-#if ENABLE(CONTEXT_MENUS)
-    virtual void showContextMenu() { }
-#endif
-
 #if ENABLE(REGISTER_PROTOCOL_HANDLER)
     virtual void registerProtocolHandler(const String&, const String&, const String&, const String&) { }
 #endif
@@ -566,6 +562,10 @@ public:
 #if PLATFORM(MAC)
     virtual void searchWithSpotlight() { }
 #endif
+
+#if USE(ACCESSIBILITY_CONTEXT_MENUS)
+    virtual void showContextMenu() { }
+#endif
 };
 #endif // ENABLE(CONTEXT_MENUS)
 
index 5e0122ddddc9fba64a0a960f3df9ad90c7033efc..ade262d7c3c42abd54fcbe50d5f8e63c349f1c3f 100644 (file)
@@ -555,13 +555,6 @@ PassRefPtr<SearchPopupMenu> Chrome::createSearchPopupMenu(PopupMenuClient* clien
     return m_client->createSearchPopupMenu(client);
 }
 
-#if ENABLE(CONTEXT_MENUS)
-void Chrome::showContextMenu()
-{
-    m_client->showContextMenu();
-}
-#endif
-
 bool Chrome::requiresFullscreenForVideoPlayback()
 {
     return m_client->requiresFullscreenForVideoPlayback();
index c6704c97a44df629b528ffaadfabe221a1a13c73..841eb50c07c0c89efe9220bf5a7ed7cdc960eb48 100644 (file)
@@ -173,10 +173,6 @@ namespace WebCore {
         PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const;
         PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const;
 
-#if ENABLE(CONTEXT_MENUS)
-        void showContextMenu();
-#endif
-
     private:
         Chrome(Page*, ChromeClient*);
 
index 33b1c4b87149083bc68ea79b79ff142ecdd59e43..f14d3d9e50ffcca27d2e8a716bd4eeb1f2a3050a 100644 (file)
@@ -307,10 +307,6 @@ namespace WebCore {
         virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const = 0;
         virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const = 0;
 
-#if ENABLE(CONTEXT_MENUS)
-        virtual void showContextMenu() = 0;
-#endif
-
         virtual void postAccessibilityNotification(AccessibilityObject*, AXObjectCache::AXNotification) { }
         
         virtual void notifyScrollerThumbIsVisibleInRect(const IntRect&) { }
index c9389c05881ac81212eff823a01a0f0654563dab..310349bb2cb5dd046dc71bf903d2235688181d8c 100644 (file)
@@ -60,6 +60,10 @@ namespace WebCore {
 #if PLATFORM(MAC)
         virtual void searchWithSpotlight() = 0;
 #endif
+
+#if USE(ACCESSIBILITY_CONTEXT_MENUS)
+        virtual void showContextMenu() = 0;
+#endif
     };
 }
 
index 98b29817fc51c0a8c273ceba46b0f6af265a2f23..c5156753bab28762b5a80a6c5a8b4c48f585f4c3 100644 (file)
@@ -58,6 +58,7 @@
 #include "NavigationAction.h"
 #include "Node.h"
 #include "Page.h"
+#include "PlatformEvent.h"
 #include "RenderLayer.h"
 #include "RenderObject.h"
 #include "ReplaceSelectionCommand.h"
@@ -1270,6 +1271,17 @@ void ContextMenuController::checkOrEnableIfNeeded(ContextMenuItem& item) const
     item.setEnabled(shouldEnable);
 }
 
+#if USE(ACCESSIBILITY_CONTEXT_MENUS)
+void ContextMenuController::showContextMenuAt(Frame* frame, const IntPoint& clickPoint)
+{
+    // Simulate a click in the middle of the accessibility object.
+    PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime());
+    bool handled = frame->eventHandler()->sendContextMenuEvent(mouseEvent);
+    if (handled && client())
+        client()->showContextMenu();
+}
+#endif
+
 } // namespace WebCore
 
 #endif // ENABLE(CONTEXT_MENUS)
index 3588f03718294e115be0ea342bcb9d689a31f888..fdae946d1884cc8a1ea70b2db35f40ba8b332cc8 100644 (file)
@@ -65,6 +65,10 @@ namespace WebCore {
         void setHitTestResult(const HitTestResult& result) { m_hitTestResult = result; }
         const HitTestResult& hitTestResult() { return m_hitTestResult; }
 
+#if USE(ACCESSIBILITY_CONTEXT_MENUS)
+        void showContextMenuAt(Frame*, const IntPoint& clickPoint);
+#endif
+
     private:
         ContextMenuController(Page*, ContextMenuClient*);
 
index 5f186b798502d7a27edfebe6dadca41f4d74939f..009e2956baf1d4fc7018cdbf0d36050ad5675e41 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-26  Hajime Morrita  <morrita@chromium.org>
+
+        Move ChromeClient::showContextMenu() to ContextMenuClient
+        https://bugs.webkit.org/show_bug.cgi?id=79427
+
+        Reviewed by Adam Barth.
+
+        * WebCoreSupport/ChromeClientBlackBerry.h:
+        (ChromeClientBlackBerry):
+
 2012-02-24  Mike Fenton  <mifenton@rim.com>
 
         [BlackBerry] Eliminate excessive BlackBerry::Platform use in InputHandler
index 99c8b6062a43e1147edc416965ef35f8927616c2..3e6db47a9303cec9d3ff6a5ed7bd816be8443b48 100644 (file)
@@ -139,7 +139,6 @@ public:
     virtual bool selectItemAlignmentFollowsMenuWritingDirection();
     virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const;
     virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const;
-    virtual void showContextMenu() { }
 
 #if USE(ACCELERATED_COMPOSITING)
     virtual void attachRootGraphicsLayer(Frame*, GraphicsLayer*);
index b361423fd1c040046a011f668b61a222e5bbe891..a6e94df8942e39df785ad737998cc341f5d3967e 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-26  Hajime Morrita  <morrita@chromium.org>
+
+        Move ChromeClient::showContextMenu() to ContextMenuClient
+        https://bugs.webkit.org/show_bug.cgi?id=79427
+
+        Reviewed by Adam Barth.
+
+        * src/ChromeClientImpl.h:
+        (ChromeClientImpl):
+
 2012-02-26  James Robinson  <jamesr@chromium.org>
 
         Take 2 build fix.
index 23e02ff3d99504fc29982f37116356a10054976c..03a78800913319cb2f14cab59ea67578b36de485 100644 (file)
@@ -196,10 +196,6 @@ public:
     virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const;
     virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
 
-#if ENABLE(CONTEXT_MENUS)
-    virtual void showContextMenu() { }
-#endif
-
     virtual bool shouldRunModalDialogDuringPageDismissal(const DialogType&, const String& dialogMessage, WebCore::FrameLoader::PageDismissalType) const;
 
     virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const;
index 576224ff8e6a733e254b477c848dbaa21d3b9250..3d5f914f75f306b8aa96fa2845d739c97e041201 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-26  Hajime Morrita  <morrita@chromium.org>
+
+        Move ChromeClient::showContextMenu() to ContextMenuClient
+        https://bugs.webkit.org/show_bug.cgi?id=79427
+
+        Reviewed by Adam Barth.
+
+        * WebCoreSupport/ChromeClientEfl.h:
+        (ChromeClientEfl):
+
 2012-02-24  Grzegorz Czajkowski  <g.czajkowski@samsung.com>
 
         [EFL][DRT] Implement setValueForUser and setAutofilled.
index 82512251f6a440ea5933013e118df3c0024c79f3..77db98281bf16ef14b7d3e3f36703dad7d42d0ea 100644 (file)
@@ -121,10 +121,6 @@ public:
     virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
     virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t totalSpaceNeeded);
 
-#if ENABLE(CONTEXT_MENUS)
-    virtual void showContextMenu() { }
-#endif
-
 #if ENABLE(TOUCH_EVENTS)
     virtual void needTouchEvents(bool);
 #endif
index 59bb90acb06fe372701125ff2b0285769708e803..791cdbe5f55c168bd985c5357edb4dd07fcb9e54 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-26  Hajime Morrita  <morrita@chromium.org>
+
+        Move ChromeClient::showContextMenu() to ContextMenuClient
+        https://bugs.webkit.org/show_bug.cgi?id=79427
+
+        Reviewed by Adam Barth.
+
+        * WebCoreSupport/ChromeClientGtk.h:
+        (ChromeClient):
+
 2012-02-24  Shinya Kawanaka  <shinyak@chromium.org>
 
         SpellCheckRequest needs to know the context where the spellcheck happened.
index 5905f567959316b915648e38d165c294cedd9706..dcea2f0c42390d6183651af2936f5e8697d81d46 100644 (file)
@@ -125,9 +125,6 @@ namespace WebKit {
 #endif
         virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
         virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t totalSpaceNeeded);
-#if ENABLE(CONTEXT_MENUS)
-        virtual void showContextMenu() { }
-#endif
         virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
         virtual void loadIconForFiles(const Vector<WTF::String>&, FileIconLoader*);
 
index 233f23c79133418f4f3c0cc7b09dae1eb2844edc..ff5213e9eb2cc801ecb9d5a7c49dd25ce1aa33fe 100644 (file)
@@ -1,3 +1,17 @@
+2012-02-26  Hajime Morrita  <morrita@chromium.org>
+
+        Move ChromeClient::showContextMenu() to ContextMenuClient
+        https://bugs.webkit.org/show_bug.cgi?id=79427
+
+        Reviewed by Adam Barth.
+
+        * WebCoreSupport/WebContextMenuClient.h:
+        (WebContextMenuClient):
+        * WebCoreSupport/WebContextMenuClient.mm:
+        (WebContextMenuClient::showContextMenu): Moved from WebChromeClient
+        * WebCoreSupport/WebChromeClient.h:
+        * WebCoreSupport/WebChromeClient.mm:
+
 2012-02-25  Sam Weinig  <sam@webkit.org>
 
         QuickLook events don't make it to WebKit plugins.
index 66fa060b5a53dbc2f38eea6f5452d76da6bb1f92..46d1201d595ade117ac02d70def7908f10d34b78 100644 (file)
@@ -184,10 +184,6 @@ public:
     virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const OVERRIDE;
     virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const OVERRIDE;
 
-#if ENABLE(CONTEXT_MENUS)
-    virtual void showContextMenu() OVERRIDE;
-#endif
-    
     virtual void numWheelEventHandlersChanged(unsigned) OVERRIDE { }
     virtual void numTouchEventHandlersChanged(unsigned) OVERRIDE { }
     virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const OVERRIDE { return false; }
index 3bac87b9c68c11d99ab8930002d4536cfe8c073b..83f845989b2760960c2b7b2f629f4a462d8cd2a0 100644 (file)
@@ -857,35 +857,6 @@ PassRefPtr<WebCore::SearchPopupMenu> WebChromeClient::createSearchPopupMenu(WebC
     return adoptRef(new SearchPopupMenuMac(client));
 }
 
-#if ENABLE(CONTEXT_MENUS)
-void WebChromeClient::showContextMenu()
-{
-    Page* page = [m_webView page];
-    if (!page)
-        return;
-
-    ContextMenuController* controller = page->contextMenuController();
-    Node* node = controller->hitTestResult().innerNonSharedNode();
-    if (!node)
-        return;
-    Frame* frame = node->document()->frame();
-    if (!frame)
-        return;
-    FrameView* frameView = frame->view();
-    if (!frameView)
-        return;
-    NSView* view = frameView->documentView();
-    
-    IntPoint point = frameView->contentsToWindow(controller->hitTestResult().point());
-    NSPoint nsScreenPoint = [view convertPoint:point toView:nil];
-    // Show the contextual menu for this event.
-    NSEvent* event = [NSEvent mouseEventWithType:NSRightMouseDown location:nsScreenPoint modifierFlags:0 timestamp:0 windowNumber:[[view window] windowNumber] context:0 eventNumber:0 clickCount:1 pressure:1];
-    NSMenu* nsMenu = [view menuForEvent:event];
-    if (nsMenu)
-        [NSMenu popUpContextMenu:nsMenu withEvent:event forView:view];    
-}
-#endif
-
 #if USE(ACCELERATED_COMPOSITING)
 
 void WebChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer)
index 21b0d0f25a0ffe47470e973c8edc489346af41f3..e536f3c24be87f76c2ba938cc7906948bd81f2df 100644 (file)
@@ -46,6 +46,7 @@ public:
     virtual void speak(const WTF::String&) OVERRIDE;
     virtual void stopSpeaking() OVERRIDE;
     virtual void searchWithSpotlight() OVERRIDE;
+    virtual void showContextMenu() OVERRIDE;
 
     WebView *webView() { return m_webView; }
         
index 08c0d6087877e847a7945a8b433b5dcc6067858d..e20da440af102b8d1fc5d9c956e3de94f90d85ec 100644 (file)
 #import "WebViewInternal.h"
 #import <WebCore/ContextMenu.h>
 #import <WebCore/ContextMenuController.h>
+#import <WebCore/Document.h>
 #import <WebCore/KURL.h>
 #import <WebCore/LocalizedStrings.h>
 #import <WebCore/Page.h>
+#import <WebCore/Frame.h>
+#import <WebCore/FrameView.h>
 #import <WebCore/RuntimeApplicationChecks.h>
 #import <WebKit/DOMPrivate.h>
 
@@ -346,3 +349,29 @@ void WebContextMenuClient::stopSpeaking()
 {
     [NSApp stopSpeaking:nil];
 }
+
+void WebContextMenuClient::showContextMenu()
+{
+    Page* page = [m_webView page];
+    if (!page)
+        return;
+    ContextMenuController* controller = page->contextMenuController();
+    Node* node = controller->hitTestResult().innerNonSharedNode();
+    if (!node)
+        return;
+    Frame* frame = node->document()->frame();
+    if (!frame)
+        return;
+    FrameView* frameView = frame->view();
+    if (!frameView)
+        return;
+
+    IntPoint point = frameView->contentsToWindow(controller->hitTestResult().point());
+    NSView* view = frameView->documentView();
+    NSPoint nsScreenPoint = [view convertPoint:point toView:nil];
+    // Show the contextual menu for this event.
+    NSEvent* event = [NSEvent mouseEventWithType:NSRightMouseDown location:nsScreenPoint modifierFlags:0 timestamp:0 windowNumber:[[view window] windowNumber] context:0 eventNumber:0 clickCount:1 pressure:1];
+    NSMenu* nsMenu = [view menuForEvent:event];
+    if (nsMenu)
+        [NSMenu popUpContextMenu:nsMenu withEvent:event forView:view];
+}
index d0bcd674be6ea1f5de6d0807bfc38f69ba121f76..88d85e21fc7f8c93b098349a1abb4972f0425620 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-26  Hajime Morrita  <morrita@chromium.org>
+
+        Move ChromeClient::showContextMenu() to ContextMenuClient
+        https://bugs.webkit.org/show_bug.cgi?id=79427
+
+        Reviewed by Adam Barth.
+
+        * WebCoreSupport/ChromeClientQt.h:
+        (ChromeClientQt):
+
 2012-02-24  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>
 
         [Qt] API: Unify the loading properties and signals.
index 3d45b7b51a2e320044e6401f708bb2c08f3755c4..386b986d4f18a4f657a7f0f91c9990a0f93b692c 100644 (file)
@@ -138,9 +138,6 @@ public:
 #endif
     virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
     virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t totalSpaceNeeded);
-#if ENABLE(CONTEXT_MENUS)
-    virtual void showContextMenu() { }
-#endif
 
 #if USE(ACCELERATED_COMPOSITING)
     // This is a hook for WebCore to tell us what we need to do with the GraphicsLayers.
index 1c7f320a2448a0469eb82e9ab645eef927cb52e9..d63651065ab2a564f614740fd0c3cb4b5a35bcaf 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-26  Hajime Morrita  <morrita@chromium.org>
+
+        Move ChromeClient::showContextMenu() to ContextMenuClient
+        https://bugs.webkit.org/show_bug.cgi?id=79427
+
+        Reviewed by Adam Barth.
+
+        * WebCoreSupport/WebChromeClient.h:
+        (WebChromeClient):
+
 2012-02-24  Shinya Kawanaka  <shinyak@chromium.org>
 
         SpellCheckRequest needs to know the context where the spellcheck happened.
index 2a9a8fe7f3d4f453fe4ab1f0edcb9dd39faabc9b..59c242dd6eb4aad91640b7ec2e0ee42bd567215a 100644 (file)
@@ -120,10 +120,6 @@ public:
     virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
     virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*, int64_t totalSpaceNeeded);
 
-#if ENABLE(CONTEXT_MENUS)
-    virtual void showContextMenu() { }
-#endif
-
     virtual void populateVisitedLinks();
 
     virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
index 998f5d165c6c5d1e0d2551350828ed2da574b302..9478cc5a015d527d1824fb0bf51e22a60ef8ec4d 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-26  Hajime Morrita  <morrita@chromium.org>
+
+        Move ChromeClient::showContextMenu() to ContextMenuClient
+        https://bugs.webkit.org/show_bug.cgi?id=79427
+
+        Reviewed by Adam Barth.
+
+        * WebCoreSupport/ChromeClientWinCE.h:
+        (ChromeClientWinCE):
+
 2012-02-24  Shinya Kawanaka  <shinyak@chromium.org>
 
         SpellCheckRequest needs to know the context where the spellcheck happened.
index 613783a033e59aca91d98453600064905c206213..64e2bda3e51987a95c8c59573f92e05425f5d95f 100644 (file)
@@ -131,10 +131,6 @@ public:
     // for this origin.
     virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*, int64_t totalSpaceNeeded);
 
-#if ENABLE(CONTEXT_MENUS)
-    virtual void showContextMenu() { }
-#endif
-
 #if ENABLE(NOTIFICATIONS)
     virtual WebCore::NotificationPresenter* notificationPresenter() const;
 #endif
index 0c6021eaba71feff67aeaa339b8a72b6725f6981..de5aef92c4b7811de8bf9d26c8fbae37c07a9335 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-26  Hajime Morrita  <morrita@chromium.org>
+
+        Move ChromeClient::showContextMenu() to ContextMenuClient
+        https://bugs.webkit.org/show_bug.cgi?id=79427
+
+        Reviewed by Adam Barth.
+
+        * WebKitSupport/ChromeClientWx.h:
+        (ChromeClientWx):
+
 2012-02-24  Shinya Kawanaka  <shinyak@chromium.org>
 
         SpellCheckRequest needs to know the context where the spellcheck happened.
index 2b6cdef612cafcd4f2501345168da3ce70588569..f95871ba6dd868c84038cea36eee4417dfc2ae3e 100644 (file)
@@ -126,11 +126,6 @@ public:
 
     virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
     virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t totalSpaceNeeded);
-
-#if ENABLE(CONTEXT_MENUS)
-    virtual void showContextMenu() { }
-#endif
-
     virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
     virtual void loadIconForFiles(const Vector<String>&, FileIconLoader*);
 
index 0c1cc643ceef3171241dba3261b0b3aa4c3f283c..17c6897ed80c6d668084c1c19825e804cadfd37d 100644 (file)
@@ -1,3 +1,24 @@
+2012-02-26  Hajime Morrita  <morrita@chromium.org>
+
+        Move ChromeClient::showContextMenu() to ContextMenuClient
+        https://bugs.webkit.org/show_bug.cgi?id=79427
+
+        Reviewed by Adam Barth.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        (WebChromeClient):
+        * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
+        (WebKit):
+        (WebKit::WebContextMenuClient::showContextMenu): Moved from WebChromeClient
+        * WebProcess/WebCoreSupport/WebContextMenuClient.h:
+        (WebContextMenuClient):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::handleContextMenuEvent):
+        (WebKit::handleMouseEvent):
+        (WebKit::WebPage::mouseEvent):
+        (WebKit::WebPage::mouseEventSyncForTesting):
+
 2012-02-26  Huang Dongsung  <luxtella@company100.net>
 
         Use Functional instead of a MessageQueue for messages to the LayerTreeHostProxy
index 5a48fff871f9ee8d9293c8bdf5f92e83e0c956b8..0a46eb75b5d21dd41db231ba84d9e647d578fb07 100644 (file)
@@ -30,7 +30,6 @@
 #include "DrawingArea.h"
 #include "InjectedBundleNavigationAction.h"
 #include "InjectedBundleUserMessageCoders.h"
-#include "WebContextMenu.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebFrame.h"
 #include "WebFrameLoaderClient.h"
@@ -670,13 +669,6 @@ PassRefPtr<WebCore::SearchPopupMenu> WebChromeClient::createSearchPopupMenu(WebC
     return WebSearchPopupMenu::create(m_page, client);
 }
 
-#if ENABLE(CONTEXT_MENUS)
-void WebChromeClient::showContextMenu()
-{
-    m_page->contextMenu()->show();
-}
-#endif
-
 #if USE(ACCELERATED_COMPOSITING)
 void WebChromeClient::attachRootGraphicsLayer(Frame*, GraphicsLayer* layer)
 {
index 9761c154a1e9442f23361914cca759d4a93d4261..9807c68c5164ac683eb6013d87ce9f640e19941e 100644 (file)
@@ -174,10 +174,6 @@ private:
     virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const OVERRIDE;
     virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const OVERRIDE;
 
-#if ENABLE(CONTEXT_MENUS)
-    virtual void showContextMenu() OVERRIDE;
-#endif
-
 #if USE(ACCELERATED_COMPOSITING)
     virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) OVERRIDE;
     virtual void setNeedsOneShotDrawingSynchronization() OVERRIDE;
index b2cdbcc3115b87d4435c296b69c18857460194d4..bab9ff1b9cecc65554868f1964d518a360c7d12d 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "WebContextMenuClient.h"
 
+#include "WebContextMenu.h"
 #include "WebContextMenuItemData.h"
 #include "WebPage.h"
 #include <WebCore/ContextMenu.h>
@@ -87,4 +88,11 @@ void WebContextMenuClient::searchWithGoogle(const Frame* frame)
     }
 }
 
+#if USE(ACCESSIBILITY_CONTEXT_MENUS)
+void WebContextMenuClient::showContextMenu()
+{
+    m_page->contextMenu()->show();
+}
+#endif
+
 } // namespace WebKit
index b437245c09fb6cbd365b8a828a66c78c76de06c8..86b0a489890ff9519d394f20e0e2a091a381ad0d 100644 (file)
@@ -59,7 +59,11 @@ private:
 #if PLATFORM(MAC)
     virtual void searchWithSpotlight() OVERRIDE;
 #endif
-    
+
+#if USE(ACCESSIBILITY_CONTEXT_MENUS)
+    void showContextMenu() OVERRIDE;
+#endif
+
     WebPage* m_page;
 };
 
index dad810491b7293b463bd7c2ae2b74fa7f40a82b8..f88e7cdd043f4281d79b4b874bceec162c11c9ec 100644 (file)
@@ -1220,25 +1220,25 @@ static bool isContextClick(const PlatformMouseEvent& event)
     return false;
 }
 
-static bool handleContextMenuEvent(const PlatformMouseEvent& platformMouseEvent, Page* page)
+static bool handleContextMenuEvent(const PlatformMouseEvent& platformMouseEvent, WebPage* page)
 {
-    IntPoint point = page->mainFrame()->view()->windowToContents(platformMouseEvent.position());
-    HitTestResult result = page->mainFrame()->eventHandler()->hitTestResultAtPoint(point, false);
+    IntPoint point = page->corePage()->mainFrame()->view()->windowToContents(platformMouseEvent.position());
+    HitTestResult result = page->corePage()->mainFrame()->eventHandler()->hitTestResultAtPoint(point, false);
 
-    Frame* frame = page->mainFrame();
+    Frame* frame = page->corePage()->mainFrame();
     if (result.innerNonSharedNode())
         frame = result.innerNonSharedNode()->document()->frame();
     
     bool handled = frame->eventHandler()->sendContextMenuEvent(platformMouseEvent);
     if (handled)
-        page->chrome()->showContextMenu();
+        page->contextMenu()->show();
 
     return handled;
 }
 
-static bool handleMouseEvent(const WebMouseEvent& mouseEvent, Page* page, bool onlyUpdateScrollbars)
+static bool handleMouseEvent(const WebMouseEvent& mouseEvent, WebPage* page, bool onlyUpdateScrollbars)
 {
-    Frame* frame = page->mainFrame();
+    Frame* frame = page->corePage()->mainFrame();
     if (!frame->view())
         return false;
 
@@ -1247,7 +1247,7 @@ static bool handleMouseEvent(const WebMouseEvent& mouseEvent, Page* page, bool o
     switch (platformMouseEvent.type()) {
         case PlatformEvent::MousePressed: {
             if (isContextClick(platformMouseEvent))
-                page->contextMenuController()->clearContextMenu();
+                page->corePage()->contextMenuController()->clearContextMenu();
             
             bool handled = frame->eventHandler()->handleMousePressEvent(platformMouseEvent);
             if (isContextClick(platformMouseEvent))
@@ -1291,7 +1291,7 @@ void WebPage::mouseEvent(const WebMouseEvent& mouseEvent)
         // of those cases where the page is not active and the mouse is not pressed, then we can fire a more
         // efficient scrollbars-only version of the event.
         bool onlyUpdateScrollbars = !(m_page->focusController()->isActive() || (mouseEvent.button() != WebMouseEvent::NoButton));
-        handled = handleMouseEvent(mouseEvent, m_page.get(), onlyUpdateScrollbars);
+        handled = handleMouseEvent(mouseEvent, this, onlyUpdateScrollbars);
     }
 
     send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(mouseEvent.type()), handled));
@@ -1316,7 +1316,7 @@ void WebPage::mouseEventSyncForTesting(const WebMouseEvent& mouseEvent, bool& ha
         // of those cases where the page is not active and the mouse is not pressed, then we can fire a more
         // efficient scrollbars-only version of the event.
         bool onlyUpdateScrollbars = !(m_page->focusController()->isActive() || (mouseEvent.button() != WebMouseEvent::NoButton));
-        handled = handleMouseEvent(mouseEvent, m_page.get(), onlyUpdateScrollbars);
+        handled = handleMouseEvent(mouseEvent, this, onlyUpdateScrollbars);
     }
 }