Commit 798912f8 authored by oliver's avatar oliver

2007-03-27 Oliver Hunt <oliver@apple.com>

        Reviewed by Adam.

        Don't enforce text-selection drag delay when we are
        going to drag an image anyway.

        Fixes rdar://problem/4668935

        * page/EventHandler.cpp:
        (WebCore::EventHandler::handleDrag):
Layout tests:
        Test to ensure there is no delay forced when dragging a selected image

        * editing/pasteboard/drag-selected-image-to-contenteditable-expected.checksum: Added.
        * editing/pasteboard/drag-selected-image-to-contenteditable-expected.png: Added.
        * editing/pasteboard/drag-selected-image-to-contenteditable-expected.txt: Added.
        * editing/pasteboard/drag-selected-image-to-contenteditable.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20545 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d74e433f
2007-03-27 Oliver Hunt <oliver@apple.com>
Reviewed by Adam.
Test to ensure there is no delay forced when dragging a selected image
* editing/pasteboard/drag-selected-image-to-contenteditable-expected.checksum: Added.
* editing/pasteboard/drag-selected-image-to-contenteditable-expected.png: Added.
* editing/pasteboard/drag-selected-image-to-contenteditable-expected.txt: Added.
* editing/pasteboard/drag-selected-image-to-contenteditable.html: Added.
2007-03-27 Anders Carlsson <acarlsson@apple.com>
Reviewed by Geoff.
ba69a37538c7912c7ef4932bf745da18
\ No newline at end of file
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document givenAction:WebViewInsertActionDropped
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (0,0) size 800x584
RenderBlock {DIV} at (0,0) size 302x122 [border: (1px solid #000000)]
RenderImage {IMG} at (1,1) size 76x103
RenderBlock (anonymous) at (0,122) size 800x103
RenderImage {IMG} at (0,0) size 76x103
RenderText {#text} at (0,0) size 0x0
RenderBlock {UL} at (0,241) size 800x18
RenderListItem {LI} at (40,0) size 760x18
RenderListMarker at (-17,0) size 7x18: bullet
RenderText {#text} at (0,0) size 409x18
text run at (0,0) width 409: "Abe should appear twice, once inside the div and once outside it."
selection start: position 0 of child 0 {IMG} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
selection end: position 1 of child 0 {IMG} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
<html>
<head>
<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpEditingCallbacks();
</script>
<script>
function log(message) {
var console = document.getElementById("console");
var li = document.createElement("li");
var text = document.createTextNode(message);
console.appendChild(li);
li.appendChild(text);
}
function runTest() {
if (window.layoutTestController)
layoutTestController.waitUntilDone();
// Let the subframe come into being.
window.setTimeout(step2, 100);
e = document.getElementById("dragme");
setSelectionCommand(e, 0, e, 1);
}
function step2()
{
if (!window.layoutTestController) {
log("This test uses the eventSender. To run it manually, drag the selected image into the editable div and drop it. It should appear inside the editable div.");
return;
}
log("Abe should appear twice, once inside the div and once outside it.");
e = document.getElementById("dragme");
x = e.offsetLeft + e.offsetWidth / 2;
y = e.offsetTop + e.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
e = document.getElementById("target");
x = e.offsetLeft + e.offsetWidth / 2;
y = e.offsetTop + e.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
eventSender.mouseUp();
layoutTestController.notifyDone();
}
</script>
</head>
<body style="padding:0; margin:0" onload="runTest();">
<div id="target" style="border: 1px solid black; width: 300px; height: 120px;" contenteditable="true"></div>
<img id="dragme" src="../resources/abe.jpg">
<ul id="console"></ul>
</body>
2007-03-27 Oliver Hunt <oliver@apple.com>
Reviewed by Adam.
Don't enforce text-selection drag delay when we are
going to drag an image anyway.
Fixes rdar://problem/4668935
* page/EventHandler.cpp:
(WebCore::EventHandler::handleDrag):
2007-03-27 Justin Garcia <justin.garcia@apple.com>
Build fix
......
......@@ -1431,7 +1431,7 @@ bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event)
// For drags starting in the selection, the user must wait between the mousedown and mousedrag,
// or else we bail on the dragging stuff and allow selection to occur
if (m_mouseDownMayStartDrag && dragState().m_dragSrcInSelection && event.event().timestamp() - m_mouseDownTimestamp < TextDragDelay) {
if (m_mouseDownMayStartDrag && !dragState().m_dragSrcIsImage && dragState().m_dragSrcInSelection && event.event().timestamp() - m_mouseDownTimestamp < TextDragDelay) {
m_mouseDownMayStartDrag = false;
dragState().m_dragSrc = 0;
// ...but if this was the first click in the window, we don't even want to start selection
......
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