[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

oliver at apple.com oliver at apple.com
Thu Apr 8 02:22:09 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 6183bf9367493e4fe16e1b524945bc990b812257
Author: oliver at apple.com <oliver at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Mar 15 00:01:57 2010 +0000

    2010-03-14  Oliver Hunt  <oliver at apple.com>
    
            Reviewed by Darin Adler.
    
            REGRESSION(r53287): drop event is not fired if dataTransfer.dropEffect is not explicitly set
            https://bugs.webkit.org/show_bug.cgi?id=36095
    
            Correct this test to cover the somewhat bizarre "correct" handling
            of undefined dropEffect
    
            * fast/events/drag-and-drop-expected.txt:
            * fast/events/drag-and-drop.html:
    2010-03-14  Oliver Hunt  <oliver at apple.com>
    
            Reviewed by Darin Adler.
    
            REGRESSION(r53287): drop event is not fired if dataTransfer.dropEffect is not explicitly set
            https://bugs.webkit.org/show_bug.cgi?id=36095
    
            The issue here is that while dropEffect is meant to be initialized
            to "none", the behaviour of the drag is differs between dragEffect
            not being set and dragEffect being explicitly set to "none"
    
            This patch corrects this behaviour by making Clipboard distinguish
            between the initial "none" value of dropEffect and an explicit "none".
            This alone is insufficient for correct behaviour, we also need to
            resurrect the removed defaultOperationForDrag function, but we now
            use the function only when dragEffect is uninitialized.  There are a
            few tweaks to the behaviour of the defaultOperationForDrag as well
            to ensure exactly the same set of outcomes for all cases that we
            may hit it.
    
            * dom/Clipboard.cpp:
            (WebCore::Clipboard::Clipboard):
            (WebCore::dragOpFromIEOp):
            (WebCore::Clipboard::destinationOperation):
            * dom/Clipboard.h:
            (WebCore::Clipboard::dropEffect):
            (WebCore::Clipboard::dropEffectIsUninitialized):
            * page/DragController.cpp:
            (WebCore::defaultOperationForDrag):
            (WebCore::DragController::tryDHTMLDrag):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55977 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 110c39c..ec10691 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-03-14  Oliver Hunt  <oliver at apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION(r53287): drop event is not fired if dataTransfer.dropEffect is not explicitly set
+        https://bugs.webkit.org/show_bug.cgi?id=36095
+
+        Correct this test to cover the somewhat bizarre "correct" handling
+        of undefined dropEffect
+
+        * fast/events/drag-and-drop-expected.txt:
+        * fast/events/drag-and-drop.html:
+
 2010-03-12  Shu Chang  <chang.shu at nokia.com>
 
         Reviewed by David Levin.
diff --git a/LayoutTests/fast/events/drag-and-drop-expected.txt b/LayoutTests/fast/events/drag-and-drop-expected.txt
index 7c2de07..f152f67 100644
--- a/LayoutTests/fast/events/drag-and-drop-expected.txt
+++ b/LayoutTests/fast/events/drag-and-drop-expected.txt
@@ -11,7 +11,7 @@ PASS event.dataTransfer.dropEffect is "none"
 PASS event.dataTransfer.dropEffect is "copy"
 PASS event.dataTransfer.dropEffect is "move"
 PASS event.dataTransfer.dropEffect is "link"
-PASS event.dataTransfer.dropEffect is "none"
+PASS event.dataTransfer.dropEffect is "copy"
 
 When effectAllowed == "undefined"
 
@@ -24,7 +24,7 @@ PASS event.dataTransfer.dropEffect is "move"
 PASS event.dataTransfer.effectAllowed is "uninitialized"
 PASS event.dataTransfer.dropEffect is "link"
 PASS event.dataTransfer.effectAllowed is "uninitialized"
-PASS event.dataTransfer.dropEffect is "none"
+PASS event.dataTransfer.dropEffect is "copy"
 
 When effectAllowed == "none"
 
@@ -40,7 +40,7 @@ PASS event.dataTransfer.dropEffect is "none"
 PASS event.dataTransfer.dropEffect is "copy"
 PASS event.dataTransfer.dropEffect is "move"
 PASS event.dataTransfer.dropEffect is "link"
-PASS event.dataTransfer.dropEffect is "none"
+PASS event.dataTransfer.dropEffect is "copy"
 
 When effectAllowed == "copy"
 
@@ -48,7 +48,7 @@ PASS event.dataTransfer.dropEffect is "none"
 PASS event.dataTransfer.dropEffect is "copy"
 PASS event.dataTransfer.dropEffect is "none"
 PASS event.dataTransfer.dropEffect is "none"
-PASS event.dataTransfer.dropEffect is "none"
+PASS event.dataTransfer.dropEffect is "copy"
 
 When effectAllowed == "move"
 
@@ -56,7 +56,7 @@ PASS event.dataTransfer.dropEffect is "none"
 PASS event.dataTransfer.dropEffect is "none"
 PASS event.dataTransfer.dropEffect is "move"
 PASS event.dataTransfer.dropEffect is "none"
-PASS event.dataTransfer.dropEffect is "none"
+PASS event.dataTransfer.dropEffect is "move"
 
 When effectAllowed == "link"
 
@@ -64,7 +64,7 @@ PASS event.dataTransfer.dropEffect is "none"
 PASS event.dataTransfer.dropEffect is "none"
 PASS event.dataTransfer.dropEffect is "none"
 PASS event.dataTransfer.dropEffect is "link"
-PASS event.dataTransfer.dropEffect is "none"
+PASS event.dataTransfer.dropEffect is "link"
 
 When effectAllowed == "copyMove"
 
@@ -72,7 +72,7 @@ PASS event.dataTransfer.dropEffect is "none"
 PASS event.dataTransfer.dropEffect is "copy"
 PASS event.dataTransfer.dropEffect is "move"
 PASS event.dataTransfer.dropEffect is "none"
-PASS event.dataTransfer.dropEffect is "none"
+PASS event.dataTransfer.dropEffect is "move"
 
 When effectAllowed == "copyLink"
 
@@ -80,7 +80,7 @@ PASS event.dataTransfer.dropEffect is "none"
 PASS event.dataTransfer.dropEffect is "copy"
 PASS event.dataTransfer.dropEffect is "none"
 PASS event.dataTransfer.dropEffect is "link"
-PASS event.dataTransfer.dropEffect is "none"
+PASS event.dataTransfer.dropEffect is "copy"
 
 When effectAllowed == "linkMove"
 
@@ -88,7 +88,7 @@ PASS event.dataTransfer.dropEffect is "none"
 PASS event.dataTransfer.dropEffect is "none"
 PASS event.dataTransfer.dropEffect is "move"
 PASS event.dataTransfer.dropEffect is "link"
-PASS event.dataTransfer.dropEffect is "none"
+PASS event.dataTransfer.dropEffect is "move"
 
 When effectAllowed == "dummy"
 
@@ -101,7 +101,7 @@ PASS event.dataTransfer.dropEffect is "move"
 PASS event.dataTransfer.effectAllowed is "uninitialized"
 PASS event.dataTransfer.dropEffect is "link"
 PASS event.dataTransfer.effectAllowed is "uninitialized"
-PASS event.dataTransfer.dropEffect is "none"
+PASS event.dataTransfer.dropEffect is "copy"
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/events/drag-and-drop.html b/LayoutTests/fast/events/drag-and-drop.html
index 92cbcd3..d8f9fe6 100644
--- a/LayoutTests/fast/events/drag-and-drop.html
+++ b/LayoutTests/fast/events/drag-and-drop.html
@@ -108,9 +108,26 @@
             // doesn't need special cases for undefined.
             chosenEffectAllowed = "uninitialized";
         }
-        
+        expected = dropEffectElem.options[dropEffectElem.selectedIndex].value;
+        if (chosenDropEffect == "dummy") {
+            switch (chosenEffectAllowed) {
+                case "undefined":
+                case "copyLink":
+                case "uninitialized":
+                case "all":
+                    expected = "copy";
+                    break;
+                case "copyMove":
+                case "move":
+                case "linkMove":
+                    expected = "move";
+                    break;
+                default:
+                    expected = chosenEffectAllowed;
+            }
+        }
         if (isDropEffectAllowed(chosenDropEffect, chosenEffectAllowed))
-            shouldBeEqualToString('event.dataTransfer.dropEffect', dropEffectElem.options[dropEffectElem.selectedIndex].value);
+            shouldBeEqualToString('event.dataTransfer.dropEffect', expected);
         else
             shouldBeEqualToString('event.dataTransfer.dropEffect', 'none');
             
@@ -126,6 +143,8 @@
             return true;
         if (chosenDropEffect == "link" && ["link", "copyLink", "linkMove", "uninitialized", "all"].indexOf(allowedDropEffect) != -1)
             return true;
+        if (chosenDropEffect == "dummy" && ["copy", "link", "move", "copyLink", "copyMove", "linkMove", "uninitialized", "all"].indexOf(allowedDropEffect) != -1)
+            return true; 
         return false;
     }
 
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 63e93b6..a98099e 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,34 @@
+2010-03-14  Oliver Hunt  <oliver at apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION(r53287): drop event is not fired if dataTransfer.dropEffect is not explicitly set
+        https://bugs.webkit.org/show_bug.cgi?id=36095
+
+        The issue here is that while dropEffect is meant to be initialized
+        to "none", the behaviour of the drag is differs between dragEffect
+        not being set and dragEffect being explicitly set to "none"
+
+        This patch corrects this behaviour by making Clipboard distinguish
+        between the initial "none" value of dropEffect and an explicit "none".
+        This alone is insufficient for correct behaviour, we also need to
+        resurrect the removed defaultOperationForDrag function, but we now
+        use the function only when dragEffect is uninitialized.  There are a
+        few tweaks to the behaviour of the defaultOperationForDrag as well
+        to ensure exactly the same set of outcomes for all cases that we
+        may hit it.
+
+        * dom/Clipboard.cpp:
+        (WebCore::Clipboard::Clipboard):
+        (WebCore::dragOpFromIEOp):
+        (WebCore::Clipboard::destinationOperation):
+        * dom/Clipboard.h:
+        (WebCore::Clipboard::dropEffect):
+        (WebCore::Clipboard::dropEffectIsUninitialized):
+        * page/DragController.cpp:
+        (WebCore::defaultOperationForDrag):
+        (WebCore::DragController::tryDHTMLDrag):
+
 2010-03-14  Antti Koivisto  <koivisto at iki.fi>
 
         Reviewed by Simon Hausmann.
diff --git a/WebCore/dom/Clipboard.cpp b/WebCore/dom/Clipboard.cpp
index 7f33aac..4473b74 100644
--- a/WebCore/dom/Clipboard.cpp
+++ b/WebCore/dom/Clipboard.cpp
@@ -36,7 +36,7 @@ namespace WebCore {
 
 Clipboard::Clipboard(ClipboardAccessPolicy policy, bool isForDragging) 
     : m_policy(policy)
-    , m_dropEffect("none")
+    , m_dropEffect("uninitialized")
     , m_effectAllowed("uninitialized")
     , m_dragStarted(false)
     , m_forDragging(isForDragging)
@@ -110,7 +110,7 @@ DragOperation Clipboard::sourceOperation() const
 DragOperation Clipboard::destinationOperation() const
 {
     DragOperation op = dragOpFromIEOp(m_dropEffect);
-    ASSERT(op == DragOperationCopy || op == DragOperationNone || op == DragOperationLink || op == DragOperationGeneric || op == DragOperationMove);
+    ASSERT(op == DragOperationCopy || op == DragOperationNone || op == DragOperationLink || op == DragOperationGeneric || op == DragOperationMove || op == DragOperationEvery);
     return op;
 }
 
diff --git a/WebCore/dom/Clipboard.h b/WebCore/dom/Clipboard.h
index 2f4dc6f..4018e4f 100644
--- a/WebCore/dom/Clipboard.h
+++ b/WebCore/dom/Clipboard.h
@@ -43,8 +43,9 @@ namespace WebCore {
         // Is this operation a drag-drop or a copy-paste?
         bool isForDragging() const { return m_forDragging; }
 
-        String dropEffect() const { return m_dropEffect; }
+        String dropEffect() const { return dropEffectIsUninitialized() ? "none" : m_dropEffect; }
         void setDropEffect(const String&);
+        bool dropEffectIsUninitialized() const { return m_dropEffect == "uninitialized"; }
         String effectAllowed() const { return m_effectAllowed; }
         void setEffectAllowed(const String&);
     
diff --git a/WebCore/page/DragController.cpp b/WebCore/page/DragController.cpp
index c19e349..76e454f 100644
--- a/WebCore/page/DragController.cpp
+++ b/WebCore/page/DragController.cpp
@@ -485,6 +485,25 @@ bool DragController::canProcessDrag(DragData* dragData)
     return true;
 }
 
+static DragOperation defaultOperationForDrag(DragOperation srcOpMask)
+{
+    // This is designed to match IE's operation fallback for the case where
+    // the page calls preventDefault() in a drag event but doesn't set dropEffect.
+    if (srcOpMask == DragOperationEvery)
+        return DragOperationCopy;
+    if (srcOpMask == DragOperationNone)
+        return DragOperationNone;
+    if (srcOpMask & DragOperationMove || srcOpMask & DragOperationGeneric)
+        return DragOperationMove;
+    if (srcOpMask & DragOperationCopy)
+        return DragOperationCopy;
+    if (srcOpMask & DragOperationLink)
+        return DragOperationLink;
+    
+    // FIXME: Does IE really return "generic" even if no operations were allowed by the source?
+    return DragOperationGeneric;
+}
+
 bool DragController::tryDHTMLDrag(DragData* dragData, DragOperation& operation)
 {
     ASSERT(dragData);
@@ -506,7 +525,9 @@ bool DragController::tryDHTMLDrag(DragData* dragData, DragOperation& operation)
     }
 
     operation = clipboard->destinationOperation();
-    if (!(srcOpMask & operation)) {
+    if (clipboard->dropEffectIsUninitialized())
+        operation = defaultOperationForDrag(srcOpMask);
+    else if (!(srcOpMask & operation)) {
         // The element picked an operation which is not supported by the source
         operation = DragOperationNone;
     }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list