Diff
Modified: trunk/Source/WebCore/ChangeLog (218179 => 218180)
--- trunk/Source/WebCore/ChangeLog 2017-06-13 16:47:42 UTC (rev 218179)
+++ trunk/Source/WebCore/ChangeLog 2017-06-13 16:58:13 UTC (rev 218180)
@@ -1,3 +1,24 @@
+2017-06-13 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Unable to paste text that was copied from a page into the universal search field
+ https://bugs.webkit.org/show_bug.cgi?id=173293
+ <rdar://problem/32440918>
+
+ Reviewed by Ryosuke Niwa.
+
+ Vend "public.utf8-plain-text" and "public.utf16-plain-text" as additional representations on the pasteboard when
+ copying both rich and plain web content in PlatformPasteboardIOS.mm. This is because UITextView no longer
+ supports pasting "public.text" as text in iOS 11.
+
+ Tests:
+ UIPasteboardTests.CopyPlainTextWritesConcreteTypes
+ UIPasteboardTests.CopyRichTextWritesConcreteTypes
+
+ * platform/ios/PasteboardIOS.mm:
+ (WebCore::Pasteboard::writePlainText):
+ * platform/ios/PlatformPasteboardIOS.mm:
+ (WebCore::PlatformPasteboard::write):
+
2017-06-13 Sam Weinig <s...@webkit.org>
Rename JSDOMWindowShell to JSDOMWindowProxy to match the HTML5 spec.
Modified: trunk/Source/WebCore/platform/ios/PasteboardIOS.mm (218179 => 218180)
--- trunk/Source/WebCore/platform/ios/PasteboardIOS.mm 2017-06-13 16:47:42 UTC (rev 218179)
+++ trunk/Source/WebCore/platform/ios/PasteboardIOS.mm 2017-06-13 16:58:13 UTC (rev 218180)
@@ -131,6 +131,8 @@
void Pasteboard::writePlainText(const String& text, SmartReplaceOption)
{
+ // FIXME: We vend "public.text" here for backwards compatibility with pre-iOS 11 apps. In the future, we should stop vending this UTI,
+ // and instead set data for concrete plain text types. See <https://bugs.webkit.org/show_bug.cgi?id=173317>.
platformStrategies()->pasteboardStrategy()->writeToPasteboard(kUTTypeText, text, m_pasteboardName);
}
Modified: trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (218179 => 218180)
--- trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2017-06-13 16:47:42 UTC (rev 218179)
+++ trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2017-06-13 16:58:13 UTC (rev 218180)
@@ -256,8 +256,14 @@
RetainPtr<NSMutableDictionary> representations = adoptNS([[NSMutableDictionary alloc] init]);
[representations addEntriesFromDictionary:richTextRepresentationsForPasteboardWebContent(content).autorelease()];
- [representations setValue:content.dataInStringFormat forKey:(NSString *)kUTTypeText];
+ NSString *textAsString = content.dataInStringFormat;
+ [representations setValue:[textAsString dataUsingEncoding:NSUTF8StringEncoding] forKey:(NSString *)kUTTypeUTF8PlainText];
+ [representations setValue:[textAsString dataUsingEncoding:NSUTF16StringEncoding] forKey:(NSString *)kUTTypeUTF16PlainText];
+ // FIXME: We vend "public.text" here for backwards compatibility with pre-iOS 11 apps. In the future, we should stop vending this UTI,
+ // and instead set data for concrete plain text types. See <https://bugs.webkit.org/show_bug.cgi?id=173317>.
+ [representations setValue:textAsString forKey:(NSString *)kUTTypeText];
+
[m_pasteboard setItems:@[representations.get()]];
}
@@ -339,11 +345,18 @@
RetainPtr<NSDictionary> representations = adoptNS([[NSMutableDictionary alloc] init]);
+ NSString *textAsString = text;
if (pasteboardType == String(kUTTypeURL)) {
[representations setValue:adoptNS([[NSURL alloc] initWithString:text]).get() forKey:pasteboardType];
- [representations setValue:text forKey:(NSString *)kUTTypeText];
+ [representations setValue:textAsString forKey:(NSString *)kUTTypeText];
} else if (!pasteboardType.isNull())
- [representations setValue:text forKey:pasteboardType];
+ [representations setValue:textAsString forKey:pasteboardType];
+
+ auto cfPasteboardType = pasteboardType.createCFString();
+ if (UTTypeConformsTo(cfPasteboardType.get(), kUTTypeText) || UTTypeConformsTo(cfPasteboardType.get(), kUTTypeURL)) {
+ [representations setValue:[textAsString dataUsingEncoding:NSUTF8StringEncoding] forKey:(NSString *)kUTTypeUTF8PlainText];
+ [representations setValue:[textAsString dataUsingEncoding:NSUTF16StringEncoding] forKey:(NSString *)kUTTypeUTF16PlainText];
+ }
[m_pasteboard setItems:@[representations.get()]];
}
Modified: trunk/Source/WebKit2/ChangeLog (218179 => 218180)
--- trunk/Source/WebKit2/ChangeLog 2017-06-13 16:47:42 UTC (rev 218179)
+++ trunk/Source/WebKit2/ChangeLog 2017-06-13 16:58:13 UTC (rev 218180)
@@ -1,3 +1,18 @@
+2017-06-13 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Unable to paste text that was copied from a page into the universal search field
+ https://bugs.webkit.org/show_bug.cgi?id=173293
+ <rdar://problem/32440918>
+
+ Reviewed by Ryosuke Niwa.
+
+ Add boilerplate SPI on WKPreferences to enable _javascript_ access to copy and paste.
+
+ * UIProcess/API/Cocoa/WKPreferences.mm:
+ (-[WKPreferences _setJavaScriptCanAccessClipboard:]):
+ (-[WKPreferences _javaScriptCanAccessClipboard]):
+ * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
+
2017-06-13 Sam Weinig <s...@webkit.org>
Rename JSDOMWindowShell to JSDOMWindowProxy to match the HTML5 spec.
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm (218179 => 218180)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm 2017-06-13 16:47:42 UTC (rev 218179)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm 2017-06-13 16:58:13 UTC (rev 218180)
@@ -617,6 +617,16 @@
_preferences->setWebRTCLegacyAPIDisabled(!enabled);
}
+- (void)_setJavaScriptCanAccessClipboard:(BOOL)_javascript_CanAccessClipboard
+{
+ _preferences->setJavaScriptCanAccessClipboard(_javascript_CanAccessClipboard);
+}
+
+- (BOOL)_javaScriptCanAccessClipboard
+{
+ return _preferences->_javascript_CanAccessClipboard();
+}
+
@end
#endif // WK_API_ENABLED
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h (218179 => 218180)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h 2017-06-13 16:47:42 UTC (rev 218179)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h 2017-06-13 16:58:13 UTC (rev 218180)
@@ -106,6 +106,8 @@
@property (nonatomic, setter=_setICECandidateFilteringEnabled:) BOOL _iceCandidateFiltertingEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
@property (nonatomic, setter=_setWebRTCLegacyAPIEnabled:) BOOL _webRTCLegacyAPIEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+@property (nonatomic, setter=_setJavaScriptCanAccessClipboard:) BOOL _javaScriptCanAccessClipboard WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+
+ (NSArray<_WKExperimentalFeature *> *)_experimentalFeatures WK_API_AVAILABLE(macosx(10.12), ios(10.0));
- (BOOL)_isEnabledForFeature:(_WKExperimentalFeature *)feature WK_API_AVAILABLE(macosx(10.12), ios(10.0));
- (void)_setEnabled:(BOOL)value forFeature:(_WKExperimentalFeature *)feature WK_API_AVAILABLE(macosx(10.12), ios(10.0));
Modified: trunk/Tools/ChangeLog (218179 => 218180)
--- trunk/Tools/ChangeLog 2017-06-13 16:47:42 UTC (rev 218179)
+++ trunk/Tools/ChangeLog 2017-06-13 16:58:13 UTC (rev 218180)
@@ -1,3 +1,21 @@
+2017-06-13 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Unable to paste text that was copied from a page into the universal search field
+ https://bugs.webkit.org/show_bug.cgi?id=173293
+ <rdar://problem/32440918>
+
+ Reviewed by Ryosuke Niwa.
+
+ Adds 2 new unit tests for copying plain and rich selected web content.
+ See WebCore and WebKit ChangeLogs for more detail.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/rich-and-plain-text.html: Added.
+ * TestWebKitAPI/Tests/ios/UIPasteboardTests.mm: Added.
+ (TestWebKitAPI::dataForPasteboardType):
+ (TestWebKitAPI::setUpWebViewForPasteboardTests):
+ (TestWebKitAPI::TEST):
+
2017-06-13 Joanmarie Diggs <jdi...@igalia.com>
AX: [ATK] Implement missing AtkRelation types
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (218179 => 218180)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2017-06-13 16:47:42 UTC (rev 218179)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2017-06-13 16:58:13 UTC (rev 218180)
@@ -621,6 +621,8 @@
F42DA5161D8CEFE400336F40 /* large-input-field-focus-onload.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */; };
F4451C761EB8FD890020C5DA /* two-paragraph-contenteditable.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4451C751EB8FD7C0020C5DA /* two-paragraph-contenteditable.html */; };
F4538EF71E8473E600B5C953 /* large-red-square.png in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4538EF01E846B4100B5C953 /* large-red-square.png */; };
+ F46849BE1EEF58E400B937FE /* UIPasteboardTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F46849BD1EEF58E400B937FE /* UIPasteboardTests.mm */; };
+ F46849C01EEF5EF300B937FE /* rich-and-plain-text.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F46849BF1EEF5EDC00B937FE /* rich-and-plain-text.html */; };
F46A095A1ED8A6E600D4AA55 /* apple.gif in Copy Resources */ = {isa = PBXBuildFile; fileRef = F47D30EB1ED28619000482E1 /* apple.gif */; };
F46A095B1ED8A6E600D4AA55 /* gif-and-file-input.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F47D30ED1ED28A6C000482E1 /* gif-and-file-input.html */; };
F47728991E4AE3C1007ABF6A /* full-page-contenteditable.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F47728981E4AE3AD007ABF6A /* full-page-contenteditable.html */; };
@@ -705,6 +707,7 @@
dstPath = TestWebKitAPI.resources;
dstSubfolderSpec = 7;
files = (
+ F46849C01EEF5EF300B937FE /* rich-and-plain-text.html in Copy Resources */,
93E2D2761ED7D53200FA76F6 /* offscreen-iframe-of-media-document.html in Copy Resources */,
F46A095A1ED8A6E600D4AA55 /* apple.gif in Copy Resources */,
F46A095B1ED8A6E600D4AA55 /* gif-and-file-input.html in Copy Resources */,
@@ -1551,6 +1554,8 @@
F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = "large-input-field-focus-onload.html"; path = "Tests/WebKit2Cocoa/large-input-field-focus-onload.html"; sourceTree = SOURCE_ROOT; };
F4451C751EB8FD7C0020C5DA /* two-paragraph-contenteditable.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "two-paragraph-contenteditable.html"; sourceTree = "<group>"; };
F4538EF01E846B4100B5C953 /* large-red-square.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "large-red-square.png"; sourceTree = "<group>"; };
+ F46849BD1EEF58E400B937FE /* UIPasteboardTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UIPasteboardTests.mm; sourceTree = "<group>"; };
+ F46849BF1EEF5EDC00B937FE /* rich-and-plain-text.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "rich-and-plain-text.html"; sourceTree = "<group>"; };
F47728981E4AE3AD007ABF6A /* full-page-contenteditable.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "full-page-contenteditable.html"; sourceTree = "<group>"; };
F47D30EB1ED28619000482E1 /* apple.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = apple.gif; sourceTree = "<group>"; };
F47D30ED1ED28A6C000482E1 /* gif-and-file-input.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "gif-and-file-input.html"; sourceTree = "<group>"; };
@@ -1899,6 +1904,7 @@
F4D4F3B71E4E36E400BB2767 /* DataInteractionTests.mm */,
7560917719259C59009EF06E /* MemoryCacheAddImageToCacheIOS.mm */,
F4D7BCD61EA574DD00C421D3 /* PositionInformationTests.mm */,
+ F46849BD1EEF58E400B937FE /* UIPasteboardTests.mm */,
);
path = ios;
sourceTree = "<group>";
@@ -2019,6 +2025,7 @@
A1409AD81E7254AC004949D9 /* password-protected.pages */,
F415086C1DA040C10044BE9B /* play-audio-on-click.html */,
A12DDBFF1E8373C100CF6CAE /* rendered-image-excluding-overflow.html */,
+ F46849BF1EEF5EDC00B937FE /* rich-and-plain-text.html */,
C9B4AD291ECA6EA500F5FEA0 /* silence-long.m4a */,
F4F405BB1D4C0CF8007A9707 /* skinny-autoplaying-video-with-audio.html */,
515BE16E1D4288FF00DD7C68 /* StoreBlobToBeDeleted.html */,
@@ -3152,6 +3159,7 @@
5C7964101EB0278D0075D74C /* EventModifiers.cpp in Sources */,
2D4CF8BD1D8360CC0001CE8D /* WKThumbnailView.mm in Sources */,
5CE354D91E70DA5C00BEFE3B /* WKContentExtensionStore.mm in Sources */,
+ F46849BE1EEF58E400B937FE /* UIPasteboardTests.mm in Sources */,
2EFF06D71D8AF34A0004BB30 /* WKWebViewCandidateTests.mm in Sources */,
A14FC5851B89739100D107EB /* WKWebViewConfigurationExtras.mm in Sources */,
7C417F331D19E14800B8EF53 /* WKWebViewDefaultNavigationDelegate.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/rich-and-plain-text.html (0 => 218180)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/rich-and-plain-text.html (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/rich-and-plain-text.html 2017-06-13 16:58:13 UTC (rev 218180)
@@ -0,0 +1,46 @@
+<head>
+ <meta name="viewport" content="width=device-width">
+ <style>
+ body {
+ width: 100%;
+ height: 100%;
+ margin: 0;
+ }
+
+ div, textarea {
+ width: 100%;
+ height: 200px;
+ font-size: 100px;
+ white-space: nowrap;
+ }
+ </style>
+</head>
+
+<body>
+ <div id="rich" contenteditable>Hello world</div>
+ <textarea id="plain"></textarea>
+ <script>
+ plain.value="Hello world"
+
+ function deselectText()
+ {
+ blur();
+ getSelection().removeAllRanges();
+ }
+
+ function selectRichText()
+ {
+ deselectText();
+ let text = rich.childNodes[0];
+ getSelection().setBaseAndExtent(text, 0, text, text.data.length);
+ }
+
+ function selectPlainText()
+ {
+ deselectText();
+ plain.focus();
+ plain.selectionStart = 0;
+ plain.selectionEnd = plain.value.length;
+ }
+ </script>
+</body>
Added: trunk/Tools/TestWebKitAPI/Tests/ios/UIPasteboardTests.mm (0 => 218180)
--- trunk/Tools/TestWebKitAPI/Tests/ios/UIPasteboardTests.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/UIPasteboardTests.mm 2017-06-13 16:58:13 UTC (rev 218180)
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+
+#if PLATFORM(IOS) && WK_API_ENABLED
+
+#import "PlatformUtilities.h"
+#import "TestWKWebView.h"
+#import <MobileCoreServices/MobileCoreServices.h>
+#import <UIKit/UIPasteboard.h>
+#import <WebKit/WKPreferencesPrivate.h>
+#import <WebKit/WKWebViewPrivate.h>
+
+namespace TestWebKitAPI {
+
+NSData *dataForPasteboardType(CFStringRef type)
+{
+ return [[UIPasteboard generalPasteboard] dataForPasteboardType:(NSString *)type inItemSet:[NSIndexSet indexSetWithIndex:0]].firstObject;
+}
+
+RetainPtr<TestWKWebView> setUpWebViewForPasteboardTests()
+{
+ [UIPasteboard generalPasteboard].items = @[];
+ EXPECT_TRUE(!dataForPasteboardType(kUTTypeUTF8PlainText).length);
+ EXPECT_TRUE(!dataForPasteboardType(kUTTypeUTF16PlainText).length);
+
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
+ [webView configuration].preferences._javaScriptCanAccessClipboard = YES;
+ [webView synchronouslyLoadTestPageNamed:@"rich-and-plain-text"];
+ return webView;
+}
+
+TEST(UIPasteboardTests, CopyPlainTextWritesConcreteTypes)
+{
+ auto webView = setUpWebViewForPasteboardTests();
+ [webView stringByEvaluatingJavaScript:@"selectPlainText()"];
+ [webView stringByEvaluatingJavaScript:@"document.execCommand('copy')"];
+
+ auto utf8Result = adoptNS([[NSString alloc] initWithData:dataForPasteboardType(kUTTypeUTF8PlainText) encoding:NSUTF8StringEncoding]);
+ auto utf16Result = adoptNS([[NSString alloc] initWithData:dataForPasteboardType(kUTTypeUTF16PlainText) encoding:NSUTF16StringEncoding]);
+ EXPECT_WK_STREQ("Hello world", [utf8Result UTF8String]);
+ EXPECT_WK_STREQ("Hello world", [utf16Result UTF8String]);
+}
+
+TEST(UIPasteboardTests, CopyRichTextWritesConcreteTypes)
+{
+ auto webView = setUpWebViewForPasteboardTests();
+ [webView stringByEvaluatingJavaScript:@"selectRichText()"];
+ [webView stringByEvaluatingJavaScript:@"document.execCommand('copy')"];
+
+ auto utf8Result = adoptNS([[NSString alloc] initWithData:dataForPasteboardType(kUTTypeUTF8PlainText) encoding:NSUTF8StringEncoding]);
+ auto utf16Result = adoptNS([[NSString alloc] initWithData:dataForPasteboardType(kUTTypeUTF16PlainText) encoding:NSUTF16StringEncoding]);
+ EXPECT_WK_STREQ("Hello world", [utf8Result UTF8String]);
+ EXPECT_WK_STREQ("Hello world", [utf16Result UTF8String]);
+}
+
+} // namespace TestWebKitAPI
+
+#endif