https://bugs.webkit.org/show_bug.cgi?id=133578
<rdar://problem/
17180591>
Reviewed by Brent Fulgham.
Tools:
The latched scrolling tests rely on synthetic mousewheel events whose coordinates can
be wrong on machines with more than one screen. This is because we use
[NSScreen mainScreen] when computing the global coordinates of the events, but
[NSScreen mainScreen] returns the screen with the key window, not the first screen.
So replace calls to [NSScreen mainScreen] with [[NSScreen screens] firstObject]. Also
add comments clarifying why the coordinate math works (which is not obvious given
the events have no target window).
Some scrolling tests also dispatched events outside the 800x600 test window, so
fix those tests, and add logging that will appear in test output when this happens.
* DumpRenderTree/mac/DumpRenderTree.mm:
(createWebViewAndOffscreenWindow):
* DumpRenderTree/mac/EventSendingController.mm:
(-[EventSendingController mouseScrollByX:andY:continuously:]):
(-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]):
* WebKitTestRunner/mac/EventSenderProxy.mm:
(WTR::EventSenderProxy::mouseMoveTo):
(WTR::EventSenderProxy::mouseScrollBy):
(WTR::EventSenderProxy::continuousMouseScrollBy):
(WTR::EventSenderProxy::mouseScrollByWithWheelAndMomentumPhases):
LayoutTests:
Fix these tests to not dispatch events outside the window, and correct some of the wording
in the tests.
* platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-expected.txt:
* platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-with-handler-expected.txt:
* platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-with-handler.html:
* platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div.html:
* platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-mainframe-with-handler.html:
* platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-mainframe.html:
* platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-mainframe.html:
* platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-mainframe-with-handler.html:
* platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-mainframe.html:
* platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-expected.txt:
* platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-with-handler-expected.txt:
* platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-with-handler.html:
* platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select.html:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@169650
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-06-06 Simon Fraser <simon.fraser@apple.com>
+
+ Latched scrolling tests are flakey on Mavericks
+ https://bugs.webkit.org/show_bug.cgi?id=133578
+ <rdar://problem/17180591>
+
+ Reviewed by Brent Fulgham.
+
+ Fix these tests to not dispatch events outside the window, and correct some of the wording
+ in the tests.
+
+ * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-expected.txt:
+ * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-with-handler-expected.txt:
+ * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-with-handler.html:
+ * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div.html:
+ * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-mainframe-with-handler.html:
+ * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-mainframe.html:
+ * platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-mainframe.html:
+ * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-mainframe-with-handler.html:
+ * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-mainframe.html:
+ * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-expected.txt:
+ * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-with-handler-expected.txt:
+ * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-with-handler.html:
+ * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select.html:
+
2014-06-06 Alex Christensen <achristensen@webkit.org>
Run passing WebGL tests on Windows.
PASS successfullyParsed is true
TEST COMPLETE
-div display height = 485
-Mouse moved to (28, 610)
-Page before: 0, div before: 451
-Page after: 0, div after: 451
+div display height = 350
+Mouse moved to (28, 475)
+Page before: 0, div before: 586
+Page after: 0, div after: 666
PASS Page did not receive wheel events.
(GraphicsLayer
(anchor 0.00 0.00)
PASS successfullyParsed is true
TEST COMPLETE
-div display height = 485
-Mouse moved to (28, 610)
-Page before: 0, div before: 451
-Page after: 0, div after: 451
+div display height = 350
+Mouse moved to (28, 475)
+Page before: 0, div before: 586
+Page after: 0, div after: 666
PASS Page did not receive wheel events.
-Document was initial target for 0 of the wheel events.
+Document was initial target for 4 of the wheel events.
(GraphicsLayer
(anchor 0.00 0.00)
(bounds 2008.00 2341.00)
}
function scrollTest() {
- // See where our IFrame lives:
pageScrollPositionBefore = document.body.scrollTop;
divTarget = document.getElementById('target');
var startPosX = Math.round(divTarget.offsetLeft) + 20;
debug("div display height = " + Math.round(divTarget.clientHeight));
var startPosY = Math.round(divTarget.offsetTop) + Math.round(divTarget.clientHeight) - 42; // One wheel turn before end.
- eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
+ eventSender.mouseMoveTo(startPosX, startPosY);
debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
var messageLocation = document.getElementById('parent');
var message = document.createElement('div');
message.innerHTML = "<p>This test is better run under DumpRenderTree. To manually test it, place the mouse pointer<br/>"
- + "at the top of the page, and then use the mouse wheel or a two-finger swipe to scroll the<br/>"
- + "down past the div.<br/><br/>"
- + "You should not see the row of END labels if this test is successful.</p>";
+ + "near the bottom of the scrollable region, and then use the mouse wheel or a two-finger swipe to scroll up.<br/></br/>"
+ + "The page should not scroll.</p>";
messageLocation.appendChild(message);
}
}
</div>
<div class="scrollable_region">
<h3>Scrollable Region</h3>
- <div id="target" style='overflow-y: auto; overflow-x: hidden; max-height: 485px;'>
+ <div id="target" style='overflow-y: auto; overflow-x: hidden; height: 350px;'>
<table class="table" style='width: 99%'>
<tr><th>Count</th><th>DATA</th><th>Rev Count</th></tr>
<tr><td>TOP TOP TOP TOP TOP</td><td>TOP TOP TOP TOP TOP</td><td>TOP TOP TOP TOP TOP</td></tr>
}
function scrollTest() {
- // See where our IFrame lives:
pageScrollPositionBefore = document.body.scrollTop;
divTarget = document.getElementById('target');
var startPosX = Math.round(divTarget.offsetLeft) + 20;
debug("div display height = " + Math.round(divTarget.clientHeight));
var startPosY = Math.round(divTarget.offsetTop) + Math.round(divTarget.clientHeight) - 42; // One wheel turn before end.
- eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
+ eventSender.mouseMoveTo(startPosX, startPosY);
debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
var messageLocation = document.getElementById('parent');
var message = document.createElement('div');
message.innerHTML = "<p>This test is better run under DumpRenderTree. To manually test it, place the mouse pointer<br/>"
- + "at the top of the page, and then use the mouse wheel or a two-finger swipe to scroll the<br/>"
- + "down past the div.<br/><br/>"
- + "You should not see the row of END labels if this test is successful.</p>";
+ + "near the bottom of the scrollable region and scroll up.<br/><br/>"
+ + "The page should not scroll.</p>";
messageLocation.appendChild(message);
}
}
</div>
<div class="scrollable_region">
<h3>Scrollable Region</h3>
- <div id="target" style='overflow-y: auto; overflow-x: hidden; max-height: 485px;'>
+ <div id="target" style='overflow-y: auto; overflow-x: hidden; max-height: 350px;'>
<table class="table" style='width: 99%'>
<tr><th>Count</th><th>DATA</th><th>Rev Count</th></tr>
<tr><td>TOP TOP TOP TOP TOP</td><td>TOP TOP TOP TOP TOP</td><td>TOP TOP TOP TOP TOP</td></tr>
}
function scrollTest() {
- // See where our IFrame lives:
pageScrollPositionBefore = document.body.scrollTop;
divTarget = document.getElementById('target');
// Scroll the #source until we reach the #target.
var startPosX = Math.round(divTarget.offsetLeft) + 20;
- var startPosY = Math.round(divTarget.offsetTop) - 42; // Slightly more than one wheel scroll away from the IFrame
- eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
+ var startPosY = Math.round(divTarget.offsetTop) - 42;
+ eventSender.mouseMoveTo(startPosX, startPosY);
debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
message.innerHTML = "<p>This test is better run under DumpRenderTree. To manually test it, place the mouse pointer<br/>"
+ "at the top of the page, and then use the mouse wheel or a two-finger swipe to scroll the<br/>"
+ "down past the div.<br/><br/>"
- + "You should not see the row of END labels if this test is successful.</p>";
+ + "The scrollable region should not scroll.</p>";
messageLocation.appendChild(message);
}
}
</div>
<div class="scrollable_region">
<h3>Scrollable Region</h3>
- <div id="target" style='overflow-y: auto; overflow-x: hidden; max-height: 485px;'>
+ <div id="target" style='overflow-y: auto; overflow-x: hidden; height: 350px;'>
<table class="table" style='width: 99%'>
<tr><th>Count</th><th>DATA</th><th>Rev Count</th></tr>
<tr><td>TOP TOP TOP TOP TOP</td><td>TOP TOP TOP TOP TOP</td><td>TOP TOP TOP TOP TOP</td></tr>
}
function scrollTest() {
- // See where our IFrame lives:
pageScrollPositionBefore = document.body.scrollTop;
divTarget = document.getElementById('target');
// Scroll the #source until we reach the #target.
var startPosX = Math.round(divTarget.offsetLeft) + 20;
- var startPosY = Math.round(divTarget.offsetTop) - 42; // Slightly more than one wheel scroll away from the IFrame
- eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
+ var startPosY = Math.round(divTarget.offsetTop) - 42;
+ eventSender.mouseMoveTo(startPosX, startPosY);
debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
message.innerHTML = "<p>This test is better run under DumpRenderTree. To manually test it, place the mouse pointer<br/>"
+ "at the top of the page, and then use the mouse wheel or a two-finger swipe to scroll the<br/>"
+ "down past the div.<br/><br/>"
- + "You should not see the row of END labels if this test is successful.</p>";
+ + "The scrollable region should not scroll.</p>";
messageLocation.appendChild(message);
}
}
</div>
<div class="scrollable_region">
<h3>Scrollable Region</h3>
- <div id="target" style='overflow-y: auto; overflow-x: hidden; max-height: 485px;'>
+ <div id="target" style='overflow-y: auto; overflow-x: hidden; height: 350px;'>
<table class="table" style='width: 99%'>
<tr><th>Count</th><th>DATA</th><th>Rev Count</th></tr>
<tr><td>TOP TOP TOP TOP TOP</td><td>TOP TOP TOP TOP TOP</td><td>TOP TOP TOP TOP TOP</td></tr>
}
function scrollTest() {
- // See where our IFrame lives:
pageScrollPositionBefore = document.body.scrollTop;
iFrameScrollPositionBefore = window.frames['target'].document.body.scrollTop;
// Scroll the #source until we reach the #target.
var startPosX = iframeTarget.offsetLeft + 20;
var startPosY = iframeTarget.offsetTop - 42; // Slightly more than one wheel scroll away from the IFrame
- eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
+ eventSender.mouseMoveTo(startPosX, startPosY);
debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
var message = document.createElement('div');
message.innerHTML = "<p>This test is better run under DumpRenderTree. To manually test it, place the mouse pointer<br/>"
+ "at the top of the page, and then use the mouse wheel or a two-finger swipe to scroll the<br/>"
- + "down past the IFrame.<br/><br/>"
- + "You should not see the row of END labels if this test is successful.</p>";
+ + "down past the iframe.<br/><br/>"
+ + "The iframe should not scroll.</p>";
messageLocation.appendChild(message);
}
}
<div id="source" style="height: 100px">
Put mouse here and flick downwards
</div>
- <iframe id="target" name="target" style="border:solid 1px green; height: 500px; width: 500px;"
+ <iframe id="target" name="target" style="border:solid 1px green; height: 300px; width: 500px;"
src= "data:text/html,
<div id='notToBeScrolled' style='height: 1000px; width: 1000px;'>
TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP<br/><br/>
}
function scrollTest() {
- // See where our IFrame lives:
pageScrollPositionBefore = document.body.scrollTop;
selectTarget = document.getElementById('target');
// Scroll the #source until we reach the #target.
var startPosX = Math.round(selectTarget.offsetLeft) + 20;
- var startPosY = Math.round(selectTarget.offsetTop) - 42; // Slightly more than one wheel scroll away from the IFrame
- eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
+ var startPosY = Math.round(selectTarget.offsetTop) - 42;
+ eventSender.mouseMoveTo(startPosX, startPosY);
debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
}
function scrollTest() {
- // See where our IFrame lives:
pageScrollPositionBefore = document.body.scrollTop;
selectTarget = document.getElementById('target');
// Scroll the #source until we reach the #target.
var startPosX = Math.round(selectTarget.offsetLeft) + 20;
- var startPosY = Math.round(selectTarget.offsetTop) - 42; // Slightly more than one wheel scroll away from the IFrame
- eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
+ var startPosY = Math.round(selectTarget.offsetTop) - 42;
+ eventSender.mouseMoveTo(startPosX, startPosY);
debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
-Put mouse here and flick downwards
+Put mouse near the bottom of the select and scroll downwards.
Scrollable Select
-Put mouse here and flick downwards
+Put mouse near the bottom of the select and scroll downwards.
Scrollable Select
}
function scrollTest() {
- // See where our IFrame lives:
pageScrollPositionBefore = document.body.scrollTop;
selectTarget = document.getElementById('target');
selectScrollPositionBefore = selectTarget.scrollTop;
- // Scroll the #source until we reach the #target.
var startPosX = Math.round(selectTarget.offsetLeft) + 20;
debug("div display height = " + Math.round(selectTarget.clientHeight));
- var startPosY = Math.round(selectTarget.offsetTop) + Math.round(selectTarget.clientHeight) - 42; // One wheel turn before end.
- eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
+ var startPosY = Math.round(selectTarget.offsetTop) + Math.round(selectTarget.clientHeight) - 42;
+ eventSender.mouseMoveTo(startPosX, startPosY);
debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
</script>
<div id="parent" style="height: 2000px; width: 2000px;">
<div id="source" style="height: 100px; width: 500px;">
- Put mouse here and flick downwards
+ Put mouse near the bottom of the select and scroll downwards.
</div>
<div class="scrollable_region">
<h3>Scrollable Select</h3>
}
function scrollTest() {
- // See where our IFrame lives:
pageScrollPositionBefore = document.body.scrollTop;
selectTarget = document.getElementById('target');
// Scroll the #source until we reach the #target.
var startPosX = Math.round(selectTarget.offsetLeft) + 20;
debug("div display height = " + Math.round(selectTarget.clientHeight));
- var startPosY = Math.round(selectTarget.offsetTop) + Math.round(selectTarget.clientHeight) - 42; // One wheel turn before end.
- eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
+ var startPosY = Math.round(selectTarget.offsetTop) + Math.round(selectTarget.clientHeight) - 42;
+ eventSender.mouseMoveTo(startPosX, startPosY);
debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
</script>
<div id="parent" style="height: 2000px; width: 2000px;">
<div id="source" style="height: 100px; width: 500px;">
- Put mouse here and flick downwards
+ Put mouse near the bottom of the select and scroll downwards.
</div>
<div class="scrollable_region">
<h3>Scrollable Select</h3>
+2014-06-06 Simon Fraser <simon.fraser@apple.com>
+
+ Latched scrolling tests are flakey on Mavericks
+ https://bugs.webkit.org/show_bug.cgi?id=133578
+ <rdar://problem/17180591>
+
+ Reviewed by Brent Fulgham.
+
+ The latched scrolling tests rely on synthetic mousewheel events whose coordinates can
+ be wrong on machines with more than one screen. This is because we use
+ [NSScreen mainScreen] when computing the global coordinates of the events, but
+ [NSScreen mainScreen] returns the screen with the key window, not the first screen.
+
+ So replace calls to [NSScreen mainScreen] with [[NSScreen screens] firstObject]. Also
+ add comments clarifying why the coordinate math works (which is not obvious given
+ the events have no target window).
+
+ Some scrolling tests also dispatched events outside the 800x600 test window, so
+ fix those tests, and add logging that will appear in test output when this happens.
+
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (createWebViewAndOffscreenWindow):
+ * DumpRenderTree/mac/EventSendingController.mm:
+ (-[EventSendingController mouseScrollByX:andY:continuously:]):
+ (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]):
+ * WebKitTestRunner/mac/EventSenderProxy.mm:
+ (WTR::EventSenderProxy::mouseMoveTo):
+ (WTR::EventSenderProxy::mouseScrollBy):
+ (WTR::EventSenderProxy::continuousMouseScrollBy):
+ (WTR::EventSenderProxy::mouseScrollByWithWheelAndMomentumPhases):
+
2014-06-05 Carlos Alberto Lopez Perez <clopez@igalia.com>
[GTK] run-perf-tests should run the tests inside the jhbuild shell.
NSRect windowRect = NSOffsetRect(rect, -10000, [(NSScreen *)[[NSScreen screens] objectAtIndex:0] frame].size.height - rect.size.height + 10000);
DumpRenderTreeWindow *window = [[DumpRenderTreeWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
- [window setColorSpace:[[NSScreen mainScreen] colorSpace]];
+ [window setColorSpace:[[[NSScreen screens] firstObject] colorSpace]];
[window setCollectionBehavior:NSWindowCollectionBehaviorStationary];
[[window contentView] addSubview:webView];
[window orderBack:nil];
#endif
}
-- (void)mouseScrollByX:(int)x andY:(int)y continuously:(BOOL)c
+- (void)mouseScrollByX:(int)x andY:(int)y continuously:(BOOL)continuously
{
#if !PLATFORM(IOS)
- CGScrollEventUnit unit = c?kCGScrollEventUnitPixel:kCGScrollEventUnitLine;
+ CGScrollEventUnit unit = continuously ? kCGScrollEventUnitPixel : kCGScrollEventUnitLine;
CGEventRef cgScrollEvent = CGEventCreateScrollWheelEvent(NULL, unit, 2, y, x);
- // CGEvent locations are in global display coordinates.
- CGPoint lastGlobalMousePosition = {
- lastMousePosition.x,
- [[NSScreen mainScreen] frame].size.height - lastMousePosition.y
- };
+ // Set the CGEvent location in flipped coords relative to the first screen, which
+ // compensates for the behavior of +[NSEvent eventWithCGEvent:] when the event has
+ // no associated window. See <rdar://problem/17180591>.
+ CGPoint lastGlobalMousePosition = CGPointMake(lastMousePosition.x, [[[NSScreen screens] firstObject] frame].size.height - lastMousePosition.y);
CGEventSetLocation(cgScrollEvent, lastGlobalMousePosition);
NSEvent *scrollEvent = [NSEvent eventWithCGEvent:cgScrollEvent];
CGEventRef cgScrollEvent = CGEventCreateScrollWheelEvent(NULL, kCGScrollEventUnitLine, 2, y, x);
- // CGEvent locations are in global display coordinates.
- CGPoint lastGlobalMousePosition = CGPointMake(lastMousePosition.x, [[NSScreen mainScreen] frame].size.height - lastMousePosition.y);
+ // Set the CGEvent location in flipped coords relative to the first screen, which
+ // compensates for the behavior of +[NSEvent eventWithCGEvent:] when the event has
+ // no associated window. See <rdar://problem/17180591>.
+ CGPoint lastGlobalMousePosition = CGPointMake(lastMousePosition.x, [[[NSScreen screens] firstObject] frame].size.height - lastMousePosition.y);
CGEventSetLocation(cgScrollEvent, lastGlobalMousePosition);
CGEventSetIntegerValueField(cgScrollEvent, kCGScrollWheelEventIsContinuous, 1);
CGEventSetIntegerValueField(cgScrollEvent, kCGScrollWheelEventScrollPhase, phase);
[NSApp _setCurrentEvent:event];
[targetView mouseMoved:event];
[NSApp _setCurrentEvent:nil];
+ } else {
+ CGPoint windowLocation = [event locationInWindow];
+ WTFLogAlways("mouseMoveTo failed to find a target view at %f,%f\n", windowLocation.x, windowLocation.y);
}
}
{
RetainPtr<CGEventRef> cgScrollEvent = adoptCF(CGEventCreateScrollWheelEvent(0, kCGScrollEventUnitLine, 2, y, x));
- // CGEvent locations are in global display coordinates.
- CGPoint lastGlobalMousePosition = CGPointMake(m_position.x, [[NSScreen mainScreen] frame].size.height - m_position.y);
+ // Set the CGEvent location in flipped coords relative to the first screen, which
+ // compensates for the behavior of +[NSEvent eventWithCGEvent:] when the event has
+ // no associated window. See <rdar://problem/17180591>.
+ CGPoint lastGlobalMousePosition = CGPointMake(m_position.x, [[[NSScreen screens] firstObject] frame].size.height - m_position.y);
CGEventSetLocation(cgScrollEvent.get(), lastGlobalMousePosition);
NSEvent *event = [NSEvent eventWithCGEvent:cgScrollEvent.get()];
[NSApp _setCurrentEvent:event];
[targetView scrollWheel:event];
[NSApp _setCurrentEvent:nil];
+ } else {
+ NSPoint location = [event locationInWindow];
+ WTFLogAlways("mouseScrollByWithWheelAndMomentumPhases failed to find the target view at %f,%f\n", location.x, location.y);
}
}
void EventSenderProxy::continuousMouseScrollBy(int x, int y, bool paged)
{
- // FIXME: Implement this.
+ WTFLogAlways("EventSenderProxy::continuousMouseScrollBy is not implemented\n");
return;
}
{
RetainPtr<CGEventRef> cgScrollEvent = adoptCF(CGEventCreateScrollWheelEvent(0, kCGScrollEventUnitLine, 2, y, x));
- // CGEvent locations are in global display coordinates.
- CGPoint lastGlobalMousePosition = CGPointMake(m_position.x, [[NSScreen mainScreen] frame].size.height - m_position.y);
+ // Set the CGEvent location in flipped coords relative to the first screen, which
+ // compensates for the behavior of +[NSEvent eventWithCGEvent:] when the event has
+ // no associated window. See <rdar://problem/17180591>.
+ CGPoint lastGlobalMousePosition = CGPointMake(m_position.x, [[[NSScreen screens] firstObject] frame].size.height - m_position.y);
CGEventSetLocation(cgScrollEvent.get(), lastGlobalMousePosition);
CGEventSetIntegerValueField(cgScrollEvent.get(), kCGScrollWheelEventIsContinuous, 1);
CGEventSetIntegerValueField(cgScrollEvent.get(), kCGScrollWheelEventScrollPhase, phase);
CGEventSetIntegerValueField(cgScrollEvent.get(), kCGScrollWheelEventMomentumPhase, momentum);
- NSEvent* event = [NSEvent eventWithCGEvent: cgScrollEvent.get()];
+ NSEvent* event = [NSEvent eventWithCGEvent:cgScrollEvent.get()];
// Our event should have the correct settings:
- if (NSView *targetView = [m_testController->mainWebView()->platformView() hitTest: [event locationInWindow]]) {
- [NSApp _setCurrentEvent: event];
- [targetView scrollWheel: event];
- [NSApp _setCurrentEvent: nil];
+ if (NSView *targetView = [m_testController->mainWebView()->platformView() hitTest:[event locationInWindow]]) {
+ [NSApp _setCurrentEvent:event];
+ [targetView scrollWheel:event];
+ [NSApp _setCurrentEvent:nil];
+ } else {
+ CGPoint windowLocation = [event locationInWindow];
+ WTFLogAlways("mouseScrollByWithWheelAndMomentumPhases failed to find the target view at %f,%f\n", windowLocation.x, windowLocation.y);
}
}