Diff
Modified: branches/safari-605-branch/Source/WebCore/ChangeLog (228843 => 228844)
--- branches/safari-605-branch/Source/WebCore/ChangeLog 2018-02-20 22:30:18 UTC (rev 228843)
+++ branches/safari-605-branch/Source/WebCore/ChangeLog 2018-02-20 22:30:21 UTC (rev 228844)
@@ -1,5 +1,32 @@
2018-02-20 Jason Marcell <jmarc...@apple.com>
+ Cherry-pick r228825. rdar://problem/37714030
+
+ 2018-02-20 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [iOS 11.3 Beta] Can't copy a URL from Safari and paste it into the Gmail app
+ https://bugs.webkit.org/show_bug.cgi?id=182952
+ <rdar://problem/37636190>
+
+ Reviewed by Tim Horton.
+
+ After r220865 refactored the iOS copy codepaths to use NSItemProviders, we stopped writing the URL as plain text
+ to the pasteboard. However, this means clients that only check for "text/plain" (or one of its aliases) on the
+ pasteboard won't read any data on paste.
+
+ To fix this, we restore the pre-iOS 11.3 behavior of writing both the URL and plain text to the pasteboard.
+ Since we're using item providers, we also ensure that the NSURL is at a higher fidelity than the string to make
+ it clear that the data should be consumed as a URL.
+
+ This patch also rebaselines an existing drag and drop test to cover this change, and adds a new API test,
+ ActionSheetTests.CopyLinkWritesURLAndPlainText, which simulates copying a link using the share sheet and pasting
+ into a DataTransfer-dumping test harness.
+
+ * platform/ios/PlatformPasteboardIOS.mm:
+ (WebCore::PlatformPasteboard::write):
+
+2018-02-20 Jason Marcell <jmarc...@apple.com>
+
Cherry-pick r228824. rdar://problem/37714015
2018-02-20 Eric Carlson <eric.carl...@apple.com>
Modified: branches/safari-605-branch/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (228843 => 228844)
--- branches/safari-605-branch/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2018-02-20 22:30:18 UTC (rev 228843)
+++ branches/safari-605-branch/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2018-02-20 22:30:21 UTC (rev 228844)
@@ -382,6 +382,7 @@
if (!url.title.isEmpty())
nsURL._title = url.title;
[representationsToRegister addRepresentingObject:nsURL];
+ [representationsToRegister addRepresentingObject:(NSString *)url.url.string()];
}
registerItemToPasteboard(representationsToRegister.get(), m_pasteboard.get());
Modified: branches/safari-605-branch/Tools/ChangeLog (228843 => 228844)
--- branches/safari-605-branch/Tools/ChangeLog 2018-02-20 22:30:18 UTC (rev 228843)
+++ branches/safari-605-branch/Tools/ChangeLog 2018-02-20 22:30:21 UTC (rev 228844)
@@ -1,5 +1,26 @@
2018-02-20 Jason Marcell <jmarc...@apple.com>
+ Cherry-pick r228825. rdar://problem/37714030
+
+ 2018-02-20 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [iOS 11.3 Beta] Can't copy a URL from Safari and paste it into the Gmail app
+ https://bugs.webkit.org/show_bug.cgi?id=182952
+ <rdar://problem/37636190>
+
+ Reviewed by Tim Horton.
+
+ Adds a new iOS copy/paste test that copies an anchor element via action sheet, and checks that upon pasting,
+ both "text/plain" and "text/uri-list" are provided. Additionally tweaks an existing iOS drag and drop test to
+ check for the same behavior.
+
+ * TestWebKitAPI/Tests/ios/ActionSheetTests.mm:
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
+ (TestWebKitAPI::TEST):
+
+2018-02-20 Jason Marcell <jmarc...@apple.com>
+
Cherry-pick r228589. rdar://problem/37697687
2018-02-16 Ryosuke Niwa <rn...@webkit.org>
Modified: branches/safari-605-branch/Tools/TestWebKitAPI/Tests/ios/ActionSheetTests.mm (228843 => 228844)
--- branches/safari-605-branch/Tools/TestWebKitAPI/Tests/ios/ActionSheetTests.mm 2018-02-20 22:30:18 UTC (rev 228843)
+++ branches/safari-605-branch/Tools/TestWebKitAPI/Tests/ios/ActionSheetTests.mm 2018-02-20 22:30:21 UTC (rev 228844)
@@ -140,8 +140,6 @@
EXPECT_TRUE(runTest(@"08080808080"));
}
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
-
static void presentActionSheetAndChooseAction(WKWebView *webView, ActionSheetObserver *observer, CGPoint location, _WKElementActionType actionType)
{
__block RetainPtr<_WKElementAction> copyAction;
@@ -272,8 +270,30 @@
TestWebKitAPI::Util::run(&done);
}
-#endif // __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+TEST(ActionSheetTests, CopyLinkWritesURLAndPlainText)
+{
+ UIApplicationInitialize();
+ [UIPasteboard generalPasteboard].items = @[ ];
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
+ auto observer = adoptNS([[ActionSheetObserver alloc] init]);
+ [webView setUIDelegate:observer.get()];
+ [webView synchronouslyLoadTestPageNamed:@"link-and-input"];
+
+ presentActionSheetAndChooseAction(webView.get(), observer.get(), CGPointMake(100, 100), _WKElementActionTypeCopy);
+
+ [webView synchronouslyLoadTestPageNamed:@"DataTransfer"];
+ [webView paste:nil];
+
+ EXPECT_WK_STREQ("text/uri-list, text/plain", [webView stringByEvaluatingJavaScript:@"types.textContent"]);
+ EXPECT_WK_STREQ("(STRING, text/uri-list), (STRING, text/plain)", [webView stringByEvaluatingJavaScript:@"items.textContent"]);
+ EXPECT_WK_STREQ("", [webView stringByEvaluatingJavaScript:@"files.textContent"]);
+ EXPECT_WK_STREQ("https://www.apple.com/", [webView stringByEvaluatingJavaScript:@"textData.textContent"]);
+ EXPECT_WK_STREQ("https://www.apple.com/", [webView stringByEvaluatingJavaScript:@"urlData.textContent"]);
+ EXPECT_WK_STREQ("", [webView stringByEvaluatingJavaScript:@"htmlData.textContent"]);
+ EXPECT_WK_STREQ("", [webView stringByEvaluatingJavaScript:@"rawHTMLData.textContent"]);
+}
+
} // namespace TestWebKitAPI
#endif // PLATFORM(IOS)
Modified: branches/safari-605-branch/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm (228843 => 228844)
--- branches/safari-605-branch/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm 2018-02-20 22:30:18 UTC (rev 228843)
+++ branches/safari-605-branch/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm 2018-02-20 22:30:21 UTC (rev 228844)
@@ -1580,8 +1580,14 @@
[webView stringByEvaluatingJavaScript:@"rich.innerHTML = '<a href="" is a link.</a>'"];
[simulator runFrom:CGPointMake(50, 225) to:CGPointMake(50, 375)];
checkJSONWithLogging([webView stringByEvaluatingJavaScript:@"output.value"], @{
- @"dragover": @{ @"text/uri-list" : @"" },
- @"drop": @{ @"text/uri-list" : @"https://www.apple.com/" }
+ @"dragover": @{
+ @"text/uri-list" : @"",
+ @"text/plain" : @""
+ },
+ @"drop": @{
+ @"text/uri-list" : @"https://www.apple.com/",
+ @"text/plain" : @"https://www.apple.com/"
+ }
});
}