Title: [105826] trunk
Revision
105826
Author
dch...@chromium.org
Date
2012-01-24 15:48:23 -0800 (Tue, 24 Jan 2012)

Log Message

[chromium] event.dataTransfer.types should not return "Text" or "URL"
https://bugs.webkit.org/show_bug.cgi?id=76218

Source/WebCore:

Per the spec, "Text" and "URL" are special values handled for IE compatibility reasons in
dataTransfer.setData() and dataTransfer.getData(). These values should not be exposed
elsewhere.

Reviewed by Tony Chang.

Test: fast/events/dropzone-005.html

* platform/chromium/ChromiumDataObject.cpp:
(WebCore::ChromiumDataObject::types):
(WebCore::ChromiumDataObject::getData):
* platform/chromium/DragDataChromium.cpp:
(WebCore::DragData::containsURL):
(WebCore::DragData::asURL):
(WebCore::DragData::canSmartReplace):

LayoutTests:

Reviewed by Tony Chang.

* editing/pasteboard/dataTransfer-setData-getData-expected.txt:
* fast/events/dropzone-002.html:
* fast/events/dropzone-005-expected.txt: Added.
* fast/events/dropzone-005.html: Modified from LayoutTests/fast/events/dropzone-002.html.
* platform/efl/Skipped:
* platform/gtk/Skipped:
* platform/mac-wk2/Skipped:
* platform/qt/Skipped:
* platform/win-wk2/Skipped:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (105825 => 105826)


--- trunk/LayoutTests/ChangeLog	2012-01-24 23:46:49 UTC (rev 105825)
+++ trunk/LayoutTests/ChangeLog	2012-01-24 23:48:23 UTC (rev 105826)
@@ -1,3 +1,20 @@
+2012-01-24  Daniel Cheng  <dch...@chromium.org>
+
+        [chromium] event.dataTransfer.types should not return "Text" or "URL"
+        https://bugs.webkit.org/show_bug.cgi?id=76218
+
+        Reviewed by Tony Chang.
+
+        * editing/pasteboard/dataTransfer-setData-getData-expected.txt:
+        * fast/events/dropzone-002.html:
+        * fast/events/dropzone-005-expected.txt: Added.
+        * fast/events/dropzone-005.html: Modified from LayoutTests/fast/events/dropzone-002.html.
+        * platform/efl/Skipped:
+        * platform/gtk/Skipped:
+        * platform/mac-wk2/Skipped:
+        * platform/qt/Skipped:
+        * platform/win-wk2/Skipped:
+
 2012-01-24  Adam Barth  <aba...@webkit.org>
 
         Update table image baselines after http://trac.webkit.org/changeset/105775.

Modified: trunk/LayoutTests/editing/pasteboard/dataTransfer-setData-getData-expected.txt (105825 => 105826)


--- trunk/LayoutTests/editing/pasteboard/dataTransfer-setData-getData-expected.txt	2012-01-24 23:46:49 UTC (rev 105825)
+++ trunk/LayoutTests/editing/pasteboard/dataTransfer-setData-getData-expected.txt	2012-01-24 23:48:23 UTC (rev 105826)
@@ -31,8 +31,8 @@
 PASS getDataResultType is "string"
 PASS getDataResult is "http://test.com/"
 --- Test set 'text/uri-list', get 'URL' with only comments:
-FAIL getDataResultType should be string. Was undefined.
-FAIL getDataResult should be  (of type string). Was undefined (of type undefined).
+PASS getDataResultType is "string"
+PASS getDataResult is ""
 --- Test set/get 'text/plain':
 PASS getDataResultType is "string"
 PASS getDataResult is "Lorem ipsum dolor sit amet."

Modified: trunk/LayoutTests/fast/events/dropzone-002.html (105825 => 105826)


--- trunk/LayoutTests/fast/events/dropzone-002.html	2012-01-24 23:46:49 UTC (rev 105825)
+++ trunk/LayoutTests/fast/events/dropzone-002.html	2012-01-24 23:48:23 UTC (rev 105826)
@@ -32,7 +32,7 @@
 
 function changeDropZone()
 {
-    dropTarget.setAttribute("webkitdropzone", " StRinG:tExT/pLaIn sTrING:UrL " + dropEffectElem.options[dropEffectElem.selectedIndex].value);
+    dropTarget.setAttribute("webkitdropzone", " StRinG:tExT/pLaIn sTrING:TeXt/UrI-lIsT " + dropEffectElem.options[dropEffectElem.selectedIndex].value);
 }
 
 function printDropEvent(e)

Added: trunk/LayoutTests/fast/events/dropzone-005-expected.txt (0 => 105826)


--- trunk/LayoutTests/fast/events/dropzone-005-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/dropzone-005-expected.txt	2012-01-24 23:48:23 UTC (rev 105826)
@@ -0,0 +1,12 @@
+This test checks that dragging an image on to a drop zone doesn't match string:url.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Received dragend event
+Received dragend event
+Received dragend event
+Received dragend event
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/events/dropzone-005-expected.txt
___________________________________________________________________

Added: svn:eol-style

Copied: trunk/LayoutTests/fast/events/dropzone-005.html (from rev 105825, trunk/LayoutTests/fast/events/dropzone-002.html) (0 => 105826)


--- trunk/LayoutTests/fast/events/dropzone-005.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/dropzone-005.html	2012-01-24 23:48:23 UTC (rev 105826)
@@ -0,0 +1,103 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<head>
+<script src=""
+<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}
+</style>
+<script>
+var dragMe;
+var dropTarget;
+var dropEffectElem;
+var consoleElm;
+var event;
+
+window._onload_ = function()
+{
+    dragMe = document.getElementById("dragMe");
+    dropTarget = document.getElementById("dropTarget");
+    dropEffectElem = document.getElementById("dropEffect");
+    consoleElm = document.getElementById("console");
+    
+    if (!dragMe || !dropTarget || !dropEffectElem || !consoleElm)
+        return;
+    
+    dropEffectElem._onclick_ = changeDropZone;
+    changeDropZone();
+    dropTarget._ondrop_ = drop;
+    dragMe._ondragend_ = function()
+    {
+        debug("Received dragend event");
+    }
+    
+    runTest();
+}
+
+function changeDropZone()
+{
+    dropTarget.setAttribute("webkitdropzone", " StRinG:text/plain sTrING:url " + dropEffectElem.options[dropEffectElem.selectedIndex].value);
+}
+
+function printDropEvent(e)
+{
+    chosenDropEffect = dropEffectElem.options[dropEffectElem.selectedIndex].value;
+    debug("Received drop event when chosenDropEffect is " + chosenDropEffect);
+}
+
+function runTest()
+{
+    if (!window.eventSender)
+        return;
+        
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+        
+    var startX = dragMe.offsetLeft + 10;
+    var startY = dragMe.offsetTop + dragMe.offsetHeight / 2;
+    var endX = dropTarget.offsetLeft + 10;
+    var endY = dropTarget.offsetTop + dropTarget.offsetHeight / 2
+    
+    var numEffects = dropEffectElem.options.length;
+    
+    for (var j = 0; j < numEffects; ++j) {
+        dropEffectElem.options[j].selected = true;
+        changeDropZone();
+            
+        eventSender.mouseMoveTo(startX, startY);
+        eventSender.mouseDown();
+        eventSender.leapForward(100);
+        eventSender.mouseMoveTo(endX, endY);
+        eventSender.mouseUp();
+    }
+
+    var testContainer = document.getElementById("test-container");
+    if (testContainer)
+        document.body.removeChild(testContainer);
+    debug('<br /><span class="pass">TEST COMPLETE</span>');
+}
+</script>
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="test-container">
+<div id="dropTarget">Drop the image onto me.<br/><br/>
+<label for="" dropEffect</label> <select id="dropEffect">
+<option value="copy">Copy</option>
+<option value="move">Move</option>
+<option value="link">Link</option>
+<option value="dummy">Nonexistent (Dummy) Effect should be converted to copy</option>
+</select>
+</div>
+<hr/>
+<p>Items that can be dragged to the drop target:</p>
+<img id="dragMe" src=""
+<hr/>
+</div>
+<div id="console"></div>
+<script>
+description("This test checks that dragging an image on to a drop zone doesn't match string:url.<br/>");
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/efl/Skipped (105825 => 105826)


--- trunk/LayoutTests/platform/efl/Skipped	2012-01-24 23:46:49 UTC (rev 105825)
+++ trunk/LayoutTests/platform/efl/Skipped	2012-01-24 23:48:23 UTC (rev 105826)
@@ -140,6 +140,7 @@
 fast/events/dropzone-001.html
 fast/events/dropzone-002.html
 fast/events/dropzone-003.html
+fast/events/dropzone-005.html
 fast/events/fire-mousedown-while-pressing-mouse-button.html
 fast/events/frame-click-focus.html
 fast/events/ondragenter.html

Modified: trunk/LayoutTests/platform/gtk/Skipped (105825 => 105826)


--- trunk/LayoutTests/platform/gtk/Skipped	2012-01-24 23:46:49 UTC (rev 105825)
+++ trunk/LayoutTests/platform/gtk/Skipped	2012-01-24 23:48:23 UTC (rev 105826)
@@ -1298,6 +1298,7 @@
 
 # failing dropzone test(http://bugs.webkit.org/show_bug.cgi?id=61630)
 fast/events/dropzone-002.html
+fast/events/dropzone-005.html
 
 # [GTK] DumpRenderTree doesn't block external requests
 # https://bugs.webkit.org/show_bug.cgi?id=62585

Modified: trunk/LayoutTests/platform/mac-wk2/Skipped (105825 => 105826)


--- trunk/LayoutTests/platform/mac-wk2/Skipped	2012-01-24 23:46:49 UTC (rev 105825)
+++ trunk/LayoutTests/platform/mac-wk2/Skipped	2012-01-24 23:48:23 UTC (rev 105826)
@@ -141,6 +141,7 @@
 fast/events/dropzone-002.html
 fast/events/dropzone-003.html
 fast/events/dropzone-004.html
+fast/events/dropzone-005.html
 fast/events/keydown-numpad-keys.html
 fast/events/mouse-click-events.html
 fast/events/mouseup-from-button2.html

Modified: trunk/LayoutTests/platform/qt/Skipped (105825 => 105826)


--- trunk/LayoutTests/platform/qt/Skipped	2012-01-24 23:46:49 UTC (rev 105825)
+++ trunk/LayoutTests/platform/qt/Skipped	2012-01-24 23:48:23 UTC (rev 105826)
@@ -380,6 +380,7 @@
 fast/events/dropzone-002.html
 fast/events/dropzone-003.html
 fast/events/dropzone-004.html
+fast/events/dropzone-005.html
 fast/events/moving-text-should-fire-drop-and-dragend-events.html
 fast/events/moving-text-should-fire-drop-and-dragend-events-2.html
 

Modified: trunk/LayoutTests/platform/win-wk2/Skipped (105825 => 105826)


--- trunk/LayoutTests/platform/win-wk2/Skipped	2012-01-24 23:46:49 UTC (rev 105825)
+++ trunk/LayoutTests/platform/win-wk2/Skipped	2012-01-24 23:48:23 UTC (rev 105826)
@@ -201,6 +201,7 @@
 fast/events/dropzone-002.html
 fast/events/dropzone-003.html
 fast/events/dropzone-004.html
+fast/events/dropzone-005.html
 fast/events/event-input-contentEditable.html
 fast/events/focus-change-crash.html
 fast/events/focus-change-crash2.html

Modified: trunk/Source/WebCore/ChangeLog (105825 => 105826)


--- trunk/Source/WebCore/ChangeLog	2012-01-24 23:46:49 UTC (rev 105825)
+++ trunk/Source/WebCore/ChangeLog	2012-01-24 23:48:23 UTC (rev 105826)
@@ -1,5 +1,26 @@
 2012-01-24  Daniel Cheng  <dch...@chromium.org>
 
+        [chromium] event.dataTransfer.types should not return "Text" or "URL"
+        https://bugs.webkit.org/show_bug.cgi?id=76218
+
+        Per the spec, "Text" and "URL" are special values handled for IE compatibility reasons in
+        dataTransfer.setData() and dataTransfer.getData(). These values should not be exposed
+        elsewhere.
+
+        Reviewed by Tony Chang.
+
+        Test: fast/events/dropzone-005.html
+
+        * platform/chromium/ChromiumDataObject.cpp:
+        (WebCore::ChromiumDataObject::types):
+        (WebCore::ChromiumDataObject::getData):
+        * platform/chromium/DragDataChromium.cpp:
+        (WebCore::DragData::containsURL):
+        (WebCore::DragData::asURL):
+        (WebCore::DragData::canSmartReplace):
+
+2012-01-24  Daniel Cheng  <dch...@chromium.org>
+
         Make DataTransferItemList::length() const.
         https://bugs.webkit.org/show_bug.cgi?id=76946
 

Modified: trunk/Source/WebCore/platform/chromium/ChromiumDataObject.cpp (105825 => 105826)


--- trunk/Source/WebCore/platform/chromium/ChromiumDataObject.cpp	2012-01-24 23:46:49 UTC (rev 105825)
+++ trunk/Source/WebCore/platform/chromium/ChromiumDataObject.cpp	2012-01-24 23:48:23 UTC (rev 105826)
@@ -116,9 +116,6 @@
         results.add(mimeTypeTextPlain);
     }
 
-    if (m_url.isValid())
-        results.add(mimeTypeURL);
-
     if (!m_uriList.isEmpty())
         results.add(mimeTypeTextURIList);
 
@@ -146,7 +143,7 @@
     }
 
     if (type == mimeTypeURL) {
-        success = !m_url.isEmpty();
+        success = !m_uriList.isEmpty();
         return m_url.string();
     }
 

Modified: trunk/Source/WebCore/platform/chromium/DragDataChromium.cpp (105825 => 105826)


--- trunk/Source/WebCore/platform/chromium/DragDataChromium.cpp	2012-01-24 23:46:49 UTC (rev 105825)
+++ trunk/Source/WebCore/platform/chromium/DragDataChromium.cpp	2012-01-24 23:48:23 UTC (rev 105826)
@@ -50,14 +50,14 @@
 
 bool DragData::containsURL(Frame*, FilenameConversionPolicy filenamePolicy) const
 {
-    return m_platformDragData->types().contains(mimeTypeURL)
+    return m_platformDragData->types().contains(mimeTypeTextURIList)
         || (filenamePolicy == ConvertFilenames && m_platformDragData->containsFilenames());
 }
 
 String DragData::asURL(Frame*, FilenameConversionPolicy filenamePolicy, String* title) const
 {
     String url;
-    if (m_platformDragData->types().contains(mimeTypeURL)) {
+    if (m_platformDragData->types().contains(mimeTypeTextURIList)) {
         bool ignoredSuccess;
         url = "" ignoredSuccess);
         if (title)
@@ -109,7 +109,7 @@
     // ClipboardWin::writeRange is called).  For example, dragging a link
     // should not result in a space being added.
     return m_platformDragData->types().contains(mimeTypeTextPlain)
-        && !m_platformDragData->types().contains(mimeTypeURL);
+        && !m_platformDragData->types().contains(mimeTypeTextURIList);
 }
 
 bool DragData::containsCompatibleContent() const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to