Title: [175324] branches/safari-600.3-branch/Source/WebKit/mac
- Revision
- 175324
- Author
- [email protected]
- Date
- 2014-10-29 01:54:22 -0700 (Wed, 29 Oct 2014)
Log Message
Merged r175229. rdar://problem/18451638
Modified Paths
Diff
Modified: branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog (175323 => 175324)
--- branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog 2014-10-29 08:51:59 UTC (rev 175323)
+++ branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog 2014-10-29 08:54:22 UTC (rev 175324)
@@ -1,5 +1,28 @@
2014-10-29 Lucas Forschler <[email protected]>
+ Merge r175229
+
+ 2014-10-27 Beth Dakin <[email protected]>
+
+ Provide a way for WebKit1 clients to override default action menu items
+ https://bugs.webkit.org/show_bug.cgi?id=138066
+ -and corresponding-
+ rdar://problem/18451638
+
+ Reviewed by Anders Carlsson.
+
+ WebActionMenuController now has an ivar for the WebActionMenuType so that it can
+ send that along to clients customizing the menu.
+ * WebView/WebActionMenuController.h:
+ * WebView/WebActionMenuController.mm:
+ (-[WebActionMenuController prepareForMenu:withEvent:]):
+ (-[WebActionMenuController _defaultMenuItemsForHitTestResult:]):
+
+ New enum and new SPI to customize menus.
+ * WebView/WebUIDelegatePrivate.h:
+
+2014-10-29 Lucas Forschler <[email protected]>
+
Merge r175147
2014-10-23 Tim Horton <[email protected]>
Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.h (175323 => 175324)
--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.h 2014-10-29 08:51:59 UTC (rev 175323)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.h 2014-10-29 08:54:22 UTC (rev 175324)
@@ -23,11 +23,14 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "WebUIDelegatePrivate.h"
+
@class WebView;
@interface WebActionMenuController : NSObject {
@private
WebView *_webView;
+ WebActionMenuType _type;
}
- (id)initWithWebView:(WebView *)webView;
Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm (175323 => 175324)
--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm 2014-10-29 08:51:59 UTC (rev 175323)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm 2014-10-29 08:54:22 UTC (rev 175324)
@@ -58,7 +58,9 @@
{
if (!(self = [super init]))
return nil;
+
_webView = webView;
+ _type = WebActionMenuNone;
return self;
}
@@ -81,9 +83,12 @@
NSDictionary *hitTestResult = [_webView elementAtPoint:[_webView convertPoint:event.locationInWindow fromView:nil]];
- // FIXME: We should support API for clients to customize the menu items.
NSArray *menuItems = [self _defaultMenuItemsForHitTestResult:hitTestResult];
+ // Allow clients to customize the menu items.
+ if ([[_webView UIDelegate] respondsToSelector:@selector(_webView:actionMenuItemsForHitTestResult:withType:defaultActionMenuItems:)])
+ menuItems = [[_webView UIDelegate] _webView:_webView actionMenuItemsForHitTestResult:hitTestResult withType:_type defaultActionMenuItems:menuItems];
+
for (NSMenuItem *item in menuItems)
[actionMenu addItem:item];
}
@@ -236,9 +241,13 @@
- (NSArray *)_defaultMenuItemsForHitTestResult:(NSDictionary *)hitTestResult
{
NSURL *url = "" objectForKey:WebElementLinkURLKey];
- if (url)
+
+ if (url) {
+ _type = WebActionMenuLink;
return [self _defaultMenuItemsForLink:hitTestResult];
+ }
+ _type = WebActionMenuNone;
return @[ ];
}
Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h (175323 => 175324)
--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h 2014-10-29 08:51:59 UTC (rev 175323)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h 2014-10-29 08:54:22 UTC (rev 175324)
@@ -112,6 +112,18 @@
WebMenuItemTagBaseApplication = 10000
};
+enum {
+ WebActionMenuItemTagNoAction = 0,
+ WebActionMenuItemTagOpenLinkInDefaultBrowser,
+ WebActionMenuItemTagPreviewLink,
+ WebActionMenuItemTagAddLinkToSafariReadingList
+};
+
+typedef enum {
+ WebActionMenuNone = 0,
+ WebActionMenuLink
+} WebActionMenuType;
+
// Message Sources.
extern NSString *WebConsoleMessageXMLMessageSource;
extern NSString *WebConsoleMessageJSMessageSource;
@@ -193,6 +205,7 @@
- (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;
#endif
- (BOOL)webView:(WebView *)sender didPressMissingPluginButton:(DOMElement *)element;
/*!
@@ -269,11 +282,4 @@
- (NSData *)webCryptoMasterKeyForWebView:(WebView *)sender;
-enum {
- WebActionMenuItemTagNoAction = 0,
- WebActionMenuItemTagOpenLinkInDefaultBrowser,
- WebActionMenuItemTagPreviewLink,
- WebActionMenuItemTagAddLinkToSafariReadingList
-};
-
@end
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes