WebKit2 needs an API to set a custom drop target for a view. It exists in WebKit1. <rdar://problem/9090868>
Created attachment 93821 [details] [PATCH] Fix
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.
(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.
Created attachment 93832 [details] [PATCH] Fix v2
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.
Created attachment 93834 [details] [PATCH] Fix v3
Landed in r86717.