Bug 60991 - WebKit2: Needs API to set a custom drop target
Summary: WebKit2: Needs API to set a custom drop target
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Normal
Assignee: Brian Weinstein
URL:
Keywords: InRadar, PlatformOnly
Depends on:
Blocks:
 
Reported: 2011-05-17 14:47 PDT by Brian Weinstein
Modified: 2011-05-17 16:17 PDT (History)
3 users (show)

See Also:


Attachments
[PATCH] Fix (3.15 KB, patch)
2011-05-17 14:54 PDT, Brian Weinstein
aroben: review-
Details | Formatted Diff | Diff
[PATCH] Fix v2 (3.23 KB, patch)
2011-05-17 15:21 PDT, Brian Weinstein
aroben: review-
Details | Formatted Diff | Diff
[PATCH] Fix v3 (3.29 KB, patch)
2011-05-17 15:30 PDT, Brian Weinstein
aroben: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Weinstein 2011-05-17 14:47:25 PDT
WebKit2 needs an API to set a custom drop target for a view. It exists in WebKit1.

<rdar://problem/9090868>
Comment 1 Brian Weinstein 2011-05-17 14:54:41 PDT
Created attachment 93821 [details]
[PATCH] Fix
Comment 2 Adam Roben (:aroben) 2011-05-17 14:56:07 PDT
Comment on attachment 93821 [details]
[PATCH] Fix

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

> Source/WebKit2/UIProcess/win/WebView.cpp:1128
> +void WebView::setCustomDropTarget(IDropTarget* dropTarget)
> +{
> +    ::RevokeDragDrop(m_window);
> +    ::RegisterDragDrop(m_window, dropTarget);
> +}

If someone passes in 0 here, we should set the drop target back to our standard one. Otherwise clients will have no way to clear their custom drop target.
Comment 3 Brian Weinstein 2011-05-17 14:58:49 PDT
(In reply to comment #2)
> (From update of attachment 93821 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=93821&action=review
> 
> > Source/WebKit2/UIProcess/win/WebView.cpp:1128
> > +void WebView::setCustomDropTarget(IDropTarget* dropTarget)
> > +{
> > +    ::RevokeDragDrop(m_window);
> > +    ::RegisterDragDrop(m_window, dropTarget);
> > +}
> 
> If someone passes in 0 here, we should set the drop target back to our standard one. Otherwise clients will have no way to clear their custom drop target.

Fixed. New patch coming soon.
Comment 4 Brian Weinstein 2011-05-17 15:21:44 PDT
Created attachment 93832 [details]
[PATCH] Fix v2
Comment 5 Adam Roben (:aroben) 2011-05-17 15:24:31 PDT
Comment on attachment 93832 [details]
[PATCH] Fix v2

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

> Source/WebKit2/UIProcess/win/WebView.cpp:1132
> +void WebView::setCustomDropTarget(IDropTarget* dropTarget)
> +{
> +    ::RevokeDragDrop(m_window);
> +
> +    if (dropTarget)
> +        ::RegisterDragDrop(m_window, dropTarget);
> +    else
> +        ::RegisterDragDrop(m_window, this);
> +}

This won't work correctly if m_window has been destroyed or the page has already been closed. We shouldn't do anything in those cases.
Comment 6 Brian Weinstein 2011-05-17 15:30:32 PDT
Created attachment 93834 [details]
[PATCH] Fix v3
Comment 7 Brian Weinstein 2011-05-17 16:17:35 PDT
Landed in r86717.