Skip to content
  • jonlee@apple.com's avatar
    Expand DragController to provide more information about the dragging session · d18aac0a
    jonlee@apple.com authored
    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: http://svn.webkit.org/repository/webkit/trunk@99108 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    d18aac0a