Bug 180853 - [Attachment Support] Insert images as inline attachments when pasting and dropping
Summary: [Attachment Support] Insert images as inline attachments when pasting and dro...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks: 180892
  Show dependency treegraph
 
Reported: 2017-12-14 17:24 PST by Wenson Hsieh
Modified: 2017-12-18 18:51 PST (History)
5 users (show)

See Also:


Attachments
First pass (39.64 KB, patch)
2017-12-14 19:36 PST, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Slight test tweaks (39.71 KB, patch)
2017-12-15 13:34 PST, Wenson Hsieh
thorton: review+
Details | Formatted Diff | Diff
Patch for EWS. (40.47 KB, patch)
2017-12-18 14:32 PST, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>