[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

dbates at webkit.org dbates at webkit.org
Thu Oct 29 20:41:22 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit d14240a19b01cd55c66f3df4f09fde1e67efc376
Author: dbates at webkit.org <dbates at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 7 22:26:48 2009 +0000

    2009-10-07  Daniel Bates  <dbates at 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 at 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

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 65be8c9..af86939 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2009-10-07  Daniel Bates  <dbates at 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 at apple.com>
 
         Fix the build.
diff --git a/WebCore/manual-tests/drag-cursor-notallowed.html b/WebCore/manual-tests/drag-cursor-notallowed.html
new file mode 100644
index 0000000..e6cb6d4
--- /dev/null
+++ b/WebCore/manual-tests/drag-cursor-notallowed.html
@@ -0,0 +1,111 @@
+<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>
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index f338037..3b0a501 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,29 @@
+2009-10-07  Daniel Bates  <dbates at 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 at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebKit/win/WebCoreSupport/WebDragClient.cpp b/WebKit/win/WebCoreSupport/WebDragClient.cpp
index e5c5a20..840fca1 100644
--- a/WebKit/win/WebCoreSupport/WebDragClient.cpp
+++ b/WebKit/win/WebCoreSupport/WebDragClient.cpp
@@ -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))) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list