Bug 180853

Summary: [Attachment Support] Insert images as inline attachments when pasting and dropping
Product: WebKit Reporter: Wenson Hsieh <wenson_hsieh>
Component: HTML EditingAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, mitz, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 180892    
Attachments:
Description Flags
First pass
none
Slight test tweaks
thorton: review+
Patch for EWS. none

Description Wenson Hsieh 2017-12-14 17:24:20 PST
<rdar://problem/35756268>
Comment 1 Wenson Hsieh 2017-12-14 19:36:59 PST
Created attachment 329447 [details]
First pass
Comment 2 Wenson Hsieh 2017-12-15 13:34:45 PST
Created attachment 329514 [details]
Slight test tweaks
Comment 3 Tim Horton 2017-12-18 13:13:52 PST
Comment on attachment 329514 [details]
Slight test tweaks

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

> Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm:425
> +    HashMap<AtomicString, RefPtr<Blob>> urlToBlobMap;

Is it at all possible to factor this out? It seems like these same four lines show up a bunch of times.

> Source/WebCore/html/HTMLAttachmentElement.cpp:127
> +            setAttributeWithoutSynchronization(HTMLNames::titleAttr, m_file->name());

I swear I've seen this code before
Comment 4 Wenson Hsieh 2017-12-18 13:34:11 PST
Comment on attachment 329514 [details]
Slight test tweaks

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

>> Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm:425
>> +    HashMap<AtomicString, RefPtr<Blob>> urlToBlobMap;
> 
> Is it at all possible to factor this out? It seems like these same four lines show up a bunch of times.

Good idea — fixed.

>> Source/WebCore/html/HTMLAttachmentElement.cpp:127
>> +            setAttributeWithoutSynchronization(HTMLNames::titleAttr, m_file->name());
> 
> I swear I've seen this code before

It's also in HTMLAttachmentElement::updateFileWithData. I'm not sure why I avoided refactoring that to use this new logic, but at a second glance, you're right — it totally should just call into this code instead. Fixed!
Comment 5 Wenson Hsieh 2017-12-18 14:32:05 PST
Created attachment 329685 [details]
Patch for EWS.
Comment 6 WebKit Commit Bot 2017-12-18 16:19:22 PST
Comment on attachment 329685 [details]
Patch for EWS.

Clearing flags on attachment: 329685

Committed r226085: <https://trac.webkit.org/changeset/226085>