Commit e6f0b89c authored by adele@apple.com's avatar adele@apple.com

WebCore:

2008-07-07  Adele Peterson  <adele@apple.com>

        Reviewed by Dan Bernstein.

        Fix for https://bugs.webkit.org/show_bug.cgi?id=19924
        <rdar://problem/6057160> Disabled file input element updates its displayed file info when a file is dropped from the Finder.

        * page/DragController.cpp: (WebCore::DragController::concludeDrag):
        Check that the file control is enabled before taking dropped files.

LayoutTests:

2008-07-07  Adele Peterson  <adele@apple.com>

        Reviewed by Dan Bernstein.

        Test for https://bugs.webkit.org/show_bug.cgi?id=19924
        <rdar://problem/6057160> Disabled file input element updates its displayed file info when a file is dropped from the Finder.

        * fast/forms/dragging-to-disabled-file-input-expected.txt: Added.
        * fast/forms/dragging-to-disabled-file-input.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@35052 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f930d000
2008-07-07 Adele Peterson <adele@apple.com>
Reviewed by Dan Bernstein.
Test for https://bugs.webkit.org/show_bug.cgi?id=19924
<rdar://problem/6057160> Disabled file input element updates its displayed file info when a file is dropped from the Finder.
* fast/forms/dragging-to-disabled-file-input-expected.txt: Added.
* fast/forms/dragging-to-disabled-file-input.html: Added.
2008-07-07 Adele Peterson <adele@apple.com>
Reviewed by Beth.
This tests that you can't drag a file onto a disabled <input type="file">
To test manually you need to attempt to drag a file onto the file input below
PASS: Could not drop file on to the disabled file input
<p>This tests that you can't drag a file onto a disabled &lt;input type="file"&gt;</p>
<p>To test manually you need to attempt to drag a file onto the file input below</p>
<input id="target" type="file" disabled/><br />
<input id="dragStart" type="text" value="This input field is only present to allow DRT to initiate a drag"></input><br />
<pre id="console"></pre>
<script>
function debug(str) {
var c = document.getElementById('console')
c.appendChild(document.createTextNode(str + '\n'));
}
function runTest() {
var dragStart = document.getElementById("dragStart");
var x = dragStart.offsetLeft + dragStart.offsetWidth / 2;
var y = dragStart.offsetTop + dragStart.offsetHeight / 2;
var target = document.getElementById("target");
var tx = target.offsetLeft + target.offsetWidth / 2;
var ty = target.offsetTop + target.offsetHeight / 2;
dragStart.select();
var initialValue = target.value;
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.leapForward(400);
eventSender.mouseMoveTo(tx, ty);
eventSender.mouseUp();
var finalValue = target.value;
if (initialValue == finalValue)
debug("PASS: Could not drop file on to the disabled file input");
else
debug("FAIL: Dropped file on to disabled file input");
}
if (window.layoutTestController) {
layoutTestController.addFileToPasteboardOnDrag();
layoutTestController.dumpAsText();
runTest();
}
// remove drag source
var dragStart = document.getElementById("dragStart");
dragStart.parentNode.removeChild(dragStart);
</script>
2008-07-07 Adele Peterson <adele@apple.com>
Reviewed by Dan Bernstein.
Fix for https://bugs.webkit.org/show_bug.cgi?id=19924
<rdar://problem/6057160> Disabled file input element updates its displayed file info when a file is dropped from the Finder.
* page/DragController.cpp: (WebCore::DragController::concludeDrag):
Check that the file control is enabled before taking dropped files.
2008-07-07 Adele Peterson <adele@apple.com>
Reviewed by Beth.
......@@ -359,6 +359,10 @@ bool DragController::concludeDrag(DragData* dragData, DragDestinationAction acti
}
if (HTMLInputElement* fileInput = asFileInput(element)) {
if (!fileInput->isEnabled())
return false;
if (!dragData->containsFiles())
return false;
......
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