View | Details | Raw Unified | Return to bug 7323 | Differences between
and this patch

Collapse All | Expand All

(-)LayoutTests/ChangeLog (+30 lines)
Lines 1-3 Link Here
1
2006-11-01  Alexey Proskuryakov  <ap@nypop.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Test for http://bugs.webkit.org/show_bug.cgi?id=7323
6
        REGRESSION (10.4.4): ondrag* events don't fire on page in a frame
7
8
        * fast/events/drag-in-frames-expected.txt: Added.
9
        * fast/events/drag-in-frames.html: Added.
10
        * fast/events/resources/drag-in-frames-console.html: Added.
11
        * fast/events/resources/drag-in-frames-left.html: Added.
12
        * fast/events/resources/drag-in-frames-right.html: Added.
13
14
        * editing/selection/expanding-selections.html:
15
        * editing/selection/expanding-selections2.html:
16
        * fast/dynamic/layer-hit-test-crash.html:
17
        * fast/events/event-view-toString.html:
18
        * fast/events/resources/drag-outside-window-frame.html:
19
        * svg/custom/hover-default-fill.svg:
20
        Added missing calls to mouseUp().
21
22
        * svg/custom/stroke-width-click-expected.txt:
23
        * svg/custom/stroke-width-click.svg:
24
        Don't attempt to click outside the page, this was confusing DRT.
25
26
        * editing/selection/select-from-textfield-outwards-expected.txt:
27
        * editing/selection/select-from-textfield-outwards.html:
28
        Removed alerts between dragging steps - they are now useless,
29
        as the dragging events are stored and executed at once.
30
1
2006-11-01  Justin Garcia  <justin.garcia@apple.com>
31
2006-11-01  Justin Garcia  <justin.garcia@apple.com>
2
32
3
        Reviewed by darin
33
        Reviewed by darin
(-)LayoutTests/editing/selection/expanding-selections2.html (+1 lines)
Lines 12-17 function editingTest() { Link Here
12
    eventSender.mouseDown();
12
    eventSender.mouseDown();
13
    eventSender.mouseUp();
13
    eventSender.mouseUp();
14
    eventSender.mouseDown();
14
    eventSender.mouseDown();
15
    eventSender.mouseUp();
15
}
16
}
16
17
17
</script>
18
</script>
(-)LayoutTests/editing/selection/expanding-selections.html (+1 lines)
Lines 12-17 function editingTest() { Link Here
12
    eventSender.mouseDown();
12
    eventSender.mouseDown();
13
    eventSender.mouseUp();
13
    eventSender.mouseUp();
14
    eventSender.mouseDown();
14
    eventSender.mouseDown();
15
    eventSender.mouseUp();
15
}
16
}
16
17
17
</script>
18
</script>
(-)LayoutTests/editing/selection/select-from-textfield-outwards-expected.txt (-7 lines)
Lines 1-23 Link Here
1
ALERT: middle
2
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 11 of #text > DIV to 11 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
1
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 11 of #text > DIV to 11 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
3
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
2
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
4
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV to 11 of #text > DIV toDOMRange:range from 11 of #text > DIV to 12 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
3
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV to 11 of #text > DIV toDOMRange:range from 11 of #text > DIV to 12 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
5
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
4
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
6
ALERT: left
7
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV to 12 of #text > DIV toDOMRange:range from 0 of #text > DIV to 12 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
5
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV to 12 of #text > DIV toDOMRange:range from 0 of #text > DIV to 12 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
8
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
6
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
9
ALERT: right
10
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 12 of #text > DIV toDOMRange:range from 11 of #text > DIV to 17 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
7
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 12 of #text > DIV toDOMRange:range from 11 of #text > DIV to 17 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
11
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
8
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
12
ALERT: way up
13
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV to 17 of #text > DIV toDOMRange:range from 0 of #text > DIV to 12 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
9
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV to 17 of #text > DIV toDOMRange:range from 0 of #text > DIV to 12 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
14
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
10
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
15
ALERT: up
16
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 12 of #text > DIV toDOMRange:range from 0 of #text > DIV to 12 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
11
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 12 of #text > DIV toDOMRange:range from 0 of #text > DIV to 12 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
17
ALERT: down
18
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 12 of #text > DIV toDOMRange:range from 11 of #text > DIV to 17 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
12
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 12 of #text > DIV toDOMRange:range from 11 of #text > DIV to 17 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
19
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
13
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
20
ALERT: way down
21
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV to 17 of #text > DIV toDOMRange:range from 11 of #text > DIV to 17 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
14
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV to 17 of #text > DIV toDOMRange:range from 11 of #text > DIV to 17 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
22
layer at (0,0) size 800x600
15
layer at (0,0) size 800x600
23
  RenderView at (0,0) size 800x600
16
  RenderView at (0,0) size 800x600
(-)LayoutTests/editing/selection/select-from-textfield-outwards.html (-7 / +8 lines)
Lines 10-33 function editingTest() { Link Here
10
    var middleX = field.offsetLeft + field.offsetWidth / 2;
10
    var middleX = field.offsetLeft + field.offsetWidth / 2;
11
    var middleY = field.offsetTop + field.offsetHeight / 2;
11
    var middleY = field.offsetTop + field.offsetHeight / 2;
12
    
12
    
13
    alert("middle");
13
    // alert("middle");
14
    eventSender.mouseMoveTo(middleX, middleY);
14
    eventSender.mouseMoveTo(middleX, middleY);
15
    eventSender.mouseDown();
15
    eventSender.mouseDown();
16
    eventSender.leapForward(1000);
16
    eventSender.leapForward(1000);
17
    eventSender.mouseUp();
17
    eventSender.mouseUp();
18
    eventSender.mouseDown();
18
    eventSender.mouseDown();
19
    alert("left");
19
    // alert("left");
20
    eventSender.mouseMoveTo(0, middleY);
20
    eventSender.mouseMoveTo(0, middleY);
21
    alert("right");
21
    // alert("right");
22
    eventSender.mouseMoveTo(document.body.offsetWidth, middleY);
22
    eventSender.mouseMoveTo(document.body.offsetWidth, middleY);
23
    alert("way up");
23
    // alert("way up");
24
    eventSender.mouseMoveTo(middleX, middleY - 2 * field.offsetHeight);
24
    eventSender.mouseMoveTo(middleX, middleY - 2 * field.offsetHeight);
25
    alert("up");
25
    // alert("up");
26
    eventSender.mouseMoveTo(middleX, middleY - field.offsetHeight);
26
    eventSender.mouseMoveTo(middleX, middleY - field.offsetHeight);
27
    alert("down");
27
    // alert("down");
28
    eventSender.mouseMoveTo(middleX, middleY + field.offsetHeight);
28
    eventSender.mouseMoveTo(middleX, middleY + field.offsetHeight);
29
    alert("way down");
29
    // alert("way down");
30
    eventSender.mouseMoveTo(middleX, middleY + 2 * field.offsetHeight);
30
    eventSender.mouseMoveTo(middleX, middleY + 2 * field.offsetHeight);
31
    eventSender.mouseUp();
31
}
32
}
32
</script>
33
</script>
33
</head>
34
</head>
(-)LayoutTests/fast/dynamic/layer-hit-test-crash.html (+2 lines)
Lines 33-38 function moveMouse() Link Here
33
33
34
function finish()
34
function finish()
35
{
35
{
36
    if (window.eventSender)
37
        eventSender.mouseUp();
36
    if (window.layoutTestController)
38
    if (window.layoutTestController)
37
        layoutTestController.notifyDone();
39
        layoutTestController.notifyDone();
38
}
40
}
(-)LayoutTests/fast/events/drag-in-frames-expected.txt (+18 lines)
Line 0 Link Here
1
Event log
2
3
ondragstart src
4
ondrag src
5
ondragenter left target
6
ondrag src
7
ondragover left target
8
ondrag src
9
ondragenter right target
10
ondragleave left target
11
ondrag src
12
ondragover right target
13
ondragover right target
14
ondrop right target
15
ondragend src
16
These results are just "sensible" at the moment, meaning that all the events fire on the right elements, nothing more. The order in particular can rightfully change.
17
18
0
  + text/plain
19
  + text/plain
1
  + native
20
  + native
(-)LayoutTests/fast/events/drag-in-frames.html (+71 lines)
Line 0 Link Here
1
<head>
2
<script>
3
function log(message) {
4
    console_doc = frames[2].document;
5
    var item = console_doc.createElement("li");
6
    item.appendChild(console_doc.createTextNode(message));
7
    console_doc.getElementById('console_messages').appendChild(item);
8
}
9
10
function test() {
11
    if (window.layoutTestController) {
12
        layoutTestController.dumpAsText();
13
        layoutTestController.waitUntilDone();
14
15
        // Find the element to drag
16
        elementToDrag = frames[0].document.getElementById("elementToDrag");
17
        x1 = elementToDrag.offsetLeft + elementToDrag.offsetWidth / 2;
18
        y1 = elementToDrag.offsetTop + elementToDrag.offsetHeight / 2;
19
20
        // Drag to the middle of the destination element in the same frame
21
        dragTarget = frames[0].document.getElementById("dragTarget");
22
        x2 = dragTarget.offsetLeft + dragTarget.offsetWidth / 2;
23
        y2 = dragTarget.offsetTop + dragTarget.offsetHeight / 2;
24
25
        eventSender.mouseMoveTo(x1,y1);
26
        eventSender.mouseDown();
27
        eventSender.mouseMoveTo(x2, y2);
28
        eventSender.mouseMoveTo(x2, y2+1);
29
        eventSender.mouseMoveTo(x2, y2+2);
30
31
        // Drag to the middle of the destination element in another frame
32
        dragTarget2 = frames[1].document.getElementById("dragTarget2");
33
        x3 = 150 + dragTarget2.offsetLeft + dragTarget2.offsetWidth / 2;
34
        y3 = dragTarget2.offsetTop + dragTarget2.offsetHeight / 2;
35
36
        eventSender.mouseMoveTo(x3, y3);
37
        eventSender.mouseMoveTo(x3, y3+1);
38
        eventSender.mouseUp();
39
40
        document.write("<body>" + 
41
            frames[2].document.body.innerHTML + 
42
            "<p>These results are just \"sensible\" at the moment, meaning that " +
43
            "all the events fire on the right elements, nothing more. The order in particular "+
44
            "can rightfully change.</p>" +
45
            "<scr" + "ipt>layoutTestController.notifyDone();</scr" + "ipt>" + 
46
            "</body>");
47
    }
48
}
49
</script>
50
</head>
51
<!-- frames -->
52
<frameset  cols="150,150,*" border="0" onload="test();">
53
54
    <frame name="left" src="resources/drag-in-frames-left.html" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0"
55
                 ondrag="alert('ondrag left frame')"
56
                 ondrop="alert('ondrop left frame')"
57
                 ondragstart="alert('ondragstart left frame')"
58
                 ondragend="alert('ondragend left frame')"
59
                 ondragenter="log('ondragenter left frame')"
60
                 ondragover="log('ondragover left frame')"
61
                 ondragleave="log('ondragleave left frame')">
62
    <frame name="right" src="resources/drag-in-frames-right.html" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0"
63
                 ondrag="alert('ondrag right frame')"
64
                 ondrop="alert('ondrop right frame')"
65
                 ondragstart="alert('ondragstart right frame')"
66
                 ondragend="alert('ondragend right frame')"
67
                 ondragenter="log('ondragenter right frame')"
68
                 ondragover="log('ondragover right frame')"
69
                 ondragleave="log('ondragleave right frame')">
70
    <frame name="console" src="resources/drag-in-frames-console.html"  marginwidth="10" marginheight="10" scrolling="auto" frameborder="0">
71
</frameset>
0
  + text/html
72
  + text/html
(-)LayoutTests/fast/events/event-view-toString.html (+1 lines)
Lines 31-36 Link Here
31
		if (window.eventSender) {
31
		if (window.eventSender) {
32
			eventSender.mouseMoveTo(50, 50);
32
			eventSender.mouseMoveTo(50, 50);
33
			eventSender.mouseDown();
33
			eventSender.mouseDown();
34
			eventSender.mouseUp();
34
		} else {
35
		} else {
35
			resultsDiv.innerHTML += "Manual test mode.<br/>";
36
			resultsDiv.innerHTML += "Manual test mode.<br/>";
36
		}
37
		}
(-)LayoutTests/fast/events/resources/drag-in-frames-console.html (+4 lines)
Line 0 Link Here
1
<body>
2
<h4>Event log</h4>
3
<ul id='console_messages' style='font-size:8px'></ul>
4
</body>
0
  + text/html
5
  + text/html
(-)LayoutTests/fast/events/resources/drag-in-frames-left.html (+49 lines)
Line 0 Link Here
1
<html>
2
<head>
3
    <title>Left</title>
4
</head>
5
6
<body style="margin:0; padding:0">
7
8
<script>
9
function log(message) {
10
    console_doc = parent.frames[2].document;
11
    var item = console_doc.createElement("li");
12
    item.appendChild(console_doc.createTextNode(message));
13
    console_doc.getElementById('console_messages').appendChild(item);
14
}
15
</script>
16
17
<div style="width:150; height:75; text-align:center;">
18
  <a id="elementToDrag"
19
     href="#"
20
     style="position: relative; top: 50"
21
     ondrag="log('ondrag src')"
22
     ondragstart="log('ondragstart src')"
23
     ondragend="log('ondragend src')"
24
     ondragenter="log('ondragenter src')"
25
     ondragover="log('ondragover src')"
26
     ondragleave="log('ondragleave src')"
27
     ondrop="log('ondrop src')">
28
  Drag me
29
  </a>
30
</div>
31
32
<div id="dragTarget"
33
     style="width:150; height:150; background-color:lightgreen; text-align:center;"
34
     ondrag="alert('ondrag left target')"
35
     ondragstart="alert('ondragstart left target')"
36
     ondragend="alert('ondragend left target')"
37
     ondragenter="log('ondragenter left target'); return false;"
38
     ondragover="log('ondragover left target'); return false;"
39
     ondragleave="log('ondragleave left target')"
40
     ondrop="log('ondrop left target')">
41
  <span style="position: relative; top: 50">Here</span>
42
</div>
43
44
<p><a href="http://bugs.webkit.org/show_bug.cgi?id=7323" target="_top">Bug 7323</a>: 
45
REGRESSION (10.4.4): ondrag* events don't fire on page in a frame</p>
46
<p>This test works only in automatic mode, but you can also try dragging manually to compare the results with other browsers.</p>
47
48
</body>
49
</html>
0
  + text/html
50
  + text/html
(-)LayoutTests/fast/events/resources/drag-in-frames-right.html (+31 lines)
Line 0 Link Here
1
<html>
2
<head>
3
    <title>Right</title>
4
</head>
5
6
<body style="margin:0; padding:0">
7
8
<script>
9
function log(message) {
10
    console_doc = parent.frames[2].document;
11
    var item = console_doc.createElement("li");
12
    item.appendChild(console_doc.createTextNode(message));
13
    console_doc.getElementById('console_messages').appendChild(item);
14
}
15
</script>
16
17
<div style="height:75px"></div>
18
19
<div id="dragTarget2"
20
     style="width:150; height:150; background-color:lightblue; text-align:center;"
21
     ondrag="alert('ondrag right target')"
22
     ondragstart="alert('ondragstart right target')"
23
     ondragend="alert('ondragend right target')"
24
     ondragenter="log('ondragenter right target'); return false;"
25
     ondragover="log('ondragover right target'); return false;"
26
     ondragleave="log('ondragleave right target')"
27
     ondrop="log('ondrop right target')">
28
  <span style="position: relative; top: 50">And here</span>
29
</div>
30
</body>
31
</html>
0
  + text/html
32
  + text/html
(-)LayoutTests/fast/events/resources/drag-outside-window-frame.html (+1 lines)
Lines 18-23 function test() Link Here
18
    eventSender.mouseMoveTo(150, 100);
18
    eventSender.mouseMoveTo(150, 100);
19
    eventSender.mouseDown();
19
    eventSender.mouseDown();
20
    eventSender.mouseMoveTo(50, 100);
20
    eventSender.mouseMoveTo(50, 100);
21
    eventSender.mouseUp();
21
    alert("Test result: " + result);
22
    alert("Test result: " + result);
22
}
23
}
23
</script>
24
</script>
(-)LayoutTests/svg/custom/hover-default-fill.svg (+1 lines)
Lines 8-13 Link Here
8
  if (window.eventSender) {
8
  if (window.eventSender) {
9
    eventSender.mouseMoveTo(50, 50);
9
    eventSender.mouseMoveTo(50, 50);
10
    eventSender.mouseDown();
10
    eventSender.mouseDown();
11
    eventSender.mouseUp();
11
  }
12
  }
12
]]>
13
]]>
13
</script>
14
</script>
(-)LayoutTests/svg/custom/stroke-width-click-expected.txt (-2 / +1 lines)
Lines 72-78 EDITING DELEGATE: webViewDidChangeSelect Link Here
72
  
72
  
73
    
73
    
74
      
74
      
75
      SUCCESS: click at 10, 10 was correctly ignoredSUCCESS: click received at: 30, 100SUCCESS: click at 29, 100 was correctly ignoredSUCCESS: click received at: 30, 50SUCCESS: click at 30, 49 was correctly ignoredSUCCESS: click received at: 30, 150SUCCESS: click at 30, 151 was correctly ignoredSUCCESS: click received at: 300, 100SUCCESS: click at 301, 100 was correctly ignoredSUCCESS: click received at: 300, 50SUCCESS: click at 300, 49 was correctly ignoredSUCCESS: click received at: 300, 150SUCCESS: click at 300, 151 was correctly ignoredSUCCESS: click at 1000, 1000 was correctly ignored
75
      SUCCESS: click at 10, 10 was correctly ignoredSUCCESS: click received at: 30, 100SUCCESS: click at 29, 100 was correctly ignoredSUCCESS: click received at: 30, 50SUCCESS: click at 30, 49 was correctly ignoredSUCCESS: click received at: 30, 150SUCCESS: click at 30, 151 was correctly ignoredSUCCESS: click received at: 300, 100SUCCESS: click at 301, 100 was correctly ignoredSUCCESS: click received at: 300, 50SUCCESS: click at 300, 49 was correctly ignoredSUCCESS: click received at: 300, 150SUCCESS: click at 300, 151 was correctly ignored
76
    
76
    
77
  
77
  
78
  
78
  
Lines 97-103 EDITING DELEGATE: webViewDidChangeSelect Link Here
97
      testClick(300, 49, false);
97
      testClick(300, 49, false);
98
      testClick(300, 150, true);
98
      testClick(300, 150, true);
99
      testClick(300, 151, false);
99
      testClick(300, 151, false);
100
      testClick(1000, 1000, false);
101
    } else {
100
    } else {
102
      log("ERROR: window.eventSender not found!  This test must be run using DumpRenderTree.  Mousing over the yellow area will log however.");
101
      log("ERROR: window.eventSender not found!  This test must be run using DumpRenderTree.  Mousing over the yellow area will log however.");
103
    }
102
    }
(-)LayoutTests/svg/custom/stroke-width-click.svg (-1 lines)
Lines 72-78 Link Here
72
      testClick(300, 49, false);
72
      testClick(300, 49, false);
73
      testClick(300, 150, true);
73
      testClick(300, 150, true);
74
      testClick(300, 151, false);
74
      testClick(300, 151, false);
75
      testClick(1000, 1000, false);
76
    } else {
75
    } else {
77
      log("ERROR: window.eventSender not found!  This test must be run using DumpRenderTree.  Mousing over the yellow area will log however.");
76
      log("ERROR: window.eventSender not found!  This test must be run using DumpRenderTree.  Mousing over the yellow area will log however.");
78
    }
77
    }
(-)WebCore/ChangeLog (+32 lines)
Lines 1-3 Link Here
1
2006-11-01  Alexey Proskuryakov  <ap@nypop.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        http://bugs.webkit.org/show_bug.cgi?id=7323
6
        REGRESSION (10.4.4): ondrag* events don't fire on page in a frame
7
8
        * bridge/mac/FrameMac.h: Moved drag source information to a static variable
9
        in FrameMac.mm. There can be only one drag active at any moment, and having 
10
        this information here was making sharing this information between 
11
        subframes hard.
12
13
        * bridge/mac/FrameMac.mm:
14
        (WebCore::FrameMac::FrameMac): Initialize sharedDragInfo.
15
        (WebCore::FrameMac::freeClipboard):
16
        (WebCore::FrameMac::dragHysteresisExceeded):
17
        (WebCore::FrameMac::handleMouseMoveEvent):
18
        (WebCore::FrameMac::handleMouseReleaseEvent):
19
        (WebCore::FrameMac::mouseDown):
20
        (WebCore::FrameMac::dragSourceMovedTo):
21
        (WebCore::FrameMac::dragSourceEndedAt):
22
        (WebCore::FrameMac::dispatchDragSrcEvent):
23
        Access drag source info via sharedDragInfo - this fixes drag source even dispatching.
24
        Also removed some old code that was forwarding mouse events to subviews to make 
25
        HTML editing work in subframes.
26
27
        * page/FrameView.cpp:
28
        (WebCore::FrameView::updateDragAndDrop):
29
        (WebCore::FrameView::cancelDragAndDrop):
30
        (WebCore::FrameView::performDragAndDrop):
31
        Forward events to subframes for dispatching - this fixes drag target events.
32
1
2006-11-01  Justin Garcia  <justin.garcia@apple.com>
33
2006-11-01  Justin Garcia  <justin.garcia@apple.com>
2
34
3
        Reviewed by darin
35
        Reviewed by darin
(-)WebCore/bridge/mac/FrameMac.h (-9 / +1 lines)
Lines 349-363 private: Link Here
349
    Vector<KJS::Bindings::RootObject*> m_rootObjects;
349
    Vector<KJS::Bindings::RootObject*> m_rootObjects;
350
    WebScriptObject* _windowScriptObject;
350
    WebScriptObject* _windowScriptObject;
351
    NPObject* _windowScriptNPObject;
351
    NPObject* _windowScriptNPObject;
352
    
352
353
    RefPtr<Node> _dragSrc;     // element that may be a drag source, for the current mouse gesture
354
    bool _dragSrcIsLink;
355
    bool _dragSrcIsImage;
356
    bool _dragSrcInSelection;
357
    bool _dragSrcMayBeDHTML, _dragSrcMayBeUA;   // Are DHTML and/or the UserAgent allowed to drag out?
358
    bool _dragSrcIsDHTML;
359
    RefPtr<ClipboardMac> _dragClipboard;   // used on only the source side of dragging
360
    
361
    RefPtr<Range> m_markedTextRange;
353
    RefPtr<Range> m_markedTextRange;
362
};
354
};
363
355
(-)WebCore/bridge/mac/FrameMac.mm (-52 / +54 lines)
Lines 1-5 Link Here
1
/*
1
/*
2
 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.  All rights reserved.
2
 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.  All rights reserved.
3
 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
3
 *
4
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * modification, are permitted provided that the following conditions
Lines 114-119 using namespace HTMLNames; Link Here
114
115
115
NSEvent* FrameMac::_currentEvent = nil;
116
NSEvent* FrameMac::_currentEvent = nil;
116
117
118
struct FrameMacDragInfo {
119
    RefPtr<Node> m_dragSrc;     // element that may be a drag source, for the current mouse gesture
120
    bool m_dragSrcIsLink;
121
    bool m_dragSrcIsImage;
122
    bool m_dragSrcInSelection;
123
    bool m_dragSrcMayBeDHTML, m_dragSrcMayBeUA;   // Are DHTML and/or the UserAgent allowed to drag out?
124
    bool m_dragSrcIsDHTML;
125
    RefPtr<ClipboardMac> m_dragClipboard;   // used on only the source side of dragging
126
};
127
128
static FrameMacDragInfo* sharedDragInfo;
129
117
static const unsigned int escChar = 27;
130
static const unsigned int escChar = 27;
118
static SEL selectorForKeyEvent(const PlatformKeyboardEvent* event)
131
static SEL selectorForKeyEvent(const PlatformKeyboardEvent* event)
119
{
132
{
Lines 156-161 FrameMac::FrameMac(Page* page, Element* Link Here
156
    , _windowScriptObject(0)
169
    , _windowScriptObject(0)
157
    , _windowScriptNPObject(0)
170
    , _windowScriptNPObject(0)
158
{
171
{
172
     if (!sharedDragInfo)
173
         sharedDragInfo = new FrameMacDragInfo;
159
}
174
}
160
175
161
FrameMac::~FrameMac()
176
FrameMac::~FrameMac()
Lines 250-257 Frame* FrameMac::createFrame(const KURL& Link Here
250
265
251
void FrameMac::freeClipboard()
266
void FrameMac::freeClipboard()
252
{
267
{
253
    if (_dragClipboard)
268
    if (sharedDragInfo->m_dragClipboard)
254
        _dragClipboard->setAccessPolicy(ClipboardNumb);
269
        sharedDragInfo->m_dragClipboard->setAccessPolicy(ClipboardNumb);
255
}
270
}
256
271
257
// Either get cached regexp or build one that matches any of the labels.
272
// Either get cached regexp or build one that matches any of the labels.
Lines 1505-1515 bool FrameMac::dragHysteresisExceeded(fl Link Here
1505
    IntSize delta = dragLocation - m_mouseDownPos;
1520
    IntSize delta = dragLocation - m_mouseDownPos;
1506
    
1521
    
1507
    float threshold = GeneralDragHysteresis;
1522
    float threshold = GeneralDragHysteresis;
1508
    if (_dragSrcIsImage)
1523
    if (sharedDragInfo->m_dragSrcIsImage)
1509
        threshold = ImageDragHysteresis;
1524
        threshold = ImageDragHysteresis;
1510
    else if (_dragSrcIsLink)
1525
    else if (sharedDragInfo->m_dragSrcIsLink)
1511
        threshold = LinkDragHysteresis;
1526
        threshold = LinkDragHysteresis;
1512
    else if (_dragSrcInSelection)
1527
    else if (sharedDragInfo->m_dragSrcInSelection)
1513
        threshold = TextDragHysteresis;
1528
        threshold = TextDragHysteresis;
1514
1529
1515
    return fabsf(delta.width()) >= threshold || fabsf(delta.height()) >= threshold;
1530
    return fabsf(delta.width()) >= threshold || fabsf(delta.height()) >= threshold;
Lines 1520-1570 void FrameMac::handleMouseMoveEvent(cons Link Here
1520
    BEGIN_BLOCK_OBJC_EXCEPTIONS;
1535
    BEGIN_BLOCK_OBJC_EXCEPTIONS;
1521
1536
1522
    if ([_currentEvent type] == NSLeftMouseDragged) {
1537
    if ([_currentEvent type] == NSLeftMouseDragged) {
1523
        NSView *view = mouseDownViewIfStillGood();
1538
        if (mouseDownViewIfStillGood())
1524
1539
            return; // The event has been already dispatched to a subframe
1525
        if (view) {
1526
            _sendingEventToSubview = true;
1527
            [view mouseDragged:_currentEvent];
1528
            _sendingEventToSubview = false;
1529
            return;
1530
        }
1531
1540
1532
        // Careful that the drag starting logic stays in sync with eventMayStartDrag()
1541
        // Careful that the drag starting logic stays in sync with eventMayStartDrag()
1533
    
1542
    
1534
        if (mouseDownMayStartDrag() && !_dragSrc) {
1543
        if (mouseDownMayStartDrag() && !sharedDragInfo->m_dragSrc) {
1535
            BOOL tempFlag1, tempFlag2;
1544
            BOOL tempFlag1, tempFlag2;
1536
            [_bridge allowDHTMLDrag:&tempFlag1 UADrag:&tempFlag2];
1545
            [_bridge allowDHTMLDrag:&tempFlag1 UADrag:&tempFlag2];
1537
            _dragSrcMayBeDHTML = tempFlag1;
1546
            sharedDragInfo->m_dragSrcMayBeDHTML = tempFlag1;
1538
            _dragSrcMayBeUA = tempFlag2;
1547
            sharedDragInfo->m_dragSrcMayBeUA = tempFlag2;
1539
            if (!_dragSrcMayBeDHTML && !_dragSrcMayBeUA) {
1548
            if (!sharedDragInfo->m_dragSrcMayBeDHTML && !sharedDragInfo->m_dragSrcMayBeUA)
1540
                setMouseDownMayStartDrag(false);     // no element is draggable
1549
                setMouseDownMayStartDrag(false);     // no element is draggable
1541
            }
1542
        }
1550
        }
1543
        
1551
        
1544
        if (mouseDownMayStartDrag() && !_dragSrc) {
1552
        if (mouseDownMayStartDrag() && !sharedDragInfo->m_dragSrc) {
1545
            // try to find an element that wants to be dragged
1553
            // try to find an element that wants to be dragged
1546
            HitTestRequest request(true, false);
1554
            HitTestRequest request(true, false);
1547
            HitTestResult result(m_mouseDownPos);
1555
            HitTestResult result(m_mouseDownPos);
1548
            renderer()->layer()->hitTest(request, result);
1556
            renderer()->layer()->hitTest(request, result);
1549
            Node *node = result.innerNode();
1557
            Node *node = result.innerNode();
1550
            _dragSrc = (node && node->renderer()) ? node->renderer()->draggableNode(_dragSrcMayBeDHTML, _dragSrcMayBeUA, m_mouseDownPos.x(), m_mouseDownPos.y(), _dragSrcIsDHTML) : 0;
1558
            sharedDragInfo->m_dragSrc = (node && node->renderer()) ? node->renderer()->draggableNode(sharedDragInfo->m_dragSrcMayBeDHTML, sharedDragInfo->m_dragSrcMayBeUA, m_mouseDownPos.x(), m_mouseDownPos.y(), sharedDragInfo->m_dragSrcIsDHTML) : 0;
1551
            if (!_dragSrc) {
1559
            if (!sharedDragInfo->m_dragSrc) {
1552
                setMouseDownMayStartDrag(false);     // no element is draggable
1560
                setMouseDownMayStartDrag(false);     // no element is draggable
1553
            } else {
1561
            } else {
1554
                // remember some facts about this source, while we have a HitTestResult handy
1562
                // remember some facts about this source, while we have a HitTestResult handy
1555
                node = result.URLElement();
1563
                node = result.URLElement();
1556
                _dragSrcIsLink = node && node->isLink();
1564
                sharedDragInfo->m_dragSrcIsLink = node && node->isLink();
1557
1565
1558
                node = result.innerNonSharedNode();
1566
                node = result.innerNonSharedNode();
1559
                _dragSrcIsImage = node && node->renderer() && node->renderer()->isImage();
1567
                sharedDragInfo->m_dragSrcIsImage = node && node->renderer() && node->renderer()->isImage();
1560
                
1568
                
1561
                _dragSrcInSelection = selectionController()->contains(m_mouseDownPos);
1569
                sharedDragInfo->m_dragSrcInSelection = selectionController()->contains(m_mouseDownPos);
1562
            }                
1570
            }                
1563
        }
1571
        }
1564
        
1572
        
1565
        // For drags starting in the selection, the user must wait between the mousedown and mousedrag,
1573
        // For drags starting in the selection, the user must wait between the mousedown and mousedrag,
1566
        // or else we bail on the dragging stuff and allow selection to occur
1574
        // or else we bail on the dragging stuff and allow selection to occur
1567
        if (mouseDownMayStartDrag() && _dragSrcInSelection && [_currentEvent timestamp] - _mouseDownTimestamp < TextDragDelay) {
1575
        if (mouseDownMayStartDrag() && sharedDragInfo->m_dragSrcInSelection && [_currentEvent timestamp] - _mouseDownTimestamp < TextDragDelay) {
1568
            setMouseDownMayStartDrag(false);
1576
            setMouseDownMayStartDrag(false);
1569
            // ...but if this was the first click in the window, we don't even want to start selection
1577
            // ...but if this was the first click in the window, we don't even want to start selection
1570
            if (_activationEventNumber == [_currentEvent eventNumber]) {
1578
            if (_activationEventNumber == [_currentEvent eventNumber]) {
Lines 1586-1592 void FrameMac::handleMouseMoveEvent(cons Link Here
1586
                NSPoint dragLoc = NSZeroPoint;
1594
                NSPoint dragLoc = NSZeroPoint;
1587
                NSDragOperation srcOp = NSDragOperationNone;                
1595
                NSDragOperation srcOp = NSDragOperationNone;                
1588
                BOOL wcWrotePasteboard = NO;
1596
                BOOL wcWrotePasteboard = NO;
1589
                if (_dragSrcMayBeDHTML) {
1597
                if (sharedDragInfo->m_dragSrcMayBeDHTML) {
1590
                    NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:NSDragPboard];
1598
                    NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:NSDragPboard];
1591
                    // Must be done before ondragstart adds types and data to the pboard,
1599
                    // Must be done before ondragstart adds types and data to the pboard,
1592
                    // also done for security, as it erases data from the last drag
1600
                    // also done for security, as it erases data from the last drag
Lines 1594-1636 void FrameMac::handleMouseMoveEvent(cons Link Here
1594
                    
1602
                    
1595
                    freeClipboard();    // would only happen if we missed a dragEnd.  Do it anyway, just
1603
                    freeClipboard();    // would only happen if we missed a dragEnd.  Do it anyway, just
1596
                                        // to make sure it gets numbified
1604
                                        // to make sure it gets numbified
1597
                    _dragClipboard = new ClipboardMac(true, pasteboard, ClipboardWritable, this);
1605
                    sharedDragInfo->m_dragClipboard = new ClipboardMac(true, pasteboard, ClipboardWritable, this);
1598
                    
1606
                    
1599
                    // If this is drag of an element, get set up to generate a default image.  Otherwise
1607
                    // If this is drag of an element, get set up to generate a default image.  Otherwise
1600
                    // WebKit will generate the default, the element doesn't override.
1608
                    // WebKit will generate the default, the element doesn't override.
1601
                    if (_dragSrcIsDHTML) {
1609
                    if (sharedDragInfo->m_dragSrcIsDHTML) {
1602
                        int srcX, srcY;
1610
                        int srcX, srcY;
1603
                        _dragSrc->renderer()->absolutePosition(srcX, srcY);
1611
                        sharedDragInfo->m_dragSrc->renderer()->absolutePosition(srcX, srcY);
1604
                        IntSize delta = m_mouseDownPos - IntPoint(srcX, srcY);
1612
                        IntSize delta = m_mouseDownPos - IntPoint(srcX, srcY);
1605
                        _dragClipboard->setDragImageElement(_dragSrc.get(), IntPoint() + delta);
1613
                        sharedDragInfo->m_dragClipboard->setDragImageElement(sharedDragInfo->m_dragSrc.get(), IntPoint() + delta);
1606
                    } 
1614
                    } 
1607
1615
1608
                    setMouseDownMayStartDrag(dispatchDragSrcEvent(dragstartEvent, m_mouseDown) && !selectionController()->isInPasswordField());
1616
                    setMouseDownMayStartDrag(dispatchDragSrcEvent(dragstartEvent, m_mouseDown) && !selectionController()->isInPasswordField());
1609
                    // Invalidate clipboard here against anymore pasteboard writing for security.  The drag
1617
                    // Invalidate clipboard here against anymore pasteboard writing for security.  The drag
1610
                    // image can still be changed as we drag, but not the pasteboard data.
1618
                    // image can still be changed as we drag, but not the pasteboard data.
1611
                    _dragClipboard->setAccessPolicy(ClipboardImageWritable);
1619
                    sharedDragInfo->m_dragClipboard->setAccessPolicy(ClipboardImageWritable);
1612
                    
1620
                    
1613
                    if (mouseDownMayStartDrag()) {
1621
                    if (mouseDownMayStartDrag()) {
1614
                        // gather values from DHTML element, if it set any
1622
                        // gather values from DHTML element, if it set any
1615
                        _dragClipboard->sourceOperation(srcOp);
1623
                        sharedDragInfo->m_dragClipboard->sourceOperation(srcOp);
1616
1624
1617
                        NSArray *types = [pasteboard types];
1625
                        NSArray *types = [pasteboard types];
1618
                        wcWrotePasteboard = types && [types count] > 0;
1626
                        wcWrotePasteboard = types && [types count] > 0;
1619
1627
1620
                        if (_dragSrcMayBeDHTML)
1628
                        if (sharedDragInfo->m_dragSrcMayBeDHTML)
1621
                            dragImage = _dragClipboard->dragNSImage(dragLoc);
1629
                            dragImage = sharedDragInfo->m_dragClipboard->dragNSImage(dragLoc);
1622
                        
1630
                        
1623
                        // Yuck, dragSourceMovedTo() can be called as a result of kicking off the drag with
1631
                        // Yuck, dragSourceMovedTo() can be called as a result of kicking off the drag with
1624
                        // dragImage!  Because of that dumb reentrancy, we may think we've not started the
1632
                        // dragImage!  Because of that dumb reentrancy, we may think we've not started the
1625
                        // drag when that happens.  So we have to assume it's started before we kick it off.
1633
                        // drag when that happens.  So we have to assume it's started before we kick it off.
1626
                        _dragClipboard->setDragHasStarted();
1634
                        sharedDragInfo->m_dragClipboard->setDragHasStarted();
1627
                    }
1635
                    }
1628
                }
1636
                }
1629
                
1637
                
1630
                if (mouseDownMayStartDrag()) {
1638
                if (mouseDownMayStartDrag()) {
1631
                    BOOL startedDrag = [_bridge startDraggingImage:dragImage at:dragLoc operation:srcOp event:_currentEvent sourceIsDHTML:_dragSrcIsDHTML DHTMLWroteData:wcWrotePasteboard];
1639
                    BOOL startedDrag = [_bridge startDraggingImage:dragImage at:dragLoc operation:srcOp event:_currentEvent sourceIsDHTML:sharedDragInfo->m_dragSrcIsDHTML DHTMLWroteData:wcWrotePasteboard];
1632
                    if (!startedDrag && _dragSrcMayBeDHTML) {
1640
                    if (!startedDrag && sharedDragInfo->m_dragSrcMayBeDHTML) {
1633
                        // WebKit canned the drag at the last minute - we owe _dragSrc a DRAGEND event
1641
                        // WebKit canned the drag at the last minute - we owe m_dragSrc a DRAGEND event
1634
                        PlatformMouseEvent event(PlatformMouseEvent::currentEvent);
1642
                        PlatformMouseEvent event(PlatformMouseEvent::currentEvent);
1635
                        dispatchDragSrcEvent(dragendEvent, event);
1643
                        dispatchDragSrcEvent(dragendEvent, event);
1636
                        setMouseDownMayStartDrag(false);
1644
                        setMouseDownMayStartDrag(false);
Lines 1640-1646 void FrameMac::handleMouseMoveEvent(cons Link Here
1640
                if (!mouseDownMayStartDrag()) {
1648
                if (!mouseDownMayStartDrag()) {
1641
                    // something failed to start the drag, cleanup
1649
                    // something failed to start the drag, cleanup
1642
                    freeClipboard();
1650
                    freeClipboard();
1643
                    _dragSrc = 0;
1651
                    sharedDragInfo->m_dragSrc = 0;
1644
                }
1652
                }
1645
            }
1653
            }
1646
1654
Lines 1751-1762 void FrameMac::handleMouseReleaseEvent(c Link Here
1751
        return;
1759
        return;
1752
    }
1760
    }
1753
    stopAutoscrollTimer();
1761
    stopAutoscrollTimer();
1754
    
1755
    _sendingEventToSubview = true;
1756
    BEGIN_BLOCK_OBJC_EXCEPTIONS;
1757
    [view mouseUp:_currentEvent];
1758
    END_BLOCK_OBJC_EXCEPTIONS;
1759
    _sendingEventToSubview = false;
1760
}
1762
}
1761
1763
1762
bool FrameMac::passSubframeEventToSubframe(MouseEventWithHitTestResults& event, Frame* subframe)
1764
bool FrameMac::passSubframeEventToSubframe(MouseEventWithHitTestResults& event, Frame* subframe)
Lines 1849-1855 void FrameMac::mouseDown(NSEvent *event) Link Here
1849
    prepareForUserAction();
1851
    prepareForUserAction();
1850
1852
1851
    _mouseDownView = nil;
1853
    _mouseDownView = nil;
1852
    _dragSrc = 0;
1854
    sharedDragInfo->m_dragSrc = 0;
1853
    
1855
    
1854
    NSEvent *oldCurrentEvent = _currentEvent;
1856
    NSEvent *oldCurrentEvent = _currentEvent;
1855
    _currentEvent = HardRetain(event);
1857
    _currentEvent = HardRetain(event);
Lines 2954-2979 bool FrameMac::shouldClose() Link Here
2954
2956
2955
void FrameMac::dragSourceMovedTo(const PlatformMouseEvent& event)
2957
void FrameMac::dragSourceMovedTo(const PlatformMouseEvent& event)
2956
{
2958
{
2957
    if (_dragSrc && _dragSrcMayBeDHTML)
2959
    if (sharedDragInfo->m_dragSrc && sharedDragInfo->m_dragSrcMayBeDHTML)
2958
        // for now we don't care if event handler cancels default behavior, since there is none
2960
        // for now we don't care if event handler cancels default behavior, since there is none
2959
        dispatchDragSrcEvent(dragEvent, event);
2961
        dispatchDragSrcEvent(dragEvent, event);
2960
}
2962
}
2961
2963
2962
void FrameMac::dragSourceEndedAt(const PlatformMouseEvent& event, NSDragOperation operation)
2964
void FrameMac::dragSourceEndedAt(const PlatformMouseEvent& event, NSDragOperation operation)
2963
{
2965
{
2964
    if (_dragSrc && _dragSrcMayBeDHTML) {
2966
    if (sharedDragInfo->m_dragSrc && sharedDragInfo->m_dragSrcMayBeDHTML) {
2965
        _dragClipboard->setDestinationOperation(operation);
2967
        sharedDragInfo->m_dragClipboard->setDestinationOperation(operation);
2966
        // for now we don't care if event handler cancels default behavior, since there is none
2968
        // for now we don't care if event handler cancels default behavior, since there is none
2967
        dispatchDragSrcEvent(dragendEvent, event);
2969
        dispatchDragSrcEvent(dragendEvent, event);
2968
    }
2970
    }
2969
    freeClipboard();
2971
    freeClipboard();
2970
    _dragSrc = 0;
2972
    sharedDragInfo->m_dragSrc = 0;
2971
}
2973
}
2972
2974
2973
// returns if we should continue "default processing", i.e., whether eventhandler canceled
2975
// returns if we should continue "default processing", i.e., whether eventhandler canceled
2974
bool FrameMac::dispatchDragSrcEvent(const AtomicString &eventType, const PlatformMouseEvent& event) const
2976
bool FrameMac::dispatchDragSrcEvent(const AtomicString& eventType, const PlatformMouseEvent& event) const
2975
{
2977
{
2976
    bool noDefaultProc = d->m_view->dispatchDragEvent(eventType, _dragSrc.get(), event, _dragClipboard.get());
2978
    bool noDefaultProc = d->m_view->dispatchDragEvent(eventType, sharedDragInfo->m_dragSrc.get(), event, sharedDragInfo->m_dragClipboard.get());
2977
    return !noDefaultProc;
2979
    return !noDefaultProc;
2978
}
2980
}
2979
2981
(-)WebCore/page/FrameView.cpp (-6 / +26 lines)
Lines 6-11 Link Here
6
 *                     2000 Dirk Mueller <mueller@kde.org>
6
 *                     2000 Dirk Mueller <mueller@kde.org>
7
 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
7
 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
8
 *           (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8
 *           (C) 2006 Graham Dennis (graham.dennis@gmail.com)
9
 *           (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9
 *
10
 *
10
 * This library is free software; you can redistribute it and/or
11
 * This library is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU Library General Public
12
 * modify it under the terms of the GNU Library General Public
Lines 34-39 Link Here
34
#include "Frame.h"
35
#include "Frame.h"
35
#include "FrameTree.h"
36
#include "FrameTree.h"
36
#include "HTMLDocument.h"
37
#include "HTMLDocument.h"
38
#include "HTMLFrameElementBase.h"
37
#include "HTMLFrameSetElement.h"
39
#include "HTMLFrameSetElement.h"
38
#include "HTMLInputElement.h"
40
#include "HTMLInputElement.h"
39
#include "HTMLNames.h"
41
#include "HTMLNames.h"
Lines 942-955 bool FrameView::updateDragAndDrop(const Link Here
942
        newTarget = newTarget->shadowAncestorNode();
944
        newTarget = newTarget->shadowAncestorNode();
943
945
944
    if (d->dragTarget != newTarget) {
946
    if (d->dragTarget != newTarget) {
945
        // note this ordering is explicitly chosen to match WinIE
947
        // FIXME: this ordering was explicitly chosen to match WinIE. However,
948
        // it is sometimes incorrect when dragging within subframes, as seen with
949
        // LayoutTests/fast/events/drag-in-frames.html.
946
        if (newTarget)
950
        if (newTarget)
947
            accept = dispatchDragEvent(dragenterEvent, newTarget, event, clipboard);
951
            if (newTarget->hasTagName(frameTag) || newTarget->hasTagName(iframeTag))
952
                accept = static_cast<HTMLFrameElementBase*>(newTarget)->contentFrame()->view()->updateDragAndDrop(event, clipboard);
953
            else
954
                accept = dispatchDragEvent(dragenterEvent, newTarget, event, clipboard);
955
        
948
        if (d->dragTarget)
956
        if (d->dragTarget)
949
            dispatchDragEvent(dragleaveEvent, d->dragTarget.get(), event, clipboard);
957
            if (d->dragTarget->hasTagName(frameTag) || d->dragTarget->hasTagName(iframeTag))
958
                accept = static_cast<HTMLFrameElementBase*>(d->dragTarget.get())->contentFrame()->view()->updateDragAndDrop(event, clipboard);
959
            else
960
                dispatchDragEvent(dragleaveEvent, d->dragTarget.get(), event, clipboard);
950
    } else {
961
    } else {
951
        if (newTarget)
962
        if (newTarget)
952
            accept = dispatchDragEvent(dragoverEvent, newTarget, event, clipboard);
963
            if (newTarget->hasTagName(frameTag) || newTarget->hasTagName(iframeTag))
964
                accept = static_cast<HTMLFrameElementBase*>(newTarget)->contentFrame()->view()->updateDragAndDrop(event, clipboard);
965
            else
966
                accept = dispatchDragEvent(dragoverEvent, newTarget, event, clipboard);
953
    }
967
    }
954
    d->dragTarget = newTarget;
968
    d->dragTarget = newTarget;
955
969
Lines 959-965 bool FrameView::updateDragAndDrop(const Link Here
959
void FrameView::cancelDragAndDrop(const PlatformMouseEvent& event, Clipboard* clipboard)
973
void FrameView::cancelDragAndDrop(const PlatformMouseEvent& event, Clipboard* clipboard)
960
{
974
{
961
    if (d->dragTarget)
975
    if (d->dragTarget)
962
        dispatchDragEvent(dragleaveEvent, d->dragTarget.get(), event, clipboard);
976
        if (d->dragTarget->hasTagName(frameTag) || d->dragTarget->hasTagName(iframeTag))
977
            static_cast<HTMLFrameElementBase*>(d->dragTarget.get())->contentFrame()->view()->cancelDragAndDrop(event, clipboard);
978
        else
979
            dispatchDragEvent(dragleaveEvent, d->dragTarget.get(), event, clipboard);
963
    d->dragTarget = 0;
980
    d->dragTarget = 0;
964
}
981
}
965
982
Lines 967-973 bool FrameView::performDragAndDrop(const Link Here
967
{
984
{
968
    bool accept = false;
985
    bool accept = false;
969
    if (d->dragTarget)
986
    if (d->dragTarget)
970
        accept = dispatchDragEvent(dropEvent, d->dragTarget.get(), event, clipboard);
987
        if (d->dragTarget->hasTagName(frameTag) || d->dragTarget->hasTagName(iframeTag))
988
            accept = static_cast<HTMLFrameElementBase*>(d->dragTarget.get())->contentFrame()->view()->performDragAndDrop(event, clipboard);
989
        else
990
            accept = dispatchDragEvent(dropEvent, d->dragTarget.get(), event, clipboard);
971
    d->dragTarget = 0;
991
    d->dragTarget = 0;
972
    return accept;
992
    return accept;
973
}
993
}
(-)WebKitTools/ChangeLog (+25 lines)
Lines 1-3 Link Here
1
2006-11-01  Alexey Proskuryakov  <ap@nypop.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        http://bugs.webkit.org/show_bug.cgi?id=7323
6
        REGRESSION (10.4.4): ondrag* events don't fire on page in a frame
7
8
        When dragging, do not send EventSendingController's events immediately. Dragging 
9
        is supposed to be modal, so we need to perform it from within the delegate, without
10
        returning to JS to make the next mouse movement.
11
12
        When the mouse is down, mouse events are now recorded, and executed when mouseUp is sent.
13
14
        * DumpRenderTree/EventSendingController.h:
15
        * DumpRenderTree/EventSendingController.m:
16
        (-[EventSendingController dealloc]):
17
        (-[EventSendingController leapForward:]):
18
        (-[EventSendingController mouseDown]):
19
        (-[EventSendingController mouseUp]):
20
        (-[EventSendingController mouseMoveToX:Y:]):
21
        (+[EventSendingController saveEvent:]):
22
        (+[EventSendingController replaySavedEvents]):
23
        * DumpRenderTree/UIDelegate.m:
24
        (-[UIDelegate webView:dragImage:at:offset:event:pasteboard:source:slideBack:forView:]):
25
1
2006-11-01  Stephanie Lewis  <slewis@apple.com>
26
2006-11-01  Stephanie Lewis  <slewis@apple.com>
2
27
3
        Reviewed by Kevin.
28
        Reviewed by Kevin.
(-)WebKitTools/DumpRenderTree/EventSendingController.h (+3 lines)
Lines 38-43 Link Here
38
    double timeOffset;
38
    double timeOffset;
39
}
39
}
40
40
41
+ (void)saveEvent:(NSInvocation *)event;
42
+ (void)replaySavedEvents;
43
41
- (void)enableDOMUIEventLogging:(WebScriptObject *)node;
44
- (void)enableDOMUIEventLogging:(WebScriptObject *)node;
42
45
43
- (void)handleEvent:(DOMEvent *)event;
46
- (void)handleEvent:(DOMEvent *)event;
(-)WebKitTools/DumpRenderTree/EventSendingController.m (+71 lines)
Lines 2-7 Link Here
2
 * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
2
 * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
3
 * Copyright (C) 2006 Jonas Witt <jonas.witt@gmail.com>
3
 * Copyright (C) 2006 Jonas Witt <jonas.witt@gmail.com>
4
 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
4
 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
5
 * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
5
 *
6
 *
6
 * Redistribution and use in source and binary forms, with or without
7
 * Redistribution and use in source and binary forms, with or without
7
 * modification, are permitted provided that the following conditions
8
 * modification, are permitted provided that the following conditions
Lines 41-46 extern void _NSNewKillRingSequence(); Link Here
41
42
42
NSPoint lastMousePosition;
43
NSPoint lastMousePosition;
43
NSArray *webkitDomEventNames;
44
NSArray *webkitDomEventNames;
45
NSMutableArray *savedMouseEvents; // mouse events sent between mouseDown and mouseUp are stored here, and then executed at once.
46
BOOL replayingSavedEvents;
44
47
45
@implementation EventSendingController
48
@implementation EventSendingController
46
49
Lines 126-131 NSArray *webkitDomEventNames; Link Here
126
    return nil;
129
    return nil;
127
}
130
}
128
131
132
- (void)dealloc
133
{
134
    assert(!down);
135
    assert([savedMouseEvents count] == 0);
136
    [savedMouseEvents release];
137
    savedMouseEvents = nil;
138
    [super dealloc];
139
}
140
129
- (double)currentEventTime
141
- (double)currentEventTime
130
{
142
{
131
    return GetCurrentEventTime() + timeOffset;
143
    return GetCurrentEventTime() + timeOffset;
Lines 133-138 NSArray *webkitDomEventNames; Link Here
133
145
134
- (void)leapForward:(int)milliseconds
146
- (void)leapForward:(int)milliseconds
135
{
147
{
148
    if (down && !replayingSavedEvents) {
149
        NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[EventSendingController instanceMethodSignatureForSelector:@selector(leapForward:)]];
150
        [invocation setTarget:self];
151
        [invocation setSelector:@selector(leapForward:)];
152
        [invocation setArgument:&milliseconds atIndex:2];
153
        
154
        [EventSendingController saveEvent:invocation];
155
        
156
        return;
157
    }
158
136
    timeOffset += milliseconds / 1000.0;
159
    timeOffset += milliseconds / 1000.0;
137
}
160
}
138
161
Lines 143-148 NSArray *webkitDomEventNames; Link Here
143
166
144
- (void)mouseDown
167
- (void)mouseDown
145
{
168
{
169
    assert(!down);
170
    assert(!replayingSavedEvents);
171
146
    [[[frame frameView] documentView] layout];
172
    [[[frame frameView] documentView] layout];
147
    if ([self currentEventTime] - lastClick >= 1)
173
    if ([self currentEventTime] - lastClick >= 1)
148
        clickCount = 1;
174
        clickCount = 1;
Lines 167-172 NSArray *webkitDomEventNames; Link Here
167
193
168
- (void)mouseUp
194
- (void)mouseUp
169
{
195
{
196
    assert(down);
197
198
    if (!replayingSavedEvents) {
199
        NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[EventSendingController instanceMethodSignatureForSelector:@selector(mouseUp)]];
200
        [invocation setTarget:self];
201
        [invocation setSelector:@selector(mouseUp)];
202
        
203
        [EventSendingController saveEvent:invocation];
204
        [EventSendingController replaySavedEvents];
205
206
        return;
207
    }
208
209
170
    [[[frame frameView] documentView] layout];
210
    [[[frame frameView] documentView] layout];
171
    NSEvent *event = [NSEvent mouseEventWithType:NSLeftMouseUp 
211
    NSEvent *event = [NSEvent mouseEventWithType:NSLeftMouseUp 
172
                                        location:lastMousePosition 
212
                                        location:lastMousePosition 
Lines 201-206 NSArray *webkitDomEventNames; Link Here
201
241
202
- (void)mouseMoveToX:(int)x Y:(int)y
242
- (void)mouseMoveToX:(int)x Y:(int)y
203
{
243
{
244
    if (down && !replayingSavedEvents) {
245
        NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[EventSendingController instanceMethodSignatureForSelector:@selector(mouseMoveToX:Y:)]];
246
        [invocation setTarget:self];
247
        [invocation setSelector:@selector(mouseMoveToX:Y:)];
248
        [invocation setArgument:&x atIndex:2];
249
        [invocation setArgument:&y atIndex:3];
250
        
251
        [EventSendingController saveEvent:invocation];
252
        
253
        return;
254
    }
255
204
    NSView *view = [frame webView];
256
    NSView *view = [frame webView];
205
    lastMousePosition = [view convertPoint:NSMakePoint(x, [view frame].size.height - y) toView:nil];
257
    lastMousePosition = [view convertPoint:NSMakePoint(x, [view frame].size.height - y) toView:nil];
206
    NSEvent *event = [NSEvent mouseEventWithType:(down ? NSLeftMouseDragged : NSMouseMoved) 
258
    NSEvent *event = [NSEvent mouseEventWithType:(down ? NSLeftMouseDragged : NSMouseMoved) 
Lines 261-266 NSArray *webkitDomEventNames; Link Here
261
    }
313
    }
262
}
314
}
263
315
316
+ (void)saveEvent:(NSInvocation *)event
317
{
318
    if (!savedMouseEvents)
319
        savedMouseEvents = [[NSMutableArray alloc] init];
320
    [savedMouseEvents addObject:invocation];
321
}
322
323
+ (void)replaySavedEvents
324
{
325
    replayingSavedEvents = YES;
326
    while ([savedMouseEvents count]) {
327
        // if a drag is initiated, the remaining saved events will be dispatched from our dragging delegate
328
        NSInvocation *invocation = [[[savedMouseEvents objectAtIndex:0] retain] autorelease];
329
        [savedMouseEvents removeObjectAtIndex:0];
330
        [invocation invoke];
331
    }
332
    replayingSavedEvents = NO;
333
}
334
264
- (void)keyDown:(NSString *)character withModifiers:(WebScriptObject *)modifiers
335
- (void)keyDown:(NSString *)character withModifiers:(WebScriptObject *)modifiers
265
{
336
{
266
    NSString *modifier = nil;
337
    NSString *modifier = nil;
(-)WebKitTools/DumpRenderTree/UIDelegate.m (-6 / +3 lines)
Lines 46-57 DumpRenderTreeDraggingInfo *draggingInfo Link Here
46
46
47
- (void)webView:(WebView *)sender dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag forView:(NSView *)view
47
- (void)webView:(WebView *)sender dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag forView:(NSView *)view
48
{
48
{
49
    // A new drag was started before the old one ended.  Probably shouldn't happen.
49
     assert(!draggingInfo);
50
    if (draggingInfo) {
50
     draggingInfo = [[DumpRenderTreeDraggingInfo alloc] initWithImage:anImage offset:initialOffset pasteboard:pboard source:sourceObj];
51
        [[draggingInfo draggingSource] draggedImage:[draggingInfo draggedImage] endedAt:lastMousePosition operation:NSDragOperationNone];
51
     [EventSendingController replaySavedEvents];
52
        [draggingInfo release];
53
    }
54
    draggingInfo = [[DumpRenderTreeDraggingInfo alloc] initWithImage:anImage offset:initialOffset pasteboard:pboard source:sourceObj];
55
}
52
}
56
53
57
- (void)webViewFocus:(WebView *)webView
54
- (void)webViewFocus:(WebView *)webView

Return to bug 7323