Diff
Modified: trunk/Source/WebKit/ChangeLog (221414 => 221415)
--- trunk/Source/WebKit/ChangeLog 2017-08-31 03:48:21 UTC (rev 221414)
+++ trunk/Source/WebKit/ChangeLog 2017-08-31 04:07:34 UTC (rev 221415)
@@ -1,3 +1,22 @@
+2017-08-30 Dan Bernstein <m...@apple.com>
+
+ [iOS] REGRESSION (r218144) -[WKContentView targetForAction:withSender:] returns the content view for actions implemented only by the WKWebView, causing a crash
+ https://bugs.webkit.org/show_bug.cgi?id=176077
+ <rdar://problem/34145200>
+
+ Reviewed by Sam Weinig.
+
+ Test: TestWebKitAPI/Tests/WebKitCocoa/WKContentViewTargetForAction.mm
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView targetForAction:withSender:]): Override and forward WKContentView actions to
+ -[WKContentView targetForActionForWebView:withSender:].
+ * UIProcess/ios/WKContentViewInteraction.h: Declare -targetForActionForWebView:withSender:.
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView targetForAction:withSender:]): Forward to the WKWebView.
+ (-[WKContentView targetForActionForWebView:withSender:]): Call super’s
+ -targetForAction:withSender:.
+
2017-08-30 Brent Fulgham <bfulg...@apple.com>
Fix whitespace and formatting
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (221414 => 221415)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2017-08-31 03:48:21 UTC (rev 221414)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2017-08-31 04:07:34 UTC (rev 221415)
@@ -1253,6 +1253,19 @@
return [super canPerformAction:action withSender:sender];
}
+- (id)targetForAction:(SEL)action withSender:(id)sender
+{
+ #define FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW(_action) \
+ if (action == @selector(_action:) && self.usesStandardContentView) \
+ return [_contentView targetForActionForWebView:action withSender:sender];
+
+ FOR_EACH_WKCONTENTVIEW_ACTION(FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW)
+
+ #undef FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW
+
+ return [super targetForAction:action withSender:sender];
+}
+
static inline CGFloat floorToDevicePixel(CGFloat input, float deviceScaleFactor)
{
return CGFloor(input * deviceScaleFactor) / deviceScaleFactor;
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (221414 => 221415)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2017-08-31 03:48:21 UTC (rev 221414)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2017-08-31 04:07:34 UTC (rev 221415)
@@ -288,6 +288,7 @@
- (BOOL)becomeFirstResponderForWebView;
- (BOOL)resignFirstResponderForWebView;
- (BOOL)canPerformActionForWebView:(SEL)action withSender:(id)sender;
+- (id)targetForActionForWebView:(SEL)action withSender:(id)sender;
#define DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW(_action) \
- (void)_action ## ForWebView:(id)sender;
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (221414 => 221415)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2017-08-31 03:48:21 UTC (rev 221414)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2017-08-31 04:07:34 UTC (rev 221415)
@@ -2165,6 +2165,16 @@
return [super canPerformAction:action withSender:sender];
}
+- (id)targetForAction:(SEL)action withSender:(id)sender
+{
+ return [_webView targetForAction:action withSender:sender];
+}
+
+- (id)targetForActionForWebView:(SEL)action withSender:(id)sender
+{
+ return [super targetForAction:action withSender:sender];
+}
+
- (void)_resetShowingTextStyle:(NSNotification *)notification
{
_showingTextStyleOptions = NO;
Modified: trunk/Tools/ChangeLog (221414 => 221415)
--- trunk/Tools/ChangeLog 2017-08-31 03:48:21 UTC (rev 221414)
+++ trunk/Tools/ChangeLog 2017-08-31 04:07:34 UTC (rev 221415)
@@ -1,3 +1,17 @@
+2017-08-30 Dan Bernstein <m...@apple.com>
+
+ [iOS] REGRESSION (r218144) -[WKContentView targetForAction:withSender:] returns the content view for actions implemented only by the WKWebView, causing a crash
+ https://bugs.webkit.org/show_bug.cgi?id=176077
+ <rdar://problem/34145200>
+
+ Reviewed by Sam Weinig.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKitCocoa/WKContentViewTargetForAction.mm: Added.
+ (-[TestWKContentViewTargetForActionView testAction:]):
+ (TEST):
+ * TestWebKitAPI/ios/UIKitSPI.h:
+
2017-08-30 Carlos Alberto Lopez Perez <clo...@igalia.com>
[GTK] install-dependencies script should install CUPS headers
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (221414 => 221415)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2017-08-31 03:48:21 UTC (rev 221414)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2017-08-31 04:07:34 UTC (rev 221415)
@@ -114,6 +114,7 @@
33DC8912141955FE00747EF7 /* simple-iframe.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33DC890E1419539300747EF7 /* simple-iframe.html */; };
33DC89141419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */; };
33E79E06137B5FD900E32D99 /* mouse-move-listener.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */; };
+ 370CE22A1F57343400E7410B /* WKContentViewTargetForAction.mm in Sources */ = {isa = PBXBuildFile; fileRef = 370CE2291F57343400E7410B /* WKContentViewTargetForAction.mm */; };
374B7A601DF36EEE00ACCB6C /* BundleEditingDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 374B7A5E1DF36EEE00ACCB6C /* BundleEditingDelegate.mm */; };
374B7A611DF371CF00ACCB6C /* BundleEditingDelegatePlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = 374B7A5F1DF36EEE00ACCB6C /* BundleEditingDelegatePlugIn.mm */; };
375E0E171D66674400EFEC2C /* WKNSNumber.mm in Sources */ = {isa = PBXBuildFile; fileRef = 375E0E151D66674400EFEC2C /* WKNSNumber.mm */; };
@@ -1144,6 +1145,7 @@
33DC8910141953A300747EF7 /* LoadCanceledNoServerRedirectCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadCanceledNoServerRedirectCallback.cpp; sourceTree = "<group>"; };
33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadCanceledNoServerRedirectCallback_Bundle.cpp; sourceTree = "<group>"; };
33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "mouse-move-listener.html"; sourceTree = "<group>"; };
+ 370CE2291F57343400E7410B /* WKContentViewTargetForAction.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentViewTargetForAction.mm; sourceTree = "<group>"; };
3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMRange.mm; sourceTree = "<group>"; };
374B7A5E1DF36EEE00ACCB6C /* BundleEditingDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BundleEditingDelegate.mm; sourceTree = "<group>"; };
374B7A5F1DF36EEE00ACCB6C /* BundleEditingDelegatePlugIn.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BundleEditingDelegatePlugIn.mm; sourceTree = "<group>"; };
@@ -1971,6 +1973,7 @@
1F83571A1D3FFB0E00E3967B /* WKBackForwardList.mm */,
5CE354D81E70D9C300BEFE3B /* WKContentExtensionStore.mm */,
2D838B1E1EEF3A5B009B980E /* WKContentViewEditingActions.mm */,
+ 370CE2291F57343400E7410B /* WKContentViewTargetForAction.mm */,
51D124971E763AF8002B2820 /* WKHTTPCookieStore.mm */,
375E0E151D66674400EFEC2C /* WKNSNumber.mm */,
37B47E2E1D64E7CA005F4EFF /* WKObject.mm */,
@@ -2610,10 +2613,10 @@
C07E6CAD13FD67650038B22B /* mac */,
C08587F913FEC39B001EF4E5 /* TestWebKitAPI */,
440A1D3614A01000008A66F2 /* WebCore */,
- CDC8E4981BC728AE00594FEC /* WebKitLegacy */,
BC9096411255616000083756 /* WebKit */,
1ABC3DEC1899BE55004F0626 /* WebKit Cocoa */,
BC3C4C6F14575B1D0025FB62 /* WebKit Objective-C */,
+ CDC8E4981BC728AE00594FEC /* WebKitLegacy */,
BC9096461255618900083756 /* WTF */,
);
path = Tests;
@@ -3375,6 +3378,7 @@
7C54A4BE1AA11CCA00380F78 /* WKBundleFileHandle.cpp in Sources */,
5CE354D91E70DA5C00BEFE3B /* WKContentExtensionStore.mm in Sources */,
2D838B1F1EEF3A5C009B980E /* WKContentViewEditingActions.mm in Sources */,
+ 370CE22A1F57343400E7410B /* WKContentViewTargetForAction.mm in Sources */,
51D124981E763B02002B2820 /* WKHTTPCookieStore.mm in Sources */,
7CCE7F1D1A411AE600447C4C /* WKImageCreateCGImageCrash.cpp in Sources */,
375E0E171D66674400EFEC2C /* WKNSNumber.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentViewTargetForAction.mm (0 => 221415)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentViewTargetForAction.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentViewTargetForAction.mm 2017-08-31 04:07:34 UTC (rev 221415)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2017 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(IOS)
+
+#import "PlatformUtilities.h"
+#import "Test.h"
+#import "TestWKWebView.h"
+#import <WebKit/WebKit.h>
+#import <wtf/RetainPtr.h>
+
+@interface TestWKContentViewTargetForActionView : TestWKWebView
+@end
+
+@implementation TestWKContentViewTargetForActionView
+
+- (void)testAction:(id)sender
+{
+}
+
+@end
+
+TEST(WebKit2, WKContentViewTargetForAction)
+{
+ auto webView = adoptNS([[TestWKContentViewTargetForActionView alloc] init]);
+ [webView synchronouslyLoadTestPageNamed:@"rich-and-plain-text"];
+ [webView becomeFirstResponder];
+ [webView stringByEvaluatingJavaScript:@"selectPlainText()"];
+
+ // FIXME: Once this test is running in an application, it should instead use
+ // -[UIApplication sendAction:to:from:forEvent:] and verify that the action is dispatched to the
+ // right responder.
+ UIView *contentView = [webView valueForKey:@"_currentContentView"];
+ EXPECT_EQ([webView targetForAction:@selector(copy:) withSender:nil], contentView);
+ EXPECT_EQ([contentView targetForAction:@selector(copy:) withSender:nil], contentView);
+ EXPECT_EQ([webView targetForAction:@selector(testAction:) withSender:nil], webView.get());
+}
+
+#endif