Add support for action menus
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Oct 2014 21:00:15 +0000 (21:00 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Oct 2014 21:00:15 +0000 (21:00 +0000)
commit6bd56fc5dc1d1121acfb87cd6ccc43755e846bb0
treee01aca227ca16a983579648979115eaeb432d87e
parenta47ac9c537405a9d08c0d7aae392b3d8ca3f65a3
Add support for action menus
https://bugs.webkit.org/show_bug.cgi?id=137891
rdar://problem/18451638
rdar://problem/18694470

Reviewed by Anders Carlsson.

Source/WebCore:

New SPI that is needed for this.
* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* platform/spi/mac: Added.
* platform/spi/mac/NSViewSPI.h: Added.

Source/WebKit2:

Temporary artwork needed for menu item.
* Resources/OpenInNewWindowTemplate.pdf: Added.
* WebKit2.xcodeproj/project.pbxproj:

Add a preference that defaults to false for action menu support.
* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetActionMenuSupportEnabled):
(WKPreferencesGetActionMenuSupportEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:

New SPI. WebKit clients can implement this method to customize the action menu.
* UIProcess/API/Cocoa/WKViewPrivate.h:

Create the action menu if it is supported.
* UIProcess/API/mac/WKView.mm:
(-[WKView initWithFrame:context:configuration:webView:]):

Methods to implement the default menu actions.
(-[WKView _openURLFromActionMenu:]):
(-[WKView _addToReadingListFromActionMenu:]):
(-[WKView _quickLookURLFromActionMenu:]):

Add action menus support for links. Populate the menu at the right time.
(-[WKView _defaultMenuItemsForLink]):
(-[WKView _defaultMenuItems]):
(-[WKView prepareForMenu:withEvent:]):
(-[WKView _actionMenuItemsForHitTestResult:defaultActionMenuItems:]):

New member variable caches the HitTestResult on mouse move.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::mouseDidMoveOverElement):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::activeActionMenuHitTestResult):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174908 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/spi/mac/NSViewSPI.h [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/Resources/OpenInNewWindowTemplate.pdf [new file with mode: 0644]
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj