Expand DragController to provide more information about the dragging session
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Nov 2011 22:32:26 +0000 (22:32 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Nov 2011 22:32:26 +0000 (22:32 +0000)
commit643f8a1aaf9dcda4e56af673230ca560454ce0af
treec3c17dd82ee264271de4b65f8e08f3b7dcd17742
parent79e526e6b0e4568c59b96a5a5a8b642bf349c876
Expand DragController to provide more information about the dragging session
https://bugs.webkit.org/show_bug.cgi?id=71324
<rdar://problem/10379175>

Reviewed by Darin Adler.

Source/WebCore:

* WebCore.xcodeproj/project.pbxproj:
* page/DragController.cpp:
(WebCore::DragController::dragEntered):
(WebCore::DragController::dragUpdated):
(WebCore::DragController::dragEnteredOrUpdated):
(WebCore::DragController::tryDocumentDrag): In addition to determining the
drag operation, DragSession is updated with data regarding whether the mouse
is over a file input, and the number of items that would be accepted based on
the mouse's location.
* page/DragController.h:
* page/DragSession.h: Added.
(WebCore::DragSession::DragSession): Keep track of current operation, whether
the mouse is over a file input element, and how many files would be accepted if
dropped.
* platform/DragData.h: Added numberOfFiles()
* platform/chromium/DragDataChromium.cpp:
(WebCore::DragData::numberOfFiles):
* platform/efl/DragDataEfl.cpp:
(WebCore::DragData::numberOfFiles):
* platform/gtk/DragDataGtk.cpp:
(WebCore::DragData::numberOfFiles):
* platform/mac/DragDataMac.mm:
(WebCore::DragData::numberOfFiles):
* platform/qt/DragDataQt.cpp:
(WebCore::DragData::numberOfFiles):
* platform/win/DragDataWin.cpp:
(WebCore::DragData::numberOfFiles):
* platform/wince/DragDataWinCE.cpp:
(WebCore::DragData::numberOfFiles):
* platform/wx/DragDataWx.cpp:
(WebCore::DragData::numberOfFiles):

Source/WebKit/chromium:

* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::dragTargetDragEnterOrOver): The drag operation is contained
within the new DragSession struct. Minor refactor.

Source/WebKit/gtk:

* webkit/webkitwebview.cpp:
(webkit_web_view_drag_motion): Minor refactoring.
(webkit_web_view_drag_data_received): Minor refactoring.

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView draggingEntered:]): DragOperation is now inside the DragSession struct.
(-[WebView draggingUpdated:]):

Source/WebKit/qt:

* Api/qwebpage.cpp:
(QWebPagePrivate::dragEnterEvent): Minor refactoring because operation is stored in
new DragSession struct.
(QWebPagePrivate::dragMoveEvent): Ditto.

Source/WebKit/win:

* WebView.cpp:
(WebView::DragEnter): Minor refactoring because operation is stored in
new DragSession struct.
(WebView::DragOver): Ditto.

Source/WebKit2:

We now pass the DragSession struct from the Web to the UI process, instead of the
DragOperation enum.

* Scripts/webkit2/messages.py:
* Shared/WebCoreArgumentCoders.cpp:
(CoreIPC::::encode):
(CoreIPC::::decode):
* Shared/WebCoreArgumentCoders.h:
* UIProcess/API/mac/WKView.mm:
(-[WKView draggingUpdated:]):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy): We now cache the last known DragSession state
(WebKit::WebPageProxy::didPerformDragControllerAction):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::dragSession):
(WebKit::WebPageProxy::resetDragOperation):
* UIProcess/WebPageProxy.messages.in:
* UIProcess/win/WebView.cpp:
(WebKit::WebView::keyStateToDragOperation):
(WebKit::WebView::DragEnter):
(WebKit::WebView::DragOver):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::performDragControllerAction):

LayoutTests:

* editing/pasteboard/script-tests/file-input-files-access.js:
(runTest): Change the expected behavior of the test-- dragging a file over a disabled
control should not load that file. Instead, the file should be ignored, and the page
remains as is.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@99108 268f45cc-cd09-0410-ab3c-d52691b4dbfc
36 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/pasteboard/script-tests/file-input-files-access.js
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/DragController.cpp
Source/WebCore/page/DragController.h
Source/WebCore/page/DragSession.h [new file with mode: 0644]
Source/WebCore/platform/DragData.h
Source/WebCore/platform/chromium/DragDataChromium.cpp
Source/WebCore/platform/efl/DragDataEfl.cpp
Source/WebCore/platform/gtk/DragDataGtk.cpp
Source/WebCore/platform/mac/DragDataMac.mm
Source/WebCore/platform/qt/DragDataQt.cpp
Source/WebCore/platform/win/DragDataWin.cpp
Source/WebCore/platform/wince/DragDataWinCE.cpp
Source/WebCore/platform/wx/DragDataWx.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebViewImpl.cpp
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/webkit/webkitwebview.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/qt/Api/qwebpage.cpp
Source/WebKit/qt/ChangeLog
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebView.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Scripts/webkit2/messages.py
Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
Source/WebKit2/Shared/WebCoreArgumentCoders.h
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/win/WebView.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp