Commit d18aac0a authored by jonlee@apple.com's avatar 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.

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
parent 2f59eccf
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.
......@@ -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;
......
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
......
......@@ -778,6 +778,7 @@
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 */; };
......@@ -7855,6 +7856,7 @@
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>"; };
......@@ -15437,6 +15439,7 @@
A7CA595C0B27BD9E00FA021D /* DragController.cpp */,
A7CA595B0B27BD9E00FA021D /* DragController.h */,
81F65FF513788FAA00FF6F2D /* DragState.h */,
3169379A14609C5B00C01362 /* DragSession.h */,
1AF326770D78B9440068F0C4 /* EditorClient.h */,
93C09A800B064F00005ABD4D /* EventHandler.cpp */,
93C09A520B064DB3005ABD4D /* EventHandler.h */,
......@@ -24541,6 +24544,7 @@
9B3A8872145632F9003AE8F5 /* DOMDOMSettableTokenList.h in Headers */,
FD62F52E145898D80094B0ED /* AudioSourceProviderClient.h in Headers */,
2D8FEBDD143E3EF70072502B /* CSSCrossfadeValue.h in Headers */,
3169379C14609C6C00C01362 /* DragSession.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -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.
......
......@@ -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();
......
/*
* 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
......@@ -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
......
......@@ -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();
......
......@@ -41,6 +41,11 @@ bool DragData::containsFiles() const
return false;
}
unsigned DragData::numberOfFiles() const
{
return 0;
}
void DragData::asFilenames(Vector<String>& result) const
{
}
......
......@@ -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();
......
......@@ -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];
......
......@@ -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)
......
......@@ -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) {
......
......@@ -47,6 +47,11 @@ bool DragData::containsFiles() const
return false;
}
unsigned DragData::numberOfFiles() const
{
return 0;
}
void DragData::asFilenames(Vector<String>&) const
{
}
......
......@@ -47,6 +47,11 @@ bool DragData::containsFiles() const
return false;
}
unsigned DragData::numberOfFiles() const
{
return 0;
}
void DragData::asFilenames(Vector<String>& result) const
{
}
......
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
......
......@@ -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()))
......
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
......
......@@ -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);
}
......
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
......
......@@ -117,6 +117,7 @@
#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
......
......@@ -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();
......
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
......
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
......
......@@ -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;
......
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):