Implement action menu support for videos
https://bugs.webkit.org/show_bug.cgi?id=138534
-and corresponding-
rdar://problem/18742164

Reviewed by Tim Horton.

Source/WebCore:

Export needed symbols and added not-yet-implemented 
HitTestResult::isMediaThatCanBeDownloaded() so that action menus will work as 
expected once it is implemented.
* WebCore.exp.in:
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::isMediaThatCanBeDownloaded):
* rendering/HitTestResult.h:

Source/WebKit2:

New menu type and items types.
* Shared/API/c/WKActionMenuItemTypes.h:
* Shared/API/c/WKActionMenuTypes.h:

Plumb isMediaThatCanBeDownloaded() up to WebHitTestResult.
* Shared/WebHitTestResult.cpp:
(WebKit::WebHitTestResult::Data::Data):
(WebKit::WebHitTestResult::Data::encode):
(WebKit::WebHitTestResult::Data::decode):
* Shared/WebHitTestResult.h:
(WebKit::WebHitTestResult::isMediaThatCanBeDownloaded):

Re-name _canAddImageToPhotos to _canAddMediaToPhotos, which is more accurate. We 
might use this method for videos some day, so now it has an accurate name.
* UIProcess/mac/WKActionMenuController.mm:

Default items and their actions.
(-[WKActionMenuController _defaultMenuItemsForVideo]):
(-[WKActionMenuController _copyVideoURL:]):
(-[WKActionMenuController _saveVideoToDownloads:]):
(-[WKActionMenuController _defaultMenuItemsForImage]):
(-[WKActionMenuController _canAddMediaToPhotos]):
(-[WKActionMenuController _addImageToPhotos:]):
(-[WKActionMenuController _createActionMenuItemForTag:]):
(-[WKActionMenuController _defaultMenuItems:]):
(-[WKActionMenuController _canAddImageToPhotos]): Deleted.

We hit test including shadow content to get the desired result for editable text 
regions. But for media, we want to re-set to the shadow root.
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performActionMenuHitTestAtLocation):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@175779 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WKActionMenuController methods should be more careful to use the best 
WebHitTestResult
https://bugs.webkit.org/show_bug.cgi?id=138536
-and corresponding-
rdar://problem/18919195

Reviewed by Tim Horton.

This patch re-names _hitTestResultForStage to _webHitTestResult. The method no 
longer takes a stage since that value is really not necessary to determine the 
correct WebHitTestResult. This patch also makes all spots in this file that access 
a WebHitTestResult go through _webHitTestResult to ensure that they get the most 
up-to-date option.
* UIProcess/mac/WKActionMenuController.mm:
(-[WKActionMenuController willOpenMenu:withEvent:]):
(-[WKActionMenuController _openURLFromActionMenu:]):
(-[WKActionMenuController _addToReadingListFromActionMenu:]):
(-[WKActionMenuController _previewURLFromActionMenu:]):
(-[WKActionMenuController _defaultMenuItemsForVideo]):
(-[WKActionMenuController _copyVideoURL:]):
(-[WKActionMenuController _saveVideoToDownloads:]):
(-[WKActionMenuController _saveImageToDownloads:]):
(-[WKActionMenuController _defaultMenuItems]):
(-[WKActionMenuController _updateActionMenuItemsForStage:]):
(imageForResource:name::switch): Deleted.
(-[WKActionMenuController _defaultMenuItems:]): Deleted.



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