Diff
Modified: branches/safari-600.3-branch/Source/WebKit2/ChangeLog (175322 => 175323)
--- branches/safari-600.3-branch/Source/WebKit2/ChangeLog 2014-10-29 08:49:35 UTC (rev 175322)
+++ branches/safari-600.3-branch/Source/WebKit2/ChangeLog 2014-10-29 08:51:59 UTC (rev 175323)
@@ -1,5 +1,38 @@
2014-10-29 Lucas Forschler <[email protected]>
+ Merge r175193
+
+ 2014-10-24 Beth Dakin <[email protected]>
+
+ _actionMenuItemsForHitTestResult should also take a type indicating what the menu
+ was built for
+ https://bugs.webkit.org/show_bug.cgi?id=138063
+
+ Reviewed by Dan Bernstein.
+
+ New type enum that can be used by clients.
+ * Shared/API/c/WKActionMenuTypes.h: Added.
+
+ Remove the old SPI and add the new.
+ * UIProcess/API/Cocoa/WKViewPrivate.h:
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView _actionMenuItemsForHitTestResult:withType:defaultActionMenuItems:]):
+ (-[WKView _actionMenuItemsForHitTestResult:defaultActionMenuItems:]): Deleted.
+
+ Now keep an ivar for the type.
+ * UIProcess/mac/WKActionMenuController.h:
+
+ Create a category for the old SPI so that we can still call it if clients have
+ implemented it.
+ * UIProcess/mac/WKActionMenuController.mm:
+ (-[WKActionMenuController initWithPage:view:]):
+ (-[WKActionMenuController didCloseMenu:withEvent:]):
+ (imageForResource:name::if):
+ (-[WKActionMenuController _updateActionMenuItems]):
+ * WebKit2.xcodeproj/project.pbxproj:
+
+2014-10-29 Lucas Forschler <[email protected]>
+
Merge r175190
2014-10-24 Tim Horton <[email protected]>
Copied: branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKActionMenuTypes.h (from rev 175193, trunk/Source/WebKit2/Shared/API/c/WKActionMenuTypes.h) (0 => 175323)
--- branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKActionMenuTypes.h (rev 0)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKActionMenuTypes.h 2014-10-29 08:51:59 UTC (rev 175323)
@@ -0,0 +1,46 @@
+/*
+ * 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 WKActionMenuTypes_h
+#define WKActionMenuTypes_h
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+ kWKActionMenuNone = 0,
+ kWKActionMenuLink,
+ kWKActionMenuImage
+};
+typedef uint32_t _WKActionMenuType;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKActionMenuTypes_h */
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h (175322 => 175323)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h 2014-10-29 08:49:35 UTC (rev 175322)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h 2014-10-29 08:51:59 UTC (rev 175323)
@@ -23,6 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import <WebKit/WKActionMenuTypes.h>
#import <WebKit/WKBase.h>
#import <WebKit/WKView.h>
@@ -116,7 +117,7 @@
// 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 defaultActionMenuItems:(NSArray *)defaultMenuItems;
+- (NSArray *)_actionMenuItemsForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(_WKActionMenuType)type defaultActionMenuItems:(NSArray *)defaultMenuItems;
#endif
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm (175322 => 175323)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm 2014-10-29 08:49:35 UTC (rev 175322)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm 2014-10-29 08:51:59 UTC (rev 175323)
@@ -4125,7 +4125,7 @@
}
-- (NSArray *)_actionMenuItemsForHitTestResult:(WKHitTestResultRef)hitTestResult defaultActionMenuItems:(NSArray *)defaultMenuItems
+- (NSArray *)_actionMenuItemsForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(_WKActionMenuType)type defaultActionMenuItems:(NSArray *)defaultMenuItems
{
return defaultMenuItems;
}
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.h (175322 => 175323)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.h 2014-10-29 08:49:35 UTC (rev 175322)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.h 2014-10-29 08:51:59 UTC (rev 175323)
@@ -28,6 +28,7 @@
#import "ActionMenuHitTestResult.h"
#import "WKActionMenuItemTypes.h"
+#import "WKActionMenuTypes.h"
#import <AppKit/NSSharingService.h>
#import <wtf/RetainPtr.h>
@@ -50,6 +51,7 @@
WebKit::ActionMenuState _state;
WebKit::ActionMenuHitTestResult _hitTestResult;
+ _WKActionMenuType _type;
RetainPtr<NSSharingServicePicker> _sharingServicePicker;
}
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (175322 => 175323)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm 2014-10-29 08:49:35 UTC (rev 175322)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm 2014-10-29 08:51:59 UTC (rev 175323)
@@ -63,6 +63,10 @@
- (void)_updateActionMenuItems;
@end
+@interface WKView (WKDeprecatedSPI)
+- (NSArray *)_actionMenuItemsForHitTestResult:(WKHitTestResultRef)hitTestResult defaultActionMenuItems:(NSArray *)defaultMenuItems;
+@end
+
@implementation WKActionMenuController
- (instancetype)initWithPage:(WebPageProxy&)page view:(WKView *)wkView
@@ -74,6 +78,7 @@
_page = &page;
_wkView = wkView;
+ _type = kWKActionMenuNone;
return self;
}
@@ -121,6 +126,7 @@
_state = ActionMenuState::None;
_hitTestResult = ActionMenuHitTestResult();
+ _type = kWKActionMenuNone;
_sharingServicePicker = nil;
}
@@ -377,10 +383,13 @@
- (NSArray *)_defaultMenuItems
{
if (WebHitTestResult* hitTestResult = _page->activeActionMenuHitTestResult()) {
- if (!hitTestResult->absoluteImageURL().isEmpty() && _hitTestResult.image)
+ if (!hitTestResult->absoluteImageURL().isEmpty() && _hitTestResult.image) {
+ _type = kWKActionMenuImage;
return [self _defaultMenuItemsForImage];
- if (!hitTestResult->absoluteLinkURL().isEmpty())
+ } if (!hitTestResult->absoluteLinkURL().isEmpty()) {
+ _type = kWKActionMenuLink;
return [self _defaultMenuItemsForLink];
+ }
}
return @[ ];
@@ -390,8 +399,12 @@
{
[_wkView.actionMenu removeAllItems];
- NSArray *menuItems = [_wkView _actionMenuItemsForHitTestResult:toAPI(_page->activeActionMenuHitTestResult()) defaultActionMenuItems:[self _defaultMenuItems]];
-
+ NSArray *menuItems = [self _defaultMenuItems];
+ if ([_wkView respondsToSelector:@selector(_actionMenuItemsForHitTestResult:defaultActionMenuItems:)])
+ menuItems = [_wkView _actionMenuItemsForHitTestResult:toAPI(_page->activeActionMenuHitTestResult()) defaultActionMenuItems:menuItems];
+ else
+ menuItems = [_wkView _actionMenuItemsForHitTestResult:toAPI(_page->activeActionMenuHitTestResult()) withType:_type defaultActionMenuItems:menuItems];
+
for (NSMenuItem *item in menuItems)
[_wkView.actionMenu addItem:item];
}
Modified: branches/safari-600.3-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (175322 => 175323)
--- branches/safari-600.3-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-10-29 08:49:35 UTC (rev 175322)
+++ branches/safari-600.3-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-10-29 08:51:59 UTC (rev 175323)
@@ -1105,6 +1105,7 @@
9391F2CA121B679A00EBF7E8 /* WebFrameNetworkingContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9391F284121B38F500EBF7E8 /* WebFrameNetworkingContext.mm */; };
9391F2CB121B67AD00EBF7E8 /* WebFrameNetworkingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 9391F283121B38F500EBF7E8 /* WebFrameNetworkingContext.h */; };
939AE7661316E99C00AE06A6 /* WebCoreArgumentCoders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 939AE7651316E99C00AE06A6 /* WebCoreArgumentCoders.cpp */; };
+ 939F401C19FB0BBC002B2B42 /* WKActionMenuTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 939F401B19FB0BBC002B2B42 /* WKActionMenuTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
93BDEB01171DD7AF00BFEE1B /* WKPageLoadTypesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 93BDEB00171DD7AF00BFEE1B /* WKPageLoadTypesPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
9F54F88F16488E87007DF81A /* ChildProcessMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9F54F88E16488E87007DF81A /* ChildProcessMac.mm */; };
9F54F8951648AE0F007DF81A /* PluginProcessManagerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9F54F8941648AE0E007DF81A /* PluginProcessManagerMac.mm */; };
@@ -3169,6 +3170,7 @@
9391F283121B38F500EBF7E8 /* WebFrameNetworkingContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameNetworkingContext.h; sourceTree = "<group>"; };
9391F284121B38F500EBF7E8 /* WebFrameNetworkingContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebFrameNetworkingContext.mm; sourceTree = "<group>"; };
939AE7651316E99C00AE06A6 /* WebCoreArgumentCoders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreArgumentCoders.cpp; sourceTree = "<group>"; };
+ 939F401B19FB0BBC002B2B42 /* WKActionMenuTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKActionMenuTypes.h; sourceTree = "<group>"; };
93BDEB00171DD7AF00BFEE1B /* WKPageLoadTypesPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageLoadTypesPrivate.h; sourceTree = "<group>"; };
9F54F88E16488E87007DF81A /* ChildProcessMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ChildProcessMac.mm; sourceTree = "<group>"; };
9F54F8941648AE0E007DF81A /* PluginProcessManagerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProcessManagerMac.mm; sourceTree = "<group>"; };
@@ -6691,6 +6693,7 @@
BCCF6AC412C91F3B008F9C35 /* cg */,
BC4075D6124FF0000068F20A /* mac */,
934B724319F5B9BE00AE96D6 /* WKActionMenuItemTypes.h */,
+ 939F401B19FB0BBC002B2B42 /* WKActionMenuTypes.h */,
BC4075D7124FF0270068F20A /* WKArray.cpp */,
BC4075D8124FF0270068F20A /* WKArray.h */,
BCDDB316124EBD130048D13C /* WKBase.h */,
@@ -7393,6 +7396,7 @@
1ACB7987191ECADD006A6A61 /* XPCPtr.h in Headers */,
1A6420E512DCE2FF00CAAE2C /* ShareableBitmap.h in Headers */,
51217461164C20E30037A5C1 /* ShareableResource.h in Headers */,
+ 939F401C19FB0BBC002B2B42 /* WKActionMenuTypes.h in Headers */,
1A24BED5120894D100FBB059 /* SharedMemory.h in Headers */,
510274321981AF8E008165ED /* WKOriginDataManager.h in Headers */,
5272B28B1406985D0096A5D0 /* StatisticsData.h in Headers */,