• enrica@apple.com's avatar
    Source/WebCore: WebKit2: Add support for drag and drop · 9d9813d0
    enrica@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=52343
    <rdar://problem/7660558>
                   
    Reviewed by Darin Adler.
    
    This patch contains the changes required to support dropping content
    in WebKit on the Mac. The DragData class has been extended to provide
    additional context from the application (keyboard state, modal windows, etc.)
    as well as information of the drag pasteboard being used.
    The support for WebKit as drag source will be added with a separate patch.
    
    * WebCore.exp.in:
    * page/DragController.cpp:
    (WebCore::DragController::dragIsMove): Added DragData parameter.
    (WebCore::DragController::tryDocumentDrag): Modified call to dragIsMove.
    (WebCore::DragController::concludeEditDrag): Same as above.
    * page/DragController.h: Added parameter to isCopyKeyDown.
    * page/mac/DragControllerMac.mm:
    The following methods have been modified to use the information stored
    in the DragData class.
    (WebCore::DragController::isCopyKeyDown):
    (WebCore::DragController::dragOperation):
    * platform/DragData.h:
    (WebCore::DragData::flags):
    * platform/DragData.cpp: Added default flags parameter to the constructor.
    * platform/mac/DragDataMac.mm:
    (WebCore::DragData::DragData): Added constructor that receives the name of the pasteboard to use.
    (WebCore::DragData::canSmartReplace):
    (WebCore::DragData::containsColor):
    (WebCore::DragData::containsFiles):
    (WebCore::DragData::asFilenames):
    (WebCore::DragData::containsPlainText):
    (WebCore::DragData::asPlainText):
    (WebCore::DragData::containsCompatibleContent):
    (WebCore::DragData::asURL):
    (WebCore::DragData::asFragment):
    All the following files have been modified to add the DragData
    parameter to isCopyKeyDown. I plan to improve this in the future
    and make isCopyKeyDown not platform specific.
    * page/android/DragControllerAndroid.cpp:
    (WebCore::DragController::isCopyKeyDown):
    * page/brew/DragControllerBrew.cpp:
    (WebCore::DragController::isCopyKeyDown):
    * page/chromium/DragControllerChromium.cpp:
    (WebCore::DragController::isCopyKeyDown):
    * page/efl/DragControllerEfl.cpp:
    (WebCore::DragController::isCopyKeyDown):
    * page/gtk/DragControllerGtk.cpp:
    (WebCore::DragController::isCopyKeyDown):
    * page/haiku/DragControllerHaiku.cpp:
    (WebCore::DragController::isCopyKeyDown):
    * page/mac/DragControllerMac.mm:
    (WebCore::DragController::isCopyKeyDown):
    (WebCore::DragController::dragOperation):
    * page/qt/DragControllerQt.cpp:
    (WebCore::DragController::isCopyKeyDown):
    * page/win/DragControllerWin.cpp:
    (WebCore::DragController::isCopyKeyDown):
    * page/wx/DragControllerWx.cpp:
    (WebCore::DragController::isCopyKeyDown):
    
    WebKit/mac: WebKit2: Add support for drag and drop
    https://bugs.webkit.org/show_bug.cgi?id=52343
    <rdar://problem/7660558>
            
    Reviewed by Darin Adler.
    
    The DragData class has been extended to provide
    additional context from the application (keyboard state, modal windows, etc.)
    as well as information of the drag pasteboard being used.
    These are the changes to align the behavior for WebKit.
    
    * WebView/WebView.mm:
    (-[WebView applicationFlags:]): Added.
    (-[WebView draggingEntered:]): Added parameter to the DragData constructor.
    (-[WebView draggingUpdated:]): Added parameter to the DragData constructor.
    (-[WebView draggingExited:]): Added parameter to the DragData constructor.
    (-[WebView performDragOperation:]): Added parameter to the DragData constructor.
    
    WebKit2: WebKit2: Add support for drag and drop
    https://bugs.webkit.org/show_bug.cgi?id=52343
    <rdar://problem/7660558>
                   
    Reviewed by Darin Adler.
    
    This patch contains the changes required to support dropping content
    in WebKit on the Mac. The DragData class has been extended to provide
    additional context from the application (keyboard state, modal windows, etc.)
    as well as information of the drag pasteboard being used.
    The support for WebKit as drag source will be added with a separate patch.
    
    * Shared/DragControllerAction.h: Added.
    * UIProcess/API/mac/WKView.mm:
    Added implemention of the methods required to add suport for a drop target.
    To maintain asynchronous communication with the WebProcess, we always return
    the previous calculated value for the drag operation.
    (-[WKView _registerDraggedTypes]):
    (-[WKView initWithFrame:contextRef:pageGroupRef:]):
    (-[WKView applicationFlags:]):
    (-[WKView draggingEntered:]):
    (-[WKView draggingUpdated:]):
    (-[WKView draggingExited:]):
    (-[WKView prepareForDragOperation:]):
    (-[WKView performDragOperation:]):
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::WebPageProxy):
    (WebKit::WebPageProxy::performDragControllerAction):
    (WebKit::WebPageProxy::didPerformDragControllerAction):
    * UIProcess/WebPageProxy.h:
    (WebKit::WebPageProxy::dragOperation):
    (WebKit::WebPageProxy::resetDragOperation):
    * UIProcess/WebPageProxy.messages.in:
    * WebKit2.xcodeproj/project.pbxproj:
    * WebProcess/WebCoreSupport/WebDragClient.cpp:
    (WebKit::WebDragClient::willPerformDragDestinationAction):
    (WebKit::WebDragClient::willPerformDragSourceAction):
    (WebKit::WebDragClient::actionMaskForDrag):
    (WebKit::WebDragClient::dragSourceActionMaskForPoint):
    (WebKit::WebDragClient::startDrag):
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::performDragControllerAction):
    * WebProcess/WebPage/WebPage.h:
    * WebProcess/WebPage/WebPage.messages.in:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75743 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    9d9813d0
WKView.mm 56.8 KB