Title: [267305] trunk
- Revision
- 267305
- Author
- wenson_hs...@apple.com
- Date
- 2020-09-18 18:34:43 -0700 (Fri, 18 Sep 2020)
Log Message
[macOS] REGRESSION (r265702): System Services receive 0 bytes when extracting selected content as rich text data
https://bugs.webkit.org/show_bug.cgi?id=216718
<rdar://problem/69150358>
Reviewed by Tim Horton.
Source/WebKit:
Test: CopyHTML.WriteRichTextSelectionToPasteboard
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::dataSelectionForPasteboard):
After r265702, the `IPCHandle` received in the UI process was always being converted into a buffer of size 0,
due to using the `size` local variable (which is no longer set as an outparam of the sync IPC message). Instead,
use `ipcHandle.dataSize`.
Tools:
Add a new API test to verify that we get non-empty web archive data when using
`-writeSelectionToPasteboard:types:` to grab selected content as rich text data.
* TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm:
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (267304 => 267305)
--- trunk/Source/WebKit/ChangeLog 2020-09-19 01:22:42 UTC (rev 267304)
+++ trunk/Source/WebKit/ChangeLog 2020-09-19 01:34:43 UTC (rev 267305)
@@ -1,3 +1,20 @@
+2020-09-18 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [macOS] REGRESSION (r265702): System Services receive 0 bytes when extracting selected content as rich text data
+ https://bugs.webkit.org/show_bug.cgi?id=216718
+ <rdar://problem/69150358>
+
+ Reviewed by Tim Horton.
+
+ Test: CopyHTML.WriteRichTextSelectionToPasteboard
+
+ * UIProcess/mac/WebPageProxyMac.mm:
+ (WebKit::WebPageProxy::dataSelectionForPasteboard):
+
+ After r265702, the `IPCHandle` received in the UI process was always being converted into a buffer of size 0,
+ due to using the `size` local variable (which is no longer set as an outparam of the sync IPC message). Instead,
+ use `ipcHandle.dataSize`.
+
2020-09-18 Megan Gardner <megan_gard...@apple.com>
Remove unneeded respondsToSelector staging for keyboard.
Modified: trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm (267304 => 267305)
--- trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm 2020-09-19 01:22:42 UTC (rev 267304)
+++ trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm 2020-09-19 01:34:43 UTC (rev 267305)
@@ -256,7 +256,6 @@
return nullptr;
SharedMemory::IPCHandle ipcHandle;
- uint64_t size = 0;
const Seconds messageTimeout(20);
sendSync(Messages::WebPage::GetDataSelectionForPasteboard(pasteboardType), Messages::WebPage::GetDataSelectionForPasteboard::Reply(ipcHandle), messageTimeout);
MESSAGE_CHECK_WITH_RETURN_VALUE(!ipcHandle.handle.isNull(), nullptr);
@@ -264,7 +263,7 @@
auto sharedMemoryBuffer = SharedMemory::map(ipcHandle.handle, SharedMemory::Protection::ReadOnly);
if (!sharedMemoryBuffer)
return nullptr;
- return SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), static_cast<size_t>(size));
+ return SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), ipcHandle.dataSize);
}
bool WebPageProxy::readSelectionFromPasteboard(const String& pasteboardName)
Modified: trunk/Tools/ChangeLog (267304 => 267305)
--- trunk/Tools/ChangeLog 2020-09-19 01:22:42 UTC (rev 267304)
+++ trunk/Tools/ChangeLog 2020-09-19 01:34:43 UTC (rev 267305)
@@ -1,3 +1,16 @@
+2020-09-18 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [macOS] REGRESSION (r265702): System Services receive 0 bytes when extracting selected content as rich text data
+ https://bugs.webkit.org/show_bug.cgi?id=216718
+ <rdar://problem/69150358>
+
+ Reviewed by Tim Horton.
+
+ Add a new API test to verify that we get non-empty web archive data when using
+ `-writeSelectionToPasteboard:types:` to grab selected content as rich text data.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm:
+
2020-09-18 Sihui Liu <sihui_...@apple.com>
REGRESSION (r266634): fast/selectors/text-field-selection-stroke-color.html and fast/selectors/text-field-selection-window-inactive-stroke-color.html are flaky failures with pixel noise
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm (267304 => 267305)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm 2020-09-19 01:22:42 UTC (rev 267304)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm 2020-09-19 01:34:43 UTC (rev 267305)
@@ -46,6 +46,9 @@
#if PLATFORM(MAC)
+@interface WKWebView () <NSServicesMenuRequestor>
+@end
+
NSData *readHTMLDataFromPasteboard()
{
return [[NSPasteboard generalPasteboard] dataForType:NSHTMLPboardType];
@@ -193,6 +196,18 @@
EXPECT_TRUE([types containsObject:(__bridge NSString *)NSPasteboardTypeHTML]);
}
+TEST(CopyHTML, WriteRichTextSelectionToPasteboard)
+{
+ auto webView = createWebViewWithCustomPasteboardDataEnabled();
+ [webView synchronouslyLoadHTMLString:@"<strong style='color: rgb(255, 0, 0);'>This is some text to copy.</strong>"];
+ [webView stringByEvaluatingJavaScript:@"getSelection().selectAllChildren(document.body)"];
+
+ auto pasteboard = [NSPasteboard pasteboardWithUniqueName];
+ [webView writeSelectionToPasteboard:pasteboard types:@[ (__bridge NSString *)kUTTypeWebArchive ]];
+
+ EXPECT_GT([pasteboard dataForType:(__bridge NSString *)kUTTypeWebArchive].length, 0U);
+}
+
#endif // PLATFORM(MAC)
#endif // PLATFORM(COCOA)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes