Changeset 211906 in webkit
- Timestamp:
- Feb 8, 2017 3:30:52 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r211905 r211906 1 2017-02-08 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Add kUTTypeUTF8PlainText and kUTTypeJPEG to the list of compatible content types in DragData 4 https://bugs.webkit.org/show_bug.cgi?id=167942 5 <rdar://problem/30315079> 6 7 Reviewed by Tim Horton. 8 9 Adds UTI types for dragging UTF8 plain text and JPEG images to the list of supported types in DragDataMac.mm. 10 Also handles reading these types in PasteboardMac.mm. I verified manually with a test app that if a platform 11 NSView vends only UTF8 plaintext or JPEG images when dragging, WebKit is able to read the contents of the 12 pasteboard as text and an image, respectively. 13 14 New TestWebKitAPI tests in DragAndDropPasteboardTests.mm. 15 16 * platform/mac/DragDataMac.mm: 17 (WebCore::DragData::containsCompatibleContent): 18 * platform/mac/PasteboardMac.mm: 19 (WebCore::Pasteboard::read): 20 1 21 2017-02-08 Said Abou-Hallawa <sabouhallawa@apple.com> 2 22 -
trunk/Source/WebCore/platform/mac/DragDataMac.mm
r211342 r211906 205 205 || types.contains(rtfdPasteboardType()) 206 206 || types.contains(rtfPasteboardType()) 207 || types.contains(String(kUTTypeUTF8PlainText)) 207 208 || types.contains(stringPasteboardType()) 208 209 || types.contains(colorPasteboardType()) 210 || types.contains(String(kUTTypeJPEG)) 209 211 || types.contains(String(kUTTypePNG)); 210 212 } -
trunk/Source/WebCore/platform/mac/PasteboardMac.mm
r211438 r211906 415 415 } 416 416 417 if (types.contains(String(kUTTypeJPEG))) { 418 if (RefPtr<SharedBuffer> buffer = strategy.bufferForType(kUTTypeJPEG, m_pasteboardName)) { 419 if (reader.readImage(buffer.releaseNonNull(), ASCIILiteral("image/jpeg"))) 420 return; 421 } 422 } 423 417 424 if (types.contains(String(NSURLPboardType))) { 418 425 URL url = strategy.url(m_pasteboardName); … … 424 431 if (types.contains(String(NSStringPboardType))) { 425 432 String string = strategy.stringForType(NSStringPboardType, m_pasteboardName); 433 if (!string.isNull() && reader.readPlainText(string)) 434 return; 435 } 436 437 if (types.contains(String(kUTTypeUTF8PlainText))) { 438 String string = strategy.stringForType(kUTTypeUTF8PlainText, m_pasteboardName); 426 439 if (!string.isNull() && reader.readPlainText(string)) 427 440 return; -
trunk/Tools/ChangeLog
r211891 r211906 1 2017-02-08 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Add kUTTypeUTF8PlainText and kUTTypeJPEG to the list of compatible content types in DragData 4 https://bugs.webkit.org/show_bug.cgi?id=167942 5 <rdar://problem/30315079> 6 7 Reviewed by Tim Horton. 8 9 Adds a new test case that simulates dragging from a source that only vends JPEG images or UTF8 plaintext into a 10 contenteditable area. An image element and the plain text content, respectively, should be inserted into the 11 contenteditable in these cases. 12 13 The DragSource and DragInfo are used to mock dragging into the WebView. There is no reliance on using mouse 14 events in this test, since we call the dragging delegate methods (draggingEntered:, draggingUpdated:, and 15 performDragOperation:) directly. 16 17 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 18 * TestWebKitAPI/Tests/mac/DragAndDropPasteboardTests.mm: Added. 19 (+[FrameLoadCompletionListener listenerWithCompletionBlock:]): 20 (-[FrameLoadCompletionListener initWithCompletionBlock:]): 21 (-[FrameLoadCompletionListener webView:didFinishLoadForFrame:]): 22 (-[DragSource draggingSourceOperationMaskForLocal:]): 23 (-[DragInfo initWithImage:offset:pasteboard:source:destinationWindow:]): 24 (-[DragInfo lastMousePosition]): 25 (-[DragInfo setLastMousePosition:]): 26 (-[DragInfo draggingDestinationWindow]): 27 (-[DragInfo draggingSourceOperationMask]): 28 (-[DragInfo draggingLocation]): 29 (-[DragInfo draggedImageLocation]): 30 (-[DragInfo draggedImage]): 31 (-[DragInfo draggingPasteboard]): 32 (-[DragInfo draggingSource]): 33 (-[DragInfo draggingSequenceNumber]): 34 (-[DragInfo slideDraggedImageTo:]): 35 (-[DragInfo namesOfPromisedFilesDroppedAtDestination:]): 36 (-[DragInfo draggingFormation]): 37 (-[DragInfo setDraggingFormation:]): 38 (-[DragInfo animatesToDestination]): 39 (-[DragInfo setAnimatesToDestination:]): 40 (-[DragInfo numberOfValidItemsForDrop]): 41 (-[DragInfo setNumberOfValidItemsForDrop:]): 42 (-[DragInfo enumerateDraggingItemsWithOptions:forView:classes:searchOptions:usingBlock:]): 43 (-[DragInfo springLoadingHighlight]): 44 (-[DragInfo resetSpringLoading]): 45 (TestWebKitAPI::getTestImage): 46 (TestWebKitAPI::webViewAfterPerformingDragOperation): 47 (TestWebKitAPI::TEST): 48 * TestWebKitAPI/Tests/mac/full-page-contenteditable.html: Added. 49 1 50 2017-02-08 Jer Noble <jer.noble@apple.com> 2 51 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r211746 r211906 550 550 F415086D1DA040C50044BE9B /* play-audio-on-click.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F415086C1DA040C10044BE9B /* play-audio-on-click.html */; }; 551 551 F42DA5161D8CEFE400336F40 /* large-input-field-focus-onload.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */; }; 552 F47728991E4AE3C1007ABF6A /* full-page-contenteditable.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F47728981E4AE3AD007ABF6A /* full-page-contenteditable.html */; }; 553 F4BFA68E1E4AD08000154298 /* DragAndDropPasteboardTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4BFA68C1E4AD08000154298 /* DragAndDropPasteboardTests.mm */; }; 552 554 F4C2AB221DD6D95E00E06D5B /* enormous-video-with-sound.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4C2AB211DD6D94100E06D5B /* enormous-video-with-sound.html */; }; 553 555 F4F137921D9B683E002BEC57 /* large-video-test-now-playing.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4F137911D9B6832002BEC57 /* large-video-test-now-playing.html */; }; … … 623 625 dstSubfolderSpec = 7; 624 626 files = ( 627 F47728991E4AE3C1007ABF6A /* full-page-contenteditable.html in Copy Resources */, 625 628 C99B675F1E39736F00FC6C80 /* no-autoplay-with-controls.html in Copy Resources */, 626 629 C99B675D1E39722000FC6C80 /* js-play-with-controls.html in Copy Resources */, … … 1361 1364 F415086C1DA040C10044BE9B /* play-audio-on-click.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "play-audio-on-click.html"; sourceTree = "<group>"; }; 1362 1365 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; }; 1366 F47728981E4AE3AD007ABF6A /* full-page-contenteditable.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "full-page-contenteditable.html"; sourceTree = "<group>"; }; 1367 F4BFA68C1E4AD08000154298 /* DragAndDropPasteboardTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragAndDropPasteboardTests.mm; sourceTree = "<group>"; }; 1363 1368 F4C2AB211DD6D94100E06D5B /* enormous-video-with-sound.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "enormous-video-with-sound.html"; sourceTree = "<group>"; }; 1364 1369 F4F137911D9B6832002BEC57 /* large-video-test-now-playing.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "large-video-test-now-playing.html"; sourceTree = "<group>"; }; … … 2119 2124 3776BC62150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm */, 2120 2125 939BA91614103412001A01BD /* DeviceScaleFactorOnBack.mm */, 2126 F4BFA68C1E4AD08000154298 /* DragAndDropPasteboardTests.mm */, 2121 2127 37E1064A1697676400B78BD0 /* DOMHTMLTableCellCellAbove.mm */, 2122 2128 2D51A0C51C8BF00400765C45 /* DOMHTMLVideoElementWrapper.mm */, … … 2181 2187 37DC678F140D7D3A00ABCCDB /* DOMRangeOfString.html */, 2182 2188 1A7E8B351812093600AEB74A /* FragmentNavigation.html */, 2189 F47728981E4AE3AD007ABF6A /* full-page-contenteditable.html */, 2183 2190 CDBFCC421A9FF44800A7B691 /* FullscreenZoomInitialFrame.html */, 2184 2191 9B4F8FA6159D52CA002D9F94 /* HTMLCollectionNamedItem.html */, … … 2784 2791 52D673EE1AFB127300FA19FE /* WKPageCopySessionStateWithFiltering.cpp in Sources */, 2785 2792 7CCE7F1F1A411AE600447C4C /* WKPageGetScaleFactorNotZero.cpp in Sources */, 2793 F4BFA68E1E4AD08000154298 /* DragAndDropPasteboardTests.mm in Sources */, 2786 2794 7CCE7F201A411AE600447C4C /* WKPageIsPlayingAudio.cpp in Sources */, 2787 2795 2D00065F1C1F589A0088E6A7 /* WKPDFViewResizeCrash.mm in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.