Changeset 164073 in webkit


Ignore:
Timestamp:
Feb 13, 2014 4:22:36 PM (10 years ago)
Author:
Brent Fulgham
Message:

Create some latched scrolling tests.
https://bugs.webkit.org/show_bug.cgi?id=127606
<rdar://problem/15911348>

Reviewed by Simon Fraser.

Tools:

  • DumpRenderTree/mac/EventSendingController.mm:

(+[EventSendingController isSelectorExcludedFromWebScript:]): Update to recognize
the new "mouseScrollByX:andY:withWheel:andMomentumPhases:" selector.
(+[EventSendingController webScriptNameForSelector:]): Ditto.
(-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): Implement
the new wheel event sender.

  • WebKitTestRunner/EventSenderProxy.h:
  • WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl: Add declaration

of new mouseScrollByWithWheelAndMomentumPhases method.

  • WebKitTestRunner/InjectedBundle/EventSendingController.cpp:

(WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): Added

  • WebKitTestRunner/InjectedBundle/EventSendingController.h:
  • WebKitTestRunner/InjectedBundle/ios/EventSenderProxyIOS.mm:

(WTR::EventSenderProxy::mouseScrollByWithWheelAndMomentumPhases): Add stub for iOS.

  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::didReceiveMessageFromInjectedBundle): Handle the new
mouseScrollByWithWheelAndMomentumPhases message.
(WTR::TestController::didReceiveSynchronousMessageFromInjectedBundle): Handle the
new mouseScrollByWithWheelAndMomentumPhases.

  • WebKitTestRunner/efl/EventSenderProxyEfl.cpp:

(WTR::EventSenderProxy::mouseScrollByWithWheelAndMomentumPhases): Provide stub that
relays to the standard mouse wheel handler.

  • WebKitTestRunner/gtk/EventSenderProxyGtk.cpp:

(WTR::EventSenderProxy::mouseScrollByWithWheelAndMomentumPhases): Ditto.

  • WebKitTestRunner/mac/EventSenderProxy.mm:

(WTR::EventSenderProxy::mouseScrollByWithWheelAndMomentumPhases): Provide implementation
of mouse wheel gesture method.

LayoutTests:

Add a series of tests to cover desired behavior with wheel events (including momentum).
This behavior is specific to the Mac platform, so is limited to the platform/mac and
platform/mac-wk2 directories.

  • platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-expected.txt: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-with-handler-expected.txt: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-with-handler.html: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div.html: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-mainframe-expected.txt: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-mainframe-with-handler-expected.txt: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-mainframe-with-handler.html: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-mainframe.html: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-iframe-expected.txt: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-iframe-with-handler-expected.txt: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-iframe-with-handler.html: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-iframe.html: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-mainframe-expected.txt: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-mainframe-with-handler-expected.txt: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-mainframe-with-handler.html: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-mainframe.html: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-mainframe-expected.txt: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-mainframe-with-handler-expected.txt: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-mainframe-with-handler.html: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-mainframe.html: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-expected.txt: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-with-handler-expected.txt: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-with-handler.html: Added.
  • platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select.html: Added.
  • platform/mac/fast/scrolling: Added.
  • platform/mac/fast/scrolling/scroll-div-latched-div-expected.txt: Added.
  • platform/mac/fast/scrolling/scroll-div-latched-div.html: Added.
  • platform/mac/fast/scrolling/scroll-div-latched-mainframe-expected.txt: Added.
  • platform/mac/fast/scrolling/scroll-div-latched-mainframe.html: Added.
  • platform/mac/fast/scrolling/scroll-iframe-latched-iframe-expected.txt: Added.
  • platform/mac/fast/scrolling/scroll-iframe-latched-iframe.html: Added.
  • platform/mac/fast/scrolling/scroll-iframe-latched-mainframe-expected.txt: Added.
  • platform/mac/fast/scrolling/scroll-iframe-latched-mainframe.html: Added.
  • platform/mac/fast/scrolling/scroll-select-latched-mainframe-expected.txt: Added.
  • platform/mac/fast/scrolling/scroll-select-latched-mainframe.html: Added.
  • platform/mac/fast/scrolling/scroll-select-latched-select-expected.txt: Added.
  • platform/mac/fast/scrolling/scroll-select-latched-select.html: Added.
Location:
trunk
Files:
37 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r164062 r164073  
     12014-02-13  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Create some latched scrolling tests.
     4        https://bugs.webkit.org/show_bug.cgi?id=127606
     5        <rdar://problem/15911348>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add a series of tests to cover desired behavior with wheel events (including momentum).
     10        This behavior is specific to the Mac platform, so is limited to the platform/mac and
     11        platform/mac-wk2 directories.
     12
     13        * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-expected.txt: Added.
     14        * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-with-handler-expected.txt: Added.
     15        * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div-with-handler.html: Added.
     16        * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-div.html: Added.
     17        * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-mainframe-expected.txt: Added.
     18        * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-mainframe-with-handler-expected.txt: Added.
     19        * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-mainframe-with-handler.html: Added.
     20        * platform/mac-wk2/tiled-drawing/fast-scroll-div-latched-mainframe.html: Added.
     21        * platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-iframe-expected.txt: Added.
     22        * platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-iframe-with-handler-expected.txt: Added.
     23        * platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-iframe-with-handler.html: Added.
     24        * platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-iframe.html: Added.
     25        * platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-mainframe-expected.txt: Added.
     26        * platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-mainframe-with-handler-expected.txt: Added.
     27        * platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-mainframe-with-handler.html: Added.
     28        * platform/mac-wk2/tiled-drawing/fast-scroll-iframe-latched-mainframe.html: Added.
     29        * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-mainframe-expected.txt: Added.
     30        * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-mainframe-with-handler-expected.txt: Added.
     31        * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-mainframe-with-handler.html: Added.
     32        * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-mainframe.html: Added.
     33        * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-expected.txt: Added.
     34        * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-with-handler-expected.txt: Added.
     35        * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select-with-handler.html: Added.
     36        * platform/mac-wk2/tiled-drawing/fast-scroll-select-latched-select.html: Added.
     37        * platform/mac/fast/scrolling: Added.
     38        * platform/mac/fast/scrolling/scroll-div-latched-div-expected.txt: Added.
     39        * platform/mac/fast/scrolling/scroll-div-latched-div.html: Added.
     40        * platform/mac/fast/scrolling/scroll-div-latched-mainframe-expected.txt: Added.
     41        * platform/mac/fast/scrolling/scroll-div-latched-mainframe.html: Added.
     42        * platform/mac/fast/scrolling/scroll-iframe-latched-iframe-expected.txt: Added.
     43        * platform/mac/fast/scrolling/scroll-iframe-latched-iframe.html: Added.
     44        * platform/mac/fast/scrolling/scroll-iframe-latched-mainframe-expected.txt: Added.
     45        * platform/mac/fast/scrolling/scroll-iframe-latched-mainframe.html: Added.
     46        * platform/mac/fast/scrolling/scroll-select-latched-mainframe-expected.txt: Added.
     47        * platform/mac/fast/scrolling/scroll-select-latched-mainframe.html: Added.
     48        * platform/mac/fast/scrolling/scroll-select-latched-select-expected.txt: Added.
     49        * platform/mac/fast/scrolling/scroll-select-latched-select.html: Added.
     50
    1512014-02-13  Brady Eidson  <beidson@apple.com>
    252
  • trunk/Tools/ChangeLog

    r164056 r164073  
     12014-02-13  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Create some latched scrolling tests.
     4        https://bugs.webkit.org/show_bug.cgi?id=127606
     5        <rdar://problem/15911348>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * DumpRenderTree/mac/EventSendingController.mm:
     10        (+[EventSendingController isSelectorExcludedFromWebScript:]): Update to recognize
     11        the new "mouseScrollByX:andY:withWheel:andMomentumPhases:" selector.
     12        (+[EventSendingController webScriptNameForSelector:]): Ditto.
     13        (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): Implement
     14        the new wheel event sender.
     15        * WebKitTestRunner/EventSenderProxy.h:
     16        * WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl: Add declaration
     17        of new mouseScrollByWithWheelAndMomentumPhases method.
     18        * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
     19        (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): Added
     20        * WebKitTestRunner/InjectedBundle/EventSendingController.h:
     21        * WebKitTestRunner/InjectedBundle/ios/EventSenderProxyIOS.mm:
     22        (WTR::EventSenderProxy::mouseScrollByWithWheelAndMomentumPhases): Add stub for iOS.
     23        * WebKitTestRunner/TestController.cpp:
     24        (WTR::TestController::didReceiveMessageFromInjectedBundle): Handle the new
     25        mouseScrollByWithWheelAndMomentumPhases message.
     26        (WTR::TestController::didReceiveSynchronousMessageFromInjectedBundle): Handle the
     27        new mouseScrollByWithWheelAndMomentumPhases.
     28        * WebKitTestRunner/efl/EventSenderProxyEfl.cpp:
     29        (WTR::EventSenderProxy::mouseScrollByWithWheelAndMomentumPhases): Provide stub that
     30        relays to the standard mouse wheel handler.
     31        * WebKitTestRunner/gtk/EventSenderProxyGtk.cpp:
     32        (WTR::EventSenderProxy::mouseScrollByWithWheelAndMomentumPhases): Ditto.
     33        * WebKitTestRunner/mac/EventSenderProxy.mm:
     34        (WTR::EventSenderProxy::mouseScrollByWithWheelAndMomentumPhases): Provide implementation
     35        of mouse wheel gesture method.
     36
    1372014-02-13  Antoine Quint  <graouts@webkit.org>
    238
  • trunk/Tools/DumpRenderTree/mac/EventSendingController.mm

    r162817 r164073  
    11/*
    2  * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2005, 2006, 2007, 2008, 2014 Apple Inc. All rights reserved.
    33 * Copyright (C) 2006 Jonas Witt <jonas.witt@gmail.com>
    44 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
     
    7474    NoMouseButton = -1
    7575};
     76
    7677
    7778struct KeyMappingEntry {
     
    203204            || aSelector == @selector(scalePageBy:atX:andY:)
    204205            || aSelector == @selector(mouseScrollByX:andY:)
     206            || aSelector == @selector(mouseScrollByX:andY:withWheel:andMomentumPhases:)
    205207            || aSelector == @selector(continuousMouseScrollByX:andY:)
    206208#if PLATFORM(IOS)
     
    255257    if (aSelector == @selector(mouseScrollByX:andY:))
    256258        return @"mouseScrollBy";
     259    if (aSelector == @selector(mouseScrollByX:andY:withWheel:andMomentumPhases:))
     260        return @"mouseScrollByWithWheelAndMomentumPhases";
    257261    if (aSelector == @selector(continuousMouseScrollByX:andY:))
    258262        return @"continuousMouseScrollBy";
     
    698702{
    699703    [self mouseScrollByX:x andY:y continuously:NO];
     704}
     705
     706- (void)mouseScrollByX:(int)x andY:(int)y withWheel:(NSString*)phaseName andMomentumPhases:(NSString*)momentumName
     707{
     708#if !PLATFORM(IOS)
     709    uint32_t phase = 0;
     710    if ([phaseName isEqualToString: @"none"])
     711        phase = 0;
     712    else if ([phaseName isEqualToString: @"began"])
     713        phase = 1; // kCGScrollPhaseBegan
     714    else if ([phaseName isEqualToString: @"changed"])
     715        phase = 2; // kCGScrollPhaseChanged;
     716    else if ([phaseName isEqualToString: @"ended"])
     717        phase = 4; // kCGScrollPhaseEnded;
     718    else if ([phaseName isEqualToString: @"cancelled"])
     719        phase = 8; // kCGScrollPhaseCancelled;
     720    else if ([phaseName isEqualToString: @"maybegin"])
     721        phase = 128; // kCGScrollPhaseMayBegin;
     722
     723    uint32_t momentum = 0;
     724    if ([momentumName isEqualToString: @"none"])
     725        momentum = 0; // kCGMomentumScrollPhaseNone;
     726    else if ([momentumName isEqualToString:@"begin"])
     727        momentum = 1; // kCGMomentumScrollPhaseBegin;
     728    else if ([momentumName isEqualToString:@"continue"])
     729        momentum = 2; // kCGMomentumScrollPhaseContinue;
     730    else if ([momentumName isEqualToString:@"end"])
     731        momentum = 3; // kCGMomentumScrollPhaseEnd;
     732
     733    CGEventRef cgScrollEvent = CGEventCreateScrollWheelEvent(NULL, kCGScrollEventUnitLine, 2, y, x);
     734
     735    // CGEvent locations are in global display coordinates.
     736    CGPoint lastGlobalMousePosition = CGPointMake(lastMousePosition.x, [[NSScreen mainScreen] frame].size.height - lastMousePosition.y);
     737    CGEventSetLocation(cgScrollEvent, lastGlobalMousePosition);
     738    CGEventSetIntegerValueField(cgScrollEvent, kCGScrollWheelEventScrollPhase, phase);
     739    CGEventSetIntegerValueField(cgScrollEvent, kCGScrollWheelEventMomentumPhase, momentum);
     740   
     741    NSEvent* scrollEvent = [NSEvent eventWithCGEvent:cgScrollEvent];
     742    CFRelease(cgScrollEvent);
     743
     744    if (NSView* targetView = [[mainFrame webView] hitTest:[scrollEvent locationInWindow]]) {
     745        [NSApp _setCurrentEvent:scrollEvent];
     746        [targetView scrollWheel:scrollEvent];
     747        [NSApp _setCurrentEvent:nil];
     748    }
     749#endif
    700750}
    701751
  • trunk/Tools/WebKitTestRunner/EventSenderProxy.h

    r163749 r164073  
    11/*
    2  * Copyright (C) 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011, 2014 Apple Inc. All rights reserved.
    33 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44 *
     
    6161    void mouseMoveTo(double x, double y);
    6262    void mouseScrollBy(int x, int y);
     63    void mouseScrollByWithWheelAndMomentumPhases(int x, int y, int phase, int momentum);
    6364    void continuousMouseScrollBy(int x, int y, bool paged);
    6465
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl

    r149368 r164073  
    11/*
    2  * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2011, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2929    void mouseMoveTo(long x, long y);
    3030    void mouseScrollBy(long x, long y);
     31    void mouseScrollByWithWheelAndMomentumPhases(long x, long y, DOMString phase, DOMString momentum, optional boolean asyncScrolling);
    3132    void continuousMouseScrollBy(long x, long y, optional boolean paged);
    3233    object contextClick();
  • trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp

    r162729 r164073  
    11/*
    2  * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2011, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    348348}
    349349
     350void EventSendingController::mouseScrollByWithWheelAndMomentumPhases(int x, int y, JSStringRef phaseStr, JSStringRef momentumStr, bool asyncScrolling)
     351{
     352    WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
     353    WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
     354   
     355    WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
     356    WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("MouseScrollByWithWheelAndMomentumPhases"));
     357    WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
     358   
     359    WKRetainPtr<WKStringRef> xKey(AdoptWK, WKStringCreateWithUTF8CString("X"));
     360    WKRetainPtr<WKDoubleRef> xRef(AdoptWK, WKDoubleCreate(x));
     361    WKDictionarySetItem(EventSenderMessageBody.get(), xKey.get(), xRef.get());
     362   
     363    WKRetainPtr<WKStringRef> yKey(AdoptWK, WKStringCreateWithUTF8CString("Y"));
     364    WKRetainPtr<WKDoubleRef> yRef(AdoptWK, WKDoubleCreate(y));
     365    WKDictionarySetItem(EventSenderMessageBody.get(), yKey.get(), yRef.get());
     366
     367    uint64_t phase = 0;
     368    if (JSStringIsEqualToUTF8CString(phaseStr, "none"))
     369        phase = 0;
     370    else if (JSStringIsEqualToUTF8CString(phaseStr, "began"))
     371        phase = 1; // kCGScrollPhaseBegan
     372    else if (JSStringIsEqualToUTF8CString(phaseStr, "changed"))
     373        phase = 2; // kCGScrollPhaseChanged
     374    else if (JSStringIsEqualToUTF8CString(phaseStr, "ended"))
     375        phase = 4; // kCGScrollPhaseEnded
     376    else if (JSStringIsEqualToUTF8CString(phaseStr, "cancelled"))
     377        phase = 8; // kCGScrollPhaseCancelled
     378    else if (JSStringIsEqualToUTF8CString(phaseStr, "maybegin"))
     379        phase = 128; // kCGScrollPhaseMayBegin
     380
     381    WKRetainPtr<WKStringRef> phaseKey(AdoptWK, WKStringCreateWithUTF8CString("Phase"));
     382    WKRetainPtr<WKUInt64Ref> phaseRef(AdoptWK, WKUInt64Create(phase));
     383    WKDictionarySetItem(EventSenderMessageBody.get(), phaseKey.get(), phaseRef.get());
     384
     385    uint64_t momentum = 0;
     386    if (JSStringIsEqualToUTF8CString(momentumStr, "none"))
     387        momentum = 0; // kCGMomentumScrollPhaseNone
     388    else if (JSStringIsEqualToUTF8CString(momentumStr, "begin"))
     389        momentum = 1; // kCGMomentumScrollPhaseBegin
     390    else if (JSStringIsEqualToUTF8CString(momentumStr, "continue"))
     391        momentum = 2; // kCGMomentumScrollPhaseContinue
     392    else if (JSStringIsEqualToUTF8CString(momentumStr, "end"))
     393        momentum = 3; // kCGMomentumScrollPhaseEnd
     394
     395    WKRetainPtr<WKStringRef> momentumKey(AdoptWK, WKStringCreateWithUTF8CString("Momentum"));
     396    WKRetainPtr<WKUInt64Ref> momentumRef(AdoptWK, WKUInt64Create(momentum));
     397    WKDictionarySetItem(EventSenderMessageBody.get(), momentumKey.get(), momentumRef.get());
     398
     399    if (asyncScrolling)
     400        WKBundlePostMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get());
     401    else
     402        WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
     403}
     404
    350405void EventSendingController::continuousMouseScrollBy(int x, int y, bool paged)
    351406{
  • trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h

    r154720 r164073  
    11/*
    2  * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2011, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4848    void mouseMoveTo(int x, int y);
    4949    void mouseScrollBy(int x, int y);
     50    void mouseScrollByWithWheelAndMomentumPhases(int x, int y, JSStringRef phase, JSStringRef momentum, bool asyncScrolling);
    5051    void continuousMouseScrollBy(int x, int y, bool paged);
    5152    JSValueRef contextClick();
  • trunk/Tools/WebKitTestRunner/InjectedBundle/ios/EventSenderProxyIOS.mm

    r162729 r164073  
    9999}
    100100
     101void EventSenderProxy::mouseScrollByWithWheelAndMomentumPhases(int x, int y, int phase, int momentum)
     102{
     103    // Write me.
     104}
     105
    101106void EventSenderProxy::continuousMouseScrollBy(int x, int y, bool paged)
    102107{
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r163999 r164073  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    857857        }
    858858
     859        if (WKStringIsEqualToUTF8CString(subMessageName, "MouseScrollByWithWheelAndMomentumPhases")) {
     860            WKRetainPtr<WKStringRef> xKey = adoptWK(WKStringCreateWithUTF8CString("X"));
     861            double x = WKDoubleGetValue(static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, xKey.get())));
     862           
     863            WKRetainPtr<WKStringRef> yKey = adoptWK(WKStringCreateWithUTF8CString("Y"));
     864            double y = WKDoubleGetValue(static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, yKey.get())));
     865           
     866            WKRetainPtr<WKStringRef> phaseKey = adoptWK(WKStringCreateWithUTF8CString("Phase"));
     867            int phase = static_cast<int>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, phaseKey.get()))));
     868            WKRetainPtr<WKStringRef> momentumKey = adoptWK(WKStringCreateWithUTF8CString("Momentum"));
     869            int momentum = static_cast<int>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, momentumKey.get()))));
     870           
     871            // Forward to WebProcess
     872            WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), false);
     873            m_eventSenderProxy->mouseScrollByWithWheelAndMomentumPhases(x, y, phase, momentum);
     874
     875            return;
     876        }
     877
    859878        ASSERT_NOT_REACHED();
    860879    }
     
    926945        }
    927946
     947        if (WKStringIsEqualToUTF8CString(subMessageName, "MouseScrollByWithWheelAndMomentumPhases")) {
     948            WKRetainPtr<WKStringRef> xKey = adoptWK(WKStringCreateWithUTF8CString("X"));
     949            double x = WKDoubleGetValue(static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, xKey.get())));
     950           
     951            WKRetainPtr<WKStringRef> yKey = adoptWK(WKStringCreateWithUTF8CString("Y"));
     952            double y = WKDoubleGetValue(static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, yKey.get())));
     953           
     954            WKRetainPtr<WKStringRef> phaseKey = adoptWK(WKStringCreateWithUTF8CString("Phase"));
     955            int phase = static_cast<int>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, phaseKey.get()))));
     956            WKRetainPtr<WKStringRef> momentumKey = adoptWK(WKStringCreateWithUTF8CString("Momentum"));
     957            int momentum = static_cast<int>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, momentumKey.get()))));
     958
     959            // Forward to WebProcess
     960            WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), true);
     961            m_eventSenderProxy->mouseScrollByWithWheelAndMomentumPhases(x, y, phase, momentum);
     962            WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), false);
     963            return 0;
     964        }
     965       
    928966        if (WKStringIsEqualToUTF8CString(subMessageName, "ContinuousMouseScrollBy")) {
    929967            WKRetainPtr<WKStringRef> xKey = adoptWK(WKStringCreateWithUTF8CString("X"));
  • trunk/Tools/WebKitTestRunner/efl/EventSenderProxyEfl.cpp

    r156647 r164073  
    393393}
    394394
     395void EventSenderProxy::mouseScrollByWithWheelAndMomentumPhases(int x, int y, int /*phase*/, int /*momentum*/)
     396{
     397    // EFL does not have the concept of wheel gesture phases or momentum. Just relay to
     398    // the mouse wheel handler.
     399    mouseScrollBy(x, y);
     400}
     401
    395402void EventSenderProxy::leapForward(int milliseconds)
    396403{
  • trunk/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp

    r163797 r164073  
    434434}
    435435
     436void EventSenderProxy::mouseScrollByWithWheelAndMomentumPhases(int x, int y, int /*phase*/, int /*momentum*/)
     437{
     438    // Gtk+ does not have the concept of wheel gesture phases or momentum. Just relay to
     439    // the mouse wheel handler.
     440    mouseScrollBy(x, y);
     441}
     442
    436443void EventSenderProxy::leapForward(int milliseconds)
    437444{
  • trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm

    r156740 r164073  
    11/*
    2  * Copyright (C) 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011, 2014 Apple Inc. All rights reserved.
    33 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44 *
     
    462462}
    463463
     464void EventSenderProxy::mouseScrollByWithWheelAndMomentumPhases(int x, int y, int phase, int momentum)
     465{
     466    RetainPtr<CGEventRef> cgScrollEvent = adoptCF(CGEventCreateScrollWheelEvent(0, kCGScrollEventUnitLine, 2, y, x));
     467
     468    // CGEvent locations are in global display coordinates.
     469    CGPoint lastGlobalMousePosition = CGPointMake(m_position.x, [[NSScreen mainScreen] frame].size.height - m_position.y);
     470    CGEventSetLocation(cgScrollEvent.get(), lastGlobalMousePosition);
     471
     472    CGEventSetIntegerValueField(cgScrollEvent.get(), kCGScrollWheelEventScrollPhase, phase);
     473    CGEventSetIntegerValueField(cgScrollEvent.get(), kCGScrollWheelEventMomentumPhase, momentum);
     474
     475    NSEvent* event = [NSEvent eventWithCGEvent: cgScrollEvent.get()];
     476
     477    // Our event should have the correct settings:
     478    if (NSView *targetView = [m_testController->mainWebView()->platformView() hitTest: [event locationInWindow]]) {
     479        [NSApp _setCurrentEvent: event];
     480        [targetView scrollWheel: event];
     481        [NSApp _setCurrentEvent: nil];
     482    }
     483}
     484
    464485} // namespace WTR
Note: See TracChangeset for help on using the changeset viewer.