WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 176264
[iOS DnD] Refactor drag and drop logic in WKContentView in preparation for supporting multiple drag items in a drag session
https://bugs.webkit.org/show_bug.cgi?id=176264
Summary
[iOS DnD] Refactor drag and drop logic in WKContentView in preparation for su...
Wenson Hsieh
Reported
2017-09-01 19:19:40 PDT
Primarily, add a staging mechanism for writing items to the WebItemProviderPasteboard and coalescing drag item information in the UI process. Additionally, split some logic out of WKContentView and into a separate helper class to make hacking on this easier in later patches.
Attachments
First pass
(90.34 KB, patch)
2017-09-03 21:25 PDT
,
Wenson Hsieh
darin
: review+
Details
Formatted Diff
Diff
Patch for landing
(90.75 KB, patch)
2017-09-04 15:12 PDT
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Wenson Hsieh
Comment 1
2017-09-03 21:25:34 PDT
Created
attachment 319834
[details]
First pass
Wenson Hsieh
Comment 2
2017-09-03 21:26:05 PDT
Work towards <
rdar://problem/31144674
>
Darin Adler
Comment 3
2017-09-04 00:00:30 PDT
Comment on
attachment 319834
[details]
First pass View in context:
https://bugs.webkit.org/attachment.cgi?id=319834&action=review
> Source/WebKit/UIProcess/ios/DragDropInteractionState.h:54 > + bool possiblyNeedsDragPreviewUpdate;
Initialize this?
> Source/WebKit/UIProcess/ios/DragDropInteractionState.h:56 > + NSInteger itemIdentifier;
Initialize this?
> Source/WebKit/UIProcess/ios/DragDropInteractionState.h:59 > +class DragDropInteractionState {
It’s a bit hard to get a sense of what this class does, because there are so many inline function bodies interspersed. I strongly suggest moving some of them out of the class so we can see what the class’s interface is more clearly.
> Source/WebKit/UIProcess/ios/DragDropInteractionState.h:66 > + void stageDragItem(const WebCore::DragItem&, RetainPtr<UIImage>);
RetainPtr<UIImage> is a strange argument type. Normally it would just be UIImage *; why does the argument need to be a RetainPtr?
> Source/WebKit/UIProcess/ios/DragDropInteractionState.h:69 > + return !!m_stagedDragSource && stagedDragSource().action != WebCore::DragSourceActionNone;
Can write m_stagedDragSource.has_value() instead of !!m_stagedDragSource.
> Source/WebKit/UIProcess/ios/DragDropInteractionState.h:103 > + if (auto block = m_dragStartCompletionBlock) { > + m_dragStartCompletionBlock = nil; > + return block; > + } > + return nil;
This can be written as a one-liner: return WTFMove(m_dragStartCompletionBlock);
> Source/WebKit/UIProcess/ios/DragDropInteractionState.h:112 > + if (auto block = m_dragCancelSetDownBlock) { > + m_dragCancelSetDownBlock = nil; > + return block; > + } > + return nil;
Ditto.
> Source/WebKit/UIProcess/ios/DragDropInteractionState.mm:85 > +static RetainPtr<UIImage> uiImageForImage(RefPtr<Image> image)
Argument type should just be Image*.
Wenson Hsieh
Comment 4
2017-09-04 10:30:18 PDT
Comment on
attachment 319834
[details]
First pass View in context:
https://bugs.webkit.org/attachment.cgi?id=319834&action=review
>> Source/WebKit/UIProcess/ios/DragDropInteractionState.h:54 >> + bool possiblyNeedsDragPreviewUpdate; > > Initialize this?
Done!
>> Source/WebKit/UIProcess/ios/DragDropInteractionState.h:56 >> + NSInteger itemIdentifier; > > Initialize this?
Done!
>> Source/WebKit/UIProcess/ios/DragDropInteractionState.h:59 >> +class DragDropInteractionState { > > It’s a bit hard to get a sense of what this class does, because there are so many inline function bodies interspersed. I strongly suggest moving some of them out of the class so we can see what the class’s interface is more clearly.
Good call -- moved all inline implementations that aren't just simple getters to DragDropInteractionState.mm.
>> Source/WebKit/UIProcess/ios/DragDropInteractionState.h:66 >> + void stageDragItem(const WebCore::DragItem&, RetainPtr<UIImage>); > > RetainPtr<UIImage> is a strange argument type. Normally it would just be UIImage *; why does the argument need to be a RetainPtr?
Good point -- this should be a UIImage * instead of a RetainPtr. Fixed.
>> Source/WebKit/UIProcess/ios/DragDropInteractionState.h:69 >> + return !!m_stagedDragSource && stagedDragSource().action != WebCore::DragSourceActionNone; > > Can write m_stagedDragSource.has_value() instead of !!m_stagedDragSource.
True (though, looking at this again, I'm unsure why this needs to be !! in the first place -- it seems just checking m_stagedDragSource should be sufficient and a lot cleaner.)
>> Source/WebKit/UIProcess/ios/DragDropInteractionState.h:103 >> + return nil; > > This can be written as a one-liner: > > return WTFMove(m_dragStartCompletionBlock);
Done. Much cleaner!
>> Source/WebKit/UIProcess/ios/DragDropInteractionState.h:112 >> + return nil; > > Ditto.
Done!
>> Source/WebKit/UIProcess/ios/DragDropInteractionState.mm:85 >> +static RetainPtr<UIImage> uiImageForImage(RefPtr<Image> image) > > Argument type should just be Image*.
Done!
Wenson Hsieh
Comment 5
2017-09-04 14:50:05 PDT
Comment on
attachment 319834
[details]
First pass View in context:
https://bugs.webkit.org/attachment.cgi?id=319834&action=review
> Source/WebCore/platform/ios/PlatformPasteboardIOS.mm:182 > + if ([pasteboard respondsToSelector:@selector(stageRegistrationList:)])
On second thought, only staging the registration list here and not setting the item provider array will break bincompat with older (iOS 11) UIKit -- we'll need to continue doing both for now. (For internal reference: see <
rdar://problem/34244415
>).
Wenson Hsieh
Comment 6
2017-09-04 15:12:14 PDT
Created
attachment 319862
[details]
Patch for landing
WebKit Commit Bot
Comment 7
2017-09-04 16:36:24 PDT
Comment on
attachment 319862
[details]
Patch for landing Clearing flags on attachment: 319862 Committed
r221595
: <
http://trac.webkit.org/changeset/221595
>
Jonathan Bedard
Comment 8
2017-09-20 09:16:53 PDT
Committed
r222265
: <
http://trac.webkit.org/changeset/222265
>
Jonathan Bedard
Comment 9
2017-09-20 09:18:06 PDT
(In reply to Jonathan Bedard from
comment #8
)
> Committed
r222265
: <
http://trac.webkit.org/changeset/222265
>
A small build fix for iOS 11.
Radar WebKit Bug Importer
Comment 10
2017-09-27 12:41:58 PDT
<
rdar://problem/34693785
>
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