Remove action menu support
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 May 2015 18:43:42 +0000 (18:43 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 May 2015 18:43:42 +0000 (18:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145305
<rdar://problem/21070771>

Reviewed by Anders Carlsson.

* WebCore.xcodeproj/project.pbxproj:
* platform/spi/mac/NSMenuSPI.h:
* platform/spi/mac/NSViewSPI.h: Removed.
Remove some SPI.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/action-menu-target.pdf: Removed.
* TestWebKitAPI/Tests/WebKit2/action-menu-targets.html: Removed.
* TestWebKitAPI/Tests/WebKit2ObjC/ActionMenus.mm: Removed.
* TestWebKitAPI/Tests/WebKit2ObjC/ActionMenusBundle.mm: Removed.
* TestWebKitAPI/Tests/WebKit2ObjC/ActionMenusBundleSPI.h: Removed.
Remove the tests.

* WebKit.xcodeproj/project.pbxproj:
Remove some files.

* Configurations/WebKitLegacy.xcconfig:
* WebView/WebActionMenuController.h: Removed.
* WebView/WebActionMenuController.mm: Removed.
* WebView/WebHTMLView.mm:
(-[WebHTMLView otherMouseDown:]):
(-[WebHTMLView scrollWheel:scrollWheel:]): Deleted.
(-[WebHTMLView mouseDown:mouseDown:]): Deleted.
* WebView/WebUIDelegatePrivate.h:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]): Deleted.
(-[WebView _close]): Deleted.
(-[WebView prepareForMenu:withEvent:]): Deleted.
(-[WebView willOpenMenu:withEvent:]): Deleted.
(-[WebView didCloseMenu:withEvent:]): Deleted.
(-[WebView _actionMenuController]): Deleted.
* WebView/WebViewData.h:
* WebView/WebViewData.mm:
(-[WebViewPrivate dealloc]): Deleted.
* WebView/WebViewInternal.h:
Remove everything, except some enums that clients still refer to.

* Configurations/WebKit.xcconfig:
* Shared/API/c/WKActionMenuItemTypes.h:
* Shared/API/c/WKActionMenuTypes.h:
* UIProcess/API/Cocoa/WKViewPrivate.h:
* UIProcess/API/mac/WKView.mm:
(-[WKView _didPerformImmediateActionHitTest:contentPreventsDefault:userData:]):
(-[WKView dealloc]): Deleted.
(-[WKView mouseDown:]): Deleted.
(-[WKView initWithFrame:processPool:configuration:webView:]): Deleted.
(-[WKView prepareForMenu:withEvent:]): Deleted.
(-[WKView willOpenMenu:withEvent:]): Deleted.
(-[WKView didCloseMenu:withEvent:]): Deleted.
(-[WKView _didPerformActionMenuHitTest:forImmediateAction:contentPreventsDefault:userData:]): Deleted.
(-[WKView _actionMenuItemsForHitTestResult:withType:defaultActionMenuItems:]): Deleted.
(-[WKView _actionMenuItemsForHitTestResult:withType:defaultActionMenuItems:userData:]): Deleted.
* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::performImmediateActionHitTestAtLocation):
(WebKit::WebPageProxy::didPerformImmediateActionHitTest):
(WebKit::WebPageProxy::performActionMenuHitTestAtLocation): Deleted.
(WebKit::WebPageProxy::selectLastActionMenuRange): Deleted.
(WebKit::WebPageProxy::focusAndSelectLastActionMenuHitTestResult): Deleted.
(WebKit::WebPageProxy::didPerformActionMenuHitTest): Deleted.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::didPerformImmediateActionHitTest):
(WebKit::PageClientImpl::didPerformActionMenuHitTest): Deleted.
* UIProcess/mac/WKActionMenuController.h: Removed.
* UIProcess/mac/WKActionMenuController.mm: Removed.
* UIProcess/mac/WKImmediateActionController.h:
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController didPerformImmediateActionHitTest:contentPreventsDefault:userData:]):
(-[WKImmediateActionController immediateActionRecognizerWillPrepare:]):
(-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
(-[WKImmediateActionController didPerformActionMenuHitTest:contentPreventsDefault:userData:]): Deleted.
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/API/APIInjectedBundlePageContextMenuClient.h:
(API::InjectedBundle::PageContextMenuClient::prepareForImmediateAction):
(API::InjectedBundle::PageContextMenuClient::prepareForActionMenu): Deleted.
* WebProcess/InjectedBundle/API/c/WKBundlePageContextMenuClient.h:
* WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
* WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h:
* WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp:
(WebKit::InjectedBundlePageContextMenuClient::prepareForImmediateAction):
(WebKit::InjectedBundlePageContextMenuClient::prepareForActionMenu): Deleted.
* WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/WebPageOverlay.cpp:
(WebKit::WebPageOverlay::actionContextForResultAtPoint):
* WebProcess/WebPage/WebPageOverlay.h:
(WebKit::WebPageOverlay::Client::actionContextForResultAtPoint):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::textIndicatorTransitionForImmediateAction):
(WebKit::WebPage::performImmediateActionHitTestAtLocation):
(WebKit::textIndicatorTransitionForActionMenu): Deleted.
(WebKit::WebPage::performActionMenuHitTestAtLocation): Deleted.
(WebKit::WebPage::selectLastActionMenuRange): Deleted.
(WebKit::WebPage::focusAndSelectLastActionMenuHitTestResult): Deleted.
Remove everything, except some enums that clients still refer to.
Also, leave SPI that used to be shared between immediate actions and
action menus intact, even if it had "action menu" in the name. We can
deprecate and rename in another patch... except for the very recently-added
support from r184106, which we'll revert entirely, removing WKBundlePageOverlayV2,
which was not adopted by any clients.

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

54 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/spi/mac/NSMenuSPI.h
Source/WebCore/platform/spi/mac/NSViewSPI.h [deleted file]
Source/WebKit/ChangeLog
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Configurations/WebKitLegacy.xcconfig
Source/WebKit/mac/WebView/WebActionMenuController.h [deleted file]
Source/WebKit/mac/WebView/WebActionMenuController.mm [deleted file]
Source/WebKit/mac/WebView/WebHTMLView.mm
Source/WebKit/mac/WebView/WebUIDelegatePrivate.h
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/mac/WebView/WebViewData.h
Source/WebKit/mac/WebView/WebViewData.mm
Source/WebKit/mac/WebView/WebViewInternal.h
Source/WebKit2/ChangeLog
Source/WebKit2/Configurations/WebKit.xcconfig
Source/WebKit2/Shared/API/c/WKActionMenuItemTypes.h
Source/WebKit2/Shared/API/c/WKActionMenuTypes.h
Source/WebKit2/Shared/WebHitTestResult.cpp
Source/WebKit2/Shared/WebHitTestResult.h
Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
Source/WebKit2/UIProcess/PageClient.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/mac/PageClientImpl.h
Source/WebKit2/UIProcess/mac/PageClientImpl.mm
Source/WebKit2/UIProcess/mac/WKActionMenuController.h [deleted file]
Source/WebKit2/UIProcess/mac/WKActionMenuController.mm [deleted file]
Source/WebKit2/UIProcess/mac/WKImmediateActionController.h
Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/InjectedBundle/API/APIInjectedBundlePageContextMenuClient.h
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageContextMenuClient.h
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
Source/WebKit2/WebProcess/WebPage/WebPageOverlay.cpp
Source/WebKit2/WebProcess/WebPage/WebPageOverlay.h
Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2/action-menu-target.pdf [deleted file]
Tools/TestWebKitAPI/Tests/WebKit2/action-menu-targets.html [deleted file]
Tools/TestWebKitAPI/Tests/WebKit2ObjC/ActionMenus.mm [deleted file]
Tools/TestWebKitAPI/Tests/WebKit2ObjC/ActionMenusBundle.mm [deleted file]
Tools/TestWebKitAPI/Tests/WebKit2ObjC/ActionMenusBundleSPI.h [deleted file]

index 9f9afb2..ab5648d 100644 (file)
@@ -1,3 +1,16 @@
+2015-05-22  Tim Horton  <timothy_horton@apple.com>
+
+        Remove action menu support
+        https://bugs.webkit.org/show_bug.cgi?id=145305
+        <rdar://problem/21070771>
+
+        Reviewed by Anders Carlsson.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/spi/mac/NSMenuSPI.h:
+        * platform/spi/mac/NSViewSPI.h: Removed.
+        Remove some SPI.
+
 2015-05-22  Antti Koivisto  <antti@apple.com>
 
         MaskImageOperation code does not manage CachedImageClients correctly
index 138a461..37e477c 100644 (file)
                9343CB8212F25E510033C5EE /* TextCodecUTF8.h in Headers */ = {isa = PBXBuildFile; fileRef = 9343CB8012F25E510033C5EE /* TextCodecUTF8.h */; };
                93442C9E0D2B335C00338FF9 /* HTMLTableRowsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 93442C9D0D2B335C00338FF9 /* HTMLTableRowsCollection.h */; };
                93442CA00D2B336000338FF9 /* HTMLTableRowsCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93442C9F0D2B336000338FF9 /* HTMLTableRowsCollection.cpp */; };
-               9348428219F1A9190009D5AE /* NSViewSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 9348428119F1A9190009D5AE /* NSViewSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
                934907E4125BBBC8007F23A0 /* GraphicsContextCG.h in Headers */ = {isa = PBXBuildFile; fileRef = 934907E3125BBBC8007F23A0 /* GraphicsContextCG.h */; settings = {ATTRIBUTES = (Private, ); }; };
                934CC10A0EDB223900A658F2 /* ScriptSourceCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 934CC1090EDB223900A658F2 /* ScriptSourceCode.h */; };
                934D9BA50B8C116B007B42A9 /* WebCoreNSStringExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = 934D9BA40B8C116B007B42A9 /* WebCoreNSStringExtras.mm */; };
                9343CB8012F25E510033C5EE /* TextCodecUTF8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCodecUTF8.h; sourceTree = "<group>"; };
                93442C9D0D2B335C00338FF9 /* HTMLTableRowsCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLTableRowsCollection.h; sourceTree = "<group>"; };
                93442C9F0D2B336000338FF9 /* HTMLTableRowsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLTableRowsCollection.cpp; sourceTree = "<group>"; };
-               9348428119F1A9190009D5AE /* NSViewSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSViewSPI.h; sourceTree = "<group>"; };
                934907E3125BBBC8007F23A0 /* GraphicsContextCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContextCG.h; sourceTree = "<group>"; };
                934CC1090EDB223900A658F2 /* ScriptSourceCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptSourceCode.h; sourceTree = "<group>"; };
                934D9BA40B8C116B007B42A9 /* WebCoreNSStringExtras.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreNSStringExtras.mm; sourceTree = "<group>"; };
                                93F1E1EB1A40FDDC00348D13 /* NSPopoverSPI.h */,
                                2DCB837719F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h */,
                                2DCB837819F99BBA00A7FBE4 /* NSSharingServiceSPI.h */,
-                               9348428119F1A9190009D5AE /* NSViewSPI.h */,
                                937F4CCB1A2D48C100BB39F5 /* QuickLookMacSPI.h */,
                                2D232BFF1A326EF9006BF2DB /* TUCallSPI.h */,
                        );
                                CE1252531A1BEC0600864480 /* NSStringSPI.h in Headers */,
                                CE1252551A1BEC0E00864480 /* NSURLDownloadSPI.h in Headers */,
                                658F540319A1C9240088FC92 /* NSURLFileTypeMappingsSPI.h in Headers */,
-                               9348428219F1A9190009D5AE /* NSViewSPI.h in Headers */,
                                F55B3DC81251F12D003EF269 /* NumberInputType.h in Headers */,
                                1A569D120D7E2B82007C3983 /* objc_class.h in Headers */,
                                1A569D140D7E2B82007C3983 /* objc_header.h in Headers */,
index 1c6cad9..0db7c91 100644 (file)
@@ -28,7 +28,6 @@
 typedef NS_ENUM(NSInteger, NSMenuType) {
     NSMenuTypeNone = 0,
     NSMenuTypeContextMenu,
-    NSMenuTypeActionMenu,
 };
 
 @interface NSMenu (Private)
diff --git a/Source/WebCore/platform/spi/mac/NSViewSPI.h b/Source/WebCore/platform/spi/mac/NSViewSPI.h
deleted file mode 100644 (file)
index 17ecc4f..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-// FIXME: This should include private headers when possible.
-
-#import <AppKit/NSView.h>
-
-@interface NSView (Private)
-@property (strong, setter=_setActionMenu:) NSMenu *_actionMenu;
-@end
index 3f3add8..e77316a 100644 (file)
@@ -1,3 +1,14 @@
+2015-05-22  Tim Horton  <timothy_horton@apple.com>
+
+        Remove action menu support
+        https://bugs.webkit.org/show_bug.cgi?id=145305
+        <rdar://problem/21070771>
+
+        Reviewed by Anders Carlsson.
+
+        * WebKit.xcodeproj/project.pbxproj:
+        Remove some files.
+
 2015-05-18  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         [CMake] Ignore warnings in system headers
index 9378150..9fe4e81 100644 (file)
                934C11670D8710BB00C32ABD /* WebDynamicScrollBarsViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 934C11660D8710BB00C32ABD /* WebDynamicScrollBarsViewInternal.h */; };
                934C4A910F01406C009372C0 /* WebNSObjectExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = 934C4A900F01406C009372C0 /* WebNSObjectExtras.mm */; };
                934C4AA00F0141F7009372C0 /* WebResourceInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 934C4A9F0F0141F7009372C0 /* WebResourceInternal.h */; };
-               935D44E419F9AFF000FB5306 /* WebActionMenuController.h in Headers */ = {isa = PBXBuildFile; fileRef = 935D44E219F9AFF000FB5306 /* WebActionMenuController.h */; };
-               935D44E519F9AFF000FB5306 /* WebActionMenuController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 935D44E319F9AFF000FB5306 /* WebActionMenuController.mm */; };
                936A2DE80FD2D08000D312DB /* WebTextCompletionController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 936A2DE70FD2D08000D312DB /* WebTextCompletionController.mm */; };
                936A2DEA0FD2D08400D312DB /* WebTextCompletionController.h in Headers */ = {isa = PBXBuildFile; fileRef = 936A2DE90FD2D08400D312DB /* WebTextCompletionController.h */; };
                9391F275121B38BD00EBF7E8 /* WebFrameNetworkingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 9391F273121B38BD00EBF7E8 /* WebFrameNetworkingContext.h */; };
                934C11660D8710BB00C32ABD /* WebDynamicScrollBarsViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDynamicScrollBarsViewInternal.h; sourceTree = "<group>"; };
                934C4A900F01406C009372C0 /* WebNSObjectExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNSObjectExtras.mm; sourceTree = "<group>"; };
                934C4A9F0F0141F7009372C0 /* WebResourceInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebResourceInternal.h; sourceTree = "<group>"; };
-               935D44E219F9AFF000FB5306 /* WebActionMenuController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebActionMenuController.h; sourceTree = "<group>"; };
-               935D44E319F9AFF000FB5306 /* WebActionMenuController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebActionMenuController.mm; sourceTree = "<group>"; };
                936A2DE70FD2D08000D312DB /* WebTextCompletionController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebTextCompletionController.mm; sourceTree = "<group>"; };
                936A2DE90FD2D08400D312DB /* WebTextCompletionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebTextCompletionController.h; sourceTree = "<group>"; };
                9391F273121B38BD00EBF7E8 /* WebFrameNetworkingContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameNetworkingContext.h; sourceTree = "<group>"; };
                                51E94C0706C02CA300A9B09E /* PDF */,
                                A10C1D79182030190036883A /* ios */,
                                2DF064A81A2DD53C00DBB354 /* DictionaryPopupInfo.h */,
-                               935D44E219F9AFF000FB5306 /* WebActionMenuController.h */,
-                               935D44E319F9AFF000FB5306 /* WebActionMenuController.mm */,
                                8373435A0624EE0D00F3B289 /* WebArchive.h */,
                                8373435B0624EE0D00F3B289 /* WebArchive.mm */,
                                44BB8B131241A022001E3A22 /* WebArchiveInternal.h */,
                                9398104B0824BF01008DF038 /* WebDataSource.h in Headers */,
                                658A40960A14853B005E6987 /* WebDataSourceInternal.h in Headers */,
                                9398104C0824BF01008DF038 /* WebDataSourcePrivate.h in Headers */,
-                               935D44E419F9AFF000FB5306 /* WebActionMenuController.h in Headers */,
                                9398104E0824BF01008DF038 /* WebDefaultContextMenuDelegate.h in Headers */,
                                9398108D0824BF01008DF038 /* WebDefaultEditingDelegate.h in Headers */,
                                9398104F0824BF01008DF038 /* WebDefaultPolicyDelegate.h in Headers */,
                                A5687BDB135B791A0074CBCB /* WebNodeHighlighter.mm in Sources */,
                                1C68F672095B5FC100C2984E /* WebNodeHighlightView.mm in Sources */,
                                A10C1D611820300E0036883A /* SearchPopupMenuIOS.cpp in Sources */,
-                               935D44E519F9AFF000FB5306 /* WebActionMenuController.mm in Sources */,
                                A10C1D6C1820300E0036883A /* WebFrameIOS.mm in Sources */,
                                312E2FE614E48182007CCA18 /* WebNotification.mm in Sources */,
                                31C11A6F1476552E0049A4CC /* WebNotificationClient.mm in Sources */,
index 6673b3e..d35d4ce 100644 (file)
@@ -1,3 +1,32 @@
+2015-05-22  Tim Horton  <timothy_horton@apple.com>
+
+        Remove action menu support
+        https://bugs.webkit.org/show_bug.cgi?id=145305
+        <rdar://problem/21070771>
+
+        Reviewed by Anders Carlsson.
+
+        * Configurations/WebKitLegacy.xcconfig:
+        * WebView/WebActionMenuController.h: Removed.
+        * WebView/WebActionMenuController.mm: Removed.
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView otherMouseDown:]):
+        (-[WebHTMLView scrollWheel:scrollWheel:]): Deleted.
+        (-[WebHTMLView mouseDown:mouseDown:]): Deleted.
+        * WebView/WebUIDelegatePrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]): Deleted.
+        (-[WebView _close]): Deleted.
+        (-[WebView prepareForMenu:withEvent:]): Deleted.
+        (-[WebView willOpenMenu:withEvent:]): Deleted.
+        (-[WebView didCloseMenu:withEvent:]): Deleted.
+        (-[WebView _actionMenuController]): Deleted.
+        * WebView/WebViewData.h:
+        * WebView/WebViewData.mm:
+        (-[WebViewPrivate dealloc]): Deleted.
+        * WebView/WebViewInternal.h:
+        Remove everything, except some enums that clients still refer to.
+
 2015-05-22  Brady Eidson  <beidson@apple.com>
 
         Rework how the ResourceRequest user initiated property key is used.
index 9f435ca..5e485b8 100644 (file)
@@ -24,7 +24,7 @@
 #include "FeatureDefines.xcconfig"
 #include "Version.xcconfig"
 
-EXCLUDED_SOURCE_FILE_NAMES[sdk=iphone*] = *.defs *.nib *.pdf *.tiff CarbonUtils.m CarbonWindowAdapter.mm CarbonWindowContentView.m CarbonWindowFrame.m HIViewAdapter.m HIWebView.mm OutlookQuirksUserScript.js PopupMenuMac.mm SearchPopupMenuMac.mm WebActionMenuController.* WebClipView.* WebDashboardRegion.* WebDynamicScrollBarsView.* WebIconDatabase.* WebIconDatabasePrivate.* WebInspectorClient.mm WebJavaScriptTextInputPanel.* WebKeyGenerator.* WebNetscapeContainerCheckContextInfo.* WebNetscapeContainerCheckPrivate.* WebNSEventExtras.* WebNSPasteboardExtras.* WebNSWindowExtras.* WebPanelAuthenticationHandler.* WebPluginsPrivate.* WebStringTruncator.* WebTextCompletionController.*;
+EXCLUDED_SOURCE_FILE_NAMES[sdk=iphone*] = *.defs *.nib *.pdf *.tiff CarbonUtils.m CarbonWindowAdapter.mm CarbonWindowContentView.m CarbonWindowFrame.m HIViewAdapter.m HIWebView.mm OutlookQuirksUserScript.js PopupMenuMac.mm SearchPopupMenuMac.mm WebClipView.* WebDashboardRegion.* WebDynamicScrollBarsView.* WebIconDatabase.* WebIconDatabasePrivate.* WebInspectorClient.mm WebJavaScriptTextInputPanel.* WebKeyGenerator.* WebNetscapeContainerCheckContextInfo.* WebNetscapeContainerCheckPrivate.* WebNSEventExtras.* WebNSPasteboardExtras.* WebNSWindowExtras.* WebPanelAuthenticationHandler.* WebPluginsPrivate.* WebStringTruncator.* WebTextCompletionController.*;
 EXCLUDED_SOURCE_FILE_NAMES[sdk=macosx*] = *IOS.mm MemoryMeasure.h WebCaretChangeListener.h WebFixedPositionContent.h WebFrameIOS.h WebFrameIPhone.h WebGeolocationCoreLocationProvider.h WebGeolocationPrivate.h WebGeolocationProviderIOS.h WebMIMETypeRegistry.h WebNSStringExtrasIOS.h WebNSStringExtrasIPhone.h WebPDFViewIOS.h WebPDFViewIPhone.h WebPDFViewPlaceholder.h WebSelectionRect.h WebUIKitDelegate.h WebUIKitSupport.h WebVisiblePosition.h;
 
 EXPORTED_SYMBOLS_FILE = $(EXPORTED_SYMBOLS_FILE_$(CURRENT_ARCH));
diff --git a/Source/WebKit/mac/WebView/WebActionMenuController.h b/Source/WebKit/mac/WebView/WebActionMenuController.h
deleted file mode 100644 (file)
index d486981..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-
-#import "WebUIDelegatePrivate.h"
-#import <AppKit/NSSharingService.h>
-#import <WebCore/HitTestResult.h>
-#import <wtf/RetainPtr.h>
-
-@class DDActionContext;
-@class WebView;
-
-namespace WebCore {
-class Range;
-class TextIndicator;
-}
-
-@interface WebActionMenuController : NSObject <NSSharingServiceDelegate, NSSharingServicePickerDelegate> {
-@private
-    WebView *_webView;
-    WebActionMenuType _type;
-    WebCore::HitTestResult _hitTestResult;
-    RetainPtr<NSSharingServicePicker> _sharingServicePicker;
-    RetainPtr<DDActionContext> _currentActionContext;
-    RefPtr<WebCore::Range> _currentDetectedDataRange;
-    BOOL _isShowingTextIndicator;
-    RefPtr<WebCore::TextIndicator> _currentDetectedDataTextIndicator;
-    BOOL _hasActivatedActionContext;
-}
-
-- (id)initWithWebView:(WebView *)webView;
-- (void)webViewClosed;
-- (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
-- (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
-- (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
-
-- (void)webView:(WebView *)webView willHandleMouseDown:(NSEvent *)event;
-- (void)webView:(WebView *)webView didHandleScrollWheel:(NSEvent *)event;
-
-@end
-
-#endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
diff --git a/Source/WebKit/mac/WebView/WebActionMenuController.mm b/Source/WebKit/mac/WebView/WebActionMenuController.mm
deleted file mode 100644 (file)
index 11d0755..0000000
+++ /dev/null
@@ -1,842 +0,0 @@
-/*
- * Copyright (C) 2014-2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "WebActionMenuController.h"
-
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-
-#import "DOMElementInternal.h"
-#import "DOMNodeInternal.h"
-#import "DOMRangeInternal.h"
-#import "WebDataSource.h"
-#import "WebDocumentInternal.h"
-#import "WebElementDictionary.h"
-#import "WebFrameInternal.h"
-#import "WebHTMLView.h"
-#import "WebHTMLViewInternal.h"
-#import "WebPDFView.h"
-#import "WebSystemInterface.h"
-#import "WebUIDelegatePrivate.h"
-#import "WebViewInternal.h"
-#import <ImageIO/ImageIO.h>
-#import <ImageKit/ImageKit.h>
-#import <WebCore/ArchiveResource.h>
-#import <WebCore/DataDetection.h>
-#import <WebCore/DataDetectorsSPI.h>
-#import <WebCore/DictionaryLookup.h>
-#import <WebCore/DocumentLoader.h>
-#import <WebCore/Editor.h>
-#import <WebCore/Element.h>
-#import <WebCore/EventHandler.h>
-#import <WebCore/FocusController.h>
-#import <WebCore/Frame.h>
-#import <WebCore/FrameView.h>
-#import <WebCore/HTMLConverter.h>
-#import <WebCore/LocalizedStrings.h>
-#import <WebCore/NSMenuSPI.h>
-#import <WebCore/NSSharingServicePickerSPI.h>
-#import <WebCore/NSSharingServiceSPI.h>
-#import <WebCore/NSViewSPI.h>
-#import <WebCore/Page.h>
-#import <WebCore/QuickLookMacSPI.h>
-#import <WebCore/Range.h>
-#import <WebCore/RenderElement.h>
-#import <WebCore/RenderObject.h>
-#import <WebCore/SharedBuffer.h>
-#import <WebCore/SoftLinking.h>
-#import <WebCore/TextCheckerClient.h>
-#import <WebCore/TextIndicator.h>
-#import <WebKitSystemInterface.h>
-#import <objc/objc-class.h>
-#import <objc/objc.h>
-
-SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, ImageKit)
-SOFT_LINK_CLASS(ImageKit, IKSlideshow)
-
-using namespace WebCore;
-
-@implementation WebActionMenuController
-
-- (id)initWithWebView:(WebView *)webView
-{
-    if (!(self = [super init]))
-        return nil;
-
-    _webView = webView;
-    _type = WebActionMenuNone;
-
-    return self;
-}
-
-- (void)webViewClosed
-{
-    _webView = nil;
-}
-
-- (WebElementDictionary *)performHitTestAtPoint:(NSPoint)windowPoint
-{
-    NSView<WebDocumentView> *documentView = [[[_webView _selectedOrMainFrame] frameView] documentView];
-    if (![documentView isKindOfClass:[WebHTMLView class]])
-        return nil;
-        
-    Frame* coreFrame = core([(WebHTMLView *)documentView _frame]);
-    if (!coreFrame)
-        return nil;
-
-    NSPoint point = [documentView convertPoint:windowPoint fromView:nil];
-    _hitTestResult = coreFrame->eventHandler().hitTestResultAtPoint(IntPoint(point));
-
-    return [[[WebElementDictionary alloc] initWithHitTestResult:_hitTestResult] autorelease];
-}
-
-- (void)webView:(WebView *)webView willHandleMouseDown:(NSEvent *)event
-{
-    if (_currentActionContext && _hasActivatedActionContext) {
-        [getDDActionsManagerClass() didUseActions];
-        _hasActivatedActionContext = NO;
-    }
-}
-
-- (void)webView:(WebView *)webView didHandleScrollWheel:(NSEvent *)event
-{
-    [self _dismissActionMenuPopovers];
-    [self _hideTextIndicatorWithAnimation:TextIndicatorDismissalAnimation::None];
-}
-
-- (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event
-{
-    if (!_webView)
-        return;
-
-    NSMenu *actionMenu = _webView._actionMenu;
-    if (menu != actionMenu)
-        return;
-
-    [self _dismissActionMenuPopovers];
-    [self _hideTextIndicatorWithAnimation:TextIndicatorDismissalAnimation::FadeOut];
-    [actionMenu removeAllItems];
-
-    WebElementDictionary *hitTestResult = [self performHitTestAtPoint:event.locationInWindow];
-    NSArray *menuItems = [self _defaultMenuItems];
-
-    // Allow clients to customize the menu items.
-    if ([[_webView UIDelegate] respondsToSelector:@selector(_webView:actionMenuItemsForHitTestResult:withType:defaultActionMenuItems:)])
-        menuItems = [(id)[_webView UIDelegate] _webView:_webView actionMenuItemsForHitTestResult:hitTestResult withType:_type defaultActionMenuItems:menuItems];
-
-    for (NSMenuItem *item in menuItems)
-        [actionMenu addItem:item];
-
-    if (_currentActionContext) {
-        _hasActivatedActionContext = YES;
-        if (![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()]) {
-            [menu cancelTracking];
-            [menu removeAllItems];
-        }
-    }
-}
-
-- (BOOL)isMenuForTextContent
-{
-    return _type == WebActionMenuReadOnlyText || _type == WebActionMenuEditableText || _type == WebActionMenuEditableTextWithSuggestions;
-}
-
-- (void)focusAndSelectHitTestResult
-{
-    if (!_hitTestResult.isContentEditable())
-        return;
-
-    Element* element = _hitTestResult.innerElement();
-    if (!element)
-        return;
-
-    Frame* frame = element->document().frame();
-    if (!frame)
-        return;
-
-    frame->page()->focusController().setFocusedElement(element, frame);
-    VisiblePosition position = frame->visiblePositionForPoint(_hitTestResult.roundedPointInInnerNodeFrame());
-    frame->selection().setSelection(position);
-}
-
-- (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event
-{
-    if (menu != _webView._actionMenu)
-        return;
-
-    if (!menu.numberOfItems)
-        return;
-
-    if (_type == WebActionMenuDataDetectedItem) {
-        if (menu.numberOfItems == 1)
-            [[_webView _selectedOrMainFrame] _clearSelection];
-        else
-            [self _selectDataDetectedText];
-        return;
-    }
-
-    if (_type == WebActionMenuWhitespaceInEditableArea) {
-        [self focusAndSelectHitTestResult];
-        return;
-    }
-
-    if (![self isMenuForTextContent]) {
-        [[_webView _selectedOrMainFrame] _clearSelection];
-        return;
-    }
-
-    // Action menus for text should highlight the text so that it is clear what the action menu actions
-    // will apply to. If the text is already selected, the menu will use the existing selection.
-    if (!_hitTestResult.isSelected())
-        [self _selectLookupText];
-}
-
-- (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event
-{
-    if (menu != _webView._actionMenu)
-        return;
-
-    if (_currentActionContext && _hasActivatedActionContext) {
-        [getDDActionsManagerClass() didUseActions];
-        _hasActivatedActionContext = NO;
-    }
-
-    _type = WebActionMenuNone;
-    _sharingServicePicker = nil;
-    _currentDetectedDataTextIndicator = nil;
-    _currentDetectedDataRange = nil;
-    _currentActionContext = nil;
-}
-
-#pragma mark Link actions
-
-- (void)_openURLFromActionMenu:(id)sender
-{
-    if (!_webView)
-        return;
-
-    [[NSWorkspace sharedWorkspace] openURL:_hitTestResult.absoluteLinkURL()];
-}
-
-- (void)_addToReadingListFromActionMenu:(id)sender
-{
-    if (!_webView)
-        return;
-
-    NSURL *url = _hitTestResult.absoluteLinkURL();
-    NSSharingService *service = [NSSharingService sharingServiceNamed:NSSharingServiceNameAddToSafariReadingList];
-    [service performWithItems:@[ url ]];
-}
-
-static IntRect elementBoundingBoxInWindowCoordinatesFromNode(Node* node)
-{
-    if (!node)
-        return IntRect();
-
-    Frame* frame = node->document().frame();
-    if (!frame)
-        return IntRect();
-
-    FrameView* view = frame->view();
-    if (!view)
-        return IntRect();
-
-    RenderObject* renderer = node->renderer();
-    if (!renderer)
-        return IntRect();
-
-    return view->contentsToWindow(renderer->absoluteBoundingBoxRect());
-}
-
-- (NSArray *)_defaultMenuItemsForLink
-{
-    RetainPtr<NSMenuItem> openLinkItem = [self _createActionMenuItemForTag:WebActionMenuItemTagOpenLinkInDefaultBrowser];
-    RetainPtr<NSMenuItem> readingListItem = [self _createActionMenuItemForTag:WebActionMenuItemTagAddLinkToSafariReadingList];
-
-    NSURL *url = _hitTestResult.absoluteLinkURL();
-    RetainPtr<NSMenuItem> shareItem = [self _createShareActionMenuItemForTag:WebActionMenuItemTagShareLink withItems:@[ url ]];
-
-    return @[ openLinkItem.get(), shareItem.get(), [NSMenuItem separatorItem], readingListItem.get() ];
-}
-
-#pragma mark mailto: and tel: Link actions
-
-- (NSArray *)_defaultMenuItemsForDataDetectableLink
-{
-    Node* node = _hitTestResult.innerNode();
-    if (!node)
-        return @[ ];
-
-    RetainPtr<DDActionContext> actionContext = adoptNS([allocDDActionContextInstance() init]);
-
-    // FIXME: Should this show a yellow highlight?
-    _currentActionContext = [actionContext contextForView:_webView altMode:YES interactionStartedHandler:^() {
-    } interactionChangedHandler:^() {
-    } interactionStoppedHandler:^() {
-    }];
-
-    [_currentActionContext setHighlightFrame:elementBoundingBoxInWindowCoordinatesFromNode(node)];
-
-    return [[getDDActionsManagerClass() sharedManager] menuItemsForTargetURL:_hitTestResult.absoluteLinkURL() actionContext:_currentActionContext.get()];
-}
-
-#pragma mark Image actions
-
-- (NSArray *)_defaultMenuItemsForImage
-{
-    RetainPtr<NSMenuItem> copyImageItem = [self _createActionMenuItemForTag:WebActionMenuItemTagCopyImage];
-
-    RetainPtr<NSMenuItem> addToPhotosItem;
-    if ([self _canAddMediaToPhotos])
-        addToPhotosItem = [self _createActionMenuItemForTag:WebActionMenuItemTagAddImageToPhotos];
-    else
-        addToPhotosItem = [NSMenuItem separatorItem];
-
-    RetainPtr<NSMenuItem> saveToDownloadsItem = [self _createActionMenuItemForTag:WebActionMenuItemTagSaveImageToDownloads];
-    if (!_webView.downloadDelegate)
-        [saveToDownloadsItem setEnabled:NO];
-
-    RefPtr<SharedBuffer> buffer = _hitTestResult.image()->data();
-    RetainPtr<NSImage> nsImage = adoptNS([[NSImage alloc] initWithData:[NSData dataWithBytes:buffer->data() length:buffer->size()]]);
-    RetainPtr<NSMenuItem> shareItem = [self _createShareActionMenuItemForTag:WebActionMenuItemTagShareImage withItems:@[ nsImage.get() ]];
-
-    return @[ copyImageItem.get(), addToPhotosItem.get(), saveToDownloadsItem.get(), shareItem.get() ];
-}
-
-- (void)_copyImage:(id)sender
-{
-    Frame* frame = core([_webView _selectedOrMainFrame]);
-    if (!frame)
-        return;
-    frame->editor().copyImage(_hitTestResult);
-}
-
-static NSString *temporaryPhotosDirectoryPath()
-{
-    static NSString *temporaryPhotosDirectoryPath;
-
-    if (!temporaryPhotosDirectoryPath) {
-        NSString *temporaryDirectoryTemplate = [NSTemporaryDirectory() stringByAppendingPathComponent:@"WebKitPhotos-XXXXXX"];
-        CString templateRepresentation = [temporaryDirectoryTemplate fileSystemRepresentation];
-
-        if (mkdtemp(templateRepresentation.mutableData()))
-            temporaryPhotosDirectoryPath = [[[NSFileManager defaultManager] stringWithFileSystemRepresentation:templateRepresentation.data() length:templateRepresentation.length()] copy];
-    }
-
-    return temporaryPhotosDirectoryPath;
-}
-
-static NSString *pathToPhotoOnDisk(NSString *suggestedFilename)
-{
-    NSString *photoDirectoryPath = temporaryPhotosDirectoryPath();
-    if (!photoDirectoryPath) {
-        WTFLogAlways("Cannot create temporary photo download directory.");
-        return nil;
-    }
-
-    NSString *path = [photoDirectoryPath stringByAppendingPathComponent:suggestedFilename];
-
-    NSFileManager *fileManager = [NSFileManager defaultManager];
-    if ([fileManager fileExistsAtPath:path]) {
-        NSString *pathTemplatePrefix = [photoDirectoryPath stringByAppendingPathComponent:@"XXXXXX-"];
-        NSString *pathTemplate = [pathTemplatePrefix stringByAppendingString:suggestedFilename];
-        CString pathTemplateRepresentation = [pathTemplate fileSystemRepresentation];
-
-        int fd = mkstemps(pathTemplateRepresentation.mutableData(), pathTemplateRepresentation.length() - strlen([pathTemplatePrefix fileSystemRepresentation]) + 1);
-        if (fd < 0) {
-            WTFLogAlways("Cannot create photo file in the temporary directory (%@).", suggestedFilename);
-            return nil;
-        }
-
-        close(fd);
-        path = [fileManager stringWithFileSystemRepresentation:pathTemplateRepresentation.data() length:pathTemplateRepresentation.length()];
-    }
-
-    return path;
-}
-
-- (BOOL)_canAddMediaToPhotos
-{
-    return [getIKSlideshowClass() canExportToApplication:@"com.apple.Photos"];
-}
-
-- (void)_addImageToPhotos:(id)sender
-{
-    if (![self _canAddMediaToPhotos])
-        return;
-
-    Image* image = _hitTestResult.image();
-    if (!image)
-        return;
-
-    String imageExtension = image->filenameExtension();
-    if (imageExtension.isEmpty())
-        return;
-
-    RefPtr<SharedBuffer> buffer = image->data();
-    if (!buffer)
-        return;
-    RetainPtr<NSData> nsData = [NSData dataWithBytes:buffer->data() length:buffer->size()];
-    RetainPtr<NSString> suggestedFilename = [[[NSProcessInfo processInfo] globallyUniqueString] stringByAppendingPathExtension:imageExtension];
-
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        NSString *filePath = pathToPhotoOnDisk(suggestedFilename.get());
-        if (!filePath)
-            return;
-
-        NSURL *fileURL = [NSURL fileURLWithPath:filePath];
-        [nsData writeToURL:fileURL atomically:NO];
-
-        dispatch_async(dispatch_get_main_queue(), ^{
-            // This API provides no way to report failure, but if 18420778 is fixed so that it does, we should handle this.
-            [getIKSlideshowClass() exportSlideshowItem:filePath toApplication:@"com.apple.Photos"];
-        });
-    });
-}
-
-- (void)_saveImageToDownloads:(id)sender
-{
-    [_webView _downloadURL:_hitTestResult.absoluteImageURL()];
-}
-
-#pragma mark Video actions
-
-- (NSArray*)_defaultMenuItemsForVideo
-{
-    RetainPtr<NSMenuItem> copyVideoURLItem = [self _createActionMenuItemForTag:WebActionMenuItemTagCopyVideoURL];
-
-    RetainPtr<NSMenuItem> saveToDownloadsItem = [self _createActionMenuItemForTag:WebActionMenuItemTagSaveVideoToDownloads];
-    if (!_hitTestResult.isDownloadableMedia() || !_webView.downloadDelegate)
-        [saveToDownloadsItem setEnabled:NO];
-
-    String urlToShare = _hitTestResult.isDownloadableMedia() ? _hitTestResult.absoluteMediaURL() : [_webView mainFrameURL];
-    RetainPtr<NSMenuItem> shareItem = [self _createShareActionMenuItemForTag:WebActionMenuItemTagShareImage withItems:@[ urlToShare ]];
-
-    return @[ copyVideoURLItem.get(), [NSMenuItem separatorItem], saveToDownloadsItem.get(), shareItem.get() ];
-}
-
-- (void)_copyVideoURL:(id)sender
-{
-    NSString *urlToCopy = _hitTestResult.absoluteMediaURL();
-    if (!_hitTestResult.isDownloadableMedia())
-        urlToCopy = [_webView mainFrameURL];
-
-    [[NSPasteboard generalPasteboard] clearContents];
-    [[NSPasteboard generalPasteboard] writeObjects:@[ urlToCopy ]];
-}
-
-- (void)_saveVideoToDownloads:(id)sender
-{
-    [_webView _downloadURL:_hitTestResult.absoluteMediaURL()];
-}
-
-#pragma mark Text actions
-
-- (NSArray *)_defaultMenuItemsForText
-{
-    RetainPtr<NSMenuItem> copyTextItem = [self _createActionMenuItemForTag:WebActionMenuItemTagCopyText];
-    RetainPtr<NSMenuItem> pasteItem = [self _createActionMenuItemForTag:WebActionMenuItemTagPaste];
-    [pasteItem setEnabled:NO];
-
-    return @[ copyTextItem.get(), [NSMenuItem separatorItem], pasteItem.get() ];
-}
-
-- (NSArray *)_defaultMenuItemsForEditableText
-{
-    RetainPtr<NSMenuItem> copyTextItem = [self _createActionMenuItemForTag:WebActionMenuItemTagCopyText];
-    RetainPtr<NSMenuItem> pasteItem = [self _createActionMenuItemForTag:WebActionMenuItemTagPaste];
-
-    return @[ copyTextItem.get(), [NSMenuItem separatorItem], pasteItem.get() ];
-}
-
-- (NSArray *)_defaultMenuItemsForEditableTextWithSuggestions
-{
-    Frame* frame = core([_webView _selectedOrMainFrame]);
-    if (!frame)
-        return @[ ];
-
-    NSDictionary *options = nil;
-    RefPtr<Range> lookupRange = rangeForDictionaryLookupAtHitTestResult(_hitTestResult, &options);
-    if (!lookupRange)
-        return @[ ];
-
-    String lookupText = lookupRange->text();
-    TextCheckerClient* textChecker = frame->editor().textChecker();
-    if (!textChecker)
-        return @[ ];
-
-    Vector<TextCheckingResult> results = textChecker->checkTextOfParagraph(lookupText, NSTextCheckingTypeSpelling);
-    if (results.isEmpty())
-        return @[ ];
-
-    Vector<String> guesses;
-    frame->editor().textChecker()->getGuessesForWord(lookupText, String(), guesses);
-    if (guesses.isEmpty())
-        return @[ ];
-
-    RetainPtr<NSMenu> spellingSubMenu = adoptNS([[NSMenu alloc] init]);
-    for (const auto& guess : guesses) {
-        RetainPtr<NSMenuItem> item = adoptNS([[NSMenuItem alloc] initWithTitle:guess action:@selector(_changeSelectionToSuggestion:) keyEquivalent:@""]);
-        [item setRepresentedObject:guess];
-        [item setTarget:self];
-        [spellingSubMenu addItem:item.get()];
-    }
-
-    RetainPtr<NSMenuItem> copyTextItem = [self _createActionMenuItemForTag:WebActionMenuItemTagCopyText];
-    RetainPtr<NSMenuItem> pasteItem = [self _createActionMenuItemForTag:WebActionMenuItemTagPaste];
-    RetainPtr<NSMenuItem> textSuggestionsItem = [self _createActionMenuItemForTag:WebActionMenuItemTagTextSuggestions];
-
-    [textSuggestionsItem setSubmenu:spellingSubMenu.get()];
-
-    return @[ copyTextItem.get(), [NSMenuItem separatorItem], pasteItem.get(), textSuggestionsItem.get() ];
-}
-
-- (void)_selectDataDetectedText
-{
-    [_webView _mainCoreFrame]->selection().setSelectedRange(_currentDetectedDataRange.get(), DOWNSTREAM, true);
-}
-
-- (NSArray *)_defaultMenuItemsForDataDetectedText
-{
-    RefPtr<Range> detectedDataRange;
-    FloatRect detectedDataBoundingBox;
-    RetainPtr<DDActionContext> actionContext;
-
-    if ([[_webView UIDelegate] respondsToSelector:@selector(_webView:actionContextForHitTestResult:range:)]) {
-        RetainPtr<WebElementDictionary> hitTestDictionary = adoptNS([[WebElementDictionary alloc] initWithHitTestResult:_hitTestResult]);
-
-        DOMRange *customDataDetectorsRange;
-        actionContext = [(id)[_webView UIDelegate] _webView:_webView actionContextForHitTestResult:hitTestDictionary.get() range:&customDataDetectorsRange];
-
-        if (actionContext && customDataDetectorsRange)
-            detectedDataRange = core(customDataDetectorsRange);
-    }
-
-    // If the client didn't give us an action context, try to scan around the hit point.
-    if (!actionContext || !detectedDataRange)
-        actionContext = DataDetection::detectItemAroundHitTestResult(_hitTestResult, detectedDataBoundingBox, detectedDataRange);
-
-    if (!actionContext || !detectedDataRange)
-        return @[ ];
-
-    [actionContext setAltMode:YES];
-    if ([[getDDActionsManagerClass() sharedManager] respondsToSelector:@selector(hasActionsForResult:actionContext:)]) {
-        if (![[getDDActionsManagerClass() sharedManager] hasActionsForResult:[actionContext mainResult] actionContext:actionContext.get()])
-            return @[ ];
-    }
-
-    _currentDetectedDataTextIndicator = TextIndicator::createWithRange(*detectedDataRange, TextIndicatorPresentationTransition::BounceAndCrossfade);
-
-    _currentActionContext = [actionContext contextForView:_webView altMode:YES interactionStartedHandler:^() {
-    } interactionChangedHandler:^() {
-        [self _showTextIndicator];
-    } interactionStoppedHandler:^() {
-        [self _hideTextIndicatorWithAnimation:TextIndicatorDismissalAnimation::FadeOut];
-    }];
-    _currentDetectedDataRange = detectedDataRange;
-
-    [_currentActionContext setHighlightFrame:[_webView.window convertRectToScreen:detectedDataBoundingBox]];
-
-    NSArray *menuItems = [[getDDActionsManagerClass() sharedManager] menuItemsForResult:[_currentActionContext mainResult] actionContext:_currentActionContext.get()];
-    if (menuItems.count == 1 && _currentDetectedDataTextIndicator)
-        _currentDetectedDataTextIndicator->setPresentationTransition(TextIndicatorPresentationTransition::Bounce);
-    return menuItems;
-}
-
-- (void)_copySelection:(id)sender
-{
-    [_webView copy:self];
-}
-
-- (void)_paste:(id)sender
-{
-    [_webView paste:self];
-}
-
-- (void)_selectLookupText
-{
-    NSDictionary *options = nil;
-    RefPtr<Range> lookupRange = rangeForDictionaryLookupAtHitTestResult(_hitTestResult, &options);
-    if (!lookupRange)
-        return;
-
-    Frame* frame = _hitTestResult.innerNode()->document().frame();
-    if (!frame)
-        return;
-
-    frame->selection().setSelectedRange(lookupRange.get(), DOWNSTREAM, true);
-}
-
-- (void)_changeSelectionToSuggestion:(id)sender
-{
-    NSString *selectedCorrection = [sender representedObject];
-    if (!selectedCorrection)
-        return;
-
-    ASSERT([selectedCorrection isKindOfClass:[NSString class]]);
-
-    WebHTMLView *documentView = [[[_webView _selectedOrMainFrame] frameView] documentView];
-    [documentView _changeSpellingToWord:selectedCorrection];
-}
-
-#pragma mark Whitespace actions
-
-- (NSArray *)_defaultMenuItemsForWhitespaceInEditableArea
-{
-    RetainPtr<NSMenuItem> copyTextItem = [self _createActionMenuItemForTag:WebActionMenuItemTagCopyText];
-    RetainPtr<NSMenuItem> pasteItem = [self _createActionMenuItemForTag:WebActionMenuItemTagPaste];
-    [copyTextItem setEnabled:NO];
-
-    return @[ copyTextItem.get(), [NSMenuItem separatorItem], pasteItem.get() ];
-}
-
-#pragma mark NSSharingServicePickerDelegate implementation
-
-- (NSArray *)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker sharingServicesForItems:(NSArray *)items mask:(NSSharingServiceMask)mask proposedSharingServices:(NSArray *)proposedServices
-{
-    RetainPtr<NSMutableArray> services = adoptNS([[NSMutableArray alloc] initWithCapacity:proposedServices.count]);
-
-    for (NSSharingService *service in proposedServices) {
-        if ([service.name isEqualToString:NSSharingServiceNameAddToIPhoto])
-            continue;
-        [services addObject:service];
-    }
-
-    return services.autorelease();
-}
-
-- (id <NSSharingServiceDelegate>)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker delegateForSharingService:(NSSharingService *)sharingService
-{
-    return self;
-}
-
-#pragma mark NSSharingServiceDelegate implementation
-
-- (NSWindow *)sharingService:(NSSharingService *)sharingService sourceWindowForShareItems:(NSArray *)items sharingContentScope:(NSSharingContentScope *)sharingContentScope
-{
-    return _webView.window;
-}
-
-#pragma mark Menu Items
-
-- (RetainPtr<NSMenuItem>)_createActionMenuItemForTag:(uint32_t)tag
-{
-    SEL selector = nullptr;
-    NSString *title = nil;
-    NSImage *image = nil;
-    bool enabled = true;
-
-    switch (tag) {
-    case WebActionMenuItemTagOpenLinkInDefaultBrowser:
-        selector = @selector(_openURLFromActionMenu:);
-        title = WEB_UI_STRING_KEY("Open", "Open (action menu item)", "action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuOpenInNewWindow"];
-        break;
-
-    case WebActionMenuItemTagAddLinkToSafariReadingList:
-        selector = @selector(_addToReadingListFromActionMenu:);
-        title = WEB_UI_STRING_KEY("Add to Reading List", "Add to Reading List (action menu item)", "action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuAddToReadingList"];
-        break;
-
-    case WebActionMenuItemTagCopyText:
-        selector = @selector(_copySelection:);
-        title = WEB_UI_STRING_KEY("Copy", "Copy (text action menu item)", "text action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuCopy"];
-        enabled = _hitTestResult.allowsCopy();
-        break;
-
-    case WebActionMenuItemTagPaste:
-        selector = @selector(_paste:);
-        title = WEB_UI_STRING_KEY("Paste", "Paste (action menu item)", "action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuPaste"];
-        break;
-
-    case WebActionMenuItemTagTextSuggestions:
-        title = WEB_UI_STRING_KEY("Suggestions", "Suggestions (action menu item)", "action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuSpelling"];
-        break;
-
-    case WebActionMenuItemTagCopyImage:
-        selector = @selector(_copyImage:);
-        title = WEB_UI_STRING_KEY("Copy", "Copy (image action menu item)", "image action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuCopy"];
-        break;
-
-    case WebActionMenuItemTagAddImageToPhotos:
-        selector = @selector(_addImageToPhotos:);
-        title = WEB_UI_STRING_KEY("Add to Photos", "Add to Photos (action menu item)", "action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuAddToPhotos"];
-        break;
-
-    case WebActionMenuItemTagSaveImageToDownloads:
-        selector = @selector(_saveImageToDownloads:);
-        title = WEB_UI_STRING_KEY("Save to Downloads", "Save to Downloads (image action menu item)", "image action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuSaveToDownloads"];
-        enabled = !WebCore::protocolIs(_hitTestResult.absoluteImageURL(), "file");
-        break;
-
-    case WebActionMenuItemTagCopyVideoURL:
-        selector = @selector(_copyVideoURL:);
-        title = WEB_UI_STRING_KEY("Copy", "Copy (video action menu item)", "video action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuCopy"];
-        break;
-
-    case WebActionMenuItemTagSaveVideoToDownloads:
-        selector = @selector(_saveVideoToDownloads:);
-        title = WEB_UI_STRING_KEY("Save to Downloads", "Save to Downloads (video action menu item)", "video action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuSaveToDownloads"];
-        enabled = !WebCore::protocolIs(_hitTestResult.absoluteMediaURL(), "file") && _hitTestResult.isDownloadableMedia();
-        break;
-
-    default:
-        ASSERT_NOT_REACHED();
-        return nil;
-    }
-
-    RetainPtr<NSMenuItem> item = adoptNS([[NSMenuItem alloc] initWithTitle:title action:selector keyEquivalent:@""]);
-    [item setImage:image];
-    [item setTarget:self];
-    [item setTag:tag];
-    [item setEnabled:enabled];
-    return item;
-}
-
-- (RetainPtr<NSMenuItem>)_createShareActionMenuItemForTag:(uint32_t)tag withItems:(NSArray *)items
-{
-    RetainPtr<NSMenuItem> shareItem = [NSMenuItem standardShareMenuItemWithItems:items];
-    [shareItem setTag:tag];
-
-    NSSharingServicePicker *sharingServicePicker = [shareItem representedObject];
-    sharingServicePicker.delegate = self;
-
-    return shareItem;
-}
-
-- (NSArray *)_defaultMenuItems
-{
-    NSURL *url = _hitTestResult.absoluteLinkURL();
-    NSString *absoluteURLString = [url absoluteString];
-    if (url && WebCore::protocolIsInHTTPFamily(absoluteURLString)) {
-        _type = WebActionMenuLink;
-        return [self _defaultMenuItemsForLink];
-    }
-
-    if (url && WebCore::protocolIs(absoluteURLString, "mailto")) {
-        _type = WebActionMenuMailtoLink;
-        return [self _defaultMenuItemsForDataDetectableLink];
-    }
-
-    if (url && WebCore::protocolIs(absoluteURLString, "tel")) {
-        _type = WebActionMenuTelLink;
-        return [self _defaultMenuItemsForDataDetectableLink];
-    }
-
-    if (!_hitTestResult.absoluteMediaURL().isEmpty()) {
-        _type = WebActionMenuVideo;
-        return [self _defaultMenuItemsForVideo];
-    }
-
-    Image* image = _hitTestResult.image();
-    if (image && !_hitTestResult.absoluteImageURL().isEmpty() && !image->filenameExtension().isEmpty() && image->data() && !image->data()->isEmpty()) {
-        _type = WebActionMenuImage;
-        return [self _defaultMenuItemsForImage];
-    }
-
-    Node* node = _hitTestResult.innerNode();
-    if ((node && node->isTextNode()) || _hitTestResult.isOverTextInsideFormControlElement()) {
-        NSArray *dataDetectorMenuItems = [self _defaultMenuItemsForDataDetectedText];
-        if (_currentActionContext) {
-            // If this is a data detected item with no menu items, we should not fall back to regular text options.
-            if (!dataDetectorMenuItems.count) {
-                _type = WebActionMenuNone;
-                return @[ ];
-            }
-            _type = WebActionMenuDataDetectedItem;
-            return dataDetectorMenuItems;
-        }
-
-        if (_hitTestResult.isContentEditable()) {
-            NSArray *editableTextWithSuggestions = [self _defaultMenuItemsForEditableTextWithSuggestions];
-            if (editableTextWithSuggestions.count) {
-                _type = WebActionMenuEditableTextWithSuggestions;
-                return editableTextWithSuggestions;
-            }
-
-            _type = WebActionMenuEditableText;
-            return [self _defaultMenuItemsForEditableText];
-        }
-
-        _type = WebActionMenuReadOnlyText;
-        return [self _defaultMenuItemsForText];
-    }
-
-    if (_hitTestResult.isContentEditable()) {
-        _type = WebActionMenuWhitespaceInEditableArea;
-        return [self _defaultMenuItemsForWhitespaceInEditableArea];
-    }
-
-    if (_hitTestResult.isSelected()) {
-        // A selection should present the read-only text menu. It might make more sense to present a new
-        // type of menu with just copy, but for the time being, we should stay consistent with text.
-        _type = WebActionMenuReadOnlyText;
-        return [self _defaultMenuItemsForText];
-    }
-
-    _type = WebActionMenuNone;
-    return @[ ];
-}
-
-#pragma mark Text Indicator
-
-- (void)_showTextIndicator
-{
-    if (_isShowingTextIndicator)
-        return;
-
-    if (_type == WebActionMenuDataDetectedItem && _currentDetectedDataTextIndicator) {
-        [_webView _setTextIndicator:*_currentDetectedDataTextIndicator withLifetime:TextIndicatorLifetime::Permanent];
-        _isShowingTextIndicator = YES;
-    }
-}
-
-- (void)_hideTextIndicatorWithAnimation:(TextIndicatorDismissalAnimation)animation
-{
-    if (!_isShowingTextIndicator)
-        return;
-
-    [_webView _clearTextIndicatorWithAnimation:animation];
-    _isShowingTextIndicator = NO;
-}
-
-- (void)_dismissActionMenuPopovers
-{
-    DDActionsManager *actionsManager = [getDDActionsManagerClass() sharedManager];
-    if ([actionsManager respondsToSelector:@selector(requestBubbleClosureUnanchorOnFailure:)])
-        [actionsManager requestBubbleClosureUnanchorOnFailure:YES];
-}
-
-@end
-
-#endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
index 4eda206..01fb4b7 100644 (file)
@@ -35,7 +35,6 @@
 #import "DOMNodeInternal.h"
 #import "DOMRangeInternal.h"
 #import "DictionaryPopupInfo.h"
-#import "WebActionMenuController.h"
 #import "WebArchive.h"
 #import "WebClipView.h"
 #import "WebContextMenuClient.h"
@@ -52,6 +51,7 @@
 #import "WebFrameViewInternal.h"
 #import "WebHTMLRepresentationPrivate.h"
 #import "WebHTMLViewInternal.h"
+#import "WebImmediateActionController.h"
 #import "WebKitLogging.h"
 #import "WebKitNSStringExtras.h"
 #import "WebKitVersionChecks.h"
@@ -3728,7 +3728,6 @@ static void setMenuTargets(NSMenu* menu)
 #endif
 
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-    [[[self _webView] _actionMenuController] webView:[self _webView] didHandleScrollWheel:event];
     [[[self _webView] _immediateActionController] webView:[self _webView] didHandleScrollWheel:event];
 #endif
 }
@@ -3839,10 +3838,6 @@ static void setMenuTargets(NSMenu* menu)
     // Record the mouse down position so we can determine drag hysteresis.
     [self _setMouseDownEvent:event];
 
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-    [[[self _webView] _actionMenuController] webView:[self _webView] willHandleMouseDown:event];
-#endif
-
 #if PLATFORM(IOS)
     // TEXTINPUT: if there is marked text and the current input
     // manager wants to handle mouse events, we need to make sure to
@@ -5434,7 +5429,7 @@ static BOOL writingDirectionKeyBindingsEnabled()
 - (void)otherMouseDown:(NSEvent *)event
 {
     if ([event buttonNumber] != 2 || ([NSMenu respondsToSelector:@selector(menuTypeForEvent:)]
-        && ([NSMenu menuTypeForEvent:event] == NSMenuTypeActionMenu || [NSMenu menuTypeForEvent:event] == NSMenuTypeContextMenu))) {
+        && [NSMenu menuTypeForEvent:event] == NSMenuTypeContextMenu)) {
         [super otherMouseDown:event];
         return;
     }
index b398132..b178596 100644 (file)
@@ -112,25 +112,7 @@ enum {
     WebMenuItemTagBaseApplication = 10000
 };
 
-enum {
-    WebActionMenuItemTagNoAction = 0,
-    WebActionMenuItemTagOpenLinkInDefaultBrowser,
-    WebActionMenuItemTagPreviewLink,
-    WebActionMenuItemTagAddLinkToSafariReadingList,
-    WebActionMenuItemTagCopyText,
-    WebActionMenuItemTagLookupText,
-    WebActionMenuItemTagPaste,
-    WebActionMenuItemTagTextSuggestions,
-    WebActionMenuItemTagCopyImage,
-    WebActionMenuItemTagAddImageToPhotos,
-    WebActionMenuItemTagSaveImageToDownloads,
-    WebActionMenuItemTagShareImage,
-    WebActionMenuItemTagCopyVideoURL,
-    WebActionMenuItemTagSaveVideoToDownloads,
-    WebActionMenuItemTagShareVideo,
-    WebActionMenuItemTagShareLink
-};
-
+// Deprecated; remove when there are no more clients.
 typedef enum {
     WebActionMenuNone = 0,
     WebActionMenuLink,
@@ -238,7 +220,8 @@ extern NSString *WebConsoleMessageErrorMessageLevel;
 - (void)webView:(WebView *)sender willPopupMenu:(NSMenu *)menu;
 - (void)webView:(WebView *)sender contextMenuItemSelected:(NSMenuItem *)item forElement:(NSDictionary *)element;
 - (void)webView:(WebView *)sender saveFrameView:(WebFrameView *)frameView showingPanel:(BOOL)showingPanel;
-- (NSArray *)_webView:(WebView *)sender actionMenuItemsForHitTestResult:(NSDictionary *)hitTestResult withType:(WebActionMenuType)type defaultActionMenuItems:(NSArray *)defaultMenuItems;
+
+// FIXME: Rename this because it's only used by immediate action code.
 - (DDActionContext *)_webView:(WebView *)sender actionContextForHitTestResult:(NSDictionary *)hitTestResult range:(DOMRange **)range;
 
 // Clients that want to maintain default behavior can return nil. To disable the immediate action entirely, return NSNull. And to
index 402ebb8..297e290 100644 (file)
 #import <wtf/StdLibExtras.h>
 
 #if !PLATFORM(IOS)
-#import "WebActionMenuController.h"
 #import "WebContextMenuClient.h"
 #import "WebFullScreenController.h"
 #import "WebImmediateActionController.h"
 #import "WebPDFView.h"
 #import <WebCore/LookupSPI.h>
 #import <WebCore/NSImmediateActionGestureRecognizerSPI.h>
-#import <WebCore/NSViewSPI.h>
 #import <WebCore/SoftLinking.h>
 #import <WebCore/TextIndicator.h>
 #import <WebCore/TextIndicatorWindow.h>
@@ -909,13 +907,6 @@ static void WebKitInitializeGamepadProviderIfNecessary()
     [frameView release];
 
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-    if ([self respondsToSelector:@selector(_setActionMenu:)]) {
-        RetainPtr<NSMenu> actionMenu = adoptNS([[NSMenu alloc] init]);
-        self._actionMenu = actionMenu.get();
-        _private->actionMenuController = [[WebActionMenuController alloc] initWithWebView:self];
-        self._actionMenu.autoenablesItems = NO;
-    }
-
     if (Class gestureClass = NSClassFromString(@"NSImmediateActionGestureRecognizer")) {
         RetainPtr<NSImmediateActionGestureRecognizer> recognizer = adoptNS([(NSImmediateActionGestureRecognizer *)[gestureClass alloc] init]);
         _private->immediateActionController = [[WebImmediateActionController alloc] initWithWebView:self recognizer:recognizer.get()];
@@ -1762,7 +1753,6 @@ static bool fastDocumentTeardownEnabled()
     [_private->inspector webViewClosed];
 #endif
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-    [_private->actionMenuController webViewClosed];
     [_private->immediateActionController webViewClosed];
 #endif
 
@@ -8550,35 +8540,6 @@ bool LayerFlushController::flushLayers()
 
 #if PLATFORM(MAC)
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-- (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event
-{
-    if (menu != self._actionMenu)
-        return;
-
-    [_private->actionMenuController prepareForMenu:menu withEvent:event];
-}
-
-- (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event
-{
-    if (menu != self._actionMenu)
-        return;
-
-    [_private->actionMenuController willOpenMenu:menu withEvent:event];
-}
-
-- (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event
-{
-    if (menu != self._actionMenu)
-        return;
-
-    [_private->actionMenuController didCloseMenu:menu withEvent:event];
-}
-
-- (WebActionMenuController *)_actionMenuController
-{
-    return _private->actionMenuController;
-}
-
 - (WebImmediateActionController *)_immediateActionController
 {
     return _private->immediateActionController;
index 43d10ec..31139b4 100644 (file)
@@ -49,7 +49,6 @@ class Page;
 class TextIndicatorWindow;
 }
 
-@class WebActionMenuController;
 @class WebImmediateActionController;
 @class WebInspector;
 @class WebNodeHighlight;
@@ -169,7 +168,6 @@ private:
 
 #if PLATFORM(MAC)
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-    WebActionMenuController *actionMenuController;
     WebImmediateActionController *immediateActionController;
 #endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     std::unique_ptr<WebCore::TextIndicatorWindow> textIndicatorWindow;
index 8bd9e47..c5e41d1 100644 (file)
@@ -188,7 +188,6 @@ WebViewLayerFlushScheduler::WebViewLayerFlushScheduler(LayerFlushController* flu
     [inspector release];
     [currentNodeHighlight release];
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-    [actionMenuController release];
     [immediateActionController release];
 #endif
     [hostWindow release];
index 02d1b34..14209a3 100644 (file)
@@ -70,7 +70,6 @@ class WebSelectionServiceController;
 
 #endif
 
-@class WebActionMenuController;
 @class WebBasePluginPackage;
 @class WebDownload;
 @class WebImmediateActionController;
@@ -271,7 +270,6 @@ OBJC_CLASS NSTextAlternatives;
 - (void)_showDictionaryLookupPopup:(const DictionaryPopupInfo&)dictionaryPopupInfo;
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
 - (id)_animationControllerForDictionaryLookupPopupInfo:(const DictionaryPopupInfo&)dictionaryPopupInfo;
-- (WebActionMenuController *)_actionMenuController;
 - (WebImmediateActionController *)_immediateActionController;
 #endif
 - (NSEvent *)_pressureEvent;
index 81c0687..d8a84ce 100644 (file)
@@ -1,3 +1,80 @@
+2015-05-22  Tim Horton  <timothy_horton@apple.com>
+
+        Remove action menu support
+        https://bugs.webkit.org/show_bug.cgi?id=145305
+        <rdar://problem/21070771>
+
+        Reviewed by Anders Carlsson.
+
+        * Configurations/WebKit.xcconfig:
+        * Shared/API/c/WKActionMenuItemTypes.h:
+        * Shared/API/c/WKActionMenuTypes.h:
+        * UIProcess/API/Cocoa/WKViewPrivate.h:
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _didPerformImmediateActionHitTest:contentPreventsDefault:userData:]):
+        (-[WKView dealloc]): Deleted.
+        (-[WKView mouseDown:]): Deleted.
+        (-[WKView initWithFrame:processPool:configuration:webView:]): Deleted.
+        (-[WKView prepareForMenu:withEvent:]): Deleted.
+        (-[WKView willOpenMenu:withEvent:]): Deleted.
+        (-[WKView didCloseMenu:withEvent:]): Deleted.
+        (-[WKView _didPerformActionMenuHitTest:forImmediateAction:contentPreventsDefault:userData:]): Deleted.
+        (-[WKView _actionMenuItemsForHitTestResult:withType:defaultActionMenuItems:]): Deleted.
+        (-[WKView _actionMenuItemsForHitTestResult:withType:defaultActionMenuItems:userData:]): Deleted.
+        * UIProcess/API/mac/WKViewInternal.h:
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::performImmediateActionHitTestAtLocation):
+        (WebKit::WebPageProxy::didPerformImmediateActionHitTest):
+        (WebKit::WebPageProxy::performActionMenuHitTestAtLocation): Deleted.
+        (WebKit::WebPageProxy::selectLastActionMenuRange): Deleted.
+        (WebKit::WebPageProxy::focusAndSelectLastActionMenuHitTestResult): Deleted.
+        (WebKit::WebPageProxy::didPerformActionMenuHitTest): Deleted.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/mac/PageClientImpl.h:
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::didPerformImmediateActionHitTest):
+        (WebKit::PageClientImpl::didPerformActionMenuHitTest): Deleted.
+        * UIProcess/mac/WKActionMenuController.h: Removed.
+        * UIProcess/mac/WKActionMenuController.mm: Removed.
+        * UIProcess/mac/WKImmediateActionController.h:
+        * UIProcess/mac/WKImmediateActionController.mm:
+        (-[WKImmediateActionController didPerformImmediateActionHitTest:contentPreventsDefault:userData:]):
+        (-[WKImmediateActionController immediateActionRecognizerWillPrepare:]):
+        (-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
+        (-[WKImmediateActionController didPerformActionMenuHitTest:contentPreventsDefault:userData:]): Deleted.
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/InjectedBundle/API/APIInjectedBundlePageContextMenuClient.h:
+        (API::InjectedBundle::PageContextMenuClient::prepareForImmediateAction):
+        (API::InjectedBundle::PageContextMenuClient::prepareForActionMenu): Deleted.
+        * WebProcess/InjectedBundle/API/c/WKBundlePageContextMenuClient.h:
+        * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
+        * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h:
+        * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp:
+        (WebKit::InjectedBundlePageContextMenuClient::prepareForImmediateAction):
+        (WebKit::InjectedBundlePageContextMenuClient::prepareForActionMenu): Deleted.
+        * WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h:
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/WebPageOverlay.cpp:
+        (WebKit::WebPageOverlay::actionContextForResultAtPoint):
+        * WebProcess/WebPage/WebPageOverlay.h:
+        (WebKit::WebPageOverlay::Client::actionContextForResultAtPoint):
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::textIndicatorTransitionForImmediateAction):
+        (WebKit::WebPage::performImmediateActionHitTestAtLocation):
+        (WebKit::textIndicatorTransitionForActionMenu): Deleted.
+        (WebKit::WebPage::performActionMenuHitTestAtLocation): Deleted.
+        (WebKit::WebPage::selectLastActionMenuRange): Deleted.
+        (WebKit::WebPage::focusAndSelectLastActionMenuHitTestResult): Deleted.
+        Remove everything, except some enums that clients still refer to.
+        Also, leave SPI that used to be shared between immediate actions and
+        action menus intact, even if it had "action menu" in the name. We can
+        deprecate and rename in another patch... except for the very recently-added
+        support from r184106, which we'll revert entirely, removing WKBundlePageOverlayV2, 
+        which was not adopted by any clients.
+
 2015-05-22  Brady Eidson  <beidson@apple.com>
 
         Rework how the ResourceRequest user initiated property key is used.
index 61e209c..0b56985 100644 (file)
@@ -48,7 +48,7 @@ SECTORDER_FLAGS = $(SECTORDER_FLAGS_$(CONFIGURATION));
 SECTORDER_FLAGS_Production[sdk=iphoneos*] = -Wl,-order_file,$(SDKROOT)/AppleInternal/OrderFiles/WebKit.order;
 SECTORDER_FLAGS_Production[sdk=macosx*] = -Wl,-order_file,mac/WebKit2.order;
 
-EXCLUDED_SOURCE_FILE_NAMES[sdk=iphone*] = *.pdf Resources/mac/* WKActionMenuController.* com.apple.WebKit.Databases.sb com.apple.WebKit.NetworkProcess.sb com.apple.WebProcess.sb PlugInSandboxProfiles/*.sb;
+EXCLUDED_SOURCE_FILE_NAMES[sdk=iphone*] = *.pdf Resources/mac/* com.apple.WebKit.Databases.sb com.apple.WebKit.NetworkProcess.sb com.apple.WebProcess.sb PlugInSandboxProfiles/*.sb;
 
 INSTALLHDRS_SCRIPT_PHASE = YES;
 
index 3bad235..7ab00f5 100644 (file)
@@ -32,6 +32,7 @@
 extern "C" {
 #endif
 
+// Deprecated; remove when there are no more clients.
 enum {
     kWKContextActionItemTagNoAction = 0,
     kWKContextActionItemTagOpenLinkInDefaultBrowser,
index 5b5eb73..4769c39 100644 (file)
@@ -32,6 +32,7 @@
 extern "C" {
 #endif
 
+// Deprecated; remove when there are no more clients.
 enum {
     kWKActionMenuNone = 0,
     kWKActionMenuLink,
index 9110dcc..36c6bc4 100644 (file)
@@ -84,11 +84,9 @@ WebHitTestResult::Data::Data(const WebCore::HitTestResult& hitTestResult, bool i
 
     if (Image* image = hitTestResult.image()) {
         RefPtr<SharedBuffer> buffer = image->data();
-        String filenameExtension = image->filenameExtension();
-        if (!filenameExtension.isEmpty() && buffer) {
+        if (buffer) {
             imageSharedMemory = SharedMemory::allocate(buffer->size());
             memcpy(imageSharedMemory->data(), buffer->data(), buffer->size());
-            imageExtension = filenameExtension;
             imageSize = buffer->size();
         }
     }
@@ -114,7 +112,6 @@ void WebHitTestResult::Data::encode(IPC::ArgumentEncoder& encoder) const
     encoder << isOverTextInsideFormControlElement;
     encoder << allowsCopy;
     encoder << isDownloadableMedia;
-    encoder << hitTestLocationInViewCoordinates;
     encoder << lookupText;
     encoder << dictionaryPopupInfo;
 
@@ -123,7 +120,6 @@ void WebHitTestResult::Data::encode(IPC::ArgumentEncoder& encoder) const
         imageSharedMemory->createHandle(imageHandle, SharedMemory::Protection::ReadOnly);
     encoder << imageHandle;
     encoder << imageSize;
-    encoder << imageExtension;
 
     bool hasLinkTextIndicator = linkTextIndicator;
     encoder << hasLinkTextIndicator;
@@ -149,7 +145,6 @@ bool WebHitTestResult::Data::decode(IPC::ArgumentDecoder& decoder, WebHitTestRes
         || !decoder.decode(hitTestResultData.isOverTextInsideFormControlElement)
         || !decoder.decode(hitTestResultData.allowsCopy)
         || !decoder.decode(hitTestResultData.isDownloadableMedia)
-        || !decoder.decode(hitTestResultData.hitTestLocationInViewCoordinates)
         || !decoder.decode(hitTestResultData.lookupText)
         || !decoder.decode(hitTestResultData.dictionaryPopupInfo))
         return false;
@@ -164,9 +159,6 @@ bool WebHitTestResult::Data::decode(IPC::ArgumentDecoder& decoder, WebHitTestRes
     if (!decoder.decode(hitTestResultData.imageSize))
         return false;
 
-    if (!decoder.decode(hitTestResultData.imageExtension))
-        return false;
-
     bool hasLinkTextIndicator;
     if (!decoder.decode(hasLinkTextIndicator))
         return false;
index 4c531e8..b82611f 100644 (file)
@@ -64,12 +64,9 @@ public:
         bool allowsCopy;
         bool isDownloadableMedia;
 
-        // FIXME: Added from ActionHitTestResult. All make sense?
-        WebCore::FloatPoint hitTestLocationInViewCoordinates;
         String lookupText;
         RefPtr<SharedMemory> imageSharedMemory;
         uint64_t imageSize;
-        String imageExtension;
 
 #if PLATFORM(MAC)
         RetainPtr<DDActionContext> detectedDataActionContext;
index 5dd7711..819ab2e 100644 (file)
@@ -23,7 +23,6 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import <WebKit/WKActionMenuTypes.h>
 #import <WebKit/WKBase.h>
 #import <WebKit/WKImmediateActionTypes.h>
 #import <WebKit/WKLayoutMode.h>
 // The rect returned is always that of the snapshot, and only if it is the view being manipulated by the swipe. This only works for layer-backed windows.
 - (void)_setDidMoveSwipeSnapshotCallback:(void(^)(CGRect swipeSnapshotRectInWindowCoordinates))callback;
 
-- (NSArray *)_actionMenuItemsForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(_WKActionMenuType)type defaultActionMenuItems:(NSArray *)defaultMenuItems;
-- (NSArray *)_actionMenuItemsForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(_WKActionMenuType)type defaultActionMenuItems:(NSArray *)defaultMenuItems userData:(WKTypeRef)userData;
-
 // Clients that want to maintain default behavior can return nil. To disable the immediate action entirely, return NSNull. And to
 // do something custom, return an object that conforms to the NSImmediateActionAnimationController protocol.
 - (id)_immediateActionAnimationControllerForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(_WKImmediateActionType)type userData:(WKTypeRef)userData;
index 3790380..75a3d3f 100644 (file)
@@ -55,8 +55,6 @@
 #import "ViewGestureController.h"
 #import "ViewSnapshotStore.h"
 #import "WKAPICast.h"
-#import "WKActionMenuController.h"
-#import "WKActionMenuItemTypes.h"
 #import "WKFullScreenWindowController.h"
 #import "WKImmediateActionController.h"
 #import "WKLayoutMode.h"
@@ -96,7 +94,6 @@
 #import <WebCore/LookupSPI.h>
 #import <WebCore/NSImmediateActionGestureRecognizerSPI.h>
 #import <WebCore/NSMenuSPI.h>
-#import <WebCore/NSViewSPI.h>
 #import <WebCore/PlatformEventFactoryMac.h>
 #import <WebCore/PlatformScreen.h>
 #import <WebCore/Region.h>
@@ -284,7 +281,6 @@ struct WKViewInterpretKeyEventsParameters {
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     BOOL _automaticallyAdjustsContentInsets;
-    RetainPtr<WKActionMenuController> _actionMenuController;
     RetainPtr<WKImmediateActionController> _immediateActionController;
     RetainPtr<NSImmediateActionGestureRecognizer> _immediateActionGestureRecognizer;
 #endif
@@ -387,7 +383,6 @@ struct WKViewInterpretKeyEventsParameters {
 - (void)dealloc
 {
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-    [_data->_actionMenuController willDestroyView:self];
     [_data->_immediateActionController willDestroyView:self];
 #endif
     [_data->_layoutStrategy willDestroyView:self];
@@ -1262,10 +1257,6 @@ static NSToolbarItem *toolbarItem(id <NSValidatedUserInterfaceItem> item)
             }]; \
             return; \
         } \
-        if ([NSMenu respondsToSelector:@selector(menuTypeForEvent:)] && [NSMenu menuTypeForEvent:theEvent] == NSMenuTypeActionMenu) { \
-            [super Selector:theEvent]; \
-            return; \
-        } \
         NativeWebMouseEvent webEvent(theEvent, _data->_pressureEvent, self); \
         _data->_page->handleMouseEvent(webEvent); \
     }
@@ -1298,10 +1289,6 @@ static NSToolbarItem *toolbarItem(id <NSValidatedUserInterfaceItem> item)
             LOG(TextInput, "%s was handled by text input context", String(#Selector).substring(0, String(#Selector).find("Internal")).ascii().data()); \
             return; \
         } \
-        if ([NSMenu respondsToSelector:@selector(menuTypeForEvent:)] && [NSMenu menuTypeForEvent:theEvent] == NSMenuTypeActionMenu) { \
-            [super Selector:theEvent]; \
-            return; \
-        } \
         NativeWebMouseEvent webEvent(theEvent, _data->_pressureEvent, self); \
         _data->_page->handleMouseEvent(webEvent); \
     }
@@ -1396,9 +1383,6 @@ NATIVE_MOUSE_EVENT_HANDLER_INTERNAL(mouseDraggedInternal)
     [self _setMouseDownEvent:event];
     _data->_ignoringMouseDraggedEvents = NO;
 
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-    [_data->_actionMenuController wkView:self willHandleMouseDown:event];
-#endif
     [self mouseDownInternal:event];
 }
 
@@ -3846,14 +3830,6 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
     [workspaceNotificationCenter addObserver:self selector:@selector(_activeSpaceDidChange:) name:NSWorkspaceActiveSpaceDidChangeNotification object:nil];
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-    if ([self respondsToSelector:@selector(_setActionMenu:)]) {
-        RetainPtr<NSMenu> menu = adoptNS([[NSMenu alloc] init]);
-        self._actionMenu = menu.get();
-        _data->_actionMenuController = adoptNS([[WKActionMenuController alloc] initWithPage:*_data->_page view:self]);
-        self._actionMenu.delegate = _data->_actionMenuController.get();
-        self._actionMenu.autoenablesItems = NO;
-    }
-
     if (Class gestureClass = NSClassFromString(@"NSImmediateActionGestureRecognizer")) {
         _data->_immediateActionGestureRecognizer = adoptNS([(NSImmediateActionGestureRecognizer *)[gestureClass alloc] init]);
         _data->_immediateActionController = adoptNS([[WKImmediateActionController alloc] initWithPage:*_data->_page view:self recognizer:_data->_immediateActionGestureRecognizer.get()]);
@@ -3968,42 +3944,9 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
 
-- (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event
+- (void)_didPerformImmediateActionHitTest:(const WebHitTestResult::Data&)hitTestResult contentPreventsDefault:(BOOL)contentPreventsDefault userData:(API::Object*)userData
 {
-    if (_data->_ignoresNonWheelEvents) {
-        [menu cancelTracking];
-        return;
-    }
-
-    [_data->_actionMenuController prepareForMenu:menu withEvent:event];
-}
-
-- (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event
-{
-    if (_data->_ignoresNonWheelEvents) {
-        [menu cancelTracking];
-        return;
-    }
-
-    [_data->_actionMenuController willOpenMenu:menu withEvent:event];
-}
-
-- (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event
-{
-    if (_data->_ignoresNonWheelEvents) {
-        [menu cancelTracking];
-        return;
-    }
-
-    [_data->_actionMenuController didCloseMenu:menu withEvent:event];
-}
-
-- (void)_didPerformActionMenuHitTest:(const WebHitTestResult::Data&)hitTestResult forImmediateAction:(BOOL)forImmediateAction contentPreventsDefault:(BOOL)contentPreventsDefault userData:(API::Object*)userData
-{
-    if (forImmediateAction)
-        [_data->_immediateActionController didPerformActionMenuHitTest:hitTestResult contentPreventsDefault:contentPreventsDefault userData:userData];
-    else
-        [_data->_actionMenuController didPerformActionMenuHitTest:hitTestResult userData:userData];
+    [_data->_immediateActionController didPerformImmediateActionHitTest:hitTestResult contentPreventsDefault:contentPreventsDefault userData:userData];
 }
 
 #endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
@@ -4644,16 +4587,6 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path)
     _data->_gestureController->setDidMoveSwipeSnapshotCallback(callback);
 }
 
-- (NSArray *)_actionMenuItemsForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(_WKActionMenuType)type defaultActionMenuItems:(NSArray *)defaultMenuItems
-{
-    return defaultMenuItems;
-}
-
-- (NSArray *)_actionMenuItemsForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(_WKActionMenuType)type defaultActionMenuItems:(NSArray *)defaultMenuItems userData:(WKTypeRef)userData
-{
-    return [self _actionMenuItemsForHitTestResult:hitTestResult withType:type defaultActionMenuItems:defaultMenuItems];
-}
-
 - (id)_immediateActionAnimationControllerForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(_WKImmediateActionType)type userData:(WKTypeRef)userData
 {
     return nil;
index d03d375..a80f9d9 100644 (file)
@@ -143,7 +143,7 @@ struct WebPageConfiguration;
 - (void)_prepareForDictionaryLookup;
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-- (void)_didPerformActionMenuHitTest:(const WebKit::WebHitTestResult::Data&)hitTestResult forImmediateAction:(BOOL)forImmediateAction contentPreventsDefault:(BOOL)contentPreventsDefault userData:(API::Object*)userData;
+- (void)_didPerformImmediateActionHitTest:(const WebKit::WebHitTestResult::Data&)hitTestResult contentPreventsDefault:(BOOL)contentPreventsDefault userData:(API::Object*)userData;
 #endif
 
 @property (nonatomic, retain, setter=_setPrimaryTrackingArea:) NSTrackingArea *_primaryTrackingArea;
index dde8ac5..60ef7b2 100644 (file)
@@ -319,7 +319,7 @@ public:
     virtual void didChangeBackgroundColor() = 0;
 
 #if PLATFORM(MAC)
-    virtual void didPerformActionMenuHitTest(const WebHitTestResult::Data&, bool forImmediateAction, bool contentPreventsDefault, API::Object*) = 0;
+    virtual void didPerformImmediateActionHitTest(const WebHitTestResult::Data&, bool contentPreventsDefault, API::Object*) = 0;
 #endif
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
index 2f4a7cf..9a57935 100644 (file)
@@ -5781,19 +5781,9 @@ void WebPageProxy::removeNavigationGestureSnapshot()
     m_pageClient.removeNavigationGestureSnapshot();
 }
 
-void WebPageProxy::performActionMenuHitTestAtLocation(FloatPoint point, bool forImmediateAction)
+void WebPageProxy::performImmediateActionHitTestAtLocation(FloatPoint point)
 {
-    m_process->send(Messages::WebPage::PerformActionMenuHitTestAtLocation(point, forImmediateAction), m_pageID);
-}
-
-void WebPageProxy::selectLastActionMenuRange()
-{
-    m_process->send(Messages::WebPage::SelectLastActionMenuRange(), m_pageID);
-}
-
-void WebPageProxy::focusAndSelectLastActionMenuHitTestResult()
-{
-    m_process->send(Messages::WebPage::FocusAndSelectLastActionMenuHitTestResult(), m_pageID);
+    m_process->send(Messages::WebPage::PerformImmediateActionHitTestAtLocation(point), m_pageID);
 }
 
 void WebPageProxy::immediateActionDidUpdate()
@@ -5811,9 +5801,9 @@ void WebPageProxy::immediateActionDidComplete()
     m_process->send(Messages::WebPage::ImmediateActionDidComplete(), m_pageID);
 }
 
-void WebPageProxy::didPerformActionMenuHitTest(const WebHitTestResult::Data& result, bool forImmediateAction, bool contentPreventsDefault, const UserData& userData)
+void WebPageProxy::didPerformImmediateActionHitTest(const WebHitTestResult::Data& result, bool contentPreventsDefault, const UserData& userData)
 {
-    m_pageClient.didPerformActionMenuHitTest(result, forImmediateAction, contentPreventsDefault, m_process->transformHandlesToObjects(userData.object()).get());
+    m_pageClient.didPerformImmediateActionHitTest(result, contentPreventsDefault, m_process->transformHandlesToObjects(userData.object()).get());
 }
 
 void WebPageProxy::installViewStateChangeCompletionHandler(void (^completionHandler)())
index 2d0e959..0d4b47a 100644 (file)
@@ -1004,9 +1004,7 @@ public:
     void removeNavigationGestureSnapshot();
 
     WebHitTestResult* lastMouseMoveHitTestResult() const { return m_lastMouseMoveHitTestResult.get(); }
-    void performActionMenuHitTestAtLocation(WebCore::FloatPoint, bool forImmediateAction);
-    void selectLastActionMenuRange();
-    void focusAndSelectLastActionMenuHitTestResult();
+    void performImmediateActionHitTestAtLocation(WebCore::FloatPoint);
 
     void immediateActionDidUpdate();
     void immediateActionDidCancel();
@@ -1438,7 +1436,7 @@ private:
     void viewDidEnterWindow();
 
 #if PLATFORM(MAC)
-    void didPerformActionMenuHitTest(const WebHitTestResult::Data&, bool forImmediateAction, bool contentPreventsDefault, const UserData&);
+    void didPerformImmediateActionHitTest(const WebHitTestResult::Data&, bool contentPreventsDefault, const UserData&);
 #endif
 
     void handleAutoFillButtonClick(const UserData&);
index 328caa4..db82a72 100644 (file)
@@ -428,7 +428,7 @@ messages -> WebPageProxy {
     IsPlayingMediaDidChange(unsigned state)
 
 #if PLATFORM(MAC)
-    DidPerformActionMenuHitTest(struct WebKit::WebHitTestResult::Data result, bool forImmediateAction, bool contentPreventsDefault, WebKit::UserData userData)
+    DidPerformImmediateActionHitTest(struct WebKit::WebHitTestResult::Data result, bool contentPreventsDefault, WebKit::UserData userData)
 #endif
     HandleMessage(String messageName, WebKit::UserData messageBody) WantsConnection
     HandleSynchronousMessage(String messageName, WebKit::UserData messageBody) -> (WebKit::UserData returnData) WantsConnection
index 34d1011..ac67496 100644 (file)
@@ -196,7 +196,7 @@ private:
     virtual void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) override;
     virtual void removeNavigationGestureSnapshot() override;
 
-    virtual void didPerformActionMenuHitTest(const WebHitTestResult::Data&, bool forImmediateAction, bool contentPreventsDefault, API::Object*) override;
+    virtual void didPerformImmediateActionHitTest(const WebHitTestResult::Data&, bool contentPreventsDefault, API::Object*) override;
     virtual void showPlatformContextMenu(NSMenu *, WebCore::IntPoint) override;
 
     virtual void didChangeBackgroundColor() override;
index 32a72b8..d7418d3 100644 (file)
@@ -807,10 +807,10 @@ CGRect PageClientImpl::boundsOfLayerInLayerBackedWindowCoordinates(CALayer *laye
     return [windowContentLayer convertRect:layer.bounds fromLayer:layer];
 }
 
-void PageClientImpl::didPerformActionMenuHitTest(const WebHitTestResult::Data& result, bool forImmediateAction, bool contentPreventsDefault, API::Object* userData)
+void PageClientImpl::didPerformImmediateActionHitTest(const WebHitTestResult::Data& result, bool contentPreventsDefault, API::Object* userData)
 {
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-    [m_wkView _didPerformActionMenuHitTest:result forImmediateAction:forImmediateAction contentPreventsDefault:contentPreventsDefault userData:userData];
+    [m_wkView _didPerformImmediateActionHitTest:result contentPreventsDefault:contentPreventsDefault userData:userData];
 #endif
 }
 
diff --git a/Source/WebKit2/UIProcess/mac/WKActionMenuController.h b/Source/WebKit2/UIProcess/mac/WKActionMenuController.h
deleted file mode 100644 (file)
index a69b28f..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WKActionMenuController_h
-#define WKActionMenuController_h
-
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-
-#import "WKActionMenuItemTypes.h"
-#import "WKActionMenuTypes.h"
-#import "WebHitTestResult.h"
-#import <AppKit/NSSharingService.h>
-#import <wtf/RetainPtr.h>
-
-namespace WebKit {
-class WebPageProxy;
-
-enum class ActionMenuState {
-    None = 0,
-    Pending,
-    TimedOut,
-    Ready
-};
-}
-
-@class DDActionContext;
-@class WKView;
-
-@interface WKActionMenuController : NSObject <NSMenuDelegate> {
-@private
-    WebKit::WebPageProxy *_page;
-    WKView *_wkView;
-
-    WebKit::ActionMenuState _state;
-    WebKit::WebHitTestResult::Data _hitTestResultData;
-    RefPtr<API::Object> _userData;
-    _WKActionMenuType _type;
-    RetainPtr<NSSharingServicePicker> _sharingServicePicker;
-
-    BOOL _hasActivatedActionContext;
-
-    RetainPtr<DDActionContext> _currentActionContext;
-}
-
-- (instancetype)initWithPage:(WebKit::WebPageProxy&)page view:(WKView *)wkView;
-- (void)willDestroyView:(WKView *)view;
-
-- (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
-- (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
-- (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
-- (void)wkView:(WKView *)wkView willHandleMouseDown:(NSEvent *)event;
-
-- (void)didPerformActionMenuHitTest:(const WebKit::WebHitTestResult::Data&)hitTestResult userData:(API::Object*)userData;
-
-@end
-
-#endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-
-#endif // WKActionMenuController_h
diff --git a/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm b/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm
deleted file mode 100644 (file)
index b69999a..0000000
+++ /dev/null
@@ -1,762 +0,0 @@
-/*
- * Copyright (C) 2014-2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "WKActionMenuController.h"
-
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-
-#import "WKNSURLExtras.h"
-#import "WKViewInternal.h"
-#import "WebKitSystemInterface.h"
-#import "WebPageMessages.h"
-#import "WebPageProxy.h"
-#import "WebPageProxyMessages.h"
-#import "WebProcessPool.h"
-#import "WebProcessProxy.h"
-#import <Foundation/Foundation.h>
-#import <ImageIO/ImageIO.h>
-#import <ImageKit/ImageKit.h>
-#import <WebCore/DataDetectorsSPI.h>
-#import <WebCore/LocalizedStrings.h>
-#import <WebCore/NSMenuSPI.h>
-#import <WebCore/NSSharingServiceSPI.h>
-#import <WebCore/NSSharingServicePickerSPI.h>
-#import <WebCore/NSViewSPI.h>
-#import <WebCore/SoftLinking.h>
-#import <WebCore/TextIndicator.h>
-#import <WebCore/URL.h>
-
-SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, ImageKit)
-SOFT_LINK_CLASS(ImageKit, IKSlideshow)
-
-using namespace WebCore;
-using namespace WebKit;
-
-@interface WKActionMenuController () <NSSharingServiceDelegate, NSSharingServicePickerDelegate>
-- (void)_updateActionMenuItems;
-- (BOOL)_canAddMediaToPhotos;
-- (void)_clearActionMenuState;
-@end
-
-@interface WKView (WKDeprecatedSPI)
-- (NSArray *)_actionMenuItemsForHitTestResult:(WKHitTestResultRef)hitTestResult defaultActionMenuItems:(NSArray *)defaultMenuItems;
-@end
-
-@implementation WKActionMenuController
-
-- (instancetype)initWithPage:(WebPageProxy&)page view:(WKView *)wkView
-{
-    self = [super init];
-
-    if (!self)
-        return nil;
-
-    _page = &page;
-    _wkView = wkView;
-    _type = kWKActionMenuNone;
-
-    return self;
-}
-
-- (void)willDestroyView:(WKView *)view
-{
-    _page = nullptr;
-    _wkView = nil;
-    _hitTestResultData = WebHitTestResult::Data();
-    _currentActionContext = nil;
-}
-
-- (void)wkView:(WKView *)wkView willHandleMouseDown:(NSEvent *)event
-{
-    [self _clearActionMenuState];
-}
-
-- (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event
-{
-    if (menu != _wkView._actionMenu)
-        return;
-
-    [_wkView _dismissContentRelativeChildWindows];
-
-    _page->performActionMenuHitTestAtLocation([_wkView convertPoint:event.locationInWindow fromView:nil], false);
-
-    _state = ActionMenuState::Pending;
-    [self _updateActionMenuItems];
-}
-
-- (BOOL)isMenuForTextContent
-{
-    return _type == kWKActionMenuReadOnlyText || _type == kWKActionMenuEditableText || _type == kWKActionMenuEditableTextWithSuggestions;
-}
-
-- (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event
-{
-    if (menu != _wkView._actionMenu)
-        return;
-
-    if (!menu.numberOfItems)
-        return;
-
-    if (_type == kWKActionMenuDataDetectedItem) {
-        if (menu.numberOfItems == 1)
-            _page->clearSelection();
-        else
-            _page->selectLastActionMenuRange();
-        return;
-    }
-
-    if (_type == kWKActionMenuWhitespaceInEditableArea) {
-        _page->focusAndSelectLastActionMenuHitTestResult();
-        return;
-    }
-
-    if (![self isMenuForTextContent]) {
-        _page->clearSelection();
-        return;
-    }
-
-    // Action menus for text should highlight the text so that it is clear what the action menu actions
-    // will apply to. If the text is already selected, the menu will use the existing selection.
-    RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult];
-    if (!hitTestResult->isSelected())
-        _page->selectLastActionMenuRange();
-}
-
-- (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event
-{
-    if (menu != _wkView._actionMenu)
-        return;
-
-    [self _clearActionMenuState];
-}
-
-- (void)_clearActionMenuState
-{
-    if (_currentActionContext && _hasActivatedActionContext) {
-        [getDDActionsManagerClass() didUseActions];
-        _hasActivatedActionContext = NO;
-    }
-
-    _state = ActionMenuState::None;
-    _hitTestResultData = WebHitTestResult::Data();
-    _type = kWKActionMenuNone;
-    _sharingServicePicker = nil;
-    _currentActionContext = nil;
-    _userData = nil;
-}
-
-- (void)didPerformActionMenuHitTest:(const WebHitTestResult::Data&)hitTestResult userData:(API::Object*)userData
-{
-    // FIXME: This needs to use the WebKit2 callback mechanism to avoid out-of-order replies.
-    _state = ActionMenuState::Ready;
-    _hitTestResultData = hitTestResult;
-    _userData = userData;
-
-    [self _updateActionMenuItems];
-}
-
-#pragma mark Link actions
-
-- (NSURL *)_hitLinkURL
-{
-    RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult];
-    return [NSURL _web_URLWithWTFString:hitTestResult->absoluteLinkURL()];
-}
-
-- (NSArray *)_defaultMenuItemsForLink
-{
-    RetainPtr<NSMenuItem> openLinkItem = [self _createActionMenuItemForTag:kWKContextActionItemTagOpenLinkInDefaultBrowser];
-    RetainPtr<NSMenuItem> readingListItem = [self _createActionMenuItemForTag:kWKContextActionItemTagAddLinkToSafariReadingList];
-    RetainPtr<NSMenuItem> shareItem = [self _createShareActionMenuItemForTag:kWKContextActionItemTagShareLink withItems:@[ [self _hitLinkURL] ]];
-
-    return @[ openLinkItem.get(), shareItem.get(), [NSMenuItem separatorItem], readingListItem.get() ];
-}
-
-- (void)_openURLFromActionMenu:(id)sender
-{
-    [[NSWorkspace sharedWorkspace] openURL:[self _hitLinkURL]];
-}
-
-- (void)_addToReadingListFromActionMenu:(id)sender
-{
-    NSSharingService *service = [NSSharingService sharingServiceNamed:NSSharingServiceNameAddToSafariReadingList];
-    [service performWithItems:@[ [self _hitLinkURL] ]];
-}
-
-#pragma mark Video actions
-
-- (NSArray *)_defaultMenuItemsForVideo
-{
-    RetainPtr<NSMenuItem> copyVideoURLItem = [self _createActionMenuItemForTag:kWKContextActionItemTagCopyVideoURL];
-    RetainPtr<NSMenuItem> saveToDownloadsItem = [self _createActionMenuItemForTag:kWKContextActionItemTagSaveVideoToDownloads];
-
-    RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult];
-    String urlToShare = hitTestResult->isDownloadableMedia() ? hitTestResult->absoluteMediaURL() : _page->mainFrame()->url();
-    RetainPtr<NSMenuItem> shareItem = [self _createShareActionMenuItemForTag:kWKContextActionItemTagShareVideo withItems:@[ urlToShare ]];
-
-    return @[ copyVideoURLItem.get(), [NSMenuItem separatorItem], saveToDownloadsItem.get(), shareItem.get() ];
-}
-
-- (void)_copyVideoURL:(id)sender
-{
-    RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult];
-    String urlToCopy = hitTestResult->absoluteMediaURL();
-    if (!hitTestResult->isDownloadableMedia())
-        urlToCopy = _page->mainFrame()->url();
-
-    [[NSPasteboard generalPasteboard] clearContents];
-    [[NSPasteboard generalPasteboard] writeObjects:@[ urlToCopy ]];
-}
-
-- (void)_saveVideoToDownloads:(id)sender
-{
-    RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult];
-    _page->process().processPool().download(_page, hitTestResult->absoluteMediaURL());
-}
-
-#pragma mark Image actions
-
-- (NSImage *)_hitTestResultDataImage
-{
-    RefPtr<SharedMemory> imageSharedMemory = _hitTestResultData.imageSharedMemory;
-    if (!imageSharedMemory)
-        return nil;
-
-    RetainPtr<NSImage> nsImage = adoptNS([[NSImage alloc] initWithData:[NSData dataWithBytes:imageSharedMemory->data() length:_hitTestResultData.imageSize]]);
-    return nsImage.autorelease();
-}
-
-- (NSArray *)_defaultMenuItemsForImage
-{
-    RetainPtr<NSMenuItem> copyImageItem = [self _createActionMenuItemForTag:kWKContextActionItemTagCopyImage];
-    RetainPtr<NSMenuItem> addToPhotosItem;
-    if ([self _canAddMediaToPhotos])
-        addToPhotosItem = [self _createActionMenuItemForTag:kWKContextActionItemTagAddImageToPhotos];
-    else
-        addToPhotosItem = [NSMenuItem separatorItem];
-    RetainPtr<NSMenuItem> saveToDownloadsItem = [self _createActionMenuItemForTag:kWKContextActionItemTagSaveImageToDownloads];
-    RetainPtr<NSMenuItem> shareItem = [self _createShareActionMenuItemForTag:kWKContextActionItemTagShareImage withItems:@[ [self _hitTestResultDataImage] ]];
-
-    return @[ copyImageItem.get(), addToPhotosItem.get(), saveToDownloadsItem.get(), shareItem.get() ];
-}
-
-- (void)_copyImage:(id)sender
-{
-    RetainPtr<NSImage> image = [self _hitTestResultDataImage];
-    if (!image)
-        return;
-
-    [[NSPasteboard generalPasteboard] clearContents];
-    [[NSPasteboard generalPasteboard] writeObjects:@[ image.get() ]];
-}
-
-- (void)_saveImageToDownloads:(id)sender
-{
-    RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult];
-    _page->process().processPool().download(_page, hitTestResult->absoluteImageURL());
-}
-
-// FIXME: We should try to share this with WebPageProxyMac's similar PDF functions.
-static NSString *temporaryPhotosDirectoryPath()
-{
-    static NSString *temporaryPhotosDirectoryPath;
-
-    if (!temporaryPhotosDirectoryPath) {
-        NSString *temporaryDirectoryTemplate = [NSTemporaryDirectory() stringByAppendingPathComponent:@"WebKitPhotos-XXXXXX"];
-        CString templateRepresentation = [temporaryDirectoryTemplate fileSystemRepresentation];
-
-        if (mkdtemp(templateRepresentation.mutableData()))
-            temporaryPhotosDirectoryPath = [[[NSFileManager defaultManager] stringWithFileSystemRepresentation:templateRepresentation.data() length:templateRepresentation.length()] copy];
-    }
-
-    return temporaryPhotosDirectoryPath;
-}
-
-static NSString *pathToPhotoOnDisk(NSString *suggestedFilename)
-{
-    NSString *photoDirectoryPath = temporaryPhotosDirectoryPath();
-    if (!photoDirectoryPath) {
-        WTFLogAlways("Cannot create temporary photo download directory.");
-        return nil;
-    }
-
-    NSString *path = [photoDirectoryPath stringByAppendingPathComponent:suggestedFilename];
-
-    NSFileManager *fileManager = [NSFileManager defaultManager];
-    if ([fileManager fileExistsAtPath:path]) {
-        NSString *pathTemplatePrefix = [photoDirectoryPath stringByAppendingPathComponent:@"XXXXXX-"];
-        NSString *pathTemplate = [pathTemplatePrefix stringByAppendingString:suggestedFilename];
-        CString pathTemplateRepresentation = [pathTemplate fileSystemRepresentation];
-
-        int fd = mkstemps(pathTemplateRepresentation.mutableData(), pathTemplateRepresentation.length() - strlen([pathTemplatePrefix fileSystemRepresentation]) + 1);
-        if (fd < 0) {
-            WTFLogAlways("Cannot create photo file in the temporary directory (%@).", suggestedFilename);
-            return nil;
-        }
-
-        close(fd);
-        path = [fileManager stringWithFileSystemRepresentation:pathTemplateRepresentation.data() length:pathTemplateRepresentation.length()];
-    }
-
-    return path;
-}
-
-- (BOOL)_canAddMediaToPhotos
-{
-    return [getIKSlideshowClass() canExportToApplication:@"com.apple.Photos"];
-}
-
-- (void)_addImageToPhotos:(id)sender
-{
-    if (![self _canAddMediaToPhotos])
-        return;
-
-    RefPtr<SharedMemory> imageSharedMemory = _hitTestResultData.imageSharedMemory;
-    if (!imageSharedMemory->data() || _hitTestResultData.imageExtension.isEmpty() || !_hitTestResultData.imageSize)
-        return;
-
-    RetainPtr<NSData> imageData = adoptNS([[NSData alloc] initWithBytes:imageSharedMemory->data() length:_hitTestResultData.imageSize]);
-    RetainPtr<NSString> suggestedFilename = [[[NSProcessInfo processInfo] globallyUniqueString] stringByAppendingPathExtension:_hitTestResultData.imageExtension];
-
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        NSString *filePath = pathToPhotoOnDisk(suggestedFilename.get());
-        if (!filePath)
-            return;
-
-        NSURL *fileURL = [NSURL fileURLWithPath:filePath];
-        [imageData writeToURL:fileURL atomically:NO];
-
-        dispatch_async(dispatch_get_main_queue(), ^{
-            // This API provides no way to report failure, but if 18420778 is fixed so that it does, we should handle this.
-            [getIKSlideshowClass() exportSlideshowItem:filePath toApplication:@"com.apple.Photos"];
-        });
-    });
-}
-
-#pragma mark Text actions
-
-- (NSArray *)_defaultMenuItemsForDataDetectedText
-{
-    DDActionContext *actionContext = _hitTestResultData.detectedDataActionContext.get();
-    if (!actionContext)
-        return @[ ];
-
-    actionContext.altMode = YES;
-    if ([[getDDActionsManagerClass() sharedManager] respondsToSelector:@selector(hasActionsForResult:actionContext:)]) {
-        if (![[getDDActionsManagerClass() sharedManager] hasActionsForResult:actionContext.mainResult actionContext:actionContext])
-            return @[ ];
-    }
-
-    // Ref our WebPageProxy for use in the blocks below.
-    RefPtr<WebPageProxy> page = _page;
-    PageOverlay::PageOverlayID overlayID = _hitTestResultData.detectedDataOriginatingPageOverlay;
-    _currentActionContext = [actionContext contextForView:_wkView altMode:YES interactionStartedHandler:^() {
-        page->send(Messages::WebPage::DataDetectorsDidPresentUI(overlayID));
-    } interactionChangedHandler:^() {
-        if (_hitTestResultData.detectedDataTextIndicator)
-            page->setTextIndicator(_hitTestResultData.detectedDataTextIndicator->data());
-        page->send(Messages::WebPage::DataDetectorsDidChangeUI(overlayID));
-    } interactionStoppedHandler:^() {
-        page->send(Messages::WebPage::DataDetectorsDidHideUI(overlayID));
-        page->clearTextIndicator();
-    }];
-
-    [_currentActionContext setHighlightFrame:[_wkView.window convertRectToScreen:[_wkView convertRect:_hitTestResultData.detectedDataBoundingBox toView:nil]]];
-
-    NSArray *menuItems = [[getDDActionsManagerClass() sharedManager] menuItemsForResult:[_currentActionContext mainResult] actionContext:_currentActionContext.get()];
-    return menuItems;
-}
-
-- (NSArray *)_defaultMenuItemsForText
-{
-    RetainPtr<NSMenuItem> copyTextItem = [self _createActionMenuItemForTag:kWKContextActionItemTagCopyText];
-    RetainPtr<NSMenuItem> pasteItem = [self _createActionMenuItemForTag:kWKContextActionItemTagPaste];
-    [pasteItem setEnabled:NO];
-
-    return @[ copyTextItem.get(), [NSMenuItem separatorItem], pasteItem.get() ];
-}
-
-- (NSArray *)_defaultMenuItemsForEditableText
-{
-    RetainPtr<NSMenuItem> copyTextItem = [self _createActionMenuItemForTag:kWKContextActionItemTagCopyText];
-    RetainPtr<NSMenuItem> pasteItem = [self _createActionMenuItemForTag:kWKContextActionItemTagPaste];
-
-    return @[ copyTextItem.get(), [NSMenuItem separatorItem], pasteItem.get() ];
-}
-
-- (NSArray *)_defaultMenuItemsForEditableTextWithSuggestions
-{
-    if (_hitTestResultData.lookupText.isEmpty())
-        return @[ ];
-
-    Vector<TextCheckingResult> results;
-    _page->checkTextOfParagraph(_hitTestResultData.lookupText, NSTextCheckingTypeSpelling, results);
-    if (results.isEmpty())
-        return @[ ];
-
-    Vector<String> guesses;
-    _page->getGuessesForWord(_hitTestResultData.lookupText, String(), guesses);
-    if (guesses.isEmpty())
-        return @[ ];
-
-    RetainPtr<NSMenu> spellingSubMenu = adoptNS([[NSMenu alloc] init]);
-    for (const auto& guess : guesses) {
-        RetainPtr<NSMenuItem> item = adoptNS([[NSMenuItem alloc] initWithTitle:guess action:@selector(_changeSelectionToSuggestion:) keyEquivalent:@""]);
-        [item setRepresentedObject:guess];
-        [item setTarget:self];
-        [spellingSubMenu addItem:item.get()];
-    }
-
-    RetainPtr<NSMenuItem> copyTextItem = [self _createActionMenuItemForTag:kWKContextActionItemTagCopyText];
-    RetainPtr<NSMenuItem> pasteItem = [self _createActionMenuItemForTag:kWKContextActionItemTagPaste];
-    RetainPtr<NSMenuItem> textSuggestionsItem = [self _createActionMenuItemForTag:kWKContextActionItemTagTextSuggestions];
-
-    [textSuggestionsItem setSubmenu:spellingSubMenu.get()];
-
-    return @[ copyTextItem.get(), [NSMenuItem separatorItem], pasteItem.get(), textSuggestionsItem.get() ];
-}
-
-- (void)_copySelection:(id)sender
-{
-    _page->executeEditCommand("copy");
-}
-
-- (void)_paste:(id)sender
-{
-    _page->executeEditCommand("paste");
-}
-
-- (void)_changeSelectionToSuggestion:(id)sender
-{
-    NSString *selectedCorrection = [sender representedObject];
-    if (!selectedCorrection)
-        return;
-
-    ASSERT([selectedCorrection isKindOfClass:[NSString class]]);
-
-    _page->changeSpellingToWord(selectedCorrection);
-}
-
-#pragma mark Whitespace actions
-
-- (NSArray *)_defaultMenuItemsForWhitespaceInEditableArea
-{
-    RetainPtr<NSMenuItem> copyTextItem = [self _createActionMenuItemForTag:kWKContextActionItemTagCopyText];
-    RetainPtr<NSMenuItem> pasteItem = [self _createActionMenuItemForTag:kWKContextActionItemTagPaste];
-    [copyTextItem setEnabled:NO];
-
-    return @[ copyTextItem.get(), [NSMenuItem separatorItem], pasteItem.get() ];
-}
-
-#pragma mark mailto: and tel: Link actions
-
-- (NSArray *)_defaultMenuItemsForDataDetectableLink
-{
-    RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult];
-    RetainPtr<DDActionContext> actionContext = adoptNS([allocDDActionContextInstance() init]);
-
-    // FIXME: Should this show a yellow highlight?
-    _currentActionContext = [actionContext contextForView:_wkView altMode:YES interactionStartedHandler:^() {
-    } interactionChangedHandler:^() {
-    } interactionStoppedHandler:^() {
-    }];
-
-    [_currentActionContext setHighlightFrame:[_wkView.window convertRectToScreen:[_wkView convertRect:_hitTestResultData.detectedDataBoundingBox toView:nil]]];
-
-    return [[getDDActionsManagerClass() sharedManager] menuItemsForTargetURL:hitTestResult->absoluteLinkURL() actionContext:_currentActionContext.get()];
-}
-
-#pragma mark NSMenuDelegate implementation
-
-- (void)menuNeedsUpdate:(NSMenu *)menu
-{
-    if (menu != _wkView._actionMenu)
-        return;
-
-    ASSERT(_state != ActionMenuState::None);
-
-    // FIXME: We need to be able to cancel this if the menu goes away.
-    // FIXME: Connection can be null if the process is closed; we should clean up better in that case.
-    if (_state == ActionMenuState::Pending) {
-        if (auto* connection = _page->process().connection()) {
-            bool receivedReply = connection->waitForAndDispatchImmediately<Messages::WebPageProxy::DidPerformActionMenuHitTest>(_page->pageID(), std::chrono::milliseconds(500));
-            if (!receivedReply)
-                _state = ActionMenuState::TimedOut;
-        }
-    }
-
-    if (_state != ActionMenuState::Ready)
-        [self _updateActionMenuItems];
-
-    if (_currentActionContext) {
-        _hasActivatedActionContext = YES;
-        if (![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()]) {
-            [menu cancelTracking];
-            [menu removeAllItems];
-        }
-    }
-}
-
-#pragma mark NSSharingServicePickerDelegate implementation
-
-- (NSArray *)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker sharingServicesForItems:(NSArray *)items mask:(NSSharingServiceMask)mask proposedSharingServices:(NSArray *)proposedServices
-{
-    RetainPtr<NSMutableArray> services = adoptNS([[NSMutableArray alloc] initWithCapacity:proposedServices.count]);
-
-    for (NSSharingService *service in proposedServices) {
-        if ([service.name isEqualToString:NSSharingServiceNameAddToIPhoto])
-            continue;
-        [services addObject:service];
-    }
-
-    return services.autorelease();
-}
-
-- (id <NSSharingServiceDelegate>)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker delegateForSharingService:(NSSharingService *)sharingService
-{
-    return self;
-}
-
-#pragma mark NSSharingServiceDelegate implementation
-
-- (NSWindow *)sharingService:(NSSharingService *)sharingService sourceWindowForShareItems:(NSArray *)items sharingContentScope:(NSSharingContentScope *)sharingContentScope
-{
-    return _wkView.window;
-}
-
-#pragma mark Menu Items
-
-- (RetainPtr<NSMenuItem>)_createActionMenuItemForTag:(uint32_t)tag
-{
-    SEL selector = nullptr;
-    NSString *title = nil;
-    NSImage *image = nil;
-    bool enabled = true;
-    RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult];
-
-    switch (tag) {
-    case kWKContextActionItemTagOpenLinkInDefaultBrowser:
-        selector = @selector(_openURLFromActionMenu:);
-        title = WEB_UI_STRING_KEY("Open", "Open (action menu item)", "action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuOpenInNewWindow"];
-        break;
-
-    case kWKContextActionItemTagPreviewLink:
-        ASSERT_NOT_REACHED();
-        break;
-
-    case kWKContextActionItemTagAddLinkToSafariReadingList:
-        selector = @selector(_addToReadingListFromActionMenu:);
-        title = WEB_UI_STRING_KEY("Add to Reading List", "Add to Reading List (action menu item)", "action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuAddToReadingList"];
-        break;
-
-    case kWKContextActionItemTagCopyImage:
-        selector = @selector(_copyImage:);
-        title = WEB_UI_STRING_KEY("Copy", "Copy (image action menu item)", "image action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuCopy"];
-        break;
-
-    case kWKContextActionItemTagAddImageToPhotos:
-        selector = @selector(_addImageToPhotos:);
-        title = WEB_UI_STRING_KEY("Add to Photos", "Add to Photos (action menu item)", "action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuAddToPhotos"];
-        break;
-
-    case kWKContextActionItemTagSaveImageToDownloads:
-        selector = @selector(_saveImageToDownloads:);
-        title = WEB_UI_STRING_KEY("Save to Downloads", "Save to Downloads (image action menu item)", "image action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuSaveToDownloads"];
-        enabled = !WebCore::protocolIs(hitTestResult->absoluteImageURL(), "file");
-        break;
-
-    case kWKContextActionItemTagCopyText:
-        selector = @selector(_copySelection:);
-        title = WEB_UI_STRING_KEY("Copy", "Copy (text action menu item)", "text action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuCopy"];
-        enabled = hitTestResult->allowsCopy();
-        break;
-
-    case kWKContextActionItemTagPaste:
-        selector = @selector(_paste:);
-        title = WEB_UI_STRING_KEY("Paste", "Paste (action menu item)", "action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuPaste"];
-        break;
-
-    case kWKContextActionItemTagTextSuggestions:
-        title = WEB_UI_STRING_KEY("Suggestions", "Suggestions (action menu item)", "action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuSpelling"];
-        break;
-
-    case kWKContextActionItemTagCopyVideoURL:
-        selector = @selector(_copyVideoURL:);
-        title = WEB_UI_STRING_KEY("Copy", "Copy (video action menu item)", "video action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuCopy"];
-        break;
-
-    case kWKContextActionItemTagSaveVideoToDownloads:
-        selector = @selector(_saveVideoToDownloads:);
-        title = WEB_UI_STRING_KEY("Save to Downloads", "Save to Downloads (video action menu item)", "video action menu item");
-        image = [NSImage imageNamed:@"NSActionMenuSaveToDownloads"];
-        enabled = !WebCore::protocolIs(hitTestResult->absoluteMediaURL(), "file") && hitTestResult->isDownloadableMedia();
-        break;
-
-    default:
-        ASSERT_NOT_REACHED();
-        return nil;
-    }
-
-    RetainPtr<NSMenuItem> item = adoptNS([[NSMenuItem alloc] initWithTitle:title action:selector keyEquivalent:@""]);
-    [item setImage:image];
-    [item setTarget:self];
-    [item setTag:tag];
-    [item setEnabled:enabled];
-    return item;
-}
-
-- (RetainPtr<NSMenuItem>)_createShareActionMenuItemForTag:(uint32_t)tag withItems:(NSArray *)items
-{
-    RetainPtr<NSMenuItem> shareItem = [NSMenuItem standardShareMenuItemWithItems:items];
-    [shareItem setTag:tag];
-
-    NSSharingServicePicker *sharingServicePicker = [shareItem representedObject];
-    sharingServicePicker.delegate = self;
-
-    return shareItem;
-}
-
-- (PassRefPtr<WebHitTestResult>)_webHitTestResult
-{
-    RefPtr<WebHitTestResult> hitTestResult;
-    if (_state == ActionMenuState::Ready)
-        hitTestResult = WebHitTestResult::create(_hitTestResultData);
-    else
-        hitTestResult = _page->lastMouseMoveHitTestResult();
-
-    return hitTestResult.release();
-}
-
-- (NSArray *)_defaultMenuItems
-{
-    RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult];
-    if (!hitTestResult) {
-        _type = kWKActionMenuNone;
-        return _state == ActionMenuState::Pending ? @[ [NSMenuItem separatorItem] ] : @[ ];
-    }
-
-    String absoluteLinkURL = hitTestResult->absoluteLinkURL();
-    if (!absoluteLinkURL.isEmpty()) {
-        if (WebCore::protocolIsInHTTPFamily(absoluteLinkURL)) {
-            _type = kWKActionMenuLink;
-            return [self _defaultMenuItemsForLink];
-        }
-
-        if (protocolIs(absoluteLinkURL, "mailto")) {
-            _type = kWKActionMenuMailtoLink;
-            return [self _defaultMenuItemsForDataDetectableLink];
-        }
-
-        if (protocolIs(absoluteLinkURL, "tel")) {
-            _type = kWKActionMenuTelLink;
-            return [self _defaultMenuItemsForDataDetectableLink];
-        }
-    }
-
-    if (!hitTestResult->absoluteMediaURL().isEmpty()) {
-        _type = kWKActionMenuVideo;
-        return [self _defaultMenuItemsForVideo];
-    }
-
-    if (!hitTestResult->absoluteImageURL().isEmpty() && _hitTestResultData.imageSharedMemory && !_hitTestResultData.imageExtension.isEmpty()) {
-        _type = kWKActionMenuImage;
-        return [self _defaultMenuItemsForImage];
-    }
-
-    if (hitTestResult->isTextNode() || hitTestResult->isOverTextInsideFormControlElement()) {
-        NSArray *dataDetectorMenuItems = [self _defaultMenuItemsForDataDetectedText];
-        if (_currentActionContext) {
-            // If this is a data detected item with no menu items, we should not fall back to regular text options.
-            if (!dataDetectorMenuItems.count) {
-                _type = kWKActionMenuNone;
-                return @[ ];
-            }
-            _type = kWKActionMenuDataDetectedItem;
-            return dataDetectorMenuItems;
-        }
-
-        if (hitTestResult->isContentEditable()) {
-            NSArray *editableTextWithSuggestions = [self _defaultMenuItemsForEditableTextWithSuggestions];
-            if (editableTextWithSuggestions.count) {
-                _type = kWKActionMenuEditableTextWithSuggestions;
-                return editableTextWithSuggestions;
-            }
-
-            _type = kWKActionMenuEditableText;
-            return [self _defaultMenuItemsForEditableText];
-        }
-
-        _type = kWKActionMenuReadOnlyText;
-        return [self _defaultMenuItemsForText];
-    }
-
-    if (hitTestResult->isContentEditable()) {
-        _type = kWKActionMenuWhitespaceInEditableArea;
-        return [self _defaultMenuItemsForWhitespaceInEditableArea];
-    }
-
-    if (hitTestResult->isSelected()) {
-        // A selection should present the read-only text menu. It might make more sense to present a new
-        // type of menu with just copy, but for the time being, we should stay consistent with text.
-        _type = kWKActionMenuReadOnlyText;
-        return [self _defaultMenuItemsForText];
-    }
-
-    _type = kWKActionMenuNone;
-    return _state == ActionMenuState::Pending ? @[ [NSMenuItem separatorItem] ] : @[ ];
-}
-
-- (void)_updateActionMenuItems
-{
-    [_wkView._actionMenu removeAllItems];
-
-    NSArray *menuItems = [self _defaultMenuItems];
-    RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult];
-
-    if ([_wkView respondsToSelector:@selector(_actionMenuItemsForHitTestResult:defaultActionMenuItems:)])
-        menuItems = [_wkView _actionMenuItemsForHitTestResult:toAPI(hitTestResult.get()) defaultActionMenuItems:menuItems];
-    else
-        menuItems = [_wkView _actionMenuItemsForHitTestResult:toAPI(hitTestResult.get()) withType:_type defaultActionMenuItems:menuItems userData:toAPI(_userData.get())];
-
-    for (NSMenuItem *item in menuItems)
-        [_wkView._actionMenu addItem:item];
-
-    if (!_wkView._actionMenu.numberOfItems)
-        [_wkView._actionMenu cancelTracking];
-}
-
-@end
-
-#endif // PLATFORM(MAC)
index 255e3dc..4067659 100644 (file)
@@ -69,7 +69,7 @@ enum class ImmediateActionState {
 
 - (instancetype)initWithPage:(WebKit::WebPageProxy&)page view:(WKView *)wkView recognizer:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer;
 - (void)willDestroyView:(WKView *)view;
-- (void)didPerformActionMenuHitTest:(const WebKit::WebHitTestResult::Data&)hitTestResult contentPreventsDefault:(BOOL)contentPreventsDefault userData:(API::Object*)userData;
+- (void)didPerformImmediateActionHitTest:(const WebKit::WebHitTestResult::Data&)hitTestResult contentPreventsDefault:(BOOL)contentPreventsDefault userData:(API::Object*)userData;
 - (void)dismissContentRelativeChildWindows;
 - (BOOL)hasActiveImmediateAction;
 
index 4436551..d6e6672 100644 (file)
@@ -131,7 +131,7 @@ using namespace WebKit;
     _hasActiveImmediateAction = NO;
 }
 
-- (void)didPerformActionMenuHitTest:(const WebHitTestResult::Data&)hitTestResult contentPreventsDefault:(BOOL)contentPreventsDefault userData:(API::Object*)userData
+- (void)didPerformImmediateActionHitTest:(const WebHitTestResult::Data&)hitTestResult contentPreventsDefault:(BOOL)contentPreventsDefault userData:(API::Object*)userData
 {
     // If we've already given up on this gesture (either because it was canceled or the
     // willBeginAnimation timeout expired), we shouldn't build a new animationController for it.
@@ -172,7 +172,7 @@ using namespace WebKit;
 
     _page->setMaintainsInactiveSelection(true);
 
-    _page->performActionMenuHitTestAtLocation([immediateActionRecognizer locationInView:immediateActionRecognizer.view], true);
+    _page->performImmediateActionHitTestAtLocation([immediateActionRecognizer locationInView:immediateActionRecognizer.view]);
 
     _state = ImmediateActionState::Pending;
     immediateActionRecognizer.animationController = nil;
@@ -192,7 +192,7 @@ using namespace WebKit;
     // FIXME: Connection can be null if the process is closed; we should clean up better in that case.
     if (_state == ImmediateActionState::Pending) {
         if (auto* connection = _page->process().connection()) {
-            bool receivedReply = connection->waitForAndDispatchImmediately<Messages::WebPageProxy::DidPerformActionMenuHitTest>(_page->pageID(), std::chrono::milliseconds(500));
+            bool receivedReply = connection->waitForAndDispatchImmediately<Messages::WebPageProxy::DidPerformImmediateActionHitTest>(_page->pageID(), std::chrono::milliseconds(500));
             if (!receivedReply)
                 _state = ImmediateActionState::TimedOut;
         }
index 62ebbcd..979ad18 100644 (file)
                29CD55AB128E294F00133C85 /* WKAccessibilityWebPageObjectBase.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29CD55A9128E294F00133C85 /* WKAccessibilityWebPageObjectBase.mm */; };
                29D55DF1161BF9F10031A2E3 /* WebPageGroupProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29D55DEF161BF9F10031A2E3 /* WebPageGroupProxyMessageReceiver.cpp */; };
                29D55DF2161BF9F10031A2E3 /* WebPageGroupProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 29D55DF0161BF9F10031A2E3 /* WebPageGroupProxyMessages.h */; };
-               2D0730A219F9C7DA00E9D9C4 /* WKActionMenuController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D0730A019F9C7DA00E9D9C4 /* WKActionMenuController.mm */; };
-               2D0730A319F9C7DA00E9D9C4 /* WKActionMenuController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D0730A119F9C7DA00E9D9C4 /* WKActionMenuController.h */; };
                2D125C5E1857EA05003BA3CB /* ViewGestureController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D125C5C1857EA05003BA3CB /* ViewGestureController.h */; };
                2D125C5F1857EA05003BA3CB /* ViewGestureControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D125C5D1857EA05003BA3CB /* ViewGestureControllerMac.mm */; };
                2D1B5D5D185869C8006C6596 /* ViewGestureControllerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D1B5D5B185869C8006C6596 /* ViewGestureControllerMessageReceiver.cpp */; };
                29D55DEE161BF8780031A2E3 /* WebPageGroupProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebPageGroupProxy.messages.in; sourceTree = "<group>"; };
                29D55DEF161BF9F10031A2E3 /* WebPageGroupProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageGroupProxyMessageReceiver.cpp; sourceTree = "<group>"; };
                29D55DF0161BF9F10031A2E3 /* WebPageGroupProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageGroupProxyMessages.h; sourceTree = "<group>"; };
-               2D0730A019F9C7DA00E9D9C4 /* WKActionMenuController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKActionMenuController.mm; sourceTree = "<group>"; };
-               2D0730A119F9C7DA00E9D9C4 /* WKActionMenuController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKActionMenuController.h; sourceTree = "<group>"; };
                2D125C5C1857EA05003BA3CB /* ViewGestureController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewGestureController.h; sourceTree = "<group>"; };
                2D125C5D1857EA05003BA3CB /* ViewGestureControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewGestureControllerMac.mm; sourceTree = "<group>"; };
                2D1B5D5A18586599006C6596 /* ViewGestureController.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = ViewGestureController.messages.in; sourceTree = "<group>"; };
                                51D130571382F10500351EDD /* WebProcessProxyMac.mm */,
                                868160CD18763D4B0021E79D /* WindowServerConnection.h */,
                                868160CF187645370021E79D /* WindowServerConnection.mm */,
-                               2D0730A119F9C7DA00E9D9C4 /* WKActionMenuController.h */,
-                               2D0730A019F9C7DA00E9D9C4 /* WKActionMenuController.mm */,
                                E1AEA22D14687BDB00804569 /* WKFullKeyboardAccessWatcher.h */,
                                E1AEA22E14687BDB00804569 /* WKFullKeyboardAccessWatcher.mm */,
                                CDCA85C7132ABA4E00E961DF /* WKFullScreenWindowController.h */,
                                3F889D15188778C900FEADAF /* WebVideoFullscreenManagerProxy.h in Headers */,
                                29CD55AA128E294F00133C85 /* WKAccessibilityWebPageObjectBase.h in Headers */,
                                29232DF418B29D6800D0596F /* WKAccessibilityWebPageObjectMac.h in Headers */,
-                               2D0730A319F9C7DA00E9D9C4 /* WKActionMenuController.h in Headers */,
                                934B724419F5B9BE00AE96D6 /* WKActionMenuItemTypes.h in Headers */,
                                939F401C19FB0BBC002B2B42 /* WKActionMenuTypes.h in Headers */,
                                0FCB4E4818BBE044000FCFC9 /* WKActionSheet.h in Headers */,
                                29CD55AB128E294F00133C85 /* WKAccessibilityWebPageObjectBase.mm in Sources */,
                                29232DF818B2A9AE00D0596F /* WKAccessibilityWebPageObjectIOS.mm in Sources */,
                                29232DF918B2AB3A00D0596F /* WKAccessibilityWebPageObjectMac.mm in Sources */,
-                               2D0730A219F9C7DA00E9D9C4 /* WKActionMenuController.mm in Sources */,
                                0FCB4E4918BBE044000FCFC9 /* WKActionSheet.mm in Sources */,
                                0FCB4E4B18BBE044000FCFC9 /* WKActionSheetAssistant.mm in Sources */,
                                C5FA1ED418E1062200B3F402 /* WKAirPlayRoutePicker.mm in Sources */,
index 948317f..7962483 100644 (file)
@@ -52,7 +52,7 @@ public:
     virtual ~PageContextMenuClient() { }
 
     virtual bool getCustomMenuFromDefaultItems(WebKit::WebPage&, const WebCore::HitTestResult&, const Vector<WebCore::ContextMenuItem>& /* defaultMenu */, Vector<WebKit::WebContextMenuItemData>& /* newMenu */, RefPtr<API::Object>& /* userData */) { return false; }
-    virtual void prepareForActionMenu(WebKit::WebPage&, const WebCore::HitTestResult&, RefPtr<API::Object>& /* userData */) { }
+    virtual void prepareForImmediateAction(WebKit::WebPage&, const WebCore::HitTestResult&, RefPtr<API::Object>& /* userData */) { }
 };
 
 } // namespace InjectedBundle
index a17c478..83fe62e 100644 (file)
@@ -46,6 +46,8 @@ typedef struct WKBundlePageContextMenuClientV1 {
     WKBundlePageContextMenuClientBase                                   base;
 
     WKBundlePageGetContextMenuFromDefaultContextMenuCallback            getContextMenuFromDefaultMenu;
+
+    // This is actually about immediate actions; we should consider deprecating and renaming.
     WKBundlePagePrepareForActionMenuCallback                            prepareForActionMenu;
 } WKBundlePageContextMenuClientV1;
 
index a8ac692..bff6400 100644 (file)
@@ -44,7 +44,7 @@
 namespace API {
 
 template<> struct ClientTraits<WKBundlePageOverlayClientBase> {
-    typedef std::tuple<WKBundlePageOverlayClientV0, WKBundlePageOverlayClientV1, WKBundlePageOverlayClientV2> Versions;
+    typedef std::tuple<WKBundlePageOverlayClientV0, WKBundlePageOverlayClientV1> Versions;
 };
 
 template<> struct ClientTraits<WKBundlePageOverlayAccessibilityClientBase> {
@@ -135,21 +135,11 @@ private:
     }
 
 #if PLATFORM(MAC)
-    virtual DDActionContext *actionContextForResultAtPoint(WebPageOverlay& pageOverlay, WebCore::FloatPoint location, RefPtr<WebCore::Range>& rangeHandle, bool forImmediateAction) override
+    virtual DDActionContext *actionContextForResultAtPoint(WebPageOverlay& pageOverlay, WebCore::FloatPoint location, RefPtr<WebCore::Range>& rangeHandle) override
     {
         if (m_client.actionContextForResultAtPoint) {
             WKBundleRangeHandleRef apiRange = nullptr;
-            DDActionContext *actionContext = (DDActionContext *)m_client.actionContextForResultAtPoint(toAPI(&pageOverlay), WKPointMake(location.x(), location.y()), &apiRange, forImmediateAction ? kWKBundlePageOverlayActionContextForImmediateActionRequestType : kWKBundlePageOverlayActionContextForActionMenuRequestType, m_client.base.clientInfo);
-
-            if (apiRange)
-                rangeHandle = toImpl(apiRange)->coreRange();
-
-            return actionContext;
-        }
-
-        if (m_client.actionContextForResultAtPoint_deprecatedForUseWithV1) {
-            WKBundleRangeHandleRef apiRange = nullptr;
-            DDActionContext *actionContext = (DDActionContext *)m_client.actionContextForResultAtPoint_deprecatedForUseWithV1(toAPI(&pageOverlay), WKPointMake(location.x(), location.y()), &apiRange, m_client.base.clientInfo);
+            DDActionContext *actionContext = (DDActionContext *)m_client.actionContextForResultAtPoint(toAPI(&pageOverlay), WKPointMake(location.x(), location.y()), &apiRange, m_client.base.clientInfo);
 
             if (apiRange)
                 rangeHandle = toImpl(apiRange)->coreRange();
index fcfbb20..bedebd7 100644 (file)
 extern "C" {
 #endif
 
-enum {
-    kWKBundlePageOverlayActionContextForActionMenuRequestType = 0,
-    kWKBundlePageOverlayActionContextForImmediateActionRequestType,
-};
-typedef uint32_t _WKBundlePageOverlayActionContextRequestType;
-
 // Page overlay client.
 typedef void (*WKBundlePageOverlayWillMoveToPageCallback)(WKBundlePageOverlayRef pageOverlay, WKBundlePageRef page, const void* clientInfo);
 typedef void (*WKBundlePageOverlayDidMoveToPageCallback)(WKBundlePageOverlayRef pageOverlay, WKBundlePageRef page, const void* clientInfo);
@@ -55,8 +49,7 @@ typedef bool (*WKBundlePageOverlayMouseUpCallback)(WKBundlePageOverlayRef pageOv
 typedef bool (*WKBundlePageOverlayMouseMovedCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, const void* clientInfo);
 typedef bool (*WKBundlePageOverlayMouseDraggedCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, WKEventMouseButton mouseButton, const void* clientInfo);
 
-typedef void* (*WKBundlePageOverlayActionContextForResultAtPointCallback_deprecatedForUseWithV1)(WKBundlePageOverlayRef pageOverlay, WKPoint position, WKBundleRangeHandleRef* rangeHandle, const void* clientInfo);
-typedef void* (*WKBundlePageOverlayActionContextForResultAtPointCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, WKBundleRangeHandleRef* rangeHandle, _WKBundlePageOverlayActionContextRequestType requestType, const void* clientInfo);
+typedef void* (*WKBundlePageOverlayActionContextForResultAtPointCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, WKBundleRangeHandleRef* rangeHandle, const void* clientInfo);
 typedef void (*WKBundlePageOverlayDataDetectorsDidPresentUI)(WKBundlePageOverlayRef pageOverlay, const void* clientInfo);
 typedef void (*WKBundlePageOverlayDataDetectorsDidChangeUI)(WKBundlePageOverlayRef pageOverlay, const void* clientInfo);
 typedef void (*WKBundlePageOverlayDataDetectorsDidHideUI)(WKBundlePageOverlayRef pageOverlay, const void* clientInfo);
@@ -95,25 +88,6 @@ typedef struct WKBundlePageOverlayClientV1 {
     WKBundlePageOverlayDataDetectorsDidHideUI                           dataDetectorsDidHideUI;
 } WKBundlePageOverlayClientV1;
 
-typedef struct WKBundlePageOverlayClientV2 {
-    WKBundlePageOverlayClientBase                                       base;
-
-    WKBundlePageOverlayWillMoveToPageCallback                           willMoveToPage;
-    WKBundlePageOverlayDidMoveToPageCallback                            didMoveToPage;
-    WKBundlePageOverlayDrawRectCallback                                 drawRect;
-    WKBundlePageOverlayMouseDownCallback                                mouseDown;
-    WKBundlePageOverlayMouseUpCallback                                  mouseUp;
-    WKBundlePageOverlayMouseMovedCallback                               mouseMoved;
-    WKBundlePageOverlayMouseDraggedCallback                             mouseDragged;
-
-    WKBundlePageOverlayActionContextForResultAtPointCallback_deprecatedForUseWithV1 actionContextForResultAtPoint_deprecatedForUseWithV1;
-    WKBundlePageOverlayDataDetectorsDidPresentUI                        dataDetectorsDidPresentUI;
-    WKBundlePageOverlayDataDetectorsDidChangeUI                         dataDetectorsDidChangeUI;
-    WKBundlePageOverlayDataDetectorsDidHideUI                           dataDetectorsDidHideUI;
-
-    WKBundlePageOverlayActionContextForResultAtPointCallback            actionContextForResultAtPoint;
-} WKBundlePageOverlayClientV2;
-
 enum { kWKBundlePageOverlayClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 0 };
 typedef struct WKBundlePageOverlayClient {
     int                                                                 version;
index 6b710c1..e80b2ce 100644 (file)
@@ -83,7 +83,7 @@ bool InjectedBundlePageContextMenuClient::getCustomMenuFromDefaultItems(WebPage&
     return true;
 }
 
-void InjectedBundlePageContextMenuClient::prepareForActionMenu(WebPage& page, const HitTestResult& hitTestResult, RefPtr<API::Object>& userData)
+void InjectedBundlePageContextMenuClient::prepareForImmediateAction(WebPage& page, const HitTestResult& hitTestResult, RefPtr<API::Object>& userData)
 {
     if (!m_client.prepareForActionMenu)
         return;
index 3402346..9a3263a 100644 (file)
@@ -55,7 +55,7 @@ public:
 
 private:
     bool getCustomMenuFromDefaultItems(WebPage&, const WebCore::HitTestResult&, const Vector<WebCore::ContextMenuItem>& defaultMenu, Vector<WebContextMenuItemData>& newMenu, RefPtr<API::Object>& userData) override;
-    void prepareForActionMenu(WebPage&, const WebCore::HitTestResult&, RefPtr<API::Object>& userData) override;
+    void prepareForImmediateAction(WebPage&, const WebCore::HitTestResult&, RefPtr<API::Object>& userData) override;
 };
 
 } // namespace WebKit
index 5ef9eb2..00073d9 100644 (file)
@@ -1102,10 +1102,8 @@ private:
     void reportUsedFeatures();
 
 #if PLATFORM(MAC)
-    void performActionMenuHitTestAtLocation(WebCore::FloatPoint, bool forImmediateAction);
+    void performImmediateActionHitTestAtLocation(WebCore::FloatPoint);
     PassRefPtr<WebCore::Range> lookupTextAtLocation(WebCore::FloatPoint, NSDictionary **options);
-    void selectLastActionMenuRange();
-    void focusAndSelectLastActionMenuHitTestResult();
     void immediateActionDidUpdate();
     void immediateActionDidCancel();
     void immediateActionDidComplete();
@@ -1366,12 +1364,6 @@ private:
     WebCore::WebGLLoadPolicy m_systemWebGLPolicy;
 #endif
 
-#if PLATFORM(MAC)
-    RefPtr<WebCore::Range> m_lastActionMenuRangeForSelection;
-    WebCore::HitTestResult m_lastActionMenuHitTestResult;
-    RefPtr<WebPageOverlay> m_lastActionMenuHitPageOverlay;
-#endif
-
     bool m_mainFrameProgressCompleted;
     bool m_shouldDispatchFakeMouseMoveEvents;
     bool m_isEditorStateMissingPostLayoutData { false };
index 9077d30..9aff8f2 100644 (file)
@@ -410,9 +410,7 @@ messages -> WebPage LegacyReceiver {
     
     TakeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, uint64_t callbackID)
 #if PLATFORM(MAC)
-    PerformActionMenuHitTestAtLocation(WebCore::FloatPoint location, bool forImmediateAction)
-    SelectLastActionMenuRange()
-    FocusAndSelectLastActionMenuHitTestResult()
+    PerformImmediateActionHitTestAtLocation(WebCore::FloatPoint location)
     ImmediateActionDidUpdate()
     ImmediateActionDidCancel()
     ImmediateActionDidComplete()
index 4052030..9e4086e 100644 (file)
@@ -120,9 +120,9 @@ void WebPageOverlay::didScrollFrame(PageOverlay&, Frame& frame)
 }
 
 #if PLATFORM(MAC)
-DDActionContext *WebPageOverlay::actionContextForResultAtPoint(FloatPoint location, RefPtr<WebCore::Range>& rangeHandle, bool forImmediateAction)
+DDActionContext *WebPageOverlay::actionContextForResultAtPoint(FloatPoint location, RefPtr<WebCore::Range>& rangeHandle)
 {
-    return m_client->actionContextForResultAtPoint(*this, location, rangeHandle, forImmediateAction);
+    return m_client->actionContextForResultAtPoint(*this, location, rangeHandle);
 }
 
 void WebPageOverlay::dataDetectorsDidPresentUI()
index cf76ef0..fbbe62a 100644 (file)
@@ -55,7 +55,7 @@ public:
         virtual void didScrollFrame(WebPageOverlay&, WebFrame*) { }
 
 #if PLATFORM(MAC)
-        virtual DDActionContext *actionContextForResultAtPoint(WebPageOverlay&, WebCore::FloatPoint location, RefPtr<WebCore::Range>& rangeHandle, bool forImmediateAction) { return nullptr; }
+        virtual DDActionContext *actionContextForResultAtPoint(WebPageOverlay&, WebCore::FloatPoint location, RefPtr<WebCore::Range>& rangeHandle) { return nullptr; }
         virtual void dataDetectorsDidPresentUI(WebPageOverlay&) { }
         virtual void dataDetectorsDidChangeUI(WebPageOverlay&) { }
         virtual void dataDetectorsDidHideUI(WebPageOverlay&) { }
@@ -79,7 +79,7 @@ public:
     Client& client() const { return *m_client; }
 
 #if PLATFORM(MAC)
-    DDActionContext *actionContextForResultAtPoint(WebCore::FloatPoint, RefPtr<WebCore::Range>&, bool forImmediateAction);
+    DDActionContext *actionContextForResultAtPoint(WebCore::FloatPoint, RefPtr<WebCore::Range>&);
     void dataDetectorsDidPresentUI();
     void dataDetectorsDidChangeUI();
     void dataDetectorsDidHideUI();
index 0859cb3..93fa60e 100644 (file)
@@ -1062,46 +1062,41 @@ String WebPage::platformUserAgent(const URL&) const
     return String();
 }
 
-static TextIndicatorPresentationTransition textIndicatorTransitionForActionMenu(Range* selectionRange, Range& indicatorRange, bool forImmediateAction, bool forDataDetectors)
+static TextIndicatorPresentationTransition textIndicatorTransitionForImmediateAction(Range* selectionRange, Range& indicatorRange, bool forDataDetectors)
 {
-    if (areRangesEqual(&indicatorRange, selectionRange) || (forDataDetectors && !forImmediateAction))
-        return forImmediateAction ? TextIndicatorPresentationTransition::Crossfade : TextIndicatorPresentationTransition::BounceAndCrossfade;
-    return forImmediateAction ? TextIndicatorPresentationTransition::FadeIn : TextIndicatorPresentationTransition::Bounce;
+    if (areRangesEqual(&indicatorRange, selectionRange))
+        return TextIndicatorPresentationTransition::Crossfade;
+    return TextIndicatorPresentationTransition::FadeIn;
 }
 
 #if ENABLE(PDFKIT_PLUGIN)
-static TextIndicatorPresentationTransition textIndicatorTransitionForActionMenu(bool forImmediateAction, bool forDataDetectors)
+static TextIndicatorPresentationTransition textIndicatorTransitionForImmediateAction()
 {
-    if (forDataDetectors && !forImmediateAction)
-        return forImmediateAction ? TextIndicatorPresentationTransition::Crossfade : TextIndicatorPresentationTransition::BounceAndCrossfade;
-    return forImmediateAction ? TextIndicatorPresentationTransition::FadeIn : TextIndicatorPresentationTransition::Bounce;
+    return TextIndicatorPresentationTransition::FadeIn;
 }
 #endif
 
-void WebPage::performActionMenuHitTestAtLocation(WebCore::FloatPoint locationInViewCoordinates, bool forImmediateAction)
+void WebPage::performImmediateActionHitTestAtLocation(WebCore::FloatPoint locationInViewCoordinates)
 {
     layoutIfNeeded();
 
     MainFrame& mainFrame = corePage()->mainFrame();
     if (!mainFrame.view() || !mainFrame.view()->renderView()) {
-        send(Messages::WebPageProxy::DidPerformActionMenuHitTest(WebHitTestResult::Data(), forImmediateAction, false, UserData()));
+        send(Messages::WebPageProxy::DidPerformImmediateActionHitTest(WebHitTestResult::Data(), false, UserData()));
         return;
     }
 
     IntPoint locationInContentCoordinates = mainFrame.view()->rootViewToContents(roundedIntPoint(locationInViewCoordinates));
     HitTestResult hitTestResult = mainFrame.eventHandler().hitTestResultAtPoint(locationInContentCoordinates);
 
-    bool actionMenuHitTestPreventsDefault = false;
+    bool immediateActionHitTestPreventsDefault = false;
     Element* element = hitTestResult.innerElement();
 
-    if (forImmediateAction) {
-        mainFrame.eventHandler().setImmediateActionStage(ImmediateActionStage::PerformedHitTest);
-        if (element)
-            actionMenuHitTestPreventsDefault = element->dispatchMouseForceWillBegin();
-    }
+    mainFrame.eventHandler().setImmediateActionStage(ImmediateActionStage::PerformedHitTest);
+    if (element)
+        immediateActionHitTestPreventsDefault = element->dispatchMouseForceWillBegin();
 
-    WebHitTestResult::Data actionMenuResult(hitTestResult, !forImmediateAction);
-    actionMenuResult.hitTestLocationInViewCoordinates = locationInViewCoordinates;
+    WebHitTestResult::Data immediateActionResult(hitTestResult);
 
     RefPtr<Range> selectionRange = corePage()->focusController().focusedOrMainFrame().selection().selection().firstRange();
 
@@ -1109,23 +1104,20 @@ void WebPage::performActionMenuHitTestAtLocation(WebCore::FloatPoint locationInV
     Element *URLElement = hitTestResult.URLElement();
     if (!absoluteLinkURL.isEmpty() && URLElement) {
         RefPtr<Range> linkRange = rangeOfContents(*URLElement);
-        actionMenuResult.linkTextIndicator = TextIndicator::createWithRange(*linkRange, textIndicatorTransitionForActionMenu(selectionRange.get(), *linkRange, forImmediateAction, false));
+        immediateActionResult.linkTextIndicator = TextIndicator::createWithRange(*linkRange, textIndicatorTransitionForImmediateAction(selectionRange.get(), *linkRange, false));
     }
 
     NSDictionary *options = nil;
     RefPtr<Range> lookupRange = lookupTextAtLocation(locationInViewCoordinates, &options);
-    actionMenuResult.lookupText = lookupRange ? lookupRange->text() : String();
+    immediateActionResult.lookupText = lookupRange ? lookupRange->text() : String();
 
     if (lookupRange) {
         if (Node* node = hitTestResult.innerNode()) {
             if (Frame* hitTestResultFrame = node->document().frame())
-                actionMenuResult.dictionaryPopupInfo = dictionaryPopupInfoForRange(hitTestResultFrame, *lookupRange.get(), &options, textIndicatorTransitionForActionMenu(selectionRange.get(), *lookupRange, forImmediateAction, false));
+                immediateActionResult.dictionaryPopupInfo = dictionaryPopupInfoForRange(hitTestResultFrame, *lookupRange.get(), &options, textIndicatorTransitionForImmediateAction(selectionRange.get(), *lookupRange, false));
         }
     }
 
-    m_lastActionMenuRangeForSelection = lookupRange;
-    m_lastActionMenuHitTestResult = hitTestResult;
-
     bool pageOverlayDidOverrideDataDetectors = false;
     for (const auto& overlay : mainFrame.pageOverlayController().pageOverlays()) {
         WebPageOverlay* webOverlay = WebPageOverlay::fromCoreOverlay(*overlay);
@@ -1133,12 +1125,12 @@ void WebPage::performActionMenuHitTestAtLocation(WebCore::FloatPoint locationInV
             continue;
 
         RefPtr<Range> mainResultRange;
-        DDActionContext *actionContext = webOverlay->actionContextForResultAtPoint(locationInContentCoordinates, mainResultRange, forImmediateAction);
+        DDActionContext *actionContext = webOverlay->actionContextForResultAtPoint(locationInContentCoordinates, mainResultRange);
         if (!actionContext || !mainResultRange)
             continue;
 
         pageOverlayDidOverrideDataDetectors = true;
-        actionMenuResult.detectedDataActionContext = actionContext;
+        immediateActionResult.detectedDataActionContext = actionContext;
 
         Vector<FloatQuad> quads;
         mainResultRange->textQuads(quads);
@@ -1147,10 +1139,9 @@ void WebPage::performActionMenuHitTestAtLocation(WebCore::FloatPoint locationInV
         for (const auto& quad : quads)
             detectedDataBoundingBox.unite(frameView->contentsToWindow(quad.enclosingBoundingBox()));
 
-        actionMenuResult.detectedDataBoundingBox = detectedDataBoundingBox;
-        actionMenuResult.detectedDataTextIndicator = TextIndicator::createWithRange(*mainResultRange, textIndicatorTransitionForActionMenu(selectionRange.get(), *mainResultRange, forImmediateAction, true));
-        actionMenuResult.detectedDataOriginatingPageOverlay = overlay->pageOverlayID();
-        m_lastActionMenuRangeForSelection = mainResultRange;
+        immediateActionResult.detectedDataBoundingBox = detectedDataBoundingBox;
+        immediateActionResult.detectedDataTextIndicator = TextIndicator::createWithRange(*mainResultRange, textIndicatorTransitionForImmediateAction(selectionRange.get(), *mainResultRange, true));
+        immediateActionResult.detectedDataOriginatingPageOverlay = overlay->pageOverlayID();
 
         break;
     }
@@ -1159,11 +1150,10 @@ void WebPage::performActionMenuHitTestAtLocation(WebCore::FloatPoint locationInV
     if (!pageOverlayDidOverrideDataDetectors && hitTestResult.innerNode() && hitTestResult.innerNode()->isTextNode()) {
         FloatRect detectedDataBoundingBox;
         RefPtr<Range> detectedDataRange;
-        actionMenuResult.detectedDataActionContext = DataDetection::detectItemAroundHitTestResult(hitTestResult, detectedDataBoundingBox, detectedDataRange);
-        if (actionMenuResult.detectedDataActionContext && detectedDataRange) {
-            actionMenuResult.detectedDataBoundingBox = detectedDataBoundingBox;
-            actionMenuResult.detectedDataTextIndicator = TextIndicator::createWithRange(*detectedDataRange, textIndicatorTransitionForActionMenu(selectionRange.get(), *detectedDataRange, forImmediateAction, true));
-            m_lastActionMenuRangeForSelection = detectedDataRange;
+        immediateActionResult.detectedDataActionContext = DataDetection::detectItemAroundHitTestResult(hitTestResult, detectedDataBoundingBox, detectedDataRange);
+        if (immediateActionResult.detectedDataActionContext && detectedDataRange) {
+            immediateActionResult.detectedDataBoundingBox = detectedDataBoundingBox;
+            immediateActionResult.detectedDataTextIndicator = TextIndicator::createWithRange(*detectedDataRange, textIndicatorTransitionForImmediateAction(selectionRange.get(), *detectedDataRange, true));
         }
     }
 
@@ -1178,7 +1168,7 @@ void WebPage::performActionMenuHitTestAtLocation(WebCore::FloatPoint locationInV
             // FIXME: We don't have API to identify images inside PDFs based on position.
             NSDictionary *options = nil;
             PDFSelection *selection = nil;
-            String selectedText = pdfPugin->lookupTextAtLocation(locationInViewCoordinates, actionMenuResult, &selection, &options);
+            String selectedText = pdfPugin->lookupTextAtLocation(locationInViewCoordinates, immediateActionResult, &selection, &options);
             if (!selectedText.isEmpty()) {
                 if (element->document().isPluginDocument()) {
                     // FIXME(144030): Focus does not seem to get set to the PDF when invoking the menu.
@@ -1186,21 +1176,21 @@ void WebPage::performActionMenuHitTestAtLocation(WebCore::FloatPoint locationInV
                     pluginDocument.setFocusedElement(element);
                 }
 
-                actionMenuResult.lookupText = selectedText;
-                actionMenuResult.isTextNode = true;
-                actionMenuResult.isSelected = true;
-                actionMenuResult.allowsCopy = true;
+                immediateActionResult.lookupText = selectedText;
+                immediateActionResult.isTextNode = true;
+                immediateActionResult.isSelected = true;
+                immediateActionResult.allowsCopy = true;
 
-                actionMenuResult.dictionaryPopupInfo = dictionaryPopupInfoForSelectionInPDFPlugin(selection, *pdfPugin, &options, textIndicatorTransitionForActionMenu(forImmediateAction, false));
+                immediateActionResult.dictionaryPopupInfo = dictionaryPopupInfoForSelectionInPDFPlugin(selection, *pdfPugin, &options, textIndicatorTransitionForImmediateAction());
             }
         }
     }
 #endif
 
     RefPtr<API::Object> userData;
-    injectedBundleContextMenuClient().prepareForActionMenu(*this, hitTestResult, userData);
+    injectedBundleContextMenuClient().prepareForImmediateAction(*this, hitTestResult, userData);
 
-    send(Messages::WebPageProxy::DidPerformActionMenuHitTest(actionMenuResult, forImmediateAction, actionMenuHitTestPreventsDefault, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+    send(Messages::WebPageProxy::DidPerformImmediateActionHitTest(immediateActionResult, immediateActionHitTestPreventsDefault, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
 }
 
 PassRefPtr<WebCore::Range> WebPage::lookupTextAtLocation(FloatPoint locationInViewCoordinates, NSDictionary **options)
@@ -1214,30 +1204,6 @@ PassRefPtr<WebCore::Range> WebPage::lookupTextAtLocation(FloatPoint locationInVi
     return rangeForDictionaryLookupAtHitTestResult(result, options);
 }
 
-void WebPage::selectLastActionMenuRange()
-{
-    if (m_lastActionMenuRangeForSelection)
-        corePage()->mainFrame().selection().setSelectedRange(m_lastActionMenuRangeForSelection.get(), DOWNSTREAM, true);
-}
-
-void WebPage::focusAndSelectLastActionMenuHitTestResult()
-{
-    if (!m_lastActionMenuHitTestResult.isContentEditable())
-        return;
-
-    Element* element = m_lastActionMenuHitTestResult.innerElement();
-    if (!element)
-        return;
-
-    Frame* frame = element->document().frame();
-    if (!frame)
-        return;
-
-    m_page->focusController().setFocusedElement(element, frame);
-    VisiblePosition position = frame->visiblePositionForPoint(m_lastActionMenuHitTestResult.roundedPointInInnerNodeFrame());
-    frame->selection().setSelection(position);
-}
-
 void WebPage::immediateActionDidUpdate()
 {
     m_page->mainFrame().eventHandler().setImmediateActionStage(ImmediateActionStage::ActionUpdated);
index 277d0a4..a9c1747 100644 (file)
@@ -1,3 +1,19 @@
+2015-05-22  Tim Horton  <timothy_horton@apple.com>
+
+        Remove action menu support
+        https://bugs.webkit.org/show_bug.cgi?id=145305
+        <rdar://problem/21070771>
+
+        Reviewed by Anders Carlsson.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2/action-menu-target.pdf: Removed.
+        * TestWebKitAPI/Tests/WebKit2/action-menu-targets.html: Removed.
+        * TestWebKitAPI/Tests/WebKit2ObjC/ActionMenus.mm: Removed.
+        * TestWebKitAPI/Tests/WebKit2ObjC/ActionMenusBundle.mm: Removed.
+        * TestWebKitAPI/Tests/WebKit2ObjC/ActionMenusBundleSPI.h: Removed.
+        Remove the tests.
+
 2015-05-22  Dan Bernstein  <mitz@apple.com>
 
         Removed the Use Shrink To Fit button from the toolbar’s default set.
index 9a1f29e..5b276d8 100644 (file)
@@ -29,8 +29,6 @@
                290F4275172A221C00939FF0 /* custom-protocol-sync-xhr.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */; };
                297234B7173AFAC700983601 /* CustomProtocolsInvalidScheme_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 297234B5173AFAC700983601 /* CustomProtocolsInvalidScheme_Bundle.cpp */; };
                2D1FE0B01AD465C1006CD9E6 /* FixedLayoutSize.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D1FE0AF1AD465C1006CD9E6 /* FixedLayoutSize.mm */; };
-               2D950FBE1A2217D300012434 /* ActionMenusBundle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D950FBB1A2217D000012434 /* ActionMenusBundle.mm */; };
-               2D950FC01A230C3A00012434 /* action-menu-targets.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2D950FBF1A230C1E00012434 /* action-menu-targets.html */; };
                2DD7D3AF178227B30026E1E3 /* lots-of-text-vertical-lr.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2DD7D3AE178227AC0026E1E3 /* lots-of-text-vertical-lr.html */; };
                2E7765CD16C4D80A00BA2BB1 /* mainIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E7765CC16C4D80A00BA2BB1 /* mainIOS.mm */; };
                2E7765CF16C4D81100BA2BB1 /* mainMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E7765CE16C4D81100BA2BB1 /* mainMac.mm */; };
@@ -69,7 +67,6 @@
                7AA021BB1AB09EA70052953F /* DateMath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AA021BA1AB09EA70052953F /* DateMath.cpp */; };
                7AA6A1521AAC0B31002B2ED3 /* WorkQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AA6A1511AAC0B31002B2ED3 /* WorkQueue.cpp */; };
                7AE9E5091AE5AE8B00CF874B /* test.pdf in Copy Resources */ = {isa = PBXBuildFile; fileRef = 7AE9E5081AE5AE8B00CF874B /* test.pdf */; };
-               7AE9E50B1AE5F97000CF874B /* action-menu-target.pdf in Copy Resources */ = {isa = PBXBuildFile; fileRef = 7AE9E50A1AE5F91300CF874B /* action-menu-target.pdf */; };
                7C486BA11AA12567003F6F9B /* bundle-file.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 7C486BA01AA1254B003F6F9B /* bundle-file.html */; };
                7C54A4BE1AA11CCA00380F78 /* WKBundleFileHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C54A4BC1AA11CCA00380F78 /* WKBundleFileHandle.cpp */; };
                7C54A4C11AA11CE400380F78 /* WKBundleFileHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C54A4BF1AA11CE400380F78 /* WKBundleFileHandle_Bundle.cpp */; };
                7CCE7F251A411AF600447C4C /* OpenAndCloseWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */; };
                7CCE7F261A411AF600447C4C /* Preferences.mm in Sources */ = {isa = PBXBuildFile; fileRef = C95501BE19AD2FAF0049BE3E /* Preferences.mm */; };
                7CCE7F271A411AF600447C4C /* UserContentController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CC3E1FA197E234100BE6252 /* UserContentController.mm */; };
-               7CCE7F281A411B1000447C4C /* ActionMenus.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D950FBA1A2217D000012434 /* ActionMenus.mm */; };
                7CCE7F291A411B1000447C4C /* CustomProtocolsInvalidScheme.mm in Sources */ = {isa = PBXBuildFile; fileRef = 297234B2173AD04800983601 /* CustomProtocolsInvalidScheme.mm */; };
                7CCE7F2A1A411B1000447C4C /* CustomProtocolsSyncXHRTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 290F4276172A232C00939FF0 /* CustomProtocolsSyncXHRTest.mm */; };
                7CCE7F2B1A411B1000447C4C /* CustomProtocolsTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29AB8A9F164C735800D49BEC /* CustomProtocolsTest.mm */; };
                        dstPath = TestWebKitAPI.resources;
                        dstSubfolderSpec = 7;
                        files = (
-                               7AE9E50B1AE5F97000CF874B /* action-menu-target.pdf in Copy Resources */,
                                7AE9E5091AE5AE8B00CF874B /* test.pdf in Copy Resources */,
                                7A1458FC1AD5C07000E06772 /* mouse-button-listener.html in Copy Resources */,
                                7C486BA11AA12567003F6F9B /* bundle-file.html in Copy Resources */,
                                1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */,
                                379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */,
-                               2D950FC01A230C3A00012434 /* action-menu-targets.html in Copy Resources */,
                                B55F11BE15191A0600915916 /* Ahem.ttf in Copy Resources */,
                                1A63479F183D72A4005B1707 /* all-content-in-one-iframe.html in Copy Resources */,
                                F6B7BE9717469B96008A3445 /* associate-form-controls.html in Copy Resources */,
                29AB8AA3164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestBrowsingContextLoadDelegate.h; sourceTree = "<group>"; };
                2D1FE0AF1AD465C1006CD9E6 /* FixedLayoutSize.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FixedLayoutSize.mm; sourceTree = "<group>"; };
                2D640B5417875DFF00BFAF99 /* ScrollPinningBehaviors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollPinningBehaviors.cpp; sourceTree = "<group>"; };
-               2D950FBA1A2217D000012434 /* ActionMenus.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ActionMenus.mm; path = WebKit2ObjC/ActionMenus.mm; sourceTree = "<group>"; };
-               2D950FBB1A2217D000012434 /* ActionMenusBundle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ActionMenusBundle.mm; path = WebKit2ObjC/ActionMenusBundle.mm; sourceTree = "<group>"; };
-               2D950FBF1A230C1E00012434 /* action-menu-targets.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "action-menu-targets.html"; sourceTree = "<group>"; };
                2DD7D3A9178205D00026E1E3 /* ResizeReversePaginatedWebView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResizeReversePaginatedWebView.cpp; sourceTree = "<group>"; };
                2DD7D3AE178227AC0026E1E3 /* lots-of-text-vertical-lr.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "lots-of-text-vertical-lr.html"; sourceTree = "<group>"; };
-               2DDE58961A36342B00AA80DE /* ActionMenusBundleSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ActionMenusBundleSPI.h; path = WebKit2ObjC/ActionMenusBundleSPI.h; sourceTree = "<group>"; };
                2E7765CC16C4D80A00BA2BB1 /* mainIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = mainIOS.mm; sourceTree = "<group>"; };
                2E7765CE16C4D81100BA2BB1 /* mainMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = mainMac.mm; sourceTree = "<group>"; };
                333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PreventEmptyUserAgent.cpp; sourceTree = "<group>"; };
                7AA021BA1AB09EA70052953F /* DateMath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateMath.cpp; sourceTree = "<group>"; };
                7AA6A1511AAC0B31002B2ED3 /* WorkQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueue.cpp; sourceTree = "<group>"; };
                7AE9E5081AE5AE8B00CF874B /* test.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = test.pdf; sourceTree = "<group>"; };
-               7AE9E50A1AE5F91300CF874B /* action-menu-target.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "action-menu-target.pdf"; sourceTree = "<group>"; };
                7C486BA01AA1254B003F6F9B /* bundle-file.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "bundle-file.html"; sourceTree = "<group>"; };
                7C54A4BC1AA11CCA00380F78 /* WKBundleFileHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleFileHandle.cpp; sourceTree = "<group>"; };
                7C54A4BF1AA11CE400380F78 /* WKBundleFileHandle_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleFileHandle_Bundle.cpp; sourceTree = "<group>"; };
                BC3C4C6F14575B1D0025FB62 /* WebKit2 Objective-C */ = {
                        isa = PBXGroup;
                        children = (
-                               2D950FBA1A2217D000012434 /* ActionMenus.mm */,
-                               2D950FBB1A2217D000012434 /* ActionMenusBundle.mm */,
-                               2DDE58961A36342B00AA80DE /* ActionMenusBundleSPI.h */,
                                297234B2173AD04800983601 /* CustomProtocolsInvalidScheme.mm */,
                                297234B5173AFAC700983601 /* CustomProtocolsInvalidScheme_Bundle.cpp */,
                                290F4276172A232C00939FF0 /* CustomProtocolsSyncXHRTest.mm */,
                BC90977B125571AE00083756 /* Resources */ = {
                        isa = PBXGroup;
                        children = (
-                               7AE9E50A1AE5F91300CF874B /* action-menu-target.pdf */,
                                7AE9E5081AE5AE8B00CF874B /* test.pdf */,
                                7A1458FB1AD5C03500E06772 /* mouse-button-listener.html */,
                                C045F9461385C2F800C0F3CD /* 18-characters.html */,
-                               2D950FBF1A230C1E00012434 /* action-menu-targets.html */,
                                93D3D19B17B1A7B000C7C415 /* all-content-in-one-iframe.html */,
                                F6B7BE9617469B7E008A3445 /* associate-form-controls.html */,
                                76E182DE15475A8300F1FADD /* auto-submitting-form.html */,
                        files = (
                                7CCE7EE41A411AE600447C4C /* AboutBlankLoad.cpp in Sources */,
                                7CCE7EB31A411A7E00447C4C /* AcceptsFirstMouse.mm in Sources */,
-                               7CCE7F281A411B1000447C4C /* ActionMenus.mm in Sources */,
                                7CCE7F301A411B8E00447C4C /* AtomicString.cpp in Sources */,
                                7CCE7EB41A411A7E00447C4C /* AttributedString.mm in Sources */,
                                7CCE7EB51A411A7E00447C4C /* BackForwardList.mm in Sources */,
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               2D950FBE1A2217D300012434 /* ActionMenusBundle.mm in Sources */,
                                BC246D9C132F1FF000B56D7C /* CanHandleRequest_Bundle.cpp in Sources */,
                                297234B7173AFAC700983601 /* CustomProtocolsInvalidScheme_Bundle.cpp in Sources */,
                                F6B7BE9517469212008A3445 /* DidAssociateFormControls_Bundle.cpp in Sources */,
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/action-menu-target.pdf b/Tools/TestWebKitAPI/Tests/WebKit2/action-menu-target.pdf
deleted file mode 100644 (file)
index a5f457f..0000000
Binary files a/Tools/TestWebKitAPI/Tests/WebKit2/action-menu-target.pdf and /dev/null differ
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/action-menu-targets.html b/Tools/TestWebKitAPI/Tests/WebKit2/action-menu-targets.html
deleted file mode 100644 (file)
index 9988820..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-<style>
-div {
-    position: absolute;
-    width: 195px; height: 45px;
-    overflow: hidden;
-    border: 1px solid black;
-}
-
-embed {
-    position: absolute;
-    width: 100%; height: 100%;
-    overflow: hidden;
-    padding: 0;
-    margin: 0;
-}
-</style>
-
-<script>
-function editableAreaString(name) {
-    if (name.indexOf("textarea") === 0 || name.indexOf("input") === 0)
-        return document.getElementById(name).value;
-    return document.getElementById(name).innerText;
-}
-
-function stringifySelection() {
-    var sel = window.getSelection();
-    if (sel.rangeCount == 0 || sel.getRangeAt(0).collapsed)
-        return "<no selection>";
-    return sel.toString();
-}
-
-function stringifySelectionInElement(name) {
-    var el = document.getElementById(name);
-    console.log(el);
-    if (el.selectionStart == undefined)
-        return "<no selection>";
-    return el.value.substring(el.selectionStart, el.selectionEnd);
-}
-
-var failWasCalled = false;
-
-function fail() {
-    failWasCalled = true;
-}
-
-function wasFailCalled() {
-    return failWasCalled;
-}
-
-// MSE video:
-var source;
-var request;
-var videoIsReady = false;
-
-window.onload = function () {
-    playVideo();
-}
-
-function playVideo()
-{
-    request = new XMLHttpRequest();
-    request.responseType = 'arraybuffer';
-    request.open('GET', 'test-mse.mp4', true);
-    request.addEventListener('load', load);
-    request.send();
-}
-
-function load(event)
-{
-    source = new MediaSource();
-    source.addEventListener('sourceopen', sourceOpen);
-    var video = document.getElementById('mse-video');
-    video.src = URL.createObjectURL(source);
-}
-
-function sourceOpen(event)
-{
-    var sourceBuffer = source.addSourceBuffer('video/mp4;codecs="avc1.4D4001,mp4a.40.2"');
-    sourceBuffer.appendBuffer(request.response);
-    sourceBuffer.addEventListener('updateend', updateEnd);
-}
-
-function updateEnd(event)
-{
-    videoIsReady = true;
-}
-
-function isVideoReady()
-{
-    return videoIsReady;
-}
-
-</script>
-
-<div style="top: 0px; left: 0px;">word</div><br/>
-<div style="top: 0px; left: 200px;">New York</div><br/>
-
-<div style="top: 50px; left: 0px;">1 Infinite Loop, Cupertino, CA 95014</div><br/>
-<div style="top: 50px; left: 200px;">May 17th, 2012</div><br/>
-<div style="top: 50px; left: 400px;">(408) 996-1010</div><br/>
-
-<div id="editable1" style="top: 150px; left: 0px;" contenteditable>editable editable editable editable</div><br/>
-<div style="top: 150px; left: 200px;"><input id="input1" type="text" value="editable editable editable editable"></input></div><br/>
-<div style="top: 150px; left: 400px;"><textarea id="textarea1">editable editable editable editable</textarea></div><br/>
-
-<div id="editable2" style="top: 200px; left: 0px;" contenteditable>New York some words</div><br/>
-<div style="top: 200px; left: 200px;"><input id="input2" type="text" value="New York some words"></input></div><br/>
-<div style="top: 200px; left: 400px;"><textarea id="textarea2">New York some words</textarea></div><br/>
-
-<div style="top: 250px; left: 0px;"><img src="icon.png" height="100%"></div><br/>
-<div style="top: 250px; left: 200px;"><a href="http://example.org/"><img src="icon.png" height="100%"></a></div><br/>
-
-<div style="top: 250px; left: 400px; height: 350px"><embed src="action-menu-target.pdf"></embed></div><br/>
-
-<div style="top: 300px; left: 0px; width: 95px;"><a href="http://example.org/">http</a></div><br/>
-<div style="top: 300px; left: 100px; width: 95px;"><a href="ftp://example.org/">ftp</a></div><br/>
-<div style="top: 300px; left: 200px; width: 95px;"><a href="mailto:example@example.org">mailto link</a></div><br/>
-<div style="top: 300px; left: 300px; width: 95px;"><a href="javascript:fail()">javascript link</a></div><br/>
-
-<div style="top: 350px; left: 0px;"><video src="test.mp4"></video></div><br/>
-<div style="top: 350px; left: 200px;"><video id="mse-video"></video></div><br/>
-
-<div style="top: 0px; left: 750px; height: 600px;">data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text data detectors menu text </div><br/>
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2ObjC/ActionMenus.mm b/Tools/TestWebKitAPI/Tests/WebKit2ObjC/ActionMenus.mm
deleted file mode 100644 (file)
index 8a33a82..0000000
+++ /dev/null
@@ -1,807 +0,0 @@
-/*
- * Copyright (C) 2014-2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-
-#if PLATFORM(MAC)
-
-#import "Test.h"
-
-#import "PlatformUtilities.h"
-#import "PlatformWebView.h"
-#import "TestBrowsingContextLoadDelegate.h"
-#import <JavaScriptCore/JSContextRef.h>
-#import <JavaScriptCore/JSRetainPtr.h>
-#import <WebKit/WebKit2.h>
-#import <WebKit/WKActionMenuItemTypes.h>
-#import <WebKit/WKActionMenuTypes.h>
-#import <WebKit/WKPreferencesPrivate.h>
-#import <WebKit/WKSerializedScriptValue.h>
-#import <WebKit/WKViewPrivate.h>
-#import <wtf/RetainPtr.h>
-
-static bool didFinishLoad = false;
-static bool didFinishDownload = false;
-
-@interface WKView (Details)
-
-- (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
-- (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
-- (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
-
-- (NSMenu *)_actionMenu;
-- (void)copy:(id)sender;
-
-@end
-
-struct ActionMenuResult {
-    WKRetainPtr<WKHitTestResultRef> hitTestResult;
-    _WKActionMenuType type;
-    RetainPtr<NSArray> defaultMenuItems;
-    WKRetainPtr<WKTypeRef> userData;
-};
-
-@interface ActionMenusTestWKView : WKView {
-    ActionMenuResult _actionMenuResult;
-    RetainPtr<NSArray> _overrideItems;
-    BOOL _shouldHaveUserData;
-}
-
-@property (nonatomic, assign, setter=_setActionMenuResult:) ActionMenuResult _actionMenuResult;
-
-@end
-
-@implementation ActionMenusTestWKView
-
-@synthesize _actionMenuResult=_actionMenuResult;
-
-- (NSArray *)_actionMenuItemsForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(_WKActionMenuType)type defaultActionMenuItems:(NSArray *)defaultMenuItems userData:(WKTypeRef)userData
-{
-    if (type != kWKActionMenuNone)
-        EXPECT_GT(defaultMenuItems.count, (NSUInteger)0);
-
-    if (!hitTestResult)
-        return defaultMenuItems;
-
-    // Clients should be able to pass userData from the Web to UI process, between
-    // the WKBundlePageContextMenuClient's prepareForActionMenu, and here.
-    // http://trac.webkit.org/changeset/175444
-    if (_shouldHaveUserData) {
-        EXPECT_NOT_NULL(userData);
-        EXPECT_EQ(WKDictionaryGetTypeID(), WKGetTypeID(userData));
-        WKRetainPtr<WKStringRef> hasLinkKey = adoptWK(WKStringCreateWithUTF8CString("hasLinkURL"));
-        WKTypeRef hasLinkValue = WKDictionaryGetItemForKey((WKDictionaryRef)userData, hasLinkKey.get());
-        EXPECT_NOT_NULL(hasLinkValue);
-        EXPECT_EQ(WKBooleanGetTypeID(), WKGetTypeID(hasLinkValue));
-        WKRetainPtr<WKURLRef> absoluteLinkURL = adoptWK(WKHitTestResultCopyAbsoluteLinkURL(hitTestResult));
-        EXPECT_EQ(!!absoluteLinkURL, WKBooleanGetValue((WKBooleanRef)hasLinkValue));
-    } else
-        EXPECT_NULL(userData);
-
-    _actionMenuResult.hitTestResult = hitTestResult;
-    _actionMenuResult.type = type;
-    _actionMenuResult.defaultMenuItems = defaultMenuItems;
-    _actionMenuResult.userData = userData;
-    return _overrideItems ? _overrideItems.get() : defaultMenuItems;
-}
-
-- (void)runMenuSequenceAtPoint:(NSPoint)point preDidCloseMenuHandler:(void(^)(void))preDidCloseMenuHandler
-{
-    __block bool didFinishSequence = false;
-
-    NSMenu *actionMenu = self._actionMenu;
-    RetainPtr<NSEvent> event = [NSEvent mouseEventWithType:NSLeftMouseDown location:point modifierFlags:0 timestamp:0 windowNumber:self.window.windowNumber context:0 eventNumber:0 clickCount:0 pressure:0];
-
-    dispatch_async(dispatch_get_main_queue(), ^{
-        [self prepareForMenu:actionMenu withEvent:event.get()];
-    });
-
-    dispatch_async(dispatch_get_main_queue(), ^{
-        _shouldHaveUserData = YES;
-        [[actionMenu delegate] menuNeedsUpdate:actionMenu];
-        _shouldHaveUserData = NO;
-    });
-
-    dispatch_async(dispatch_get_main_queue(), ^{
-        [self willOpenMenu:actionMenu withEvent:event.get()];
-    });
-
-    void (^copiedPreDidCloseMenuHandler)() = Block_copy(preDidCloseMenuHandler);
-    dispatch_async(dispatch_get_main_queue(), ^{
-        copiedPreDidCloseMenuHandler();
-        Block_release(copiedPreDidCloseMenuHandler);
-        [self didCloseMenu:actionMenu withEvent:event.get()];
-        [self mouseDown:event.get()];
-        didFinishSequence = true;
-    });
-
-    TestWebKitAPI::Util::run(&didFinishSequence);
-}
-
-- (void)_setOverrideActionMenuItems:(NSArray *)overrideItems
-{
-    _overrideItems = overrideItems;
-}
-
-@end
-
-namespace TestWebKitAPI {
-
-struct ActiveDownloadContext {
-    WKRetainPtr<WKStringRef> path;
-    bool shouldCheckForImage = 0;
-};
-
-static void didFinishLoadForFrameCallback(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
-{
-    didFinishLoad = true;
-}
-
-static void didFinishDownloadCallback(WKContextRef context, WKDownloadRef download, const void *clientInfo)
-{
-    WKStringRef wkActiveDownloadPath = ((ActiveDownloadContext*)clientInfo)->path.get();
-    size_t length = WKStringGetLength(wkActiveDownloadPath) + 1;
-    char *activeDownloadPath = (char *)calloc(1, length);
-    WKStringGetUTF8CString(wkActiveDownloadPath, activeDownloadPath, length);
-
-    if (((ActiveDownloadContext*)clientInfo)->shouldCheckForImage) {
-        RetainPtr<NSImage> image = adoptNS([[NSImage alloc] initWithContentsOfFile:[NSString stringWithUTF8String:activeDownloadPath]]);
-
-        EXPECT_EQ(215, [image size].width);
-        EXPECT_EQ(174, [image size].height);
-    }
-
-    didFinishDownload = true;
-}
-
-static void didCreateDownloadDestinationCallback(WKContextRef context, WKDownloadRef download, WKStringRef path, const void *clientInfo)
-{
-    ((ActiveDownloadContext*)clientInfo)->path = path;
-}
-
-static NSString *watchPasteboardForString()
-{
-    [[NSPasteboard generalPasteboard] clearContents];
-
-    while (true) {
-        [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]];
-        NSString *pasteboardString = [[NSPasteboard generalPasteboard] stringForType:NSPasteboardTypeString];
-        if (pasteboardString)
-            return pasteboardString;
-    }
-}
-
-static NSImage *watchPasteboardForImage()
-{
-    [[NSPasteboard generalPasteboard] clearContents];
-
-    while (true) {
-        [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]];
-        NSArray *pasteboardItems = [[NSPasteboard generalPasteboard] readObjectsForClasses:@[ [NSImage class] ] options:nil];
-        if (pasteboardItems && pasteboardItems.count)
-            return pasteboardItems.lastObject;
-    }
-}
-
-struct JavaScriptStringCallbackContext {
-    JavaScriptStringCallbackContext()
-        : didFinish(false)
-    {
-    }
-
-    bool didFinish;
-    JSRetainPtr<JSStringRef> actualString;
-};
-
-struct JavaScriptBoolCallbackContext {
-    JavaScriptBoolCallbackContext()
-        : didFinish(false)
-    {
-    }
-
-    bool didFinish;
-    bool value;
-};
-
-static void javaScriptStringCallback(WKSerializedScriptValueRef resultSerializedScriptValue, WKErrorRef error, void* ctx)
-{
-    EXPECT_NOT_NULL(resultSerializedScriptValue);
-
-    JavaScriptStringCallbackContext* context = static_cast<JavaScriptStringCallbackContext*>(ctx);
-
-    JSGlobalContextRef scriptContext = JSGlobalContextCreate(0);
-    EXPECT_NOT_NULL(scriptContext);
-
-    JSValueRef scriptValue = WKSerializedScriptValueDeserialize(resultSerializedScriptValue, scriptContext, 0);
-    EXPECT_NOT_NULL(scriptValue);
-
-    context->actualString.adopt(JSValueToStringCopy(scriptContext, scriptValue, 0));
-    EXPECT_NOT_NULL(context->actualString.get());
-
-    context->didFinish = true;
-    
-    JSGlobalContextRelease(scriptContext);
-    
-    EXPECT_NULL(error);
-}
-
-static void javaScriptBoolCallback(WKSerializedScriptValueRef resultSerializedScriptValue, WKErrorRef error, void* ctx)
-{
-    EXPECT_NOT_NULL(resultSerializedScriptValue);
-
-    JavaScriptBoolCallbackContext* context = static_cast<JavaScriptBoolCallbackContext*>(ctx);
-
-    JSGlobalContextRef scriptContext = JSGlobalContextCreate(0);
-    EXPECT_NOT_NULL(scriptContext);
-
-    JSValueRef scriptValue = WKSerializedScriptValueDeserialize(resultSerializedScriptValue, scriptContext, 0);
-    EXPECT_NOT_NULL(scriptValue);
-
-    EXPECT_TRUE(JSValueIsBoolean(scriptContext, scriptValue));
-
-    context->value = JSValueToBoolean(scriptContext, scriptValue);
-    context->didFinish = true;
-    
-    JSGlobalContextRelease(scriptContext);
-    
-    EXPECT_NULL(error);
-}
-
-static std::unique_ptr<char[]> callJavaScriptReturningString(WKPageRef page, const char* js)
-{
-    JavaScriptStringCallbackContext context;
-    WKPageRunJavaScriptInMainFrame(page, Util::toWK(js).get(), &context, javaScriptStringCallback);
-    Util::run(&context.didFinish);
-
-    size_t bufferSize = JSStringGetMaximumUTF8CStringSize(context.actualString.get());
-    auto buffer = std::make_unique<char[]>(bufferSize);
-    JSStringGetUTF8CString(context.actualString.get(), buffer.get(), bufferSize);
-    return buffer;
-}
-
-static bool callJavaScriptReturningBool(WKPageRef page, const char* js)
-{
-    JavaScriptBoolCallbackContext context;
-    WKPageRunJavaScriptInMainFrame(page, Util::toWK(js).get(), &context, javaScriptBoolCallback);
-    Util::run(&context.didFinish);
-    return context.value;
-}
-
-static void watchEditableAreaForString(WKPageRef page, const char *areaName, const char *watchString)
-{
-    while (true) {
-        [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]];
-        auto buffer = callJavaScriptReturningString(page, [[NSString stringWithFormat:@"editableAreaString('%s')", areaName] UTF8String]);
-
-        if (!strcmp(buffer.get(), watchString))
-            return;
-    }
-}
-
-static void waitForVideoReady(WKPageRef page)
-{
-    while (true) {
-        [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]];
-        if (callJavaScriptReturningBool(page, "isVideoReady()"))
-            return;
-    }
-}
-
-static NSString *retrieveSelection(WKPageRef page)
-{
-    auto buffer = callJavaScriptReturningString(page, "stringifySelection()");
-    return [NSString stringWithUTF8String:buffer.get()];
-}
-
-static NSString *retrieveSelectionInElement(WKPageRef page, const char *areaName)
-{
-    auto buffer = callJavaScriptReturningString(page, [[NSString stringWithFormat:@"stringifySelectionInElement('%s')", areaName] UTF8String]);
-    return [NSString stringWithUTF8String:buffer.get()];
-}
-
-static void performMenuItemAtIndexOfTypeAsync(NSMenu *menu, NSInteger index, int type)
-{
-    EXPECT_LT(index, menu.numberOfItems);
-    if (index >= menu.numberOfItems)
-        return;
-    NSMenuItem *menuItem = [menu itemAtIndex:index];
-    EXPECT_NOT_NULL(menuItem);
-    EXPECT_EQ(type, [menuItem tag]);
-    EXPECT_TRUE([menuItem isEnabled]);
-    [menuItem.target performSelector:menuItem.action withObject:menuItem afterDelay:0];
-}
-
-static void ensureMenuItemAtIndexOfTypeIsDisabled(NSMenu *menu, NSInteger index, int type)
-{
-    EXPECT_LT(index, menu.numberOfItems);
-    if (index >= menu.numberOfItems)
-        return;
-    NSMenuItem *menuItem = [menu itemAtIndex:index];
-    EXPECT_NOT_NULL(menuItem);
-    EXPECT_EQ(type, [menuItem tag]);
-    EXPECT_FALSE([menuItem isEnabled]);
-}
-
-enum class TargetType {
-    Word,
-    Phrase,
-    Address,
-    Date,
-    PhoneNumber,
-    ContentEditableWords,
-    ContentEditablePhrase,
-    TextInputWords,
-    TextInputPhrase,
-    TextAreaWords,
-    TextAreaPhrase,
-    Image,
-    ImageAsLink,
-    HTTPLink,
-    FTPLink,
-    MailtoLink,
-    JavaScriptLink,
-    PageOverlay,
-    PageWhitespace,
-    Video,
-    MSEVideo,
-    PDFEmbed,
-    PDFDocument
-};
-
-static NSPoint windowPointForTarget(TargetType target)
-{
-    NSPoint contentPoint;
-    switch (target) {
-    case TargetType::Word:
-        contentPoint = NSMakePoint(0, 0);
-        break;
-    case TargetType::Phrase:
-        contentPoint = NSMakePoint(200, 0);
-        break;
-    case TargetType::Address:
-        contentPoint = NSMakePoint(0, 50);
-        break;
-    case TargetType::Date:
-        contentPoint = NSMakePoint(200, 50);
-        break;
-    case TargetType::PhoneNumber:
-        contentPoint = NSMakePoint(400, 50);
-        break;
-    case TargetType::ContentEditableWords:
-        contentPoint = NSMakePoint(0, 150);
-        break;
-    case TargetType::ContentEditablePhrase:
-        contentPoint = NSMakePoint(0, 200);
-        break;
-    case TargetType::TextInputWords:
-        contentPoint = NSMakePoint(200, 150);
-        break;
-    case TargetType::TextInputPhrase:
-        contentPoint = NSMakePoint(200, 200);
-        break;
-    case TargetType::TextAreaWords:
-        contentPoint = NSMakePoint(400, 150);
-        break;
-    case TargetType::TextAreaPhrase:
-        contentPoint = NSMakePoint(400, 200);
-        break;
-    case TargetType::Image:
-        contentPoint = NSMakePoint(0, 250);
-        break;
-    case TargetType::ImageAsLink:
-        contentPoint = NSMakePoint(200, 250);
-        break;
-    case TargetType::HTTPLink:
-        contentPoint = NSMakePoint(0, 300);
-        break;
-    case TargetType::FTPLink:
-        contentPoint = NSMakePoint(100, 300);
-        break;
-    case TargetType::MailtoLink:
-        contentPoint = NSMakePoint(200, 300);
-        break;
-    case TargetType::JavaScriptLink:
-        contentPoint = NSMakePoint(300, 300);
-        break;
-    case TargetType::PageOverlay:
-        contentPoint = NSMakePoint(750, 100);
-        break;
-    case TargetType::PageWhitespace:
-        contentPoint = NSMakePoint(650, 0);
-        break;
-    case TargetType::Video:
-        contentPoint = NSMakePoint(0, 350);
-        break;
-    case TargetType::MSEVideo:
-        contentPoint = NSMakePoint(200, 350);
-        break;
-    case TargetType::PDFEmbed:
-        contentPoint = NSMakePoint(522, 363);
-        break;
-    case TargetType::PDFDocument:
-        contentPoint = NSMakePoint(141, 374);
-        break;
-    }
-
-    return NSMakePoint(contentPoint.x + 8, 600 - contentPoint.y - 8);
-}
-
-static void waitForPDFToLoad(ActionMenusTestWKView* wkView)
-{
-    __block bool pdfSeemsLoaded = false;
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::PDFEmbed) preDidCloseMenuHandler:^() {
-        pdfSeemsLoaded = kWKActionMenuReadOnlyText == [wkView _actionMenuResult].type;
-    }];
-    Util::run(&didFinishLoad);
-}
-
-// FIXME: Ideally, each of these would be able to run as its own subtest in a suite, sharing a WKView (for performance reasons),
-// but we cannot because run-api-tests explicitly runs each test in a separate process. So, we use a single test for many tests instead.
-TEST(WebKit2, DISABLED_ActionMenusTest)
-{
-    WKRetainPtr<WKContextRef> context = adoptWK(Util::createContextForInjectedBundleTest("ActionMenusTest"));
-
-    WKRetainPtr<WKPageGroupRef> pageGroup = adoptWK(WKPageGroupCreateWithIdentifier(Util::toWK("ActionMenusTestGroup").get()));
-    WKPreferencesRef preferences = WKPageGroupGetPreferences(pageGroup.get());
-    WKPreferencesSetMediaSourceEnabled(preferences, true);
-    WKPreferencesSetFileAccessFromFileURLsAllowed(preferences, true);
-
-    PlatformWebView platformWebView(context.get(), pageGroup.get(), [ActionMenusTestWKView class]);
-    RetainPtr<ActionMenusTestWKView> wkView = (ActionMenusTestWKView *)platformWebView.platformView();
-
-    if (![wkView respondsToSelector:@selector(_setActionMenu:)])
-        return;
-
-    WKPageLoaderClientV0 loaderClient;
-    memset(&loaderClient, 0, sizeof(loaderClient));
-    loaderClient.base.version = 0;
-    loaderClient.didFinishLoadForFrame = didFinishLoadForFrameCallback;
-    WKPageSetPageLoaderClient([wkView pageRef], &loaderClient.base);
-
-    ActiveDownloadContext activeDownloadContext;
-
-    WKContextDownloadClientV0 downloadClient;
-    memset(&downloadClient, 0, sizeof(downloadClient));
-    downloadClient.base.version = 0;
-    downloadClient.base.clientInfo = &activeDownloadContext;
-    downloadClient.didFinish = didFinishDownloadCallback;
-    downloadClient.didCreateDestination = didCreateDownloadDestinationCallback;
-    WKContextSetDownloadClient(context.get(), &downloadClient.base);
-
-    WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("action-menu-targets", "html"));
-    WKPageLoadURL([wkView pageRef], url.get());
-
-    Util::run(&didFinishLoad);
-
-    waitForVideoReady([wkView pageRef]);
-
-    // PDF embeds should have selectable/copyable text.
-    waitForPDFToLoad(wkView.get());
-
-    // Read-only text.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::Word) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuReadOnlyText, [wkView _actionMenuResult].type);
-        EXPECT_WK_STREQ(@"word", retrieveSelection([wkView pageRef]));
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 0, kWKContextActionItemTagCopyText);
-        EXPECT_WK_STREQ(@"word", watchPasteboardForString());
-    }];
-
-    // Read-only text, on a phrase.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::Phrase) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuReadOnlyText, [wkView _actionMenuResult].type);
-        EXPECT_WK_STREQ(@"New York", retrieveSelection([wkView pageRef]));
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 0, kWKContextActionItemTagCopyText);
-        EXPECT_WK_STREQ(@"New York", watchPasteboardForString());
-    }];
-
-    // Read-only text, on an address.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::Address) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuReadOnlyText, [wkView _actionMenuResult].type);
-        EXPECT_WK_STREQ(@"1 Infinite Loop, Cupertino, CA 95014", retrieveSelection([wkView pageRef]));
-    }];
-
-    // Read-only text, on a date.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::Date) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuReadOnlyText, [wkView _actionMenuResult].type);
-        EXPECT_WK_STREQ(@"May 17th, 2012", retrieveSelection([wkView pageRef]));
-    }];
-
-    // Read-only text, on a phone number.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::PhoneNumber) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuDataDetectedItem, [wkView _actionMenuResult].type);
-        EXPECT_WK_STREQ(@"(408) 996-1010", retrieveSelection([wkView pageRef]));
-    }];
-
-    // Copy from a contentEditable div.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::ContentEditableWords) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuEditableText, [wkView _actionMenuResult].type);
-        EXPECT_WK_STREQ(@"editable", retrieveSelection([wkView pageRef]));
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 0, kWKContextActionItemTagCopyText);
-        EXPECT_WK_STREQ(@"editable", watchPasteboardForString());
-    }];
-
-    // Copy a phrase from a contentEditable div.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::ContentEditablePhrase) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuEditableText, [wkView _actionMenuResult].type);
-        EXPECT_WK_STREQ(@"New York", retrieveSelection([wkView pageRef]));
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 0, kWKContextActionItemTagCopyText);
-        EXPECT_WK_STREQ(@"New York", watchPasteboardForString());
-    }];
-
-    // Paste on top of the text in the contentEditable div.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::ContentEditableWords) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuEditableText, [wkView _actionMenuResult].type);
-        [[NSPasteboard generalPasteboard] clearContents];
-        [[NSPasteboard generalPasteboard] setString:@"pasted string" forType:NSPasteboardTypeString];
-        EXPECT_WK_STREQ(@"editable", retrieveSelection([wkView pageRef]));
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 2, kWKContextActionItemTagPaste);
-
-        // Now check and see if our paste succeeded. It should only replace one 'editable'.
-        watchEditableAreaForString([wkView pageRef], "editable1", "pasted string editable editable editable");
-    }];
-
-    // Paste on top of a phrase in the contentEditable div.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::ContentEditablePhrase) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuEditableText, [wkView _actionMenuResult].type);
-        [[NSPasteboard generalPasteboard] clearContents];
-        [[NSPasteboard generalPasteboard] setString:@"pasted over phrase" forType:NSPasteboardTypeString];
-        EXPECT_WK_STREQ(@"New York", retrieveSelection([wkView pageRef]));
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 2, kWKContextActionItemTagPaste);
-
-        // Now check and see if our paste succeeded, and replaced the whole phrase.
-        watchEditableAreaForString([wkView pageRef], "editable2", "pasted over phrase some words");
-    }];
-
-    // Copy from an <input>.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::TextInputWords) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuEditableText, [wkView _actionMenuResult].type);
-        EXPECT_WK_STREQ(@"editable", retrieveSelectionInElement([wkView pageRef], "input1"));
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 0, kWKContextActionItemTagCopyText);
-        EXPECT_WK_STREQ(@"editable", watchPasteboardForString());
-    }];
-
-    // Copy a phrase from an <input>.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::TextInputPhrase) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuEditableText, [wkView _actionMenuResult].type);
-        EXPECT_WK_STREQ(@"New York", retrieveSelectionInElement([wkView pageRef], "input2"));
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 0, kWKContextActionItemTagCopyText);
-        EXPECT_WK_STREQ(@"New York", watchPasteboardForString());
-    }];
-
-    // Paste on top of the editable text in an <input>.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::TextInputWords) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuEditableText, [wkView _actionMenuResult].type);
-        [[NSPasteboard generalPasteboard] clearContents];
-        [[NSPasteboard generalPasteboard] setString:@"pasted string" forType:NSPasteboardTypeString];
-        EXPECT_WK_STREQ(@"editable", retrieveSelectionInElement([wkView pageRef], "input1"));
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 2, kWKContextActionItemTagPaste);
-
-        // Now check and see if our paste succeeded. It should only replace one 'editable'.
-        watchEditableAreaForString([wkView pageRef], "input1", "pasted string editable editable editable");
-    }];
-
-    // Paste on top of the editable text, on a phrase in an <input>.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::TextInputPhrase) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuEditableText, [wkView _actionMenuResult].type);
-        [[NSPasteboard generalPasteboard] clearContents];
-        [[NSPasteboard generalPasteboard] setString:@"pasted over phrase" forType:NSPasteboardTypeString];
-        EXPECT_WK_STREQ(@"New York", retrieveSelectionInElement([wkView pageRef], "input2"));
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 2, kWKContextActionItemTagPaste);
-
-        // Now check and see if our paste succeeded, and replaced the whole phrase.
-        watchEditableAreaForString([wkView pageRef], "input2", "pasted over phrase some words");
-    }];
-
-    // Copy from a <textarea>.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::TextAreaWords) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuEditableText, [wkView _actionMenuResult].type);
-        EXPECT_WK_STREQ(@"editable", retrieveSelectionInElement([wkView pageRef], "textarea1"));
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 0, kWKContextActionItemTagCopyText);
-        EXPECT_WK_STREQ(@"editable", watchPasteboardForString());
-    }];
-
-    // Copy a phrase from a <textarea>.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::TextAreaPhrase) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuEditableText, [wkView _actionMenuResult].type);
-        EXPECT_WK_STREQ(@"New York", retrieveSelectionInElement([wkView pageRef], "textarea2"));
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 0, kWKContextActionItemTagCopyText);
-        EXPECT_WK_STREQ(@"New York", watchPasteboardForString());
-    }];
-
-    // Paste on top of the editable text in a <textarea>.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::TextAreaWords) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuEditableText, [wkView _actionMenuResult].type);
-        [[NSPasteboard generalPasteboard] clearContents];
-        [[NSPasteboard generalPasteboard] setString:@"pasted" forType:NSPasteboardTypeString];
-        EXPECT_WK_STREQ(@"editable", retrieveSelectionInElement([wkView pageRef], "textarea1"));
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 2, kWKContextActionItemTagPaste);
-
-        // Now check and see if our paste succeeded. It should only replace one 'editable'.
-        watchEditableAreaForString([wkView pageRef], "textarea1", "pasted editable editable editable");
-    }];
-
-    // Paste on top of the editable text, on a phrase in a <textarea>.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::TextAreaPhrase) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuEditableText, [wkView _actionMenuResult].type);
-        [[NSPasteboard generalPasteboard] clearContents];
-        [[NSPasteboard generalPasteboard] setString:@"pasted over phrase" forType:NSPasteboardTypeString];
-        EXPECT_WK_STREQ(@"New York", retrieveSelectionInElement([wkView pageRef], "textarea2"));
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 2, kWKContextActionItemTagPaste);
-
-        // Now check and see if our paste succeeded, and replaced the whole phrase.
-        watchEditableAreaForString([wkView pageRef], "textarea2", "pasted over phrase some words");
-    }];
-
-    // Copy an image.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::Image) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuImage, [wkView _actionMenuResult].type);
-
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 0, kWKContextActionItemTagCopyImage);
-        NSImage *image = watchPasteboardForImage();
-
-        EXPECT_EQ(215, image.size.width);
-        EXPECT_EQ(174, image.size.height);
-    }];
-
-    // Download a local image (should be disabled)
-    activeDownloadContext.shouldCheckForImage = true;
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::Image) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuImage, [wkView _actionMenuResult].type);
-        ensureMenuItemAtIndexOfTypeIsDisabled([wkView _actionMenu], 2, kWKContextActionItemTagSaveImageToDownloads);
-    }];
-    activeDownloadContext.shouldCheckForImage = false;
-
-    // Images that are also links should be treated as links.
-    // http://trac.webkit.org/changeset/175701
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::ImageAsLink) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuLink, [wkView _actionMenuResult].type);
-    }];
-
-    // Copy a video URL.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::Video) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuVideo, [wkView _actionMenuResult].type);
-
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 0, kWKContextActionItemTagCopyVideoURL);
-        NSString *videoURL = watchPasteboardForString();
-        EXPECT_WK_STREQ(@"test.mp4", [videoURL lastPathComponent]);
-
-        // Since this video is a local file, it should be disabled.
-        ensureMenuItemAtIndexOfTypeIsDisabled([wkView _actionMenu], 2, kWKContextActionItemTagSaveVideoToDownloads);
-    }];
-
-    // Copying a video URL for a non-downloadable video should result in copying the page URL instead.
-    // http://trac.webkit.org/changeset/176131
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::MSEVideo) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuVideo, [wkView _actionMenuResult].type);
-
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 0, kWKContextActionItemTagCopyVideoURL);
-        NSString *videoURL = watchPasteboardForString();
-        EXPECT_WK_STREQ(@"action-menu-targets.html", [videoURL lastPathComponent]);
-
-        // Also, the download menu item should be disabled for non-downloadable video.
-        ensureMenuItemAtIndexOfTypeIsDisabled([wkView _actionMenu], 2, kWKContextActionItemTagSaveVideoToDownloads);
-    }];
-
-    // HTTP link.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::HTTPLink) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuLink, [wkView _actionMenuResult].type);
-
-        // Invoking an action menu should dismiss any existing selection.
-        // http://trac.webkit.org/changeset/175753
-        EXPECT_WK_STREQ(@"<no selection>", retrieveSelection([wkView pageRef]));
-    }];
-
-    // Mailto link.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::MailtoLink) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuMailtoLink, [wkView _actionMenuResult].type);
-
-        // Data detected links don't get a selection nor special indication, for consistency with HTTP links.
-        EXPECT_WK_STREQ(@"<no selection>", retrieveSelection([wkView pageRef]));
-    }];
-
-    // Non-HTTP(S), non-mailto links should fall back to the text menu.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::FTPLink) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuReadOnlyText, [wkView _actionMenuResult].type);
-        EXPECT_WK_STREQ(@"ftp", retrieveSelection([wkView pageRef]));
-    }];
-
-    // JavaScript links should not be executed, and should fall back to the text menu.
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::JavaScriptLink) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuReadOnlyText, [wkView _actionMenuResult].type);
-        EXPECT_WK_STREQ(@"javascript", retrieveSelection([wkView pageRef]));
-        EXPECT_FALSE(callJavaScriptReturningBool([wkView pageRef], "wasFailCalled()"));
-    }];
-
-    // PDF text content
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::PDFEmbed) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuReadOnlyText, [wkView _actionMenuResult].type);
-        EXPECT_WK_STREQ("separation", WKHitTestResultCopyLookupText([wkView _actionMenuResult].hitTestResult.get()));
-    
-        // FIXME(144008): You cannot copy from PDFs hosted in <embed> tags. When this is fixed, we should test it works here.
-    }];
-
-    // Clients should be able to customize the menu by overriding WKView's _actionMenuItemsForHitTestResult.
-    // http://trac.webkit.org/changeset/174908
-    RetainPtr<NSMenuItem> item = adoptNS([[NSMenuItem alloc] initWithTitle:@"Some Action" action:@selector(copy:) keyEquivalent:@""]);
-    [wkView _setOverrideActionMenuItems:@[ item.get() ]];
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::Image) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(1, [wkView _actionMenu].numberOfItems);
-        EXPECT_WK_STREQ(@"Some Action", [[wkView _actionMenu] itemAtIndex:0].title);
-    }];
-    [wkView _setOverrideActionMenuItems:nil];
-
-    // Clients should be able to customize the DataDetectors actions by implementing
-    // WKBundlePageOverlayClient's prepareForActionMenu callback.
-    // http://trac.webkit.org/changeset/176086
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::PageOverlay) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuDataDetectedItem, [wkView _actionMenuResult].type);
-    }];
-
-    // No menu should be built for whitespace (except in editable areas).
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::PageWhitespace) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuNone, [wkView _actionMenuResult].type);
-        EXPECT_EQ(0, [wkView _actionMenu].numberOfItems);
-    }];
-}
-
-TEST(WebKit2, DISABLED_ActionMenusPDFTest)
-{
-    WKRetainPtr<WKContextRef> context = adoptWK(Util::createContextForInjectedBundleTest("ActionMenusTest"));
-    
-    WKRetainPtr<WKPageGroupRef> pageGroup = adoptWK(WKPageGroupCreateWithIdentifier(Util::toWK("ActionMenusPDFTestGroup").get()));
-    WKPreferencesRef preferences = WKPageGroupGetPreferences(pageGroup.get());
-    WKPreferencesSetMediaSourceEnabled(preferences, true);
-    WKPreferencesSetFileAccessFromFileURLsAllowed(preferences, true);
-    
-    PlatformWebView platformWebView(context.get(), pageGroup.get(), [ActionMenusTestWKView class]);
-    RetainPtr<ActionMenusTestWKView> wkView = (ActionMenusTestWKView *)platformWebView.platformView();
-    
-    if (![wkView respondsToSelector:@selector(_setActionMenu:)])
-        return;
-    
-    WKPageLoaderClientV0 loaderClient;
-    memset(&loaderClient, 0, sizeof(loaderClient));
-    loaderClient.base.version = 0;
-    loaderClient.didFinishLoadForFrame = didFinishLoadForFrameCallback;
-    WKPageSetPageLoaderClient([wkView pageRef], &loaderClient.base);
-    
-    ActiveDownloadContext activeDownloadContext;
-    
-    WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("action-menu-target", "pdf"));
-    WKPageLoadURL([wkView pageRef], url.get());
-    
-    Util::run(&didFinishLoad);
-
-    [wkView runMenuSequenceAtPoint:windowPointForTarget(TargetType::PDFDocument) preDidCloseMenuHandler:^() {
-        EXPECT_EQ(kWKActionMenuReadOnlyText, [wkView _actionMenuResult].type);
-        EXPECT_WK_STREQ("Happiness", WKHitTestResultCopyLookupText([wkView _actionMenuResult].hitTestResult.get()));
-        performMenuItemAtIndexOfTypeAsync([wkView _actionMenu], 0, kWKContextActionItemTagCopyText);
-        EXPECT_WK_STREQ(@"Happiness", watchPasteboardForString());
-    }];
-}
-
-} // namespace TestWebKitAPI
-
-#endif
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2ObjC/ActionMenusBundle.mm b/Tools/TestWebKitAPI/Tests/WebKit2ObjC/ActionMenusBundle.mm
deleted file mode 100644 (file)
index 347bf80..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-
-#if WK_HAVE_C_SPI
-
-#import "ActionMenusBundleSPI.h"
-#import "InjectedBundleTest.h"
-#import "PlatformUtilities.h"
-#import "Test.h"
-#import <Foundation/Foundation.h>
-#import <WebKit/WKBundleFramePrivate.h>
-#import <WebKit/WKBundleHitTestResult.h>
-#import <WebKit/WKBundleNodeHandlePrivate.h>
-#import <WebKit/WKBundlePage.h>
-#import <WebKit/WKBundlePageOverlay.h>
-#import <WebKit/WKBundleRangeHandlePrivate.h>
-#import <WebKit/WKDictionary.h>
-#import <WebKit/WKNumber.h>
-#import <wtf/RetainPtr.h>
-
-namespace TestWebKitAPI {
-
-RetainPtr<DDActionContext> createActionContextForPhoneNumber()
-{
-    RetainPtr<CFStringRef> plainText = CFSTR("(408) 996-1010");
-    RetainPtr<DDScannerRef> scanner = adoptCF(DDScannerCreate(DDScannerTypeStandard, 0, nullptr));
-    RetainPtr<DDScanQueryRef> scanQuery = adoptCF(DDScanQueryCreateFromString(kCFAllocatorDefault, plainText.get(), CFRangeMake(0, CFStringGetLength(plainText.get()))));
-
-    if (!DDScannerScanQuery(scanner.get(), scanQuery.get()))
-        return nullptr;
-
-    RetainPtr<CFArrayRef> results = adoptCF(DDScannerCopyResultsWithOptions(scanner.get(), DDScannerCopyResultsOptionsNoOverlap));
-
-    CFIndex resultCount = CFArrayGetCount(results.get());
-    if (resultCount != 1)
-        return nullptr;
-
-    DDResultRef mainResult = (DDResultRef)CFArrayGetValueAtIndex(results.get(), 0);
-
-    if (!mainResult)
-        return nullptr;
-
-    RetainPtr<DDActionContext> actionContext = adoptNS([[getDDActionContextClass() alloc] init]);
-    [actionContext setAllResults:@[ (id)mainResult ]];
-    [actionContext setMainResult:mainResult];
-
-    return actionContext;
-}
-    
-class ActionMenuTest : public InjectedBundleTest {
-public:
-    ActionMenuTest(const std::string& identifier)
-        : InjectedBundleTest(identifier)
-    {
-    }
-
-    static void prepareForActionMenu(WKBundlePageRef page, WKBundleHitTestResultRef hitTestResult, WKTypeRef* userData, const void* clientInfo)
-    {
-        WKStringRef keys[1];
-        WKTypeRef values[1];
-
-        WKRetainPtr<WKStringRef> hasLinkKey = adoptWK(WKStringCreateWithUTF8CString("hasLinkURL"));
-        WKRetainPtr<WKURLRef> absoluteLinkURL = adoptWK(WKBundleHitTestResultCopyAbsoluteLinkURL(hitTestResult));
-        WKRetainPtr<WKBooleanRef> hasLinkValue = adoptWK(WKBooleanCreate(!!absoluteLinkURL));
-        keys[0] = hasLinkKey.get();
-        values[0] = hasLinkValue.get();
-
-        *userData = WKDictionaryCreate(keys, values, 1);
-    }
-
-    static void* actionContextForResultAtPoint(WKBundlePageOverlayRef pageOverlay, WKPoint position, WKBundleRangeHandleRef* rangeHandle, _WKBundlePageOverlayActionContextRequestType requestType, const void* clientInfo)
-    {
-        if (position.x > 700) {
-            RetainPtr<DDActionContext> actionContext = createActionContextForPhoneNumber();
-            *rangeHandle = (WKBundleRangeHandleRef)clientInfo;
-            return (void*)actionContext.autorelease();
-        }
-        return nullptr;
-    }
-
-    static void drawRect(WKBundlePageOverlayRef pageOverlay, void* graphicsContext, WKRect dirtyRect, const void* clientInfo)
-    {
-        CGContextRef ctx = static_cast<CGContextRef>(graphicsContext);
-        CGContextSetRGBFillColor(ctx, 0, 1, 0, 1);
-        CGContextFillRect(ctx, CGRectMake(700, 0, 100, 600));
-    }
-
-    virtual void didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
-    {
-        WKBundlePageContextMenuClientV1 contextMenuClient;
-        memset(&contextMenuClient, 0, sizeof(contextMenuClient));
-        contextMenuClient.base.version = 1;
-        contextMenuClient.prepareForActionMenu = prepareForActionMenu;
-        WKBundlePageSetContextMenuClient(page, &contextMenuClient.base);
-
-        WKRetainPtr<WKBundleHitTestResultRef> hitTestResult = adoptWK(WKBundleFrameCreateHitTestResult(WKBundlePageGetMainFrame(page), WKPointMake(708, 8)));
-        WKRetainPtr<WKBundleNodeHandleRef> nodeHandle = adoptWK(WKBundleHitTestResultCopyNodeHandle(hitTestResult.get()));
-        _rangeHandle = adoptWK(WKBundleNodeHandleCopyVisibleRange(nodeHandle.get()));
-
-        WKBundlePageOverlayClientV1 pageOverlayClient;
-        memset(&pageOverlayClient, 0, sizeof(pageOverlayClient));
-        pageOverlayClient.base.version = 1;
-        pageOverlayClient.base.clientInfo = _rangeHandle.get();
-
-        pageOverlayClient.drawRect = drawRect;
-        pageOverlayClient.actionContextForResultAtPoint = actionContextForResultAtPoint;
-
-        _bundlePageOverlay = adoptWK(WKBundlePageOverlayCreate(&pageOverlayClient.base));
-        WKBundlePageInstallPageOverlay(page, _bundlePageOverlay.get());
-        WKBundlePageOverlaySetNeedsDisplay(_bundlePageOverlay.get(), WKRectMake(0, 0, 800, 600));
-    }
-
-    WKRetainPtr<WKBundlePageOverlayRef> _bundlePageOverlay;
-    WKRetainPtr<WKBundleRangeHandleRef> _rangeHandle;
-};
-
-static InjectedBundleTest::Register<ActionMenuTest> registrar("ActionMenusTest");
-
-} // namespace TestWebKitAPI
-
-#endif // PLATFORM(MAC)
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2ObjC/ActionMenusBundleSPI.h b/Tools/TestWebKitAPI/Tests/WebKit2ObjC/ActionMenusBundleSPI.h
deleted file mode 100644 (file)
index 626ace6..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import <Foundation/Foundation.h>
-#import <dlfcn.h>
-#import <objc/runtime.h>
-#import <wtf/Assertions.h>
-
-#define SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(framework) \
-    static void* framework##Library() \
-    { \
-        static void* frameworkLibrary = dlopen("/System/Library/PrivateFrameworks/" #framework ".framework/" #framework, RTLD_NOW); \
-        return frameworkLibrary; \
-    }
-
-#define SOFT_LINK(framework, functionName, resultType, parameterDeclarations, parameterNames) \
-    static resultType init##functionName parameterDeclarations; \
-    static resultType (*softLink##functionName) parameterDeclarations = init##functionName; \
-    \
-    static resultType init##functionName parameterDeclarations \
-    { \
-        softLink##functionName = (resultType (*) parameterDeclarations) dlsym(framework##Library(), #functionName); \
-        ASSERT_WITH_MESSAGE(softLink##functionName, "%s", dlerror()); \
-        return softLink##functionName parameterNames; \
-    }\
-    \
-    inline resultType functionName parameterDeclarations \
-    {\
-        return softLink##functionName parameterNames; \
-    }
-
-#define SOFT_LINK_CLASS(framework, className) \
-    static Class init##className(); \
-    static Class (*get##className##Class)() = init##className; \
-    static Class class##className; \
-    \
-    static Class className##Function() \
-    { \
-        return class##className; \
-    }\
-    \
-    static Class init##className() \
-    { \
-        framework##Library(); \
-        class##className = objc_getClass(#className); \
-        ASSERT(class##className); \
-        get##className##Class = className##Function; \
-        return class##className; \
-    }
-
-typedef struct __DDScanner DDScanner, *DDScannerRef;
-typedef struct __DDScanQuery *DDScanQueryRef;
-typedef struct __DDResult *DDResultRef;
-
-typedef enum {
-    DDScannerTypeStandard = 0,
-} DDScannerType;
-
-enum {
-    DDScannerOptionStopAtFirstMatch = 1,
-};
-typedef CFIndex DDScannerOptions;
-
-enum {
-    DDScannerCopyResultsOptionsNone = 0,
-    DDScannerCopyResultsOptionsNoOverlap = 1 << 0,
-};
-typedef CFIndex DDScannerCopyResultsOptions;
-
-SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(DataDetectors)
-SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(DataDetectorsCore)
-
-extern "C" {
-
-SOFT_LINK(DataDetectorsCore, DDScannerCreate, DDScannerRef, (DDScannerType type, DDScannerOptions options, CFErrorRef* errorRef), (type, options, errorRef))
-SOFT_LINK(DataDetectorsCore, DDScanQueryCreateFromString, DDScanQueryRef, (CFAllocatorRef allocator, CFStringRef string, CFRange range), (allocator, string, range))
-SOFT_LINK(DataDetectorsCore, DDScannerScanQuery, DDScanQueryRef, (DDScannerRef scanner, DDScanQueryRef query), (scanner, query))
-SOFT_LINK(DataDetectorsCore, DDScannerCopyResultsWithOptions, CFArrayRef, (DDScannerRef scanner, DDScannerCopyResultsOptions options), (scanner, options))
-
-}
-
-SOFT_LINK_CLASS(DataDetectors, DDActionContext)
-
-@interface DDActionContext : NSObject <NSCopying, NSSecureCoding>
-
-@property (retain) NSArray *allResults;
-@property (retain) __attribute__((NSObject)) DDResultRef mainResult;
-
-@end