WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
181192
[Attachment Support] Create attachment elements when dropping files on iOS
https://bugs.webkit.org/show_bug.cgi?id=181192
Summary
[Attachment Support] Create attachment elements when dropping files on iOS
Wenson Hsieh
Reported
2017-12-29 18:58:30 PST
This logic currently resides in WebContentReaderMac, so we currently only represent dropped file paths as attachments on Mac. We should refactor this logic so that it resides in WebContentReaderCocoa, and teach iOS to insert attachment elements for content that either (1) explicitly prefers an attachment presentation style, as specified on the UIItemProvider, or (2) would otherwise not have a relevant DOM representation in editable areas. Of course, we should only do this if the runtime switch for attachment elements is enabled.
Attachments
First pass
(68.49 KB, patch)
2017-12-31 15:58 PST
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
v2 with slight tweaks
(69.80 KB, patch)
2018-01-01 20:42 PST
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
Rebase on trunk
(70.46 KB, patch)
2018-01-03 22:09 PST
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
Patch for landing
(70.42 KB, patch)
2018-01-03 23:11 PST
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Wenson Hsieh
Comment 1
2017-12-31 15:58:01 PST
Created
attachment 330268
[details]
First pass
Wenson Hsieh
Comment 2
2018-01-01 20:42:23 PST
Created
attachment 330307
[details]
v2 with slight tweaks
Radar WebKit Bug Importer
Comment 3
2018-01-03 12:43:06 PST
<
rdar://problem/36280945
>
Tim Horton
Comment 4
2018-01-03 14:47:15 PST
Comment on
attachment 330307
[details]
v2 with slight tweaks View in context:
https://bugs.webkit.org/attachment.cgi?id=330307&action=review
> Source/WebCore/editing/WebContentReader.cpp:34 > +void WebContentReader::ensureFragment()
I feel like ensure functions usually return the thing they’re ensuring.
> Source/WebCore/platform/PasteboardItemInfo.h:37 > + bool prefersAttachmentPresentation; > + bool prefersInlinePresentation;
Both as separate bits? Seems a bit weird, what if you set both? Should be an enum, no?
> Source/WebKit/Scripts/webkit/messages.py:379 > + 'WebCore::PasteboardItemInfo': ['<WebCore/PasteboardItemInfo.h>'],
You shouldn’t have to add this.
Wenson Hsieh
Comment 5
2018-01-03 20:30:21 PST
Comment on
attachment 330307
[details]
v2 with slight tweaks View in context:
https://bugs.webkit.org/attachment.cgi?id=330307&action=review
>> Source/WebCore/editing/WebContentReader.cpp:34 >> +void WebContentReader::ensureFragment() > > I feel like ensure functions usually return the thing they’re ensuring.
Seems reasonable — made this return the DocumentFragment&.
>> Source/WebCore/platform/PasteboardItemInfo.h:37 >> + bool prefersInlinePresentation; > > Both as separate bits? Seems a bit weird, what if you set both? Should be an enum, no?
Yeah, good point. An enum is a better fit for this. Added a new enum class, PasteboardItemPresentationStyle, to represent these styles, with three values: Unspecified, Inline, and Attachment
>> Source/WebKit/Scripts/webkit/messages.py:379 >> + 'WebCore::PasteboardItemInfo': ['<WebCore/PasteboardItemInfo.h>'], > > You shouldn’t have to add this.
Removed!
Wenson Hsieh
Comment 6
2018-01-03 22:06:14 PST
Comment on
attachment 330307
[details]
v2 with slight tweaks View in context:
https://bugs.webkit.org/attachment.cgi?id=330307&action=review
> Source/WebCore/platform/ios/PlatformPasteboardIOS.mm:117 > + NSItemProvider *itemProvider = [[m_pasteboard itemProviders] objectAtIndex:index];
(Also, I just realized that I need to guard this with PASTEBOARD_SUPPORTS_ITEM_PROVIDERS, since UIPasteboard's -itemProviders do not exist on tvOS and watchOS)
Wenson Hsieh
Comment 7
2018-01-03 22:09:03 PST
Created
attachment 330446
[details]
Rebase on trunk
Wenson Hsieh
Comment 8
2018-01-03 23:11:59 PST
Created
attachment 330449
[details]
Patch for landing
WebKit Commit Bot
Comment 9
2018-01-03 23:44:59 PST
Comment on
attachment 330449
[details]
Patch for landing Clearing flags on attachment: 330449 Committed
r226396
: <
https://trac.webkit.org/changeset/226396
>
WebKit Commit Bot
Comment 10
2018-01-03 23:45:00 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug