Changeset 71041 in webkit


Ignore:
Timestamp:
Nov 1, 2010 11:34:04 AM (13 years ago)
Author:
beidson@apple.com
Message:

<rdar://problem/7660547> and https://bugs.webkit.org/show_bug.cgi?id=48699
Context menu support for WebKit 2.

Reviewed by Anders Carlsson.

WebCore:

Add a "showContextMenu" call to Chrome/ChromeClient:

  • loader/EmptyClients.h:

(WebCore::EmptyChromeClient::showContextMenu):

  • page/Chrome.cpp:

(WebCore::Chrome::showContextMenu):

  • page/Chrome.h:
  • page/ChromeClient.h:

Add a "platform description to ContextMenuItem" creator, will be needed by WebKit2

  • platform/ContextMenu.h:
  • platform/mac/ContextMenuMac.mm:

(WebCore::contextMenuItemVector):

  • platform/mac/ContextMenuItemMac.mm:

(WebCore::ContextMenuItem::checked): WebKit2 ports now need this implemented.

Stub these out to keep their WK2 ports building:

  • platform/qt/ContextMenuItemQt.cpp:

(WebCore::ContextMenuItem::checked):

  • platform/qt/ContextMenuQt.cpp:

(WebCore::contextMenuItemVector):

  • platform/win/ContextMenuItemWin.cpp:

(WebCore::ContextMenuItem::checked):

  • platform/win/ContextMenuWin.cpp:

(WebCore::contextMenuItemVector):

WebKit/chromium:

  • src/ChromeClientImpl.h:

(WebKit::ChromeClientImpl::showContextMenu):

WebKit/efl:

  • WebCoreSupport/ChromeClientEfl.h:

(WebCore::ChromeClientEfl::showContextMenu):

WebKit/gtk:

  • WebCoreSupport/ChromeClientGtk.h:

(WebKit::ChromeClient::showContextMenu):

WebKit/haiku:

  • WebCoreSupport/ChromeClientHaiku.h:

(WebCore::ChromeClientHaiku::showContextMenu):

WebKit/mac:

  • WebCoreSupport/WebChromeClient.h:

(WebChromeClient::showContextMenu):

WebKit/qt:

  • WebCoreSupport/ChromeClientQt.h:

(WebCore::ChromeClientQt::showContextMenu):

WebKit/win:

  • WebCoreSupport/WebChromeClient.h:

(WebChromeClient::showContextMenu):

WebKit/wx:

  • WebKitSupport/ChromeClientWx.h:

(WebCore::ChromeClientWx::showContextMenu):

WebKit2:

  • WebKit2.pro:
  • WebKit2.xcodeproj/project.pbxproj:
  • win/WebKit2.vcproj:
  • Shared/WebContextMenuItem.cpp: Added.

(WebKit::WebContextMenuItem::WebContextMenuItem):
(WebKit::WebContextMenuItem::encode):
(WebKit::WebContextMenuItem::decode):
(WebKit::kitItems):

  • Shared/WebContextMenuItem.h: Added.
  • UIProcess/API/mac/PageClientImpl.h:
  • UIProcess/API/mac/PageClientImpl.mm:

(WebKit::PageClientImpl::createContextMenuProxy):

  • UIProcess/API/qt/qwkpage.cpp:

(QWKPagePrivate::createContextMenuProxy): Stub to keep the build working.

  • UIProcess/API/qt/qwkpage_p.h:
  • UIProcess/PageClient.h:
  • UIProcess/WebContextMenuProxy.cpp: Added.

(WebKit::WebContextMenuProxy::~WebContextMenuProxy):
(WebKit::WebContextMenuProxy::WebContextMenuProxy):

  • UIProcess/WebContextMenuProxy.h: Added.
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::showContextMenu): Shows the menu after receiving the message from the WebProcess.
(WebKit::WebPageProxy::contextMenuItemSelected): Sends info about the selected menu item to the WebProcess

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:
  • UIProcess/mac/WebContextMenuProxyMac.h: Added.

(WebKit::WebContextMenuProxyMac::create):

  • UIProcess/mac/WebContextMenuProxyMac.mm: Added.

(+[WebMenuTarget sharedMenuTarget]):
(-[WebMenuTarget WebKit::]):
(-[WebMenuTarget setMenuProxy:WebKit::]):
(-[WebMenuTarget forwardContextMenuAction:]):
(WebKit::WebContextMenuProxyMac::WebContextMenuProxyMac):
(WebKit::WebContextMenuProxyMac::~WebContextMenuProxyMac):
(WebKit::WebContextMenuProxyMac::contextMenuItemSelected):
(WebKit::populateNSMenu):
(WebKit::nsMenuItemVector):
(WebKit::WebContextMenuProxyMac::populate):
(WebKit::WebContextMenuProxyMac::showContextMenu):
(WebKit::WebContextMenuProxyMac::hideContextMenu):

  • UIProcess/win/WebView.cpp:

(WebKit::WebView::createContextMenuProxy): Stub for now.

  • UIProcess/win/WebView.h:
  • WebProcess/WebCoreSupport/WebChromeClient.cpp:

(WebKit::WebChromeClient::showContextMenu):

  • WebProcess/WebCoreSupport/WebChromeClient.h:
  • WebProcess/WebCoreSupport/WebContextMenuClient.cpp:

(WebKit::WebContextMenuClient::getCustomMenuFromDefaultItems): Return the WebCore-provided default

menu for now. Embedding app customization will come later (see bug 48720)

  • WebProcess/WebPage/WebContextMenu.cpp: Added.

(WebKit::WebContextMenu::WebContextMenu):
(WebKit::WebContextMenu::~WebContextMenu):
(WebKit::WebContextMenu::show):
(WebKit::WebContextMenu::itemSelected):

  • WebProcess/WebPage/WebContextMenu.h: Added.

(WebKit::WebContextMenu::create):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::contextMenu):
(WebKit::handleMouseEvent): Pass right mouse presses along to WebCore as both a mouse event and context menu event,

the same way WebKit1 does.

(WebKit::WebPage::didSelectItemFromActiveContextMenu):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:
Location:
trunk
Files:
8 added
50 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r71039 r71041  
     12010-11-01  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        <rdar://problem/7660547> and https://bugs.webkit.org/show_bug.cgi?id=48699
     6        Context menu support for WebKit 2.
     7
     8        Add a "showContextMenu" call to Chrome/ChromeClient:
     9        * loader/EmptyClients.h:
     10        (WebCore::EmptyChromeClient::showContextMenu):
     11        * page/Chrome.cpp:
     12        (WebCore::Chrome::showContextMenu):
     13        * page/Chrome.h:
     14        * page/ChromeClient.h:
     15
     16        Add a "platform description to ContextMenuItem" creator, will be needed by WebKit2
     17        * platform/ContextMenu.h:
     18        * platform/mac/ContextMenuMac.mm:
     19        (WebCore::contextMenuItemVector):
     20
     21        * platform/mac/ContextMenuItemMac.mm:
     22        (WebCore::ContextMenuItem::checked): WebKit2 ports now need this implemented.
     23
     24        Stub these out to keep their WK2 ports building:
     25        * platform/qt/ContextMenuItemQt.cpp:
     26        (WebCore::ContextMenuItem::checked):
     27        * platform/qt/ContextMenuQt.cpp:
     28        (WebCore::contextMenuItemVector):
     29        * platform/win/ContextMenuItemWin.cpp:
     30        (WebCore::ContextMenuItem::checked):
     31        * platform/win/ContextMenuWin.cpp:
     32        (WebCore::contextMenuItemVector):
     33
    1342010-11-01  Eric Carlson  <eric.carlson@apple.com>
    235
  • trunk/WebCore/WebCore.exp.in

    r70960 r71041  
    12261226__ZN7WebCore11ContextMenu22setPlatformDescriptionEP14NSMutableArray
    12271227__ZN7WebCore12EventHandler20sendContextMenuEventEP7NSEvent
     1228__ZN7WebCore12EventHandler20sendContextMenuEventERKNS_18PlatformMouseEventE
    12281229__ZN7WebCore15ContextMenuItem26releasePlatformDescriptionEv
     1230__ZN7WebCore15ContextMenuItemC1ENS_19ContextMenuItemTypeENS_17ContextMenuActionERKN3WTF6StringEPNS_11ContextMenuE
     1231__ZN7WebCore15ContextMenuItemD1Ev
    12291232__ZN7WebCore21ContextMenuController16clearContextMenuEv
     1233__ZN7WebCore21ContextMenuController23contextMenuItemSelectedEPNS_15ContextMenuItemE
     1234__ZN7WebCore21contextMenuItemVectorEP14NSMutableArray
     1235__ZN7WebCore6Chrome15showContextMenuEv
    12301236__ZNK7WebCore11ContextMenu19platformDescriptionEv
     1237__ZNK7WebCore11ContextMenu21checkOrEnableIfNeededERNS_15ContextMenuItemE
     1238__ZNK7WebCore15ContextMenuItem15platformSubMenuEv
     1239__ZNK7WebCore15ContextMenuItem4typeEv
     1240__ZNK7WebCore15ContextMenuItem5titleEv
     1241__ZNK7WebCore15ContextMenuItem6actionEv
     1242__ZNK7WebCore15ContextMenuItem7checkedEv
     1243__ZNK7WebCore15ContextMenuItem7enabledEv
    12311244#endif
    12321245
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r71035 r71041  
    2129921299                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
    2130021300                        compatibilityVersion = "Xcode 2.4";
     21301                        developmentRegion = English;
    2130121302                        hasScannedForEncodings = 1;
    2130221303                        knownRegions = (
  • trunk/WebCore/loader/EmptyClients.h

    r70894 r71041  
    140140    virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const { return adoptRef(new EmptySearchPopupMenu()); }
    141141
     142#if ENABLE(CONTEXT_MENUS)
     143    virtual void showContextMenu() { }
     144#endif
     145
    142146    virtual void setStatusbarText(const String&) { }
    143147
  • trunk/WebCore/page/Chrome.cpp

    r70333 r71041  
    503503}
    504504
     505#if ENABLE(CONTEXT_MENUS)
     506void Chrome::showContextMenu()
     507{
     508    m_client->showContextMenu();
     509}
     510#endif
     511
    505512} // namespace WebCore
  • trunk/WebCore/page/Chrome.h

    r70333 r71041  
    156156        PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const;
    157157
     158#if ENABLE(CONTEXT_MENUS)
     159        void showContextMenu();
     160#endif
     161
    158162    private:
    159163        Page* m_page;
  • trunk/WebCore/page/ChromeClient.h

    r70333 r71041  
    270270        virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const = 0;
    271271
     272#if ENABLE(CONTEXT_MENUS)
     273        virtual void showContextMenu() = 0;
     274#endif
     275
    272276        virtual void postAccessibilityNotification(AccessibilityObject*, AXObjectCache::AXNotification) { }
    273277
  • trunk/WebCore/platform/ContextMenu.h

    r60454 r71041  
    9292    };
    9393
     94Vector<ContextMenuItem> contextMenuItemVector(PlatformMenuDescription);
     95
    9496}
    9597
  • trunk/WebCore/platform/mac/ContextMenuItemMac.mm

    r48429 r71041  
    155155}
    156156
     157bool ContextMenuItem::checked() const
     158{
     159    return [m_platformDescription.get() state] == NSOnState;
     160}
     161
    157162} // namespace WebCore
    158163
  • trunk/WebCore/platform/mac/ContextMenuMac.mm

    r48429 r71041  
    154154}
    155155
     156Vector<ContextMenuItem> contextMenuItemVector(PlatformMenuDescription menu)
     157{
     158    Vector<ContextMenuItem> items;
     159    unsigned count = [menu count];
     160    if (menu)
     161        items.reserveCapacity(count);
     162   
     163    for (unsigned i = 0; i < count; ++i)
     164        items.append(ContextMenuItem([menu objectAtIndex:i]));
     165   
     166    return items;
     167}
     168
    156169} // namespace WebCore
    157170
  • trunk/WebCore/platform/qt/ContextMenuItemQt.cpp

    r60751 r71041  
    105105}
    106106
     107bool ContextMenuItem::checked() const
     108{
     109    // FIXME - Implement
     110    return false;
     111}
     112
    107113void ContextMenuItem::setEnabled(bool on)
    108114{
  • trunk/WebCore/platform/qt/ContextMenuQt.cpp

    r60750 r71041  
    7575}
    7676
     77Vector<ContextMenuItem> contextMenuItemVector(PlatformMenuDescription)
     78{
     79    // FIXME - Implement   
     80    return Vector<ContextMenuItem>();
     81}
    7782
    7883}
  • trunk/WebCore/platform/win/ContextMenuItemWin.cpp

    r70812 r71041  
    185185}
    186186
     187bool ContextMenuItem::checked() const
     188{
     189    // FIXME - Implement
     190    return false;
     191}
     192
    187193void ContextMenuItem::setEnabled(bool enabled)
    188194{
  • trunk/WebCore/platform/win/ContextMenuWin.cpp

    r56825 r71041  
    156156}
    157157
     158Vector<ContextMenuItem> contextMenuItemVector(PlatformMenuDescription)
     159{
     160    // FIXME - Implement   
     161    return Vector<ContextMenuItem>();
    158162}
     163
     164}
  • trunk/WebKit/chromium/ChangeLog

    r71040 r71041  
     12010-11-01  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        <rdar://problem/7660547> and https://bugs.webkit.org/show_bug.cgi?id=48699
     6        Context menu support for WebKit 2.
     7
     8        * src/ChromeClientImpl.h:
     9        (WebKit::ChromeClientImpl::showContextMenu):
     10
    1112010-11-01  Pavel Feldman  <pfeldman@chromium.org>
    212
  • trunk/WebKit/chromium/src/ChromeClientImpl.h

    r70333 r71041  
    175175    virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
    176176
     177#if ENABLE(CONTEXT_MENUS)
     178    virtual void showContextMenu() { }
     179#endif
     180
    177181private:
    178182    void getPopupMenuInfo(WebCore::PopupContainer*, WebPopupMenuInfo*);
  • trunk/WebKit/efl/ChangeLog

    r70976 r71041  
     12010-11-01  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        <rdar://problem/7660547> and https://bugs.webkit.org/show_bug.cgi?id=48699
     6        Context menu support for WebKit 2.
     7
     8        * WebCoreSupport/ChromeClientEfl.h:
     9        (WebCore::ChromeClientEfl::showContextMenu):
     10
    1112010-10-29  Daniel Bates  <dbates@rim.com>
    212
  • trunk/WebKit/efl/WebCoreSupport/ChromeClientEfl.h

    r70333 r71041  
    116116#endif
    117117
     118#if ENABLE(CONTEXT_MENUS)
     119    virtual void showContextMenu() { }
     120#endif
     121
    118122    virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
    119123    virtual void chooseIconForFiles(const Vector<String>&, FileChooser*);
  • trunk/WebKit/gtk/ChangeLog

    r71031 r71041  
     12010-11-01  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        <rdar://problem/7660547> and https://bugs.webkit.org/show_bug.cgi?id=48699
     6        Context menu support for WebKit 2.
     7
     8        * WebCoreSupport/ChromeClientGtk.h:
     9        (WebKit::ChromeClient::showContextMenu):
     10
    1112010-11-01  Martin Robinson  <mrobinson@igalia.com>
    212
  • trunk/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h

    r70333 r71041  
    118118        virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*);
    119119#endif
     120#if ENABLE(CONTEXT_MENUS)
     121        virtual void showContextMenu() { }
     122#endif
    120123        virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
    121124        virtual void chooseIconForFiles(const Vector<WTF::String>&, WebCore::FileChooser*);
  • trunk/WebKit/haiku/ChangeLog

    r70894 r71041  
     12010-11-01  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        <rdar://problem/7660547> and https://bugs.webkit.org/show_bug.cgi?id=48699
     6        Context menu support for WebKit 2.
     7
     8        * WebCoreSupport/ChromeClientHaiku.h:
     9        (WebCore::ChromeClientHaiku::showContextMenu):
     10
    1112010-10-29  Alexey Proskuryakov  <ap@apple.com>
    212
  • trunk/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h

    r70333 r71041  
    138138        virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*);
    139139#endif
     140#if ENABLE(CONTEXT_MENUS)
     141        virtual void showContextMenu() { }
     142#endif
    140143
    141144        // This is an asynchronous call. The ChromeClient can display UI asking the user for permission
  • trunk/WebKit/mac/ChangeLog

    r70976 r71041  
     12010-11-01  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        <rdar://problem/7660547> and https://bugs.webkit.org/show_bug.cgi?id=48699
     6        Context menu support for WebKit 2.
     7
     8        * WebCoreSupport/WebChromeClient.h:
     9        (WebChromeClient::showContextMenu):
     10
    1112010-10-29  Daniel Bates  <dbates@rim.com>
    212
  • trunk/WebKit/mac/WebCoreSupport/WebChromeClient.h

    r70333 r71041  
    179179    virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
    180180
     181#if ENABLE(CONTEXT_MENUS)
     182    virtual void showContextMenu() { }
     183#endif
    181184private:
    182185    WebView *m_webView;
  • trunk/WebKit/qt/ChangeLog

    r71004 r71041  
     12010-11-01  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        <rdar://problem/7660547> and https://bugs.webkit.org/show_bug.cgi?id=48699
     6        Context menu support for WebKit 2.
     7
     8        * WebCoreSupport/ChromeClientQt.h:
     9        (WebCore::ChromeClientQt::showContextMenu):
     10
    1112010-10-31  Robert Hogan  <robert@webkit.org>
    212
  • trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.h

    r70333 r71041  
    135135        virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*);
    136136#endif
     137#if ENABLE(CONTEXT_MENUS)
     138    virtual void showContextMenu() { }
     139#endif
    137140
    138141#if ENABLE(NOTIFICATIONS)
  • trunk/WebKit/win/ChangeLog

    r71032 r71041  
     12010-11-01  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        <rdar://problem/7660547> and https://bugs.webkit.org/show_bug.cgi?id=48699
     6        Context menu support for WebKit 2.
     7
     8        * WebCoreSupport/WebChromeClient.h:
     9        (WebChromeClient::showContextMenu):
     10
    1112010-11-01  Adam Roben  <aroben@apple.com>
    212
  • trunk/WebKit/win/WebCoreSupport/WebChromeClient.h

    r70341 r71041  
    123123#endif
    124124
     125#if ENABLE(CONTEXT_MENUS)
     126    virtual void showContextMenu() { }
     127#endif
     128
    125129    virtual void populateVisitedLinks();
    126130
  • trunk/WebKit/wx/ChangeLog

    r70931 r71041  
     12010-11-01  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        <rdar://problem/7660547> and https://bugs.webkit.org/show_bug.cgi?id=48699
     6        Context menu support for WebKit 2.
     7
     8        * WebKitSupport/ChromeClientWx.h:
     9        (WebCore::ChromeClientWx::showContextMenu):
     10
    1112010-10-29  Darin Adler  <darin@apple.com>
    212
  • trunk/WebKit/wx/WebKitSupport/ChromeClientWx.h

    r70333 r71041  
    130130#endif
    131131
     132#if ENABLE(CONTEXT_MENUS)
     133    virtual void showContextMenu() { }
     134#endif
     135
    132136    virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
    133137    virtual void chooseIconForFiles(const Vector<String>&, FileChooser*);
  • trunk/WebKit2/ChangeLog

    r71033 r71041  
     12010-11-01  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        <rdar://problem/7660547> and https://bugs.webkit.org/show_bug.cgi?id=48699
     6        Context menu support for WebKit 2.
     7
     8        * WebKit2.pro:
     9        * WebKit2.xcodeproj/project.pbxproj:
     10        * win/WebKit2.vcproj:
     11
     12        * Shared/WebContextMenuItem.cpp: Added.
     13        (WebKit::WebContextMenuItem::WebContextMenuItem):
     14        (WebKit::WebContextMenuItem::encode):
     15        (WebKit::WebContextMenuItem::decode):
     16        (WebKit::kitItems):
     17        * Shared/WebContextMenuItem.h: Added.
     18
     19        * UIProcess/API/mac/PageClientImpl.h:
     20        * UIProcess/API/mac/PageClientImpl.mm:
     21        (WebKit::PageClientImpl::createContextMenuProxy):
     22        * UIProcess/API/qt/qwkpage.cpp:
     23        (QWKPagePrivate::createContextMenuProxy): Stub to keep the build working.
     24        * UIProcess/API/qt/qwkpage_p.h:
     25        * UIProcess/PageClient.h:
     26
     27        * UIProcess/WebContextMenuProxy.cpp: Added.
     28        (WebKit::WebContextMenuProxy::~WebContextMenuProxy):
     29        (WebKit::WebContextMenuProxy::WebContextMenuProxy):
     30        * UIProcess/WebContextMenuProxy.h: Added.
     31
     32        * UIProcess/WebPageProxy.cpp:
     33        (WebKit::WebPageProxy::showContextMenu): Shows the menu after receiving the message from the WebProcess.
     34        (WebKit::WebPageProxy::contextMenuItemSelected): Sends info about the selected menu item to the WebProcess
     35        * UIProcess/WebPageProxy.h:
     36        * UIProcess/WebPageProxy.messages.in:
     37
     38        * UIProcess/mac/WebContextMenuProxyMac.h: Added.
     39        (WebKit::WebContextMenuProxyMac::create):
     40        * UIProcess/mac/WebContextMenuProxyMac.mm: Added.
     41        (+[WebMenuTarget sharedMenuTarget]):
     42        (-[WebMenuTarget WebKit::]):
     43        (-[WebMenuTarget setMenuProxy:WebKit::]):
     44        (-[WebMenuTarget forwardContextMenuAction:]):
     45        (WebKit::WebContextMenuProxyMac::WebContextMenuProxyMac):
     46        (WebKit::WebContextMenuProxyMac::~WebContextMenuProxyMac):
     47        (WebKit::WebContextMenuProxyMac::contextMenuItemSelected):
     48        (WebKit::populateNSMenu):
     49        (WebKit::nsMenuItemVector):
     50        (WebKit::WebContextMenuProxyMac::populate):
     51        (WebKit::WebContextMenuProxyMac::showContextMenu):
     52        (WebKit::WebContextMenuProxyMac::hideContextMenu):
     53
     54        * UIProcess/win/WebView.cpp:
     55        (WebKit::WebView::createContextMenuProxy): Stub for now.
     56        * UIProcess/win/WebView.h:
     57
     58        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     59        (WebKit::WebChromeClient::showContextMenu):
     60        * WebProcess/WebCoreSupport/WebChromeClient.h:
     61
     62        * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
     63        (WebKit::WebContextMenuClient::getCustomMenuFromDefaultItems): Return the WebCore-provided default
     64          menu for now. Embedding app customization will come later (see bug 48720)
     65
     66        * WebProcess/WebPage/WebContextMenu.cpp: Added.
     67        (WebKit::WebContextMenu::WebContextMenu):
     68        (WebKit::WebContextMenu::~WebContextMenu):
     69        (WebKit::WebContextMenu::show):
     70        (WebKit::WebContextMenu::itemSelected):
     71        * WebProcess/WebPage/WebContextMenu.h: Added.
     72        (WebKit::WebContextMenu::create):
     73
     74        * WebProcess/WebPage/WebPage.cpp:
     75        (WebKit::WebPage::contextMenu):
     76        (WebKit::handleMouseEvent): Pass right mouse presses along to WebCore as both a mouse event and context menu event,
     77          the same way WebKit1 does.
     78        (WebKit::WebPage::didSelectItemFromActiveContextMenu):
     79        * WebProcess/WebPage/WebPage.h:
     80        * WebProcess/WebPage/WebPage.messages.in:
     81
    1822010-11-01  Adam Roben  <aroben@apple.com>
    283
  • trunk/WebKit2/UIProcess/API/mac/PageClientImpl.h

    r70730 r71041  
    6767
    6868    virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy();
     69    virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
    6970
    7071    void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut);
  • trunk/WebKit2/UIProcess/API/mac/PageClientImpl.mm

    r70738 r71041  
    3131#import "WKStringCF.h"
    3232#import "WKViewInternal.h"
     33#import "WebContextMenuProxyMac.h"
    3334#import "WebEditCommandProxy.h"
    3435#import "WebPopupMenuProxyMac.h"
     
    246247}
    247248
     249PassRefPtr<WebContextMenuProxy> PageClientImpl::createContextMenuProxy(WebPageProxy* page)
     250{
     251    return WebContextMenuProxyMac::create(m_wkView, page);
     252}
     253
    248254void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut)
    249255{
  • trunk/WebKit2/UIProcess/API/qt/qwkpage.cpp

    r71029 r71041  
    3131#include "NativeWebKeyboardEvent.h"
    3232#include "WebContext.h"
     33#include "WebContextMenuProxy.h"
    3334#include "WebEventFactoryQt.h"
    3435#include "WebPlatformStrategies.h"
     
    133134{
    134135    return WebPopupMenuProxyQt::create();
     136}
     137
     138PassRefPtr<WebContextMenuProxy> QWKPagePrivate::createContextMenuProxy(WebPageProxy*)
     139{
     140    // FIXME: Implement;
     141    return 0;
    135142}
    136143
  • trunk/WebKit2/UIProcess/API/qt/qwkpage_p.h

    r70734 r71041  
    6262    virtual void didNotHandleKeyEvent(const WebKit::NativeWebKeyboardEvent&);
    6363    virtual PassRefPtr<WebKit::WebPopupMenuProxy> createPopupMenuProxy();
     64    virtual PassRefPtr<WebKit::WebContextMenuProxy> createContextMenuProxy(WebKit::WebPageProxy*);
    6465
    6566    virtual void setFindIndicator(PassRefPtr<WebKit::FindIndicator>, bool fadeOut);
  • trunk/WebKit2/UIProcess/PageClient.h

    r70730 r71041  
    4040class FindIndicator;
    4141class NativeWebKeyboardEvent;
     42class NativeWebKeyboardEvent;
     43class WebContextMenuProxy;
    4244class WebEditCommandProxy;
    43 class NativeWebKeyboardEvent;
    4445class WebPopupMenuProxy;
    4546
     
    7374
    7475    virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy() = 0;
     76    virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) = 0;
    7577
    7678    virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut) = 0;
  • trunk/WebKit2/UIProcess/WebPageProxy.cpp

    r70894 r71041  
    3737#include "WebCertificateInfo.h"
    3838#include "WebContext.h"
     39#include "WebContextMenuProxy.h"
    3940#include "WebContextUserMessageCoders.h"
    4041#include "WebCoreArgumentCoders.h"
     
    11251126}
    11261127
     1128void WebPageProxy::showContextMenu(const WebCore::IntPoint& menuLocation, const Vector<WebContextMenuItem>& items)
     1129{
     1130    if (m_activeContextMenu)
     1131        m_activeContextMenu->hideContextMenu();
     1132    else
     1133        m_activeContextMenu = m_pageClient->createContextMenuProxy(this);
     1134     
     1135    m_activeContextMenu->showContextMenu(menuLocation, items);
     1136}
     1137
     1138void WebPageProxy::contextMenuItemSelected(const WebContextMenuItem& item)
     1139{
     1140    process()->send(Messages::WebPage::DidSelectItemFromActiveContextMenu(item), m_pageID);
     1141}
     1142
    11271143void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo)
    11281144{
  • trunk/WebKit2/UIProcess/WebPageProxy.h

    r70894 r71041  
    3333#include "SharedMemory.h"
    3434#include "WKBase.h"
     35#include "WebContextMenuItem.h"
    3536#include "WebEvent.h"
    3637#include "WebFindClient.h"
     
    7879class WebBackForwardList;
    7980class WebBackForwardListItem;
     81class WebContextMenuProxy;
    8082class WebData;
    8183class WebEditCommandProxy;
     
    231233
    232234    void getStatistics(WKContextStatistics*);
     235
     236    void contextMenuItemSelected(const WebContextMenuItem&);
    233237
    234238private:
     
    322326    void hidePopupMenu();
    323327
     328    // Context Menu.
     329    void showContextMenu(const WebCore::IntPoint&, const Vector<WebContextMenuItem>& items);
     330
    324331    void takeFocus(bool direction);
    325332    void setToolTip(const String&);
     
    362369
    363370    RefPtr<WebPopupMenuProxy> m_activePopupMenu;
     371    RefPtr<WebContextMenuProxy> m_activeContextMenu;
    364372
    365373    double m_estimatedProgress;
  • trunk/WebKit2/UIProcess/WebPageProxy.messages.in

    r70894 r71041  
    119119    ShowPopupMenu(WebCore::IntRect rect, Vector<WebKit::WebPopupItem> items, int32_t selectedIndex)
    120120    HidePopupMenu()
     121   
     122    # ContextMenu
     123    ShowContextMenu(WebCore::IntPoint point, Vector<WebKit::WebContextMenuItem> items)
    121124
    122125#if USE(ACCELERATED_COMPOSITING)
  • trunk/WebKit2/UIProcess/win/WebView.cpp

    r70885 r71041  
    626626}
    627627
     628PassRefPtr<WebContextMenuProxy> WebView::createContextMenuProxy(WebPageProxy*)
     629{
     630    // FIXME: Implement.
     631    return 0;
     632}
     633
    628634void WebView::setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut)
    629635{
  • trunk/WebKit2/UIProcess/win/WebView.h

    r70362 r71041  
    106106    virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&);
    107107    virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy();
     108    virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
    108109    virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut);
    109110
  • trunk/WebKit2/WebKit2.pro

    r70960 r71041  
    215215    Shared/VisitedLinkTable.h \
    216216    Shared/WebCertificateInfo.h \
     217    Shared/WebContextMenuItem.h \
    217218    Shared/WebEvent.h \
    218219    Shared/WebError.h \
     
    265266    UIProcess/WebContext.h \
    266267    UIProcess/WebContextInjectedBundleClient.h \
     268    UIProcess/WebContextMenuProxy.h \
    267269    UIProcess/WebContextUserMessageCoders.h \
    268270    UIProcess/WebEditCommandProxy.h \
     
    330332    WebProcess/WebPage/FindPageOverlay.h \
    331333    WebProcess/WebPage/PageOverlay.h \
     334    WebProcess/WebPage/WebContextMenu.h \
    332335    WebProcess/WebPage/WebEditCommand.h \
    333336    WebProcess/WebPage/WebFrame.h \
     
    377380    Shared/qt/WebURLResponseQt.cpp \
    378381    Shared/VisitedLinkTable.cpp \
     382    Shared/WebContextMenuItem.cpp \
    379383    Shared/WebError.cpp \
    380384    Shared/WebEvent.cpp \
     
    422426    UIProcess/WebBackForwardListItem.cpp \
    423427    UIProcess/WebContext.cpp \
     428    UIProcess/WebContextMenuProxy.cpp \
    424429    UIProcess/WebContextInjectedBundleClient.cpp \
    425430    UIProcess/WebEditCommandProxy.cpp \
     
    493498    WebProcess/WebPage/FindPageOverlay.cpp \
    494499    WebProcess/WebPage/PageOverlay.cpp \
     500    WebProcess/WebPage/WebContextMenu.cpp \
    495501    WebProcess/WebPage/WebEditCommand.cpp \
    496502    WebProcess/WebPage/WebFrame.cpp \
  • trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r70960 r71041  
    165165                51578B831209ECEF00A37C4A /* WebData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51578B821209ECEF00A37C4A /* WebData.h */; };
    166166                516A4A5D120A2CCD00C05B7F /* WebError.h in Headers */ = {isa = PBXBuildFile; fileRef = 516A4A5B120A2CCD00C05B7F /* WebError.h */; };
     167                51871B5B127CB89D00F76232 /* WebContextMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51871B59127CB89D00F76232 /* WebContextMenu.cpp */; };
     168                51871B5C127CB89D00F76232 /* WebContextMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 51871B5A127CB89D00F76232 /* WebContextMenu.h */; };
    167169                51A7F2F3125BF820008AEB1D /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A7F2F2125BF820008AEB1D /* Logging.h */; };
    168170                51A7F2F5125BF8D4008AEB1D /* Logging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A7F2F4125BF8D4008AEB1D /* Logging.cpp */; };
     171                51A84CE3127F386B00CA6EA4 /* WebContextMenuProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A84CE2127F386B00CA6EA4 /* WebContextMenuProxy.cpp */; };
     172                51ACBA151279E8C300D203B9 /* WebContextMenuItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51ACBA131279E8C300D203B9 /* WebContextMenuItem.cpp */; };
     173                51ACBA161279E8C300D203B9 /* WebContextMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 51ACBA141279E8C300D203B9 /* WebContextMenuItem.h */; };
     174                51ACBB82127A8BAD00D203B9 /* WebContextMenuProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 51ACBB81127A8BAD00D203B9 /* WebContextMenuProxy.h */; };
     175                51ACBBA0127A8F2C00D203B9 /* WebContextMenuProxyMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 51ACBB9E127A8F2C00D203B9 /* WebContextMenuProxyMac.h */; };
     176                51ACBBA1127A8F2C00D203B9 /* WebContextMenuProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51ACBB9F127A8F2C00D203B9 /* WebContextMenuProxyMac.mm */; };
    169177                51B3005012529D0E000B5CA0 /* WebBackForwardListCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */; };
    170178                51B3005112529D0E000B5CA0 /* WebPageProxyCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */; };
     
    671679                51578B821209ECEF00A37C4A /* WebData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebData.h; sourceTree = "<group>"; };
    672680                516A4A5B120A2CCD00C05B7F /* WebError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebError.h; sourceTree = "<group>"; };
     681                51871B59127CB89D00F76232 /* WebContextMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenu.cpp; sourceTree = "<group>"; };
     682                51871B5A127CB89D00F76232 /* WebContextMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenu.h; sourceTree = "<group>"; };
    673683                51A7F2F2125BF820008AEB1D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Logging.h; sourceTree = "<group>"; };
    674684                51A7F2F4125BF8D4008AEB1D /* Logging.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Logging.cpp; sourceTree = "<group>"; };
     685                51A84CE2127F386B00CA6EA4 /* WebContextMenuProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenuProxy.cpp; sourceTree = "<group>"; };
     686                51ACBA131279E8C300D203B9 /* WebContextMenuItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenuItem.cpp; sourceTree = "<group>"; };
     687                51ACBA141279E8C300D203B9 /* WebContextMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuItem.h; sourceTree = "<group>"; };
     688                51ACBB81127A8BAD00D203B9 /* WebContextMenuProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuProxy.h; sourceTree = "<group>"; };
     689                51ACBB9E127A8F2C00D203B9 /* WebContextMenuProxyMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuProxyMac.h; sourceTree = "<group>"; };
     690                51ACBB9F127A8F2C00D203B9 /* WebContextMenuProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMenuProxyMac.mm; sourceTree = "<group>"; };
    675691                51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebBackForwardListCF.cpp; path = cf/WebBackForwardListCF.cpp; sourceTree = "<group>"; };
    676692                51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPageProxyCF.cpp; path = cf/WebPageProxyCF.cpp; sourceTree = "<group>"; };
     
    12751291                                C02BFF1512514FD8009CCBEA /* NativeWebKeyboardEvent.h */,
    12761292                                BCC57161115ADB42001CCAF9 /* NotImplemented.h */,
     1293                                BCBD3C3A125BFA7A00D2C29F /* StringPairVector.h */,
    12771294                                BCB0B0DF12305AB100B1341E /* UserMessageCoders.h */,
    12781295                                1A0F29C9120B37160053D1B9 /* VisitedLinkTable.cpp */,
     
    12801297                                BC1DD7B1114DC396005ADAF3 /* WebCoreArgumentCoders.h */,
    12811298                                BCF50726124329AA005955AE /* WebCertificateInfo.h */,
    1282                                 BCBD3C3A125BFA7A00D2C29F /* StringPairVector.h */,
     1299                                51ACBA131279E8C300D203B9 /* WebContextMenuItem.cpp */,
     1300                                51ACBA141279E8C300D203B9 /* WebContextMenuItem.h */,
    12831301                                51578B821209ECEF00A37C4A /* WebData.h */,
    12841302                                BC575612126E0138006F0F12 /* WebError.cpp */,
     
    14521470                        isa = PBXGroup;
    14531471                        children = (
     1472                                51871B59127CB89D00F76232 /* WebContextMenu.cpp */,
     1473                                51871B5A127CB89D00F76232 /* WebContextMenu.h */,
    14541474                                BC963D6C113DD19500574BE2 /* mac */,
    14551475                                BC5F7BB21182376C0052C02C /* ChunkedUpdateDrawingArea.cpp */,
     
    15091529                                BCB9E2421120DACA00A137E0 /* WebContext.cpp */,
    15101530                                BCB9E2411120DACA00A137E0 /* WebContext.h */,
     1531                                51A84CE2127F386B00CA6EA4 /* WebContextMenuProxy.cpp */,
     1532                                51ACBB81127A8BAD00D203B9 /* WebContextMenuProxy.h */,
    15111533                                BCDE059A11CDA8AE00E41AF1 /* WebContextInjectedBundleClient.cpp */,
    15121534                                BCDE059911CDA8AE00E41AF1 /* WebContextInjectedBundleClient.h */,
     
    18621884                                0F5265BB11DD37860006D33C /* LayerBackedDrawingAreaProxyMac.mm */,
    18631885                                1A1C648611F415B700553C19 /* WebContextMac.mm */,
     1886                                51ACBB9E127A8F2C00D203B9 /* WebContextMenuProxyMac.h */,
     1887                                51ACBB9F127A8F2C00D203B9 /* WebContextMenuProxyMac.mm */,
    18641888                                BC5750951268F3C6006F0F12 /* WebPopupMenuProxyMac.h */,
    18651889                                BC5750961268F3C6006F0F12 /* WebPopupMenuProxyMac.mm */,
     
    22122236                                1A616150127798B5003ACD86 /* DownloadManager.h in Headers */,
    22132237                                1A6161D41278981C003ACD86 /* Download.h in Headers */,
     2238                                51ACBA161279E8C300D203B9 /* WebContextMenuItem.h in Headers */,
     2239                                51ACBB82127A8BAD00D203B9 /* WebContextMenuProxy.h in Headers */,
     2240                                51ACBBA0127A8F2C00D203B9 /* WebContextMenuProxyMac.h in Headers */,
    22142241                                1A119A95127B796200A9ECB1 /* MessageSender.h in Headers */,
     2242                                51871B5C127CB89D00F76232 /* WebContextMenu.h in Headers */,
    22152243                        );
    22162244                        runOnlyForDeploymentPostprocessing = 0;
     
    25352563                                1A6161D51278981C003ACD86 /* Download.cpp in Sources */,
    25362564                                1A61639612789B2F003ACD86 /* DownloadMac.mm in Sources */,
     2565                                51ACBA151279E8C300D203B9 /* WebContextMenuItem.cpp in Sources */,
     2566                                51ACBBA1127A8F2C00D203B9 /* WebContextMenuProxyMac.mm in Sources */,
    25372567                                C0337DAE127A24FE008FF4F4 /* WebEvent.cpp in Sources */,
    25382568                                C0337DB0127A28D0008FF4F4 /* WebMouseEvent.cpp in Sources */,
     
    25412571                                C0337DD8127A51B6008FF4F4 /* WebTouchEvent.cpp in Sources */,
    25422572                                C0337DDD127A521C008FF4F4 /* WebPlatformTouchPoint.cpp in Sources */,
     2573                                51871B5B127CB89D00F76232 /* WebContextMenu.cpp in Sources */,
     2574                                51A84CE3127F386B00CA6EA4 /* WebContextMenuProxy.cpp in Sources */,
    25432575                        );
    25442576                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r70936 r71041  
    3232#include "DrawingArea.h"
    3333#include "InjectedBundleUserMessageCoders.h"
     34#include "WebContextMenu.h"
    3435#include "WebCoreArgumentCoders.h"
    3536#include "WebFrame.h"
     
    526527}
    527528
     529#if ENABLE(CONTEXT_MENUS)
     530void WebChromeClient::showContextMenu()
     531{
     532    m_page->contextMenu()->show();
     533}
     534#endif
     535
    528536PassOwnPtr<HTMLParserQuirks> WebChromeClient::createHTMLParserQuirks()
    529537{
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h

    r70333 r71041  
    171171    virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
    172172
     173#if ENABLE(CONTEXT_MENUS)
     174    virtual void showContextMenu();
     175#endif
     176
    173177#if USE(ACCELERATED_COMPOSITING)
    174178    virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*);
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp

    r62866 r71041  
    2626#include "WebContextMenuClient.h"
    2727
     28#include <WebCore/ContextMenu.h>
     29
    2830#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
    2931#include "NotImplemented.h"
     
    3840}
    3941
    40 PlatformMenuDescription WebContextMenuClient::getCustomMenuFromDefaultItems(ContextMenu*)
     42PlatformMenuDescription WebContextMenuClient::getCustomMenuFromDefaultItems(ContextMenu* menu)
    4143{
    42     notImplemented();
    43     return 0;
     44    // FIXME:  The embedded app needs a chance to customize the context menu, and that will probably happen
     45    // via an injected bundle. <rdar://problem/8613727> and https://bugs.webkit.org/show_bug.cgi?id=48720 cover this task.
     46
     47    ASSERT(menu);
     48    return menu->platformDescription();
    4449}
    4550
  • trunk/WebKit2/WebProcess/WebPage/WebPage.cpp

    r70960 r71041  
    3939#include "WebBackForwardListProxy.h"
    4040#include "WebChromeClient.h"
     41#include "WebContextMenu.h"
    4142#include "WebContextMenuClient.h"
    4243#include "WebCoreArgumentCoders.h"
     
    5455#include "WebProcess.h"
    5556#include "WebProcessProxyMessageKinds.h"
     57#include <WebCore/Chrome.h>
     58#include <WebCore/ContextMenuController.h>
    5659#include <WebCore/EventHandler.h>
    5760#include <WebCore/FocusController.h>
     
    481484}
    482485
     486WebContextMenu* WebPage::contextMenu()
     487{
     488    if (!m_contextMenu)
     489        m_contextMenu = WebContextMenu::create(this);
     490    return m_contextMenu.get();
     491}
     492
    483493// Events
    484494
     
    520530    switch (platformMouseEvent.eventType()) {
    521531        case WebCore::MouseEventPressed:
    522             return frame->eventHandler()->handleMousePressEvent(platformMouseEvent);
     532        {
     533            if (platformMouseEvent.button() == WebCore::RightButton)
     534                page->contextMenuController()->clearContextMenu();
     535           
     536            bool handled = frame->eventHandler()->handleMousePressEvent(platformMouseEvent);
     537           
     538            if (platformMouseEvent.button() == WebCore::RightButton) {
     539                handled = frame->eventHandler()->sendContextMenuEvent(platformMouseEvent);
     540                if (handled)
     541                    page->chrome()->showContextMenu();
     542            }
     543
     544            return handled;
     545        }
    523546        case WebCore::MouseEventReleased:
    524547            return frame->eventHandler()->handleMouseReleaseEvent(platformMouseEvent);
     
    884907}
    885908
     909void WebPage::didSelectItemFromActiveContextMenu(const WebContextMenuItem& item)
     910{
     911    ASSERT(m_contextMenu);
     912    m_contextMenu->itemSelected(item);
     913    m_contextMenu = 0;
     914}
     915
    886916#if PLATFORM(MAC)
    887917void WebPage::addPluginView(PluginView* pluginView)
  • trunk/WebKit2/WebProcess/WebPage/WebPage.h

    r70934 r71041  
    6969class PageOverlay;
    7070class PluginView;
     71class WebContextMenu;
     72class WebContextMenuItem;
    7173class WebEvent;
    7274class WebFrame;
     
    187189
    188190    void pageDidScroll();
     191   
     192    WebContextMenu* contextMenu();
    189193
    190194private:
     
    253257    void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
    254258
     259#if ENABLE(CONTEXT_MENUS)
     260    void didSelectItemFromActiveContextMenu(const WebContextMenuItem&);
     261#endif
     262
    255263    OwnPtr<WebCore::Page> m_page;
    256264    RefPtr<WebFrame> m_mainFrame;
     
    295303    RefPtr<WebPopupMenu> m_activePopupMenu;
    296304
     305    RefPtr<WebContextMenu> m_contextMenu;
     306
    297307    uint64_t m_pageID;
    298308};
  • trunk/WebKit2/WebProcess/WebPage/WebPage.messages.in

    r70716 r71041  
    7979    # Popup menu.
    8080    DidChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
     81   
     82    # Context menu.
     83    DidSelectItemFromActiveContextMenu(WebKit::WebContextMenuItem menuItem);
    8184
    8285    SetWindowResizerSize(WebCore::IntSize intersectsView)
  • trunk/WebKit2/win/WebKit2.vcproj

    r70960 r71041  
    490490                        </File>
    491491                        <File
     492                                RelativePath="..\Shared\WebContextMenuItem.cpp"
     493                                >
     494                        </File>
     495                        <File
     496                                RelativePath="..\Shared\WebContextMenuItem.h"
     497                                >
     498                        </File>
     499                        <File
    492500                                RelativePath="..\Shared\WebCoreArgumentCoders.h"
    493501                                >
     
    11891197                                </File>
    11901198                                <File
     1199                                        RelativePath="..\WebProcess\WebPage\WebContextMenu.cpp"
     1200                                        >
     1201                                </File>
     1202                                <File
     1203                                        RelativePath="..\WebProcess\WebPage\WebContextMenu.h"
     1204                                        >
     1205                                </File>
     1206                                <File
    11911207                                        RelativePath="..\WebProcess\WebPage\WebEditCommand.cpp"
    11921208                                        >
     
    16831699                        <File
    16841700                                RelativePath="..\UIProcess\WebContextInjectedBundleClient.h"
     1701                                >
     1702                        </File>
     1703                        <File
     1704                                RelativePath="..\UIProcess\WebContextMenuProxy.cpp"
     1705                                >
     1706                        </File>
     1707                        <File
     1708                                RelativePath="..\UIProcess\WebContextMenuProxy.h"
    16851709                                >
    16861710                        </File>
Note: See TracChangeset for help on using the changeset viewer.