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)
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

index 229bb1c..09f7e30 100644 (file)
@@ -1,3 +1,16 @@
+2011-11-02  Jon Lee  <jonlee@apple.com>
+
+        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.
+
+        * 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.
+
 2011-11-02  Tony Chang  <tony@chromium.org>
 
         Update chromium results for printing tests.
index 97aff60..9043ab0 100644 (file)
@@ -110,22 +110,12 @@ function runTest()
 
     debug("Dragging to a disabled file input control:");
     fileInput.disabled = true;
-    window.onbeforeunload = function() {
-        // Since the drop triggered a navigation, verify the properties of the file input here.
-        shouldBeEqualToString("fileInput.value", "");
-        filesShouldBe([]);
-        shouldBeTrue("successfullyParsed");
-        debug('<br /><span class="pass">TEST COMPLETE</span>');
-
-        // Clean up after ourselves
-        fileInput.parentNode.removeChild(fileInput);
+    draggingPathsShouldResultInFiles(['DRTFakeFile'], []);
 
-        layoutTestController.notifyDone();
+    // Clean up after ourselves
+    fileInput.parentNode.removeChild(fileInput);
 
-        window.onbeforeunload = null;
-    };
-    draggingPathsShouldResultInFiles(['DRTFakeFile'], []);
-    testFailed("The final test case should have resulted in navigation");
+    layoutTestController.notifyDone();
 }
 
 var successfullyParsed = true;
index b0577c9..124df71 100644 (file)
@@ -1,3 +1,43 @@
+2011-11-02  Jon Lee  <jonlee@apple.com>
+
+        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.
+
+        * 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):
+
 2011-11-02  Alexey Proskuryakov  <ap@apple.com>
 
         Emedded PDFs cannot be opened from Web archives
index 6f28195..37328b3 100644 (file)
                31611E610E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 31611E5E0E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.h */; };
                31611E620E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 31611E5F0E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.mm */; };
                31611E630E1C4E1400F6A579 /* DOMWebKitCSSTransformValueInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 31611E600E1C4E1400F6A579 /* DOMWebKitCSSTransformValueInternal.h */; };
+               3169379C14609C6C00C01362 /* DragSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 3169379A14609C5B00C01362 /* DragSession.h */; settings = {ATTRIBUTES = (Private, ); }; };
                316FE0710E6CCBEE00BF6088 /* JSWebKitCSSKeyframeRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 316FE06D0E6CCBEE00BF6088 /* JSWebKitCSSKeyframeRule.cpp */; };
                316FE0720E6CCBEE00BF6088 /* JSWebKitCSSKeyframeRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 316FE06E0E6CCBEE00BF6088 /* JSWebKitCSSKeyframeRule.h */; };
                316FE0730E6CCBEE00BF6088 /* JSWebKitCSSKeyframesRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 316FE06F0E6CCBEE00BF6088 /* JSWebKitCSSKeyframesRule.cpp */; };
                31611E5E0E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitCSSTransformValue.h; sourceTree = "<group>"; };
                31611E5F0E1C4E1400F6A579 /* DOMWebKitCSSTransformValue.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMWebKitCSSTransformValue.mm; sourceTree = "<group>"; };
                31611E600E1C4E1400F6A579 /* DOMWebKitCSSTransformValueInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitCSSTransformValueInternal.h; sourceTree = "<group>"; };
+               3169379A14609C5B00C01362 /* DragSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragSession.h; sourceTree = "<group>"; };
                316FE06D0E6CCBEE00BF6088 /* JSWebKitCSSKeyframeRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitCSSKeyframeRule.cpp; sourceTree = "<group>"; };
                316FE06E0E6CCBEE00BF6088 /* JSWebKitCSSKeyframeRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitCSSKeyframeRule.h; sourceTree = "<group>"; };
                316FE06F0E6CCBEE00BF6088 /* JSWebKitCSSKeyframesRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitCSSKeyframesRule.cpp; sourceTree = "<group>"; };
                                A7CA595C0B27BD9E00FA021D /* DragController.cpp */,
                                A7CA595B0B27BD9E00FA021D /* DragController.h */,
                                81F65FF513788FAA00FF6F2D /* DragState.h */,
+                               3169379A14609C5B00C01362 /* DragSession.h */,
                                1AF326770D78B9440068F0C4 /* EditorClient.h */,
                                93C09A800B064F00005ABD4D /* EventHandler.cpp */,
                                93C09A520B064DB3005ABD4D /* EventHandler.h */,
                                9B3A8872145632F9003AE8F5 /* DOMDOMSettableTokenList.h in Headers */,
                                FD62F52E145898D80094B0ED /* AudioSourceProviderClient.h in Headers */,
                                2D8FEBDD143E3EF70072502B /* CSSCrossfadeValue.h in Headers */,
+                               3169379C14609C6C00C01362 /* DragSession.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index b668df4..467f39d 100644 (file)
@@ -36,6 +36,7 @@
 #include "DragActions.h"
 #include "DragClient.h"
 #include "DragData.h"
+#include "DragSession.h"
 #include "Editor.h"
 #include "EditorClient.h"
 #include "Element.h"
@@ -162,7 +163,7 @@ void DragController::dragEnded()
     m_client->dragEnded();
 }
 
-DragOperation DragController::dragEntered(DragData* dragData)
+DragSession DragController::dragEntered(DragData* dragData)
 {
     return dragEnteredOrUpdated(dragData);
 }
@@ -182,7 +183,7 @@ void DragController::dragExited(DragData* dragData)
     mouseMovedIntoDocument(0);
 }
 
-DragOperation DragController::dragUpdated(DragData* dragData)
+DragSession DragController::dragUpdated(DragData* dragData)
 {
     return dragEnteredOrUpdated(dragData);
 }
@@ -232,7 +233,7 @@ void DragController::mouseMovedIntoDocument(Document* newDocument)
     m_documentUnderMouse = newDocument;
 }
 
-DragOperation DragController::dragEnteredOrUpdated(DragData* dragData)
+DragSession DragController::dragEnteredOrUpdated(DragData* dragData)
 {
     ASSERT(dragData);
     ASSERT(m_page->mainFrame()); // It is not possible in Mac WebKit to have a Page without a mainFrame()
@@ -241,14 +242,14 @@ DragOperation DragController::dragEnteredOrUpdated(DragData* dragData)
     m_dragDestinationAction = m_client->actionMaskForDrag(dragData);
     if (m_dragDestinationAction == DragDestinationActionNone) {
         cancelDrag(); // FIXME: Why not call mouseMovedIntoDocument(0)?
-        return DragOperationNone;
+        return DragSession();
     }
 
-    DragOperation operation = DragOperationNone;
-    bool handledByDocument = tryDocumentDrag(dragData, m_dragDestinationAction, operation);
+    DragSession dragSession;
+    bool handledByDocument = tryDocumentDrag(dragData, m_dragDestinationAction, dragSession);
     if (!handledByDocument && (m_dragDestinationAction & DragDestinationActionLoad))
-        return operationForLoad(dragData);
-    return operation;
+        dragSession.operation = operationForLoad(dragData);
+    return dragSession;
 }
 
 static HTMLInputElement* asFileInput(Node* node)
@@ -284,7 +285,7 @@ static Element* elementUnderMouse(Document* documentUnderMouse, const IntPoint&
     return static_cast<Element*>(n);
 }
 
-bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction actionMask, DragOperation& operation)
+bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction actionMask, DragSession& dragSession)
 {
     ASSERT(dragData);
 
@@ -296,7 +297,7 @@ bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction a
 
     m_isHandlingDrag = false;
     if (actionMask & DragDestinationActionDHTML) {
-        m_isHandlingDrag = tryDHTMLDrag(dragData, operation);
+        m_isHandlingDrag = tryDHTMLDrag(dragData, dragSession.operation);
         // Do not continue if m_documentUnderMouse has been reset by tryDHTMLDrag.
         // tryDHTMLDrag fires dragenter event. The event listener that listens
         // to this event may create a nested message loop (open a modal dialog),
@@ -317,7 +318,7 @@ bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction a
         return true;
     } else if ((actionMask & DragDestinationActionEdit) && canProcessDrag(dragData)) {
         if (dragData->containsColor()) {
-            operation = DragOperationGeneric;
+            dragSession.operation = DragOperationGeneric;
             return true;
         }
 
@@ -325,11 +326,33 @@ bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction a
         Element* element = elementUnderMouse(m_documentUnderMouse.get(), point);
         if (!element)
             return false;
-        if (!asFileInput(element))
+        
+        HTMLInputElement* elementAsFileInput = asFileInput(element);
+        if (!elementAsFileInput)
             m_page->dragCaretController()->setCaretPosition(m_documentUnderMouse->frame()->visiblePositionForPoint(point));
 
         Frame* innerFrame = element->document()->frame();
-        operation = dragIsMove(innerFrame->selection(), dragData) ? DragOperationMove : DragOperationCopy;
+        dragSession.operation = dragIsMove(innerFrame->selection(), dragData) ? DragOperationMove : DragOperationCopy;
+        dragSession.mouseIsOverFileInput = elementAsFileInput;
+        dragSession.numberOfItemsToBeAccepted = 0;
+
+        unsigned numberOfFiles = dragData->numberOfFiles();
+        if (elementAsFileInput) {
+            if (elementAsFileInput->disabled())
+                dragSession.numberOfItemsToBeAccepted = 0;
+            else if (elementAsFileInput->multiple())
+                dragSession.numberOfItemsToBeAccepted = numberOfFiles;
+            else
+                dragSession.numberOfItemsToBeAccepted = 1;
+            
+            if (!dragSession.numberOfItemsToBeAccepted)
+                dragSession.operation = DragOperationNone;
+        } else {
+            // We are not over a file input element. The dragged item(s) will only
+            // be loaded into the view the number of dragged items is 1.
+            dragSession.numberOfItemsToBeAccepted = numberOfFiles != 1 ? 0 : 1;
+        }
+        
         return true;
     }
     // If we're not over an editable region, make sure we're clearing any prior drag cursor.
index 261a8d5..d52591d 100644 (file)
@@ -37,6 +37,7 @@ namespace WebCore {
     class Document;
     class DragClient;
     class DragData;
+    struct DragSession;
     struct DragState;
     class Element;
     class Frame;
@@ -55,9 +56,9 @@ namespace WebCore {
         ~DragController();
         DragClient* client() const { return m_client; }
 
-        DragOperation dragEntered(DragData*);
+        DragSession dragEntered(DragData*);
         void dragExited(DragData*);
-        DragOperation dragUpdated(DragData*);
+        DragSession dragUpdated(DragData*);
         bool performDrag(DragData*);
         
         // FIXME: It should be possible to remove a number of these accessors once all
@@ -94,9 +95,9 @@ namespace WebCore {
         bool dispatchTextInputEventFor(Frame*, DragData*);
         bool canProcessDrag(DragData*);
         bool concludeEditDrag(DragData*);
-        DragOperation dragEnteredOrUpdated(DragData*);
+        DragSession dragEnteredOrUpdated(DragData*);
         DragOperation operationForLoad(DragData*);
-        bool tryDocumentDrag(DragData*, DragDestinationAction, DragOperation&);
+        bool tryDocumentDrag(DragData*, DragDestinationAction, DragSession&);
         bool tryDHTMLDrag(DragData*, DragOperation&);
         DragOperation dragOperation(DragData*);
         void cancelDrag();
diff --git a/Source/WebCore/page/DragSession.h b/Source/WebCore/page/DragSession.h
new file mode 100644 (file)
index 0000000..0e93751
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef DragSession_h
+#define DragSession_h
+
+#include "DragActions.h"
+
+namespace WebCore {
+    
+struct DragSession {
+    DragOperation operation;
+    bool mouseIsOverFileInput;
+    unsigned numberOfItemsToBeAccepted;
+
+    DragSession()
+        : operation(DragOperationNone)
+        , mouseIsOverFileInput(false)
+        , numberOfItemsToBeAccepted(0)
+    {
+    }
+};
+
+}
+
+#endif
index afa219f..bb242f9 100644 (file)
@@ -116,6 +116,7 @@ public:
     bool canSmartReplace() const;
     bool containsColor() const;
     bool containsFiles() const;
+    unsigned numberOfFiles() const;
 #if PLATFORM(MAC)
     NSPasteboard *pasteboard() { return m_pasteboard.get(); }
 #endif
index 09da8a4..9c38386 100644 (file)
@@ -73,6 +73,11 @@ bool DragData::containsFiles() const
     return m_platformDragData->containsFilenames();
 }
 
+unsigned DragData::numberOfFiles() const
+{
+    return m_platformDragData->filenames().size();
+}
+
 void DragData::asFilenames(Vector<String>& result) const
 {
     const Vector<String>& filenames = m_platformDragData->filenames();
index b35b963..9d7e9ca 100644 (file)
@@ -41,6 +41,11 @@ bool DragData::containsFiles() const
     return false;
 }
 
+unsigned DragData::numberOfFiles() const
+{
+    return 0;
+}
+
 void DragData::asFilenames(Vector<String>& result) const
 {
 }
index cc9a208..02a4749 100644 (file)
@@ -41,6 +41,11 @@ bool DragData::containsFiles() const
     return m_platformDragData->hasFilenames();
 }
 
+unsigned DragData::numberOfFiles() const
+{
+    return m_platformDragData->filenames().size();
+}
+
 void DragData::asFilenames(Vector<String>& result) const
 {
     result = m_platformDragData->filenames();
index 2ca943d..294eebb 100644 (file)
@@ -76,6 +76,13 @@ bool DragData::containsFiles() const
     return [[m_pasteboard.get() types] containsObject:NSFilenamesPboardType];
 }
 
+unsigned DragData::numberOfFiles() const
+{
+    if (![[m_pasteboard.get() types] containsObject:NSFilenamesPboardType])
+        return 0;
+    return [[m_pasteboard.get() propertyListForType:NSFilenamesPboardType] count];
+}
+
 void DragData::asFilenames(Vector<String>& result) const
 {
     NSArray *filenames = [m_pasteboard.get() propertyListForType:NSFilenamesPboardType];
index 2554df4..0303ad7 100644 (file)
@@ -62,6 +62,11 @@ bool DragData::containsFiles() const
     return false;
 }
 
+unsigned DragData::numberOfFiles() const
+{
+    return 0;
+}
+
 void DragData::asFilenames(Vector<String>& result) const
 {
     if (!m_platformDragData)
index 08b6eb2..9ab62b9 100644 (file)
@@ -110,6 +110,11 @@ bool DragData::containsFiles() const
     return (m_platformDragData) ? SUCCEEDED(m_platformDragData->QueryGetData(cfHDropFormat())) : m_dragDataMap.contains(cfHDropFormat()->cfFormat);
 }
 
+unsigned DragData::numberOfFiles() const
+{
+    return 0;
+}
+
 void DragData::asFilenames(Vector<String>& result) const
 {
     if (m_platformDragData) {
index 679229d..cc5f7a7 100644 (file)
@@ -47,6 +47,11 @@ bool DragData::containsFiles() const
     return false;
 }
 
+unsigned DragData::numberOfFiles() const
+{
+    return 0;
+}
+
 void DragData::asFilenames(Vector<String>&) const
 {
 }
index be24042..82e4740 100644 (file)
@@ -47,6 +47,11 @@ bool DragData::containsFiles() const
     return false;
 }
 
+unsigned DragData::numberOfFiles() const
+{
+    return 0;
+}
+
 void DragData::asFilenames(Vector<String>& result) const
 {
 }
index b59ae14..98a2397 100644 (file)
@@ -1,3 +1,15 @@
+2011-11-02  Jon Lee  <jonlee@apple.com>
+
+        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.
+
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::dragTargetDragEnterOrOver): The drag operation is contained
+        within the new DragSession struct. Minor refactor.
+
 2011-10-31  Nat Duca  <nduca@chromium.org>
 
         [chromium] Slow down commit and draw rate based on visibility and draw completion
index 1ba5daf..48fb3e0 100644 (file)
@@ -50,6 +50,7 @@
 #include "DragController.h"
 #include "DragData.h"
 #include "DragScrollTimer.h"
+#include "DragSession.h"
 #include "Editor.h"
 #include "EventHandler.h"
 #include "Extensions3D.h"
@@ -2067,11 +2068,13 @@ WebDragOperation WebViewImpl::dragTargetDragEnterOrOver(const WebPoint& clientPo
         screenPoint,
         static_cast<DragOperation>(m_operationsAllowed));
 
-    DragOperation dropEffect;
+    DragSession dragSession;
     if (dragAction == DragEnter)
-        dropEffect = m_page->dragController()->dragEntered(&dragData);
+        dragSession = m_page->dragController()->dragEntered(&dragData);
     else
-        dropEffect = m_page->dragController()->dragUpdated(&dragData);
+        dragSession = m_page->dragController()->dragUpdated(&dragData);
+
+    DragOperation dropEffect = dragSession.operation;
 
     // Mask the drop effect operation against the drag source's allowed operations.
     if (!(dropEffect & dragData.draggingSourceOperationMask()))
index 56fe28e..487209d 100644 (file)
@@ -1,3 +1,15 @@
+2011-11-02  Jon Lee  <jonlee@apple.com>
+
+        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.
+
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_drag_motion): Minor refactoring.
+        (webkit_web_view_drag_data_received): Minor refactoring.
+
 2011-11-02  Tom Sepez  <tsepez@chromium.org>
 
         XSSAuditor is silent
index 4e7ada6..803a18b 100644 (file)
@@ -47,6 +47,7 @@
 #include "DragClientGtk.h"
 #include "DragController.h"
 #include "DragData.h"
+#include "DragSession.h"
 #include "DumpRenderTreeSupportGtk.h"
 #include "Editor.h"
 #include "EditorClientGtk.h"
@@ -1441,7 +1442,7 @@ static gboolean webkit_web_view_drag_motion(GtkWidget* widget, GdkDragContext* c
     if (!dragData)
         return TRUE;
 
-    DragOperation operation = core(webView)->dragController()->dragUpdated(dragData.get());
+    DragOperation operation = core(webView)->dragController()->dragUpdated(dragData.get()).operation;
     gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
     return TRUE;
 }
@@ -1453,7 +1454,7 @@ static void webkit_web_view_drag_data_received(GtkWidget* widget, GdkDragContext
     if (!dragData)
         return;
 
-    DragOperation operation = core(webView)->dragController()->dragEntered(dragData.get());
+    DragOperation operation = core(webView)->dragController()->dragEntered(dragData.get()).operation;
     gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
 }
 
index 54817bb..7a8960f 100644 (file)
@@ -1,3 +1,15 @@
+2011-11-02  Jon Lee  <jonlee@apple.com>
+
+        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.
+
+        * WebView/WebView.mm:
+        (-[WebView draggingEntered:]): DragOperation is now inside the DragSession struct.
+        (-[WebView draggingUpdated:]):
+
 2011-11-02  Tom Sepez  <tsepez@chromium.org>
 
         XSSAuditor is silent
index 53406df..c8db5cb 100644 (file)
 #import <WebCore/DocumentLoader.h>
 #import <WebCore/DragController.h>
 #import <WebCore/DragData.h>
+#import <WebCore/DragSession.h>
 #import <WebCore/Editor.h>
 #import <WebCore/EventHandler.h>
 #import <WebCore/ExceptionHandlers.h>
@@ -3865,7 +3866,7 @@ static NSString * const windowDidChangeResolutionNotification = @"NSWindowDidCha
     IntPoint client([draggingInfo draggingLocation]);
     IntPoint global(globalPoint([draggingInfo draggingLocation], [self window]));
     DragData dragData(draggingInfo, client, global, static_cast<DragOperation>([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]);
-    return core(self)->dragController()->dragEntered(&dragData);
+    return core(self)->dragController()->dragEntered(&dragData).operation;
 }
 
 - (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)draggingInfo
@@ -3877,7 +3878,7 @@ static NSString * const windowDidChangeResolutionNotification = @"NSWindowDidCha
     IntPoint client([draggingInfo draggingLocation]);
     IntPoint global(globalPoint([draggingInfo draggingLocation], [self window]));
     DragData dragData(draggingInfo, client, global, static_cast<DragOperation>([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]);
-    return page->dragController()->dragUpdated(&dragData);
+    return page->dragController()->dragUpdated(&dragData).operation;
 }
 
 - (void)draggingExited:(id <NSDraggingInfo>)draggingInfo
index bb1424f..7e696c4 100644 (file)
@@ -51,6 +51,7 @@
 #include "DragClientQt.h"
 #include "DragController.h"
 #include "DragData.h"
+#include "DragSession.h"
 #include "Editor.h"
 #include "EditorClientQt.h"
 #include "FocusController.h"
@@ -991,7 +992,7 @@ void QWebPagePrivate::dragEnterEvent(T* ev)
 #ifndef QT_NO_DRAGANDDROP
     DragData dragData(ev->mimeData(), QPointF(ev->pos()).toPoint(),
             QCursor::pos(), dropActionToDragOp(ev->possibleActions()));
-    Qt::DropAction action = dragOpToDropAction(page->dragController()->dragEntered(&dragData));
+    Qt::DropAction action = dragOpToDropAction(page->dragController()->dragEntered(&dragData).operation);
     ev->setDropAction(action);
     ev->acceptProposedAction();
 #endif
@@ -1013,7 +1014,7 @@ void QWebPagePrivate::dragMoveEvent(T *ev)
 #ifndef QT_NO_DRAGANDDROP
     DragData dragData(ev->mimeData(), QPointF(ev->pos()).toPoint(),
             QCursor::pos(), dropActionToDragOp(ev->possibleActions()));
-    m_lastDropAction = dragOpToDropAction(page->dragController()->dragUpdated(&dragData));
+    m_lastDropAction = dragOpToDropAction(page->dragController()->dragUpdated(&dragData).operation);
     ev->setDropAction(m_lastDropAction);
     if (m_lastDropAction != Qt::IgnoreAction)
         ev->accept();
index 9b388c0..8135584 100644 (file)
@@ -1,3 +1,16 @@
+2011-11-02  Jon Lee  <jonlee@apple.com>
+
+        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.
+
+        * Api/qwebpage.cpp:
+        (QWebPagePrivate::dragEnterEvent): Minor refactoring because operation is stored in
+        new DragSession struct.
+        (QWebPagePrivate::dragMoveEvent): Ditto.
+
 2011-11-02  Tom Sepez  <tsepez@chromium.org>
 
         XSSAuditor is silent
index 03b95ab..df1e0e7 100644 (file)
@@ -1,3 +1,16 @@
+2011-11-02  Jon Lee  <jonlee@apple.com>
+
+        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.
+
+        * WebView.cpp:
+        (WebView::DragEnter): Minor refactoring because operation is stored in
+        new DragSession struct.
+        (WebView::DragOver): Ditto.
+
 2011-11-02  Tom Sepez  <tsepez@chromium.org>
 
         XSSAuditor is silent
index 7bd77f0..89f5a9d 100644 (file)
@@ -78,6 +78,7 @@
 #include <WebCore/DocumentMarkerController.h>
 #include <WebCore/DragController.h>
 #include <WebCore/DragData.h>
+#include <WebCore/DragSession.h>
 #include <WebCore/Editor.h>
 #include <WebCore/EventHandler.h>
 #include <WebCore/EventNames.h>
@@ -5084,7 +5085,7 @@ HRESULT STDMETHODCALLTYPE WebView::DragEnter(
     ::ScreenToClient(m_viewWindow, (LPPOINT)&localpt);
     DragData data(pDataObject, IntPoint(localpt.x, localpt.y), 
         IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
-    *pdwEffect = dragOperationToDragCursor(m_page->dragController()->dragEntered(&data));
+    *pdwEffect = dragOperationToDragCursor(m_page->dragController()->dragEntered(&data).operation);
 
     m_lastDropEffect = *pdwEffect;
     m_dragData = pDataObject;
@@ -5103,7 +5104,7 @@ HRESULT STDMETHODCALLTYPE WebView::DragOver(
         ::ScreenToClient(m_viewWindow, (LPPOINT)&localpt);
         DragData data(m_dragData.get(), IntPoint(localpt.x, localpt.y), 
             IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
-        *pdwEffect = dragOperationToDragCursor(m_page->dragController()->dragUpdated(&data));
+        *pdwEffect = dragOperationToDragCursor(m_page->dragController()->dragUpdated(&data).operation);
     } else
         *pdwEffect = DROPEFFECT_NONE;
 
index bae885c..561c792 100644 (file)
@@ -1,3 +1,35 @@
+2011-11-02  Jon Lee  <jonlee@apple.com>
+
+        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.
+
+        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):
+
 2011-11-02  Anders Carlsson  <andersca@apple.com>
 
         Get rid of Plugin::deprecatedGeometryDidChange
index 6cc5316..9e9d6c3 100644 (file)
@@ -170,6 +170,7 @@ def struct_or_class(namespace, type):
         'WebCore::Animation',
         'WebCore::EditorCommandsForKeyEvent',
         'WebCore::CompositionUnderline',
+        'WebCore::DragSession',
         'WebCore::FloatPoint3D',
         'WebCore::FileChooserSettings',
         'WebCore::GrammarDetail',
index f431410..67000e0 100644 (file)
@@ -31,6 +31,7 @@
 #include <WebCore/Credential.h>
 #include <WebCore/Cursor.h>
 #include <WebCore/DatabaseDetails.h>
+#include <WebCore/DragSession.h>
 #include <WebCore/Editor.h>
 #include <WebCore/FileChooser.h>
 #include <WebCore/GraphicsContext.h>
@@ -604,6 +605,24 @@ bool ArgumentCoder<TextCheckingResult>::decode(ArgumentDecoder* decoder, TextChe
     return true;
 }
 
+void ArgumentCoder<DragSession>::encode(ArgumentEncoder* encoder, const DragSession& result)
+{
+    encoder->encodeEnum(result.operation);
+    encoder->encode(result.mouseIsOverFileInput);
+    encoder->encode(result.numberOfItemsToBeAccepted);
+}
+
+bool ArgumentCoder<DragSession>::decode(ArgumentDecoder* decoder, DragSession& result)
+{
+    if (!decoder->decodeEnum(result.operation))
+        return false;
+    if (!decoder->decode(result.mouseIsOverFileInput))
+        return false;
+    if (!decoder->decode(result.numberOfItemsToBeAccepted))
+        return false;
+    return true;
+}
+
 #if PLATFORM(QT)
 
 void ArgumentCoder<FloatPoint3D>::encode(ArgumentEncoder* encoder, const FloatPoint3D& floatPoint3D)
index ace5d9d..e76f3af 100644 (file)
@@ -47,6 +47,7 @@ namespace WebCore {
     class ResourceRequest;
     class ResourceResponse;
     struct CompositionUnderline;
+    struct DragSession;
     struct FileChooserSettings;
     struct GrammarDetail;
     struct MimeClassInfo;
@@ -213,6 +214,11 @@ template<> struct ArgumentCoder<WebCore::TextCheckingResult> {
     static void encode(ArgumentEncoder*, const WebCore::TextCheckingResult&);
     static bool decode(ArgumentDecoder*, WebCore::TextCheckingResult&);
 };
+    
+template<> struct ArgumentCoder<WebCore::DragSession> {
+    static void encode(ArgumentEncoder*, const WebCore::DragSession&);
+    static bool decode(ArgumentDecoder*, WebCore::DragSession&);
+};
 
 #if PLATFORM(QT)
 template<> struct ArgumentCoder<WebCore::FloatPoint3D> {
index deb1d06..bccf689 100644 (file)
@@ -61,6 +61,7 @@
 #import <WebCore/ColorMac.h>
 #import <WebCore/DragController.h>
 #import <WebCore/DragData.h>
+#import <WebCore/DragSession.h>
 #import <WebCore/FloatRect.h>
 #import <WebCore/IntRect.h>
 #import <WebCore/KeyboardEvent.h>
@@ -1586,7 +1587,9 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
     IntPoint global(globalPoint([draggingInfo draggingLocation], [self window]));
     DragData dragData(draggingInfo, client, global, static_cast<DragOperation>([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]);
     _data->_page->dragUpdated(&dragData, [[draggingInfo draggingPasteboard] name]);
-    return _data->_page->dragOperation();
+    
+    WebCore::DragSession dragSession = _data->_page->dragSession();
+    return dragSession.operation;
 }
 
 - (void)draggingExited:(id <NSDraggingInfo>)draggingInfo
index d31b19e..ee43b28 100644 (file)
@@ -71,7 +71,9 @@
 #include "WebProtectionSpace.h"
 #include "WebSecurityOrigin.h"
 #include "WebURLRequest.h"
+#include <WebCore/DragController.h>
 #include <WebCore/DragData.h>
+#include <WebCore/DragSession.h>
 #include <WebCore/FloatRect.h>
 #include <WebCore/FocusDirection.h>
 #include <WebCore/MIMETypeRegistry.h>
@@ -181,7 +183,6 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p
     , m_hasSpellDocumentTag(false)
     , m_pendingLearnOrIgnoreWordMessageCount(0)
     , m_mainFrameHasCustomRepresentation(false)
-    , m_currentDragOperation(DragOperationNone)
     , m_mainFrameHasHorizontalScrollbar(false)
     , m_mainFrameHasVerticalScrollbar(false)
     , m_mainFrameIsPinnedToLeftSide(false)
@@ -850,9 +851,9 @@ void WebPageProxy::performDragControllerAction(DragControllerAction action, Drag
 #endif
 }
 
-void WebPageProxy::didPerformDragControllerAction(uint64_t resultOperation)
+void WebPageProxy::didPerformDragControllerAction(WebCore::DragSession dragSession)
 {
-    m_currentDragOperation = static_cast<DragOperation>(resultOperation);
+    m_currentDragSession = dragSession;
 }
 
 #if PLATFORM(QT) || PLATFORM(GTK)
index 2bd6869..b95aa5f 100644 (file)
@@ -54,6 +54,7 @@
 #include "WebResourceLoadClient.h"
 #include "WebUIClient.h"
 #include <WebCore/DragActions.h>
+#include <WebCore/DragSession.h>
 #include <WebCore/HitTestResult.h>
 #include <WebCore/PlatformScreen.h>
 #include <WebCore/ScrollTypes.h>
@@ -467,7 +468,7 @@ public:
     void dragExited(WebCore::DragData*, const String& dragStorageName = String());
     void performDrag(WebCore::DragData*, const String& dragStorageName, const SandboxExtension::Handle&);
 
-    void didPerformDragControllerAction(uint64_t resultOperation);
+    void didPerformDragControllerAction(WebCore::DragSession);
     void dragEnded(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t operation);
 #if PLATFORM(MAC)
     void setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, bool isLinkDrag);
@@ -505,8 +506,8 @@ public:
 
     bool isValid();
     
-    WebCore::DragOperation dragOperation() { return m_currentDragOperation; }
-    void resetDragOperation() { m_currentDragOperation = WebCore::DragOperationNone; }
+    WebCore::DragSession dragSession() const { return m_currentDragSession; }
+    void resetDragOperation() { m_currentDragSession = WebCore::DragSession(); }
 
     void preferencesDidChange();
 
@@ -925,7 +926,7 @@ private:
     unsigned m_pendingLearnOrIgnoreWordMessageCount;
 
     bool m_mainFrameHasCustomRepresentation;
-    WebCore::DragOperation m_currentDragOperation;
+    WebCore::DragSession m_currentDragSession;
 
     String m_pendingAPIRequestURL;
 
index 53a1e5f..d196550 100644 (file)
@@ -206,7 +206,7 @@ messages -> WebPageProxy {
     IgnoreWord(WTF::String word);
 
     # Drag and drop messages
-    DidPerformDragControllerAction(uint64_t resultOperation)
+    DidPerformDragControllerAction(WebCore::DragSession dragSession)
 #if PLATFORM(MAC)
     SetDragImage(WebCore::IntPoint clientPosition, WebKit::ShareableBitmap::Handle dragImage, bool linkDrag)
 #endif
index a07ae76..a8d15b3 100644 (file)
@@ -46,6 +46,7 @@
 #include <Commctrl.h>
 #include <WebCore/BitmapInfo.h>
 #include <WebCore/Cursor.h>
+#include <WebCore/DragSession.h>
 #include <WebCore/Editor.h>
 #include <WebCore/FloatRect.h>
 #if USE(CG)
@@ -1641,7 +1642,7 @@ WebCore::DragOperation WebView::keyStateToDragOperation(DWORD grfKeyState) const
     // IDropTarget::DragOver. Note, grfKeyState is the current 
     // state of the keyboard modifier keys on the keyboard. See:
     // <http://msdn.microsoft.com/en-us/library/ms680129(VS.85).aspx>.
-    DragOperation operation = m_page->dragOperation();
+    DragOperation operation = m_page->dragSession().operation;
 
     if ((grfKeyState & (MK_CONTROL | MK_SHIFT)) == (MK_CONTROL | MK_SHIFT))
         operation = DragOperationLink;
@@ -1665,7 +1666,7 @@ HRESULT STDMETHODCALLTYPE WebView::DragEnter(IDataObject* pDataObject, DWORD grf
     ::ScreenToClient(m_window, (LPPOINT)&localpt);
     DragData data(pDataObject, IntPoint(localpt.x, localpt.y), IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
     m_page->dragEntered(&data);
-    *pdwEffect = dragOperationToDragCursor(m_page->dragOperation());
+    *pdwEffect = dragOperationToDragCursor(m_page->dragSession().operation);
 
     m_lastDropEffect = *pdwEffect;
     m_dragData = pDataObject;
@@ -1683,7 +1684,7 @@ HRESULT STDMETHODCALLTYPE WebView::DragOver(DWORD grfKeyState, POINTL pt, DWORD*
         ::ScreenToClient(m_window, (LPPOINT)&localpt);
         DragData data(m_dragData.get(), IntPoint(localpt.x, localpt.y), IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
         m_page->dragUpdated(&data);
-        *pdwEffect = dragOperationToDragCursor(m_page->dragOperation());
+        *pdwEffect = dragOperationToDragCursor(m_page->dragSession().operation);
     } else
         *pdwEffect = DROPEFFECT_NONE;
 
index 5395ea3..b9f7c66 100644 (file)
@@ -79,6 +79,7 @@
 #include <WebCore/DocumentMarkerController.h>
 #include <WebCore/DragController.h>
 #include <WebCore/DragData.h>
+#include <WebCore/DragSession.h>
 #include <WebCore/EventHandler.h>
 #include <WebCore/FocusController.h>
 #include <WebCore/FormState.h>
@@ -1815,7 +1816,7 @@ bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* evt)
 void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WebCore::DragDataMap& dataMap, uint32_t flags)
 {
     if (!m_page) {
-        send(Messages::WebPageProxy::DidPerformDragControllerAction(DragOperationNone));
+        send(Messages::WebPageProxy::DidPerformDragControllerAction(DragSession());
         return;
     }
 
@@ -1846,7 +1847,7 @@ void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint cli
 void WebPage::performDragControllerAction(uint64_t action, WebCore::DragData dragData)
 {
     if (!m_page) {
-        send(Messages::WebPageProxy::DidPerformDragControllerAction(DragOperationNone));
+        send(Messages::WebPageProxy::DidPerformDragControllerAction(DragSession()));
 #if PLATFORM(QT)
         QMimeData* data = const_cast<QMimeData*>(dragData.platformData());
 #elif PLATFORM(GTK)
@@ -1890,7 +1891,7 @@ void WebPage::performDragControllerAction(uint64_t action, WebCore::DragData dra
 void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const String& dragStorageName, uint32_t flags, const SandboxExtension::Handle& sandboxExtensionHandle)
 {
     if (!m_page) {
-        send(Messages::WebPageProxy::DidPerformDragControllerAction(DragOperationNone));
+        send(Messages::WebPageProxy::DidPerformDragControllerAction(DragSession()));
         return;
     }