Bug 196442

Summary: Unable to copy and paste a PDF from Notes into Mail compose body
Product: WebKit Reporter: Wenson Hsieh <wenson_hsieh>
Component: HTML EditingAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: aestes, bdakin, commit-queue, megan_gardner, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 196435    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Rebase on trunk
thorton: review+
Patch for landing none

Description Wenson Hsieh 2019-04-01 07:39:40 PDT
<rdar://problem/48573098>
Comment 1 Wenson Hsieh 2019-04-01 10:52:09 PDT
Created attachment 366404 [details]
Patch
Comment 2 Wenson Hsieh 2019-04-01 10:57:25 PDT
Created attachment 366405 [details]
Rebase on trunk
Comment 3 Tim Horton 2019-04-01 12:06:22 PDT
Comment on attachment 366405 [details]
Rebase on trunk

View in context: https://bugs.webkit.org/attachment.cgi?id=366405&action=review

> Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm:223
>  static String mimeTypeFromContentType(const String& contentType)

Why isn't this in UTIUtilities?
Comment 4 Wenson Hsieh 2019-04-01 12:29:23 PDT
Comment on attachment 366405 [details]
Rebase on trunk

View in context: https://bugs.webkit.org/attachment.cgi?id=366405&action=review

>> Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm:223
>>  static String mimeTypeFromContentType(const String& contentType)
> 
> Why isn't this in UTIUtilities?

AFAICT, no good reason :P

I'll pull this out into a separate helper in a separate change (https://bugs.webkit.org/show_bug.cgi?id=196455), since there are a number of other (unrelated) places that would also benefit from this refactoring.
Comment 5 Wenson Hsieh 2019-04-01 13:09:02 PDT
Comment on attachment 366405 [details]
Rebase on trunk

View in context: https://bugs.webkit.org/attachment.cgi?id=366405&action=review

> Source/WebCore/platform/PasteboardItemInfo.h:73
> +            return isNonTextType || containsFileURLAndFileUploadContent || !suggestedFileName.isEmpty();

As we discussed on IRC, I'm going to move the (isNonTextType || containsFileURLAndFileUploadContent) part of this out of canBeTreatedAsAttachmentOrFile() and back into Pasteboard::fileContentState, where it was originally. Relaxing the heuristic for items that contain non-text types or any file URL/file upload content causes copying and pasting text from Notes to Mail compose to insert an RTFD attachment instead of inline text :/
Comment 6 Wenson Hsieh 2019-04-01 14:04:18 PDT
Created attachment 366420 [details]
Patch for landing
Comment 7 WebKit Commit Bot 2019-04-01 14:21:30 PDT
Comment on attachment 366420 [details]
Patch for landing

Clearing flags on attachment: 366420

Committed r243713: <https://trac.webkit.org/changeset/243713>