Diff
Modified: trunk/Source/WebKit/ChangeLog (177130 => 177131)
--- trunk/Source/WebKit/ChangeLog 2014-12-11 05:31:04 UTC (rev 177130)
+++ trunk/Source/WebKit/ChangeLog 2014-12-11 06:24:01 UTC (rev 177131)
@@ -1,3 +1,12 @@
+2014-12-10 Beth Dakin <bda...@apple.com>
+
+ WK1: Add initial support for immediate actions
+ https://bugs.webkit.org/show_bug.cgi?id=139522
+
+ Reviewed by Dan Bernstein.
+
+ * WebKit.xcodeproj/project.pbxproj:
+
2014-12-10 Anders Carlsson <ander...@apple.com>
Add session storage handling to StorageNamespaceProvider
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (177130 => 177131)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2014-12-11 05:31:04 UTC (rev 177130)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2014-12-11 06:24:01 UTC (rev 177131)
@@ -161,6 +161,8 @@
9304B3000B02341500F7850D /* WebIconDatabaseInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9304B2FF0B02341500F7850D /* WebIconDatabaseInternal.h */; };
931633EB0AEDFF930062B92D /* WebFrameLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 931633EA0AEDFF930062B92D /* WebFrameLoaderClient.h */; };
931633EF0AEDFFAE0062B92D /* WebFrameLoaderClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 931633EE0AEDFFAE0062B92D /* WebFrameLoaderClient.mm */; };
+ 9321D5921A391DC3008052BE /* WebImmediateActionController.h in Headers */ = {isa = PBXBuildFile; fileRef = 9321D5911A391DB8008052BE /* WebImmediateActionController.h */; };
+ 9321D5941A391DF9008052BE /* WebImmediateActionController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9321D5931A391DF9008052BE /* WebImmediateActionController.mm */; };
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 */; };
@@ -692,6 +694,8 @@
931633EA0AEDFF930062B92D /* WebFrameLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameLoaderClient.h; sourceTree = "<group>"; };
931633EE0AEDFFAE0062B92D /* WebFrameLoaderClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebFrameLoaderClient.mm; sourceTree = "<group>"; };
93185DB506679F42005D5E7E /* WebHTMLViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebHTMLViewInternal.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+ 9321D5911A391DB8008052BE /* WebImmediateActionController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebImmediateActionController.h; sourceTree = "<group>"; };
+ 9321D5931A391DF9008052BE /* WebImmediateActionController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebImmediateActionController.mm; sourceTree = "<group>"; };
933D659903413FF2008635CE /* WebClipView.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebClipView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
933D659A03413FF2008635CE /* WebClipView.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; indentWidth = 4; path = WebClipView.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
9345D17C0365BF35008635CE /* English */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = wrapper.nib; name = English; path = Panels/English.lproj/WebAuthenticationPanel.nib; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
@@ -1346,6 +1350,8 @@
BC7F889D10C9D30C00D6133D /* WebGeolocationPosition.mm */,
BC7F88A410C9D88B00D6133D /* WebGeolocationPositionInternal.h */,
5158F6EE106D862A00AF457C /* WebHistoryDelegate.h */,
+ 9321D5911A391DB8008052BE /* WebImmediateActionController.h */,
+ 9321D5931A391DF9008052BE /* WebImmediateActionController.mm */,
A560946414D8AD2600799A8A /* WebIndicateLayer.h */,
A560946514D8AD2600799A8A /* WebIndicateLayer.mm */,
5185F62510712B80007AA393 /* WebNavigationData.h */,
@@ -1905,6 +1911,7 @@
939810890824BF01008DF038 /* WebResourcePrivate.h in Headers */,
A10C1D3A18202FC50036883A /* WebNSStringExtrasIOS.h in Headers */,
7E6FEF0808985A7200C44C3F /* WebScriptDebugDelegate.h in Headers */,
+ 9321D5921A391DC3008052BE /* WebImmediateActionController.h in Headers */,
C0167BF80D7F5DD00028696E /* WebScriptDebugger.h in Headers */,
C0B1F7E810AC8E3100C925D9 /* WebScriptWorld.h in Headers */,
C0B1F7EA10AC8E3100C925D9 /* WebScriptWorldInternal.h in Headers */,
@@ -2171,6 +2178,7 @@
065AD5A40B0C32C7005A2B1D /* WebContextMenuClient.mm in Sources */,
939810BF0824BF01008DF038 /* WebCoreStatistics.mm in Sources */,
93E2A1A5123B0B3C009FE12A /* WebDashboardRegion.mm in Sources */,
+ 9321D5941A391DF9008052BE /* WebImmediateActionController.mm in Sources */,
511F3FD50CECC88F00852565 /* WebDatabaseManager.mm in Sources */,
511F3FD80CECC88F00852565 /* WebDatabaseManagerClient.mm in Sources */,
A5DEFC1011D5343E00885273 /* WebDatabaseQuotaManager.mm in Sources */,
Modified: trunk/Source/WebKit/mac/ChangeLog (177130 => 177131)
--- trunk/Source/WebKit/mac/ChangeLog 2014-12-11 05:31:04 UTC (rev 177130)
+++ trunk/Source/WebKit/mac/ChangeLog 2014-12-11 06:24:01 UTC (rev 177131)
@@ -1,3 +1,36 @@
+2014-12-10 Beth Dakin <bda...@apple.com>
+
+ WK1: Add initial support for immediate actions
+ https://bugs.webkit.org/show_bug.cgi?id=139522
+
+ Reviewed by Dan Bernstein.
+
+ This basic implementation of the controller will use the delegate methods to
+ perform and cache a HitTest when relevant. Future patches will patch
+ _updateImmediateActionItem to use the HitTestResult to determine if there is any
+ immediate action that should be taken.
+ * WebView/WebImmediateActionController.h: Added.
+ * WebView/WebImmediateActionController.mm: Added.
+ (-[WebImmediateActionController webViewClosed]):
+ (-[WebImmediateActionController _clearImmediateActionState]):
+ (-[WebImmediateActionController performHitTestAtPoint:]):
+ (-[WebImmediateActionController immediateActionRecognizerWillPrepare:]):
+ (-[WebImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
+ (-[WebImmediateActionController immediateActionRecognizerDidCancelAnimation:]):
+ (-[WebImmediateActionController immediateActionRecognizerDidCompleteAnimation:]):
+ (-[WebImmediateActionController _updateImmediateActionItem]):
+
+ New enum for immediate action types.
+ * WebView/WebUIDelegatePrivate.h:
+
+ Create an NSImmediateActionGestureRecognizer if possible and a controller.
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:]):
+ (-[WebView _close]):
+ * WebView/WebViewData.h:
+ * WebView/WebViewData.mm:
+ (-[WebViewPrivate dealloc]):
+
2014-12-08 Anders Carlsson <ander...@apple.com>
Use the new storage namespace provider in WebKit1
Added: trunk/Source/WebKit/mac/WebView/WebImmediateActionController.h (0 => 177131)
--- trunk/Source/WebKit/mac/WebView/WebImmediateActionController.h (rev 0)
+++ trunk/Source/WebKit/mac/WebView/WebImmediateActionController.h 2014-12-11 06:24:01 UTC (rev 177131)
@@ -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.
+ */
+
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+
+#import "WebUIDelegatePrivate.h"
+#import <WebCore/HitTestResult.h>
+#import <wtf/RetainPtr.h>
+
+@class WebView;
+
+@interface WebImmediateActionController : NSObject <NSGestureRecognizerDelegate> {
+@private
+ WebView *_webView;
+ WebImmediateActionType _type;
+ WebCore::HitTestResult _hitTestResult;
+}
+
+- (instancetype)initWithWebView:(WebView *)webView;
+- (void)webViewClosed;
+
+@end
+
+#endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
Added: trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm (0 => 177131)
--- trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm (rev 0)
+++ trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm 2014-12-11 06:24:01 UTC (rev 177131)
@@ -0,0 +1,122 @@
+/*
+ * 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 "WebImmediateActionController.h"
+
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+
+#import "WebFrameInternal.h"
+#import "WebHTMLView.h"
+#import "WebHTMLViewInternal.h"
+#import "WebUIDelegatePrivate.h"
+#import "WebViewInternal.h"
+#import <WebCore/EventHandler.h>
+#import <WebCore/Frame.h>
+#import <WebCore/NSImmediateActionGestureRecognizerSPI.h>
+#import <objc/objc-class.h>
+#import <objc/objc.h>
+
+using namespace WebCore;
+
+@implementation WebImmediateActionController
+
+- (instancetype)initWithWebView:(WebView *)webView
+{
+ if (!(self = [super init]))
+ return nil;
+
+ _webView = webView;
+ _type = WebImmediateActionNone;
+
+ return self;
+}
+
+- (void)webViewClosed
+{
+ _webView = nil;
+}
+
+- (void)_clearImmediateActionState
+{
+ _type = WebImmediateActionNone;
+}
+
+- (void)performHitTestAtPoint:(NSPoint)viewPoint
+{
+ Frame* coreFrame = core([[[[_webView _selectedOrMainFrame] frameView] documentView] _frame]);
+ if (!coreFrame)
+ return;
+ _hitTestResult = coreFrame->eventHandler().hitTestResultAtPoint(IntPoint(viewPoint));
+}
+
+#pragma mark NSGestureRecognizerDelegate
+
+- (void)immediateActionRecognizerWillPrepare:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
+{
+ if (!_webView)
+ return;
+
+ if (immediateActionRecognizer.view != _webView)
+ return;
+
+ WebHTMLView *documentView = [[[_webView _selectedOrMainFrame] frameView] documentView];
+ NSPoint locationInDocumentView = [immediateActionRecognizer locationInView:documentView];
+ [self performHitTestAtPoint:locationInDocumentView];
+}
+
+- (void)immediateActionRecognizerWillBeginAnimation:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
+{
+ if (immediateActionRecognizer.view != _webView)
+ return;
+
+ // FIXME: Add support for the types of functionality provided in Action menu's menuNeedsUpdate.
+}
+
+- (void)immediateActionRecognizerDidCancelAnimation:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
+{
+ if (immediateActionRecognizer.view != _webView)
+ return;
+
+ [self _clearImmediateActionState];
+}
+
+- (void)immediateActionRecognizerDidCompleteAnimation:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
+{
+ if (immediateActionRecognizer.view != _webView)
+ return;
+
+ // FIXME: Add support for the types of functionality provided in Action menu's willOpenMenu.
+}
+
+#pragma mark Immediate actions
+
+- (void)_updateImmediateActionItem
+{
+ // FIXME: Implement. Inspect _hitTestResult to determine if there is an immediate action to take.
+}
+
+@end
+
+#endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
Modified: trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h (177130 => 177131)
--- trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h 2014-12-11 05:31:04 UTC (rev 177130)
+++ trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h 2014-12-11 06:24:01 UTC (rev 177131)
@@ -144,6 +144,10 @@
WebActionMenuTelLink
} WebActionMenuType;
+typedef enum {
+ WebImmediateActionNone = 0,
+} WebImmediateActionType;
+
// Message Sources.
extern NSString *WebConsoleMessageXMLMessageSource;
extern NSString *WebConsoleMessageJSMessageSource;
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (177130 => 177131)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2014-12-11 05:31:04 UTC (rev 177130)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2014-12-11 06:24:01 UTC (rev 177131)
@@ -209,12 +209,14 @@
#import "WebActionMenuController.h"
#import "WebContextMenuClient.h"
#import "WebFullScreenController.h"
+#import "WebImmediateActionController.h"
#import "WebNSEventExtras.h"
#import "WebNSObjectExtras.h"
#import "WebNSPasteboardExtras.h"
#import "WebNSPrintOperationExtras.h"
#import "WebPDFView.h"
#import <WebCore/LookupSPI.h>
+#import <WebCore/NSImmediateActionGestureRecognizerSPI.h>
#import <WebCore/NSViewSPI.h>
#import <WebCore/SoftLinking.h>
#import <WebCore/TextIndicator.h>
@@ -889,6 +891,13 @@
_private->actionMenuController = [[WebActionMenuController alloc] initWithWebView:self];
self.actionMenu.autoenablesItems = NO;
}
+
+ if (Class gestureClass = NSClassFromString(@"NSImmediateActionGestureRecognizer")) {
+ RetainPtr<NSImmediateActionGestureRecognizer> recognizer = adoptNS([(NSImmediateActionGestureRecognizer *)[gestureClass alloc] initWithTarget:nil action:NULL]);
+ _private->immediateActionController = [[WebImmediateActionController alloc] initWithWebView:self];
+ [recognizer setDelegate:_private->immediateActionController];
+ [self addGestureRecognizer:recognizer.get()];
+ }
#endif
#if !PLATFORM(IOS)
@@ -1743,6 +1752,7 @@
#endif
#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
[_private->actionMenuController webViewClosed];
+ [_private->immediateActionController webViewClosed];
#endif
#if !PLATFORM(IOS)
Modified: trunk/Source/WebKit/mac/WebView/WebViewData.h (177130 => 177131)
--- trunk/Source/WebKit/mac/WebView/WebViewData.h 2014-12-11 05:31:04 UTC (rev 177130)
+++ trunk/Source/WebKit/mac/WebView/WebViewData.h 2014-12-11 06:24:01 UTC (rev 177131)
@@ -51,6 +51,7 @@
}
@class WebActionMenuController;
+@class WebImmediateActionController;
@class WebInspector;
@class WebNodeHighlight;
@class WebPluginDatabase;
@@ -150,6 +151,7 @@
#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;
BOOL hasInitializedLookupObserver;
Modified: trunk/Source/WebKit/mac/WebView/WebViewData.mm (177130 => 177131)
--- trunk/Source/WebKit/mac/WebView/WebViewData.mm 2014-12-11 05:31:04 UTC (rev 177130)
+++ trunk/Source/WebKit/mac/WebView/WebViewData.mm 2014-12-11 06:24:01 UTC (rev 177131)
@@ -147,6 +147,7 @@
[currentNodeHighlight release];
#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
[actionMenuController release];
+ [immediateActionController release];
#endif
[hostWindow release];
[policyDelegateForwarder release];