Title: [177199] trunk/Source/WebKit/mac
- Revision
- 177199
- Author
- [email protected]
- Date
- 2014-12-11 17:48:45 -0800 (Thu, 11 Dec 2014)
Log Message
WK1: Need new SPI for Webkit clients to override default immediate action
https://bugs.webkit.org/show_bug.cgi?id=139568
-and corresponding-
rdar://problem/19225448
Reviewed by Dan Bernstein.
Call SPI giving clients a chance to override the default behavior.
* WebView/WebImmediateActionController.mm:
(-[WebImmediateActionController _updateImmediateActionItem]):
New SPI.
* WebView/WebUIDelegatePrivate.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit/mac/ChangeLog (177198 => 177199)
--- trunk/Source/WebKit/mac/ChangeLog 2014-12-12 01:41:30 UTC (rev 177198)
+++ trunk/Source/WebKit/mac/ChangeLog 2014-12-12 01:48:45 UTC (rev 177199)
@@ -1,3 +1,19 @@
+2014-12-11 Beth Dakin <[email protected]>
+
+ WK1: Need new SPI for Webkit clients to override default immediate action
+ https://bugs.webkit.org/show_bug.cgi?id=139568
+ -and corresponding-
+ rdar://problem/19225448
+
+ Reviewed by Dan Bernstein.
+
+ Call SPI giving clients a chance to override the default behavior.
+ * WebView/WebImmediateActionController.mm:
+ (-[WebImmediateActionController _updateImmediateActionItem]):
+
+ New SPI.
+ * WebView/WebUIDelegatePrivate.h:
+
2014-12-11 Timothy Horton <[email protected]>
Move the preview popover to WebImmediateActionController
Modified: trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm (177198 => 177199)
--- trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm 2014-12-12 01:41:30 UTC (rev 177198)
+++ trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm 2014-12-12 01:48:45 UTC (rev 177199)
@@ -27,6 +27,7 @@
#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+#import "WebElementDictionary.h"
#import "WebFrameInternal.h"
#import "WebHTMLView.h"
#import "WebHTMLViewInternal.h"
@@ -126,6 +127,7 @@
{
_type = WebImmediateActionNone;
_immediateActionRecognizer.animationController = nil;
+ id <NSImmediateActionAnimationController> defaultAnimationController = nil;
NSURL *url = ""
NSString *absoluteURLString = [url absoluteString];
@@ -135,9 +137,22 @@
RetainPtr<QLPreviewMenuItem> qlPreviewLinkItem = [NSMenuItem standardQuickLookMenuItem];
[qlPreviewLinkItem setPreviewStyle:QLPreviewStylePopover];
[qlPreviewLinkItem setDelegate:self];
- _immediateActionRecognizer.animationController = (id<NSImmediateActionAnimationController>)qlPreviewLinkItem.get();
+ defaultAnimationController = (id <NSImmediateActionAnimationController>)qlPreviewLinkItem.get();
+ }
+
+ // Allow clients the opportunity to override the default immediate action.
+ id customClientAnimationController = nil;
+ if ([[_webView UIDelegate] respondsToSelector:@selector(_webView:immediateActionAnimationControllerForHitTestResult:withType:)]) {
+ RetainPtr<WebElementDictionary> webHitTestResult = [[WebElementDictionary alloc] initWithHitTestResult:_hitTestResult];
+ customClientAnimationController = [[_webView UIDelegate] _webView:_webView immediateActionAnimationControllerForHitTestResult:webHitTestResult.get() withType:_type];
+ }
+
+ if (customClientAnimationController == [NSNull null])
return;
- }
+ if (customClientAnimationController && [customClientAnimationController conformsToProtocol:@protocol(NSImmediateActionAnimationController)])
+ _immediateActionRecognizer.animationController = (id <NSImmediateActionAnimationController>)customClientAnimationController;
+ else
+ _immediateActionRecognizer.animationController = defaultAnimationController;
}
#pragma mark QLPreviewMenuItemDelegate implementation
Modified: trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h (177198 => 177199)
--- trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h 2014-12-12 01:41:30 UTC (rev 177198)
+++ trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h 2014-12-12 01:48:45 UTC (rev 177199)
@@ -234,6 +234,10 @@
- (void)webView:(WebView *)sender saveFrameView:(WebFrameView *)frameView showingPanel:(BOOL)showingPanel;
- (NSArray *)_webView:(WebView *)sender actionMenuItemsForHitTestResult:(NSDictionary *)hitTestResult withType:(WebActionMenuType)type defaultActionMenuItems:(NSArray *)defaultMenuItems;
- (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
+// do something custom, return an object that conforms to the NSImmediateActionAnimationController protocol.
+- (id)_webView:(WebView *)sender immediateActionAnimationControllerForHitTestResult:(NSDictionary *)hitTestResult withType:(WebImmediateActionType)type;
#endif
- (BOOL)webView:(WebView *)sender didPressMissingPluginButton:(DOMElement *)element;
/*!
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes