Changeset 169650 in webkit


Ignore:
Timestamp:
Jun 6, 2014, 10:41:36 AM (11 years ago)
Author:
Simon Fraser
Message:

Latched scrolling tests are flakey on Mavericks
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:
Location:
trunk
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r169649 r169650  
     12014-06-06  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Latched scrolling tests are flakey on Mavericks
     4        https://bugs.webkit.org/show_bug.cgi?id=133578
     5        <rdar://problem/17180591>
     6
     7        Reviewed by Brent Fulgham.
     8       
     9        Fix these tests to not dispatch events outside the window, and correct some of the wording
     10        in the tests.
     11
     12        * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-expected.txt:
     13        * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-with-handler-expected.txt:
     14        * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-with-handler.html:
     15        * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div.html:
     16        * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-mainframe-with-handler.html:
     17        * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-mainframe.html:
     18        * platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-mainframe.html:
     19        * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-mainframe-with-handler.html:
     20        * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-mainframe.html:
     21        * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-expected.txt:
     22        * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-with-handler-expected.txt:
     23        * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-with-handler.html:
     24        * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select.html:
     25
    1262014-06-06  Alex Christensen  <achristensen@webkit.org>
    227
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-expected.txt

    r168244 r169650  
    5353
    5454TEST COMPLETE
    55 div display height = 485
    56 Mouse moved to (28, 610)
    57 Page before: 0, div before: 451
    58 Page after:  0, div after: 451
     55div display height = 350
     56Mouse moved to (28, 475)
     57Page before: 0, div before: 586
     58Page after:  0, div after: 666
    5959PASS Page did not receive wheel events.
    6060(GraphicsLayer
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-with-handler-expected.txt

    r168244 r169650  
    5353
    5454TEST COMPLETE
    55 div display height = 485
    56 Mouse moved to (28, 610)
    57 Page before: 0, div before: 451
    58 Page after:  0, div after: 451
     55div display height = 350
     56Mouse moved to (28, 475)
     57Page before: 0, div before: 586
     58Page after:  0, div after: 666
    5959PASS Page did not receive wheel events.
    60 Document was initial target for 0 of the wheel events.
     60Document was initial target for 4 of the wheel events.
    6161(GraphicsLayer
    6262  (anchor 0.00 0.00)
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-with-handler.html

    r169311 r169650  
    7272
    7373function scrollTest() {
    74     // See where our IFrame lives:
    7574    pageScrollPositionBefore = document.body.scrollTop;
    7675
     
    8483    debug("div display height = " + Math.round(divTarget.clientHeight));
    8584    var startPosY = Math.round(divTarget.offsetTop) + Math.round(divTarget.clientHeight) - 42; // One wheel turn before end.
    86     eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
     85    eventSender.mouseMoveTo(startPosX, startPosY);
    8786    debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
    8887    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
     
    110109        var message = document.createElement('div');
    111110        message.innerHTML = "<p>This test is better run under DumpRenderTree. To manually test it, place the mouse pointer<br/>"
    112             + "at the top of the page, and then use the mouse wheel or a two-finger swipe to scroll the<br/>"
    113             + "down past the div.<br/><br/>"
    114             + "You should not see the row of END labels if this test is successful.</p>";
     111            + "near the bottom of the scrollable region, and then use the mouse wheel or a two-finger swipe to scroll up.<br/></br/>"
     112            + "The page should not scroll.</p>";
    115113        messageLocation.appendChild(message);
    116114    }
     
    124122    <div class="scrollable_region">
    125123        <h3>Scrollable Region</h3>
    126         <div id="target" style='overflow-y: auto; overflow-x: hidden; max-height: 485px;'>
     124        <div id="target" style='overflow-y: auto; overflow-x: hidden; height: 350px;'>
    127125            <table class="table" style='width: 99%'>
    128126                <tr><th>Count</th><th>DATA</th><th>Rev Count</th></tr>
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div.html

    r169311 r169650  
    6464
    6565function scrollTest() {
    66     // See where our IFrame lives:
    6766    pageScrollPositionBefore = document.body.scrollTop;
    6867
     
    7675    debug("div display height = " + Math.round(divTarget.clientHeight));
    7776    var startPosY = Math.round(divTarget.offsetTop) + Math.round(divTarget.clientHeight) - 42; // One wheel turn before end.
    78     eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
     77    eventSender.mouseMoveTo(startPosX, startPosY);
    7978    debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
    8079    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
     
    102101        var message = document.createElement('div');
    103102        message.innerHTML = "<p>This test is better run under DumpRenderTree. To manually test it, place the mouse pointer<br/>"
    104             + "at the top of the page, and then use the mouse wheel or a two-finger swipe to scroll the<br/>"
    105             + "down past the div.<br/><br/>"
    106             + "You should not see the row of END labels if this test is successful.</p>";
     103            + "near the bottom of the scrollable region and scroll up.<br/><br/>"
     104            + "The page should not scroll.</p>";
    107105        messageLocation.appendChild(message);
    108106    }
     
    116114    <div class="scrollable_region">
    117115        <h3>Scrollable Region</h3>
    118         <div id="target" style='overflow-y: auto; overflow-x: hidden; max-height: 485px;'>
     116        <div id="target" style='overflow-y: auto; overflow-x: hidden; max-height: 350px;'>
    119117            <table class="table" style='width: 99%'>
    120118                <tr><th>Count</th><th>DATA</th><th>Rev Count</th></tr>
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-mainframe-with-handler.html

    r169311 r169650  
    7272
    7373function scrollTest() {
    74     // See where our IFrame lives:
    7574    pageScrollPositionBefore = document.body.scrollTop;
    7675
     
    8180    // Scroll the #source until we reach the #target.
    8281    var startPosX = Math.round(divTarget.offsetLeft) + 20;
    83     var startPosY = Math.round(divTarget.offsetTop) - 42; // Slightly more than one wheel scroll away from the IFrame
    84     eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
     82    var startPosY = Math.round(divTarget.offsetTop) - 42;
     83    eventSender.mouseMoveTo(startPosX, startPosY);
    8584    debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
    8685    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
     
    110109            + "at the top of the page, and then use the mouse wheel or a two-finger swipe to scroll the<br/>"
    111110            + "down past the div.<br/><br/>"
    112             + "You should not see the row of END labels if this test is successful.</p>";
     111            + "The scrollable region should not scroll.</p>";
    113112        messageLocation.appendChild(message);
    114113    }
     
    122121    <div class="scrollable_region">
    123122        <h3>Scrollable Region</h3>
    124         <div id="target" style='overflow-y: auto; overflow-x: hidden; max-height: 485px;'>
     123        <div id="target" style='overflow-y: auto; overflow-x: hidden; height: 350px;'>
    125124            <table class="table" style='width: 99%'>
    126125                <tr><th>Count</th><th>DATA</th><th>Rev Count</th></tr>
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-mainframe.html

    r169311 r169650  
    6464
    6565function scrollTest() {
    66     // See where our IFrame lives:
    6766    pageScrollPositionBefore = document.body.scrollTop;
    6867
     
    7372    // Scroll the #source until we reach the #target.
    7473    var startPosX = Math.round(divTarget.offsetLeft) + 20;
    75     var startPosY = Math.round(divTarget.offsetTop) - 42; // Slightly more than one wheel scroll away from the IFrame
    76     eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
     74    var startPosY = Math.round(divTarget.offsetTop) - 42;
     75    eventSender.mouseMoveTo(startPosX, startPosY);
    7776    debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
    7877    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
     
    102101            + "at the top of the page, and then use the mouse wheel or a two-finger swipe to scroll the<br/>"
    103102            + "down past the div.<br/><br/>"
    104             + "You should not see the row of END labels if this test is successful.</p>";
     103            + "The scrollable region should not scroll.</p>";
    105104        messageLocation.appendChild(message);
    106105    }
     
    114113    <div class="scrollable_region">
    115114        <h3>Scrollable Region</h3>
    116         <div id="target" style='overflow-y: auto; overflow-x: hidden; max-height: 485px;'>
     115        <div id="target" style='overflow-y: auto; overflow-x: hidden; height: 350px;'>
    117116            <table class="table" style='width: 99%'>
    118117                <tr><th>Count</th><th>DATA</th><th>Rev Count</th></tr>
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-mainframe.html

    r169311 r169650  
    3636
    3737function scrollTest() {
    38     // See where our IFrame lives:
    3938    pageScrollPositionBefore = document.body.scrollTop;
    4039    iFrameScrollPositionBefore = window.frames['target'].document.body.scrollTop;
     
    4544    var startPosX = iframeTarget.offsetLeft + 20;
    4645    var startPosY = iframeTarget.offsetTop - 42; // Slightly more than one wheel scroll away from the IFrame
    47     eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
     46    eventSender.mouseMoveTo(startPosX, startPosY);
    4847    debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
    4948    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
     
    7271        message.innerHTML = "<p>This test is better run under DumpRenderTree. To manually test it, place the mouse pointer<br/>"
    7372            + "at the top of the page, and then use the mouse wheel or a two-finger swipe to scroll the<br/>"
    74             + "down past the IFrame.<br/><br/>"
    75             + "You should not see the row of END labels if this test is successful.</p>";
     73            + "down past the iframe.<br/><br/>"
     74            + "The iframe should not scroll.</p>";
    7675        messageLocation.appendChild(message);
    7776    }
     
    8382        Put mouse here and flick downwards
    8483    </div>
    85     <iframe id="target" name="target" style="border:solid 1px green; height: 500px; width: 500px;"
     84    <iframe id="target" name="target" style="border:solid 1px green; height: 300px; width: 500px;"
    8685     src= "data:text/html,
    8786     <div id='notToBeScrolled' style='height: 1000px; width: 1000px;'>
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-mainframe-with-handler.html

    r169311 r169650  
    7272
    7373function scrollTest() {
    74     // See where our IFrame lives:
    7574    pageScrollPositionBefore = document.body.scrollTop;
    7675
     
    8180    // Scroll the #source until we reach the #target.
    8281    var startPosX = Math.round(selectTarget.offsetLeft) + 20;
    83     var startPosY = Math.round(selectTarget.offsetTop) - 42; // Slightly more than one wheel scroll away from the IFrame
    84     eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
     82    var startPosY = Math.round(selectTarget.offsetTop) - 42;
     83    eventSender.mouseMoveTo(startPosX, startPosY);
    8584    debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
    8685    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-mainframe.html

    r169311 r169650  
    6464
    6565function scrollTest() {
    66     // See where our IFrame lives:
    6766    pageScrollPositionBefore = document.body.scrollTop;
    6867
     
    7372    // Scroll the #source until we reach the #target.
    7473    var startPosX = Math.round(selectTarget.offsetLeft) + 20;
    75     var startPosY = Math.round(selectTarget.offsetTop) - 42; // Slightly more than one wheel scroll away from the IFrame
    76     eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
     74    var startPosY = Math.round(selectTarget.offsetTop) - 42;
     75    eventSender.mouseMoveTo(startPosX, startPosY);
    7776    debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
    7877    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-expected.txt

    r168244 r169650  
    1 Put mouse here and flick downwards
     1Put mouse near the bottom of the select and scroll downwards.
    22Scrollable Select
    33
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-with-handler-expected.txt

    r168244 r169650  
    1 Put mouse here and flick downwards
     1Put mouse near the bottom of the select and scroll downwards.
    22Scrollable Select
    33
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-with-handler.html

    r169311 r169650  
    7272
    7373function scrollTest() {
    74     // See where our IFrame lives:
    7574    pageScrollPositionBefore = document.body.scrollTop;
    7675
     
    8079    selectScrollPositionBefore = selectTarget.scrollTop;
    8180
    82     // Scroll the #source until we reach the #target.
    8381    var startPosX = Math.round(selectTarget.offsetLeft) + 20;
    8482    debug("div display height = " + Math.round(selectTarget.clientHeight));
    85     var startPosY = Math.round(selectTarget.offsetTop) + Math.round(selectTarget.clientHeight) - 42; // One wheel turn before end.
    86     eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
     83    var startPosY = Math.round(selectTarget.offsetTop) + Math.round(selectTarget.clientHeight) - 42;
     84    eventSender.mouseMoveTo(startPosX, startPosY);
    8785    debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
    8886    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
     
    120118<div id="parent" style="height: 2000px; width: 2000px;">
    121119    <div id="source" style="height: 100px; width: 500px;">
    122         Put mouse here and flick downwards
     120        Put mouse near the bottom of the select and scroll downwards.
    123121    </div>
    124122        <div class="scrollable_region">
  • trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select.html

    r169311 r169650  
    6464
    6565function scrollTest() {
    66     // See where our IFrame lives:
    6766    pageScrollPositionBefore = document.body.scrollTop;
    6867
     
    7574    var startPosX = Math.round(selectTarget.offsetLeft) + 20;
    7675    debug("div display height = " + Math.round(selectTarget.clientHeight));
    77     var startPosY = Math.round(selectTarget.offsetTop) + Math.round(selectTarget.clientHeight) - 42; // One wheel turn before end.
    78     eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
     76    var startPosY = Math.round(selectTarget.offsetTop) + Math.round(selectTarget.clientHeight) - 42;
     77    eventSender.mouseMoveTo(startPosX, startPosY);
    7978    debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
    8079    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
     
    112111<div id="parent" style="height: 2000px; width: 2000px;">
    113112    <div id="source" style="height: 100px; width: 500px;">
    114         Put mouse here and flick downwards
     113        Put mouse near the bottom of the select and scroll downwards.
    115114    </div>
    116115        <div class="scrollable_region">
  • trunk/Tools/ChangeLog

    r169614 r169650  
     12014-06-06  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Latched scrolling tests are flakey on Mavericks
     4        https://bugs.webkit.org/show_bug.cgi?id=133578
     5        <rdar://problem/17180591>
     6
     7        Reviewed by Brent Fulgham.
     8       
     9        The latched scrolling tests rely on synthetic mousewheel events whose coordinates can
     10        be wrong on machines with more than one screen. This is because we use
     11        [NSScreen mainScreen] when computing the global coordinates of the events, but
     12        [NSScreen mainScreen] returns the screen with the key window, not the first screen.
     13       
     14        So replace calls to [NSScreen mainScreen] with [[NSScreen screens] firstObject]. Also
     15        add comments clarifying why the coordinate math works (which is not obvious given
     16        the events have no target window).
     17       
     18        Some scrolling tests also dispatched events outside the 800x600 test window, so
     19        fix those tests, and add logging that will appear in test output when this happens.
     20
     21        * DumpRenderTree/mac/DumpRenderTree.mm:
     22        (createWebViewAndOffscreenWindow):
     23        * DumpRenderTree/mac/EventSendingController.mm:
     24        (-[EventSendingController mouseScrollByX:andY:continuously:]):
     25        (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]):
     26        * WebKitTestRunner/mac/EventSenderProxy.mm:
     27        (WTR::EventSenderProxy::mouseMoveTo):
     28        (WTR::EventSenderProxy::mouseScrollBy):
     29        (WTR::EventSenderProxy::continuousMouseScrollBy):
     30        (WTR::EventSenderProxy::mouseScrollByWithWheelAndMomentumPhases):
     31
    1322014-06-05  Carlos Alberto Lopez Perez  <clopez@igalia.com>
    233
  • trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r169505 r169650  
    711711    DumpRenderTreeWindow *window = [[DumpRenderTreeWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
    712712
    713     [window setColorSpace:[[NSScreen mainScreen] colorSpace]];
     713    [window setColorSpace:[[[NSScreen screens] firstObject] colorSpace]];
    714714    [window setCollectionBehavior:NSWindowCollectionBehaviorStationary];
    715715    [[window contentView] addSubview:webView];
  • trunk/Tools/DumpRenderTree/mac/EventSendingController.mm

    r167650 r169650  
    668668}
    669669
    670 - (void)mouseScrollByX:(int)x andY:(int)y continuously:(BOOL)c
    671 {
    672 #if !PLATFORM(IOS)
    673     CGScrollEventUnit unit = c?kCGScrollEventUnitPixel:kCGScrollEventUnitLine;
     670- (void)mouseScrollByX:(int)x andY:(int)y continuously:(BOOL)continuously
     671{
     672#if !PLATFORM(IOS)
     673    CGScrollEventUnit unit = continuously ? kCGScrollEventUnitPixel : kCGScrollEventUnitLine;
    674674    CGEventRef cgScrollEvent = CGEventCreateScrollWheelEvent(NULL, unit, 2, y, x);
    675675   
    676     // CGEvent locations are in global display coordinates.
    677     CGPoint lastGlobalMousePosition = {
    678         lastMousePosition.x,
    679         [[NSScreen mainScreen] frame].size.height - lastMousePosition.y
    680     };
     676    // Set the CGEvent location in flipped coords relative to the first screen, which
     677    // compensates for the behavior of +[NSEvent eventWithCGEvent:] when the event has
     678    // no associated window. See <rdar://problem/17180591>.
     679    CGPoint lastGlobalMousePosition = CGPointMake(lastMousePosition.x, [[[NSScreen screens] firstObject] frame].size.height - lastMousePosition.y);
    681680    CGEventSetLocation(cgScrollEvent, lastGlobalMousePosition);
    682681
     
    736735    CGEventRef cgScrollEvent = CGEventCreateScrollWheelEvent(NULL, kCGScrollEventUnitLine, 2, y, x);
    737736
    738     // CGEvent locations are in global display coordinates.
    739     CGPoint lastGlobalMousePosition = CGPointMake(lastMousePosition.x, [[NSScreen mainScreen] frame].size.height - lastMousePosition.y);
     737    // Set the CGEvent location in flipped coords relative to the first screen, which
     738    // compensates for the behavior of +[NSEvent eventWithCGEvent:] when the event has
     739    // no associated window. See <rdar://problem/17180591>.
     740    CGPoint lastGlobalMousePosition = CGPointMake(lastMousePosition.x, [[[NSScreen screens] firstObject] frame].size.height - lastMousePosition.y);
    740741    CGEventSetLocation(cgScrollEvent, lastGlobalMousePosition);
    741742    CGEventSetIntegerValueField(cgScrollEvent, kCGScrollWheelEventIsContinuous, 1);
  • trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm

    r168961 r169650  
    221221        [targetView mouseMoved:event];
    222222        [NSApp _setCurrentEvent:nil];
     223    } else {
     224        CGPoint windowLocation = [event locationInWindow];
     225        WTFLogAlways("mouseMoveTo failed to find a target view at %f,%f\n", windowLocation.x, windowLocation.y);
    223226    }
    224227}
     
    444447    RetainPtr<CGEventRef> cgScrollEvent = adoptCF(CGEventCreateScrollWheelEvent(0, kCGScrollEventUnitLine, 2, y, x));
    445448
    446     // CGEvent locations are in global display coordinates.
    447     CGPoint lastGlobalMousePosition = CGPointMake(m_position.x, [[NSScreen mainScreen] frame].size.height - m_position.y);
     449    // Set the CGEvent location in flipped coords relative to the first screen, which
     450    // compensates for the behavior of +[NSEvent eventWithCGEvent:] when the event has
     451    // no associated window. See <rdar://problem/17180591>.
     452    CGPoint lastGlobalMousePosition = CGPointMake(m_position.x, [[[NSScreen screens] firstObject] frame].size.height - m_position.y);
    448453    CGEventSetLocation(cgScrollEvent.get(), lastGlobalMousePosition);
    449454
     
    453458        [targetView scrollWheel:event];
    454459        [NSApp _setCurrentEvent:nil];
     460    } else {
     461        NSPoint location = [event locationInWindow];
     462        WTFLogAlways("mouseScrollByWithWheelAndMomentumPhases failed to find the target view at %f,%f\n", location.x, location.y);
    455463    }
    456464}
     
    458466void EventSenderProxy::continuousMouseScrollBy(int x, int y, bool paged)
    459467{
    460     // FIXME: Implement this.
     468    WTFLogAlways("EventSenderProxy::continuousMouseScrollBy is not implemented\n");
    461469    return;
    462470}
     
    470478    RetainPtr<CGEventRef> cgScrollEvent = adoptCF(CGEventCreateScrollWheelEvent(0, kCGScrollEventUnitLine, 2, y, x));
    471479
    472     // CGEvent locations are in global display coordinates.
    473     CGPoint lastGlobalMousePosition = CGPointMake(m_position.x, [[NSScreen mainScreen] frame].size.height - m_position.y);
     480    // Set the CGEvent location in flipped coords relative to the first screen, which
     481    // compensates for the behavior of +[NSEvent eventWithCGEvent:] when the event has
     482    // no associated window. See <rdar://problem/17180591>.
     483    CGPoint lastGlobalMousePosition = CGPointMake(m_position.x, [[[NSScreen screens] firstObject] frame].size.height - m_position.y);
    474484    CGEventSetLocation(cgScrollEvent.get(), lastGlobalMousePosition);
    475485
     
    478488    CGEventSetIntegerValueField(cgScrollEvent.get(), kCGScrollWheelEventMomentumPhase, momentum);
    479489
    480     NSEvent* event = [NSEvent eventWithCGEvent: cgScrollEvent.get()];
     490    NSEvent* event = [NSEvent eventWithCGEvent:cgScrollEvent.get()];
    481491
    482492    // Our event should have the correct settings:
    483     if (NSView *targetView = [m_testController->mainWebView()->platformView() hitTest: [event locationInWindow]]) {
    484         [NSApp _setCurrentEvent: event];
    485         [targetView scrollWheel: event];
    486         [NSApp _setCurrentEvent: nil];
     493    if (NSView *targetView = [m_testController->mainWebView()->platformView() hitTest:[event locationInWindow]]) {
     494        [NSApp _setCurrentEvent:event];
     495        [targetView scrollWheel:event];
     496        [NSApp _setCurrentEvent:nil];
     497    } else {
     498        CGPoint windowLocation = [event locationInWindow];
     499        WTFLogAlways("mouseScrollByWithWheelAndMomentumPhases failed to find the target view at %f,%f\n", windowLocation.x, windowLocation.y);
    487500    }
    488501}
Note: See TracChangeset for help on using the changeset viewer.