Changeset 248166 in webkit
- Timestamp:
- Aug 2, 2019 11:49:58 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r248164 r248166 1 2019-08-02 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [macOS 10.15] Image dragged from Safari does not appear in Notes 4 https://bugs.webkit.org/show_bug.cgi?id=188490 5 <rdar://problem/39462717> 6 7 Reviewed by Andy Estes. 8 9 Removes some logic that clears out the cached promised drag image in the UI process when WebKit is asked to 10 provide TIFF image data. This prevents the drop destination from asking for promised image data, if anything 11 else (e.g. the system) also asks the web view to provide the same data. Additionally, this logic didn't 12 previously guarantee that the promised image would be cleared anyways, since it is dependent on the drop target 13 actually requesting the promised image in order to perform the cleanup. 14 15 In lieu of clearing the promised drag image when it's requested, we instead clear it out upon mainframe 16 navigation, in PageClientImpl::didCommitLoadForMainFrame. 17 18 Test: DragAndDropTests.MultiplePromisedImageDataRequests 19 20 * UIProcess/Cocoa/WebViewImpl.h: 21 * UIProcess/Cocoa/WebViewImpl.mm: 22 (WebKit::WebViewImpl::clearPromisedDragImage): 23 (WebKit::WebViewImpl::pasteboardChangedOwner): 24 (WebKit::WebViewImpl::provideDataForPasteboard): 25 26 Fix the bug by not immediately clearing out the promised drag image. 27 28 * UIProcess/mac/PageClientImplMac.mm: 29 (WebKit::PageClientImpl::didCommitLoadForMainFrame): 30 1 31 2019-08-02 Keith Rollin <krollin@apple.com> 2 32 -
trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h
r246938 r248166 603 603 604 604 void takeFocus(WebCore::FocusDirection); 605 void clearPromisedDragImage(); 605 606 606 607 private: -
trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
r247460 r248166 4206 4206 } 4207 4207 4208 void WebViewImpl::clearPromisedDragImage() 4209 { 4210 m_promisedImage = nullptr; 4211 } 4212 4208 4213 void WebViewImpl::pasteboardChangedOwner(NSPasteboard *pasteboard) 4209 4214 { 4210 m_promisedImage = nullptr;4215 clearPromisedDragImage(); 4211 4216 m_promisedFilename = emptyString(); 4212 4217 m_promisedURL = emptyString(); … … 4215 4220 void WebViewImpl::provideDataForPasteboard(NSPasteboard *pasteboard, NSString *type) 4216 4221 { 4217 // FIXME: need to support NSRTFDPboardType 4218 4219 if ([type isEqual:WebCore::legacyTIFFPasteboardType()] && m_promisedImage) { 4222 // FIXME: Need to support NSRTFDPboardType. 4223 if ([type isEqual:WebCore::legacyTIFFPasteboardType()] && m_promisedImage) 4220 4224 [pasteboard setData:(__bridge NSData *)m_promisedImage->tiffRepresentation() forType:WebCore::legacyTIFFPasteboardType()]; 4221 m_promisedImage = nullptr;4222 }4223 4225 } 4224 4226 -
trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm
r246938 r248166 290 290 m_impl->updateSupportsArbitraryLayoutModes(); 291 291 m_impl->dismissContentRelativeChildWindowsWithAnimation(true); 292 m_impl->clearPromisedDragImage(); 292 293 } 293 294 -
trunk/Tools/ChangeLog
r248163 r248166 1 2019-08-02 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [macOS 10.15] Image dragged from Safari does not appear in Notes 4 https://bugs.webkit.org/show_bug.cgi?id=188490 5 <rdar://problem/39462717> 6 7 Reviewed by Andy Estes. 8 9 Add a test to verify that promised image data can be delivered to multiple pasteboards when performing a drop. 10 11 * TestWebKitAPI/Tests/mac/DragAndDropTestsMac.mm: 12 1 13 2019-08-02 Alex Christensen <achristensen@webkit.org> 2 14 -
trunk/Tools/TestWebKitAPI/Tests/mac/DragAndDropTestsMac.mm
r242339 r248166 136 136 } 137 137 138 TEST(DragAndDropTests, ProvideImageDataForMultiplePasteboards) 139 { 140 auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebViewFrame:NSMakeRect(0, 0, 400, 400)]); 141 TestWKWebView *webView = [simulator webView]; 142 [webView synchronouslyLoadTestPageNamed:@"image-and-contenteditable"]; 143 [simulator runFrom:NSMakePoint(100, 100) to:NSMakePoint(100, 300)]; 144 145 ALLOW_DEPRECATED_DECLARATIONS_BEGIN 146 NSPasteboard *dragPasteboard = [NSPasteboard pasteboardWithName:NSDragPboard]; 147 NSPasteboard *uniquePasteboard = [NSPasteboard pasteboardWithUniqueName]; 148 [webView pasteboard:dragPasteboard provideDataForType:NSTIFFPboardType]; 149 [webView pasteboard:uniquePasteboard provideDataForType:NSTIFFPboardType]; 150 ALLOW_DEPRECATED_DECLARATIONS_END 151 152 NSArray *allowedClasses = @[ NSImage.class ]; 153 NSImage *imageFromDragPasteboard = [dragPasteboard readObjectsForClasses:allowedClasses options:nil].firstObject; 154 NSImage *imageFromUniquePasteboard = [uniquePasteboard readObjectsForClasses:allowedClasses options:nil].firstObject; 155 156 EXPECT_EQ(imageFromUniquePasteboard.TIFFRepresentation.length, imageFromDragPasteboard.TIFFRepresentation.length); 157 EXPECT_TRUE(NSEqualSizes(imageFromDragPasteboard.size, imageFromUniquePasteboard.size)); 158 EXPECT_FALSE(NSEqualSizes(NSZeroSize, imageFromUniquePasteboard.size)); 159 } 160 138 161 #endif // ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
Note: See TracChangeset
for help on using the changeset viewer.