Changeset 228825 in webkit
- Timestamp:
- Feb 20, 2018 10:32:09 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r228824 r228825 1 2018-02-20 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS 11.3 Beta] Can't copy a URL from Safari and paste it into the Gmail app 4 https://bugs.webkit.org/show_bug.cgi?id=182952 5 <rdar://problem/37636190> 6 7 Reviewed by Tim Horton. 8 9 After r220865 refactored the iOS copy codepaths to use NSItemProviders, we stopped writing the URL as plain text 10 to the pasteboard. However, this means clients that only check for "text/plain" (or one of its aliases) on the 11 pasteboard won't read any data on paste. 12 13 To fix this, we restore the pre-iOS 11.3 behavior of writing both the URL and plain text to the pasteboard. 14 Since we're using item providers, we also ensure that the NSURL is at a higher fidelity than the string to make 15 it clear that the data should be consumed as a URL. 16 17 This patch also rebaselines an existing drag and drop test to cover this change, and adds a new API test, 18 ActionSheetTests.CopyLinkWritesURLAndPlainText, which simulates copying a link using the share sheet and pasting 19 into a DataTransfer-dumping test harness. 20 21 * platform/ios/PlatformPasteboardIOS.mm: 22 (WebCore::PlatformPasteboard::write): 23 1 24 2018-02-20 Eric Carlson <eric.carlson@apple.com> 2 25 -
trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm
r228531 r228825 385 385 nsURL._title = url.title; 386 386 [representationsToRegister addRepresentingObject:nsURL]; 387 [representationsToRegister addRepresentingObject:(NSString *)url.url.string()]; 387 388 } 388 389 -
trunk/Tools/ChangeLog
r228818 r228825 1 2018-02-20 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS 11.3 Beta] Can't copy a URL from Safari and paste it into the Gmail app 4 https://bugs.webkit.org/show_bug.cgi?id=182952 5 <rdar://problem/37636190> 6 7 Reviewed by Tim Horton. 8 9 Adds a new iOS copy/paste test that copies an anchor element via action sheet, and checks that upon pasting, 10 both "text/plain" and "text/uri-list" are provided. Additionally tweaks an existing iOS drag and drop test to 11 check for the same behavior. 12 13 * TestWebKitAPI/Tests/ios/ActionSheetTests.mm: 14 (TestWebKitAPI::TEST): 15 * TestWebKitAPI/Tests/ios/DataInteractionTests.mm: 16 (TestWebKitAPI::TEST): 17 1 18 2018-02-20 Philippe Normand <pnormand@igalia.com> 2 19 -
trunk/Tools/TestWebKitAPI/Tests/ios/ActionSheetTests.mm
r227135 r228825 141 141 } 142 142 143 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000144 145 143 static void presentActionSheetAndChooseAction(WKWebView *webView, ActionSheetObserver *observer, CGPoint location, _WKElementActionType actionType) 146 144 { … … 273 271 } 274 272 275 #endif // __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000 273 TEST(ActionSheetTests, CopyLinkWritesURLAndPlainText) 274 { 275 UIApplicationInitialize(); 276 [UIPasteboard generalPasteboard].items = @[ ]; 277 278 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); 279 auto observer = adoptNS([[ActionSheetObserver alloc] init]); 280 [webView setUIDelegate:observer.get()]; 281 [webView synchronouslyLoadTestPageNamed:@"link-and-input"]; 282 283 presentActionSheetAndChooseAction(webView.get(), observer.get(), CGPointMake(100, 100), _WKElementActionTypeCopy); 284 285 [webView synchronouslyLoadTestPageNamed:@"DataTransfer"]; 286 [webView paste:nil]; 287 288 EXPECT_WK_STREQ("text/uri-list, text/plain", [webView stringByEvaluatingJavaScript:@"types.textContent"]); 289 EXPECT_WK_STREQ("(STRING, text/uri-list), (STRING, text/plain)", [webView stringByEvaluatingJavaScript:@"items.textContent"]); 290 EXPECT_WK_STREQ("", [webView stringByEvaluatingJavaScript:@"files.textContent"]); 291 EXPECT_WK_STREQ("https://www.apple.com/", [webView stringByEvaluatingJavaScript:@"textData.textContent"]); 292 EXPECT_WK_STREQ("https://www.apple.com/", [webView stringByEvaluatingJavaScript:@"urlData.textContent"]); 293 EXPECT_WK_STREQ("", [webView stringByEvaluatingJavaScript:@"htmlData.textContent"]); 294 EXPECT_WK_STREQ("", [webView stringByEvaluatingJavaScript:@"rawHTMLData.textContent"]); 295 } 276 296 277 297 } // namespace TestWebKitAPI -
trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm
r228340 r228825 1581 1581 [simulator runFrom:CGPointMake(50, 225) to:CGPointMake(50, 375)]; 1582 1582 checkJSONWithLogging([webView stringByEvaluatingJavaScript:@"output.value"], @{ 1583 @"dragover": @{ @"text/uri-list" : @"" }, 1584 @"drop": @{ @"text/uri-list" : @"https://www.apple.com/" } 1583 @"dragover": @{ 1584 @"text/uri-list" : @"", 1585 @"text/plain" : @"" 1586 }, 1587 @"drop": @{ 1588 @"text/uri-list" : @"https://www.apple.com/", 1589 @"text/plain" : @"https://www.apple.com/" 1590 } 1585 1591 }); 1586 1592 }
Note: See TracChangeset
for help on using the changeset viewer.