Source/WebCore: WebKit2: Add support for drag and drop
authorenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jan 2011 23:14:41 +0000 (23:14 +0000)
committerenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jan 2011 23:14:41 +0000 (23:14 +0000)
commit371b2a6a994f7cab2a80ed6834a9aa9527fdadcf
tree80c71b24884fe5bf0d2bc3cbeb9febe69048fcea
parent0cf25e379a3f7e095d5793f6b64e9d612afbb54f
Source/WebCore: 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.

* 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: https://svn.webkit.org/repository/webkit/trunk@75743 268f45cc-cd09-0410-ab3c-d52691b4dbfc
31 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/DragController.cpp
Source/WebCore/page/DragController.h
Source/WebCore/page/android/DragControllerAndroid.cpp
Source/WebCore/page/brew/DragControllerBrew.cpp
Source/WebCore/page/chromium/DragControllerChromium.cpp
Source/WebCore/page/efl/DragControllerEfl.cpp
Source/WebCore/page/gtk/DragControllerGtk.cpp
Source/WebCore/page/haiku/DragControllerHaiku.cpp
Source/WebCore/page/mac/DragControllerMac.mm
Source/WebCore/page/qt/DragControllerQt.cpp
Source/WebCore/page/win/DragControllerWin.cpp
Source/WebCore/page/wx/DragControllerWx.cpp
Source/WebCore/platform/DragData.cpp
Source/WebCore/platform/DragData.h
Source/WebCore/platform/mac/DragDataMac.mm
WebKit/mac/ChangeLog
WebKit/mac/WebView/WebView.mm
WebKit2/ChangeLog
WebKit2/Shared/DragControllerAction.h [new file with mode: 0644]
WebKit2/UIProcess/API/mac/WKView.mm
WebKit2/UIProcess/WebPageProxy.cpp
WebKit2/UIProcess/WebPageProxy.h
WebKit2/UIProcess/WebPageProxy.messages.in
WebKit2/WebKit2.xcodeproj/project.pbxproj
WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp
WebKit2/WebProcess/WebPage/WebPage.cpp
WebKit2/WebProcess/WebPage/WebPage.h
WebKit2/WebProcess/WebPage/WebPage.messages.in