Commit d14240a1 authored by dbates@webkit.org's avatar dbates@webkit.org
Browse files

2009-10-07 Daniel Bates <dbates@webkit.org>

        Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=30102
        And
        <rdar://problem/5015957>
        
        Fixes an issue (in the Windows build) where the cursor does not change to the
        not-allowed cursor when the drag-and-drop operation is not allowed.
        
        The allowed effects in WebDragClient::startDrag are hard-coded to be 
        DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE. Instead, the list of 
        allowed drop effects should be determined by the allowed operations of the
        drag source.
        
        We cannot test this using DRT because DRT looks at the programmatic drop 
        cursor and until bug #24731 is fixed this value is hard-coded to DragOperationCopy.
        That is, there is a discrepancy in the Windows build between the Windows API-based 
        drop effect and the WebKit drop effect. Because DRT cannot read the screen buffer 
        to determine the cursor, a manual test is needed.

        * WebCoreSupport/WebDragClient.cpp:
        (draggingSourceOperationMaskToDragCursors): Added method.
        (WebDragClient::startDrag):
2009-10-07  Daniel Bates  <dbates@webkit.org>

        Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=30102
        And
        <rdar://problem/5015957>
        
        Manual test to confirm that the not-allowed cursor is shown for an
        invalid drag-and-drop operation.
        
        We cannot test this using DRT because of a discrepancy between the Windows
        API-based drop effect and the WebKit drop effect. See bug #24731 for more
        details.

        * manual-tests/drag-cursor-notallowed.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49268 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ef9ffa97
2009-10-07 Daniel Bates <dbates@webkit.org>
Reviewed by Darin Adler.
https://bugs.webkit.org/show_bug.cgi?id=30102
And
<rdar://problem/5015957>
Manual test to confirm that the not-allowed cursor is shown for an
invalid drag-and-drop operation.
We cannot test this using DRT because of a discrepancy between the Windows
API-based drop effect and the WebKit drop effect. See bug #24731 for more
details.
* manual-tests/drag-cursor-notallowed.html: Added.
2009-10-07 Mark Rowe <mrowe@apple.com>
 
Fix the build.
<html>
<head>
<style>
#dropTarget, #dragMe { text-align: center; display: table-cell; vertical-align: middle }
#dropTarget {width: 256px; height: 256px; border: 1px dashed}
#dragMe {-webkit-user-drag: element; -webkit-user-select: none; background: #ff0000; width: 64px; height: 64px; color: white}
.pass { font-weight: bold; color: green; }
.fail { font-weight: bold; color: red; }
</style>
<script>
var dragMe;
var dropTarget;
var messageElm;
var defaultMessageElm;
var event;
var ALLOWED_EFFECTS = 'move';
var DROP_EFFECT = 'copy';
window.onload = function()
{
dragMe = document.getElementById("dragMe");
dropTarget = document.getElementById("dropTarget");
messageElm = document.getElementById("message");
defaultMessageElm = document.getElementById("default-message");
if (!dragMe || !dropTarget || !messageElm || !defaultMessageElm)
return;
dragMe.ondragstart = dragStart;
dragMe.ondragend = dragEnd;
dropTarget.ondragenter = dragEntered;
dropTarget.ondragover = dragOver;
dropTarget.ondrop = drop;
}
function dragStart(e)
{
event = e;
e.dataTransfer.effectAllowed = ALLOWED_EFFECTS;
e.dataTransfer.setData('Text', e.target.textContent);
}
function dragEnd(e)
{
messageElm.style.visibility = "hidden";
defaultMessageElm.style.visibility = "visible";
return;
}
function dragEntered(e)
{
messageElm.style.visibility = "visible";
defaultMessageElm.style.visibility = "hidden";
dragEnteredAndUpdated(e);
}
function dragOver(e)
{
dragEnteredAndUpdated(e);
}
function dragEnteredAndUpdated(e)
{
event = e;
e.dataTransfer.dropEffect = DROP_EFFECT;
cancelDrag(e);
}
function drop(e)
{
cancelDrag(e);
}
function cancelDrag(e)
{
if (e.preventDefault)
e.preventDefault();
else {
// Assume this script is executing within Internet Explorer
e.returnValue = false;
}
}
</script>
</head>
<body>
<p id="description">This test can be used to verify that the not-allowed cursor is shown during an invalid drag-and-drop operation.
In particular, if the effectAllowed is <code><script>document.write(ALLOWED_EFFECTS)</script></code> and the dropEffect of the
drop target is <code><script>document.write(DROP_EFFECT)</script></code> then the drop is not allowed and the cursor should
change to the not-allowed cursor. Note, this test only pertains to the Windows build since the Mac build does not show a drop cursor
for a not-allowed drop operation (see bug #25925).
<br/><br/>
Drag the red square over the drop target (demarcated by the dashed boundary). While hovering over the drop target, if the cursor
is <img alt="not-allowed" src="data:image/gif;base64,R0lGODlhEgASAIAAAAAAAP///yH5BAAAAAAALAAAAAASABIAAAIvjA+px6ifmnmM1ijDmlbuuHmAhoWXaTqYKq7sObZw3HwgXd8cPr8yDGxBXEJioAAAOw=="> then the test <span class="pass">PASSED</span>. Otherwise, the test <span class="fail">FAILED</span>.</p>
<div id="test-container">
<label for="effectAllowed">effectAllowed:</label> <code><script>document.write(ALLOWED_EFFECTS)</script></code>
<br/><br/>
<div id="dropTarget">
<div id="default-message">Drag the red square over me.<br/><br/>
<label for="dropEffect">Expects dropEffect:</label> <code><script>document.write(DROP_EFFECT)</script></code>
</div>
<div id="message" style="visibility:hidden">The cursor should be <img alt="not-allowed" src="data:image/gif;base64,R0lGODlhEgASAIAAAAAAAP///yH5BAAAAAAALAAAAAASABIAAAIvjA+px6ifmnmM1ijDmlbuuHmAhoWXaTqYKq7sObZw3HwgXd8cPr8yDGxBXEJioAAAOw==">. Is it?</div>
</div>
<hr/>
<p>Items that can be dragged to the drop target:</p>
<div id="dragMe" draggable="true">Square</div>
<hr/>
</div>
</body>
</html>
2009-10-07 Daniel Bates <dbates@webkit.org>
Reviewed by Darin Adler.
https://bugs.webkit.org/show_bug.cgi?id=30102
And
<rdar://problem/5015957>
Fixes an issue (in the Windows build) where the cursor does not change to the
not-allowed cursor when the drag-and-drop operation is not allowed.
The allowed effects in WebDragClient::startDrag are hard-coded to be
DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE. Instead, the list of
allowed drop effects should be determined by the allowed operations of the
drag source.
We cannot test this using DRT because DRT looks at the programmatic drop
cursor and until bug #24731 is fixed this value is hard-coded to DragOperationCopy.
That is, there is a discrepancy in the Windows build between the Windows API-based
drop effect and the WebKit drop effect. Because DRT cannot read the screen buffer
to determine the cursor, a manual test is needed.
* WebCoreSupport/WebDragClient.cpp:
(draggingSourceOperationMaskToDragCursors): Added method.
(WebDragClient::startDrag):
2009-10-07 Steve Falkenburg <sfalken@apple.com>
Reviewed by Darin Adler.
......
......@@ -33,6 +33,7 @@
#pragma warning(push, 0)
#include <WebCore/ClipboardWin.h>
#include <WebCore/DragController.h>
#include <WebCore/DragData.h>
#include <WebCore/Font.h>
#include <WebCore/FontDescription.h>
......@@ -68,6 +69,22 @@ namespace WebCore {
using namespace WebCore;
static DWORD draggingSourceOperationMaskToDragCursors(DragOperation op)
{
DWORD result = DROPEFFECT_NONE;
if (op == DragOperationEvery)
return DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE;
if (op & DragOperationCopy)
result |= DROPEFFECT_COPY;
if (op & DragOperationLink)
result |= DROPEFFECT_LINK;
if (op & DragOperationMove)
result |= DROPEFFECT_MOVE;
if (op & DragOperationGeneric)
result |= DROPEFFECT_MOVE;
return result;
}
WebDragClient::WebDragClient(WebView* webView)
: m_webView(webView)
{
......@@ -154,8 +171,7 @@ void WebDragClient::startDrag(DragImageRef image, const IntPoint& imageOrigin, c
}
}
//FIXME: Ensure correct drag ops are available <rdar://problem/5015957>
DWORD okEffect = DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE;
DWORD okEffect = draggingSourceOperationMaskToDragCursors(m_webView->page()->dragController()->sourceDragOperation());
DWORD effect;
COMPtr<IWebUIDelegate> ui;
if (SUCCEEDED(m_webView->uiDelegate(&ui))) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment