Changeset 242773 in webkit


Ignore:
Timestamp:
Mar 11, 2019 9:59:35 PM (5 years ago)
Author:
Simon Fraser
Message:

Add testing API to hit-test and scroll overflow scrollers
https://bugs.webkit.org/show_bug.cgi?id=195278

Reviewed by Antti Koivisto.

Tools:

Add UIScriptController::immediateScrollElementAtContentPointToOffset() to enable
testing of the view hit-testing code path, and immediate scrolling of overflow:scroll.

Tests: scrollingcoordinator/ios/scroll-element-at-point.html

  • DumpRenderTree/ios/UIScriptControllerIOS.mm:

(WTR::UIScriptController::immediateScrollElementAtContentPointToOffset):

  • TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
  • TestRunnerShared/UIScriptContext/UIScriptController.cpp:

(WTR::UIScriptController::immediateScrollElementAtContentPointToOffset):

  • TestRunnerShared/UIScriptContext/UIScriptController.h:
  • WebKitTestRunner/ios/UIScriptControllerIOS.mm:

(WTR::enclosingScrollViewIncludingSelf):
(WTR::UIScriptController::immediateScrollElementAtContentPointToOffset):

LayoutTests:

The test loads a scaled page with accelerated overflow:scroll, and hit-tests
near the top-left and bottom-right corners to test the point conversion logic.

  • scrollingcoordinator/ios/scroll-element-at-point-expected.txt: Added.
  • scrollingcoordinator/ios/scroll-element-at-point.html: Added.
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r242763 r242773  
     12019-03-11  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Add testing API to hit-test and scroll overflow scrollers
     4        https://bugs.webkit.org/show_bug.cgi?id=195278
     5
     6        Reviewed by Antti Koivisto.
     7       
     8        The test loads a scaled page with accelerated overflow:scroll, and hit-tests
     9        near the top-left and bottom-right corners to test the point conversion logic.
     10
     11        * scrollingcoordinator/ios/scroll-element-at-point-expected.txt: Added.
     12        * scrollingcoordinator/ios/scroll-element-at-point.html: Added.
     13
    1142019-03-11  Zalan Bujtas  <zalan@apple.com>
    215
  • trunk/Tools/ChangeLog

    r242762 r242773  
     12019-03-11  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Add testing API to hit-test and scroll overflow scrollers
     4        https://bugs.webkit.org/show_bug.cgi?id=195278
     5
     6        Reviewed by Antti Koivisto.
     7       
     8        Add UIScriptController::immediateScrollElementAtContentPointToOffset() to enable
     9        testing of the view hit-testing code path, and immediate scrolling of overflow:scroll.
     10       
     11        Tests: scrollingcoordinator/ios/scroll-element-at-point.html
     12
     13        * DumpRenderTree/ios/UIScriptControllerIOS.mm:
     14        (WTR::UIScriptController::immediateScrollElementAtContentPointToOffset):
     15        * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
     16        * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
     17        (WTR::UIScriptController::immediateScrollElementAtContentPointToOffset):
     18        * TestRunnerShared/UIScriptContext/UIScriptController.h:
     19        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
     20        (WTR::enclosingScrollViewIncludingSelf):
     21        (WTR::UIScriptController::immediateScrollElementAtContentPointToOffset):
     22
    1232019-03-11  Tim Horton  <timothy_horton@apple.com>
    224
  • trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm

    r242069 r242773  
    249249}
    250250
     251void UIScriptController::immediateScrollElementAtContentPointToOffset(long x, long y, long xScrollOffset, long yScrollOffset)
     252{
     253}
     254
    251255void UIScriptController::immediateZoomToScale(double scale)
    252256{
  • trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl

    r242069 r242773  
    5353    // Interaction.
    5454    // These functions post events asynchronously. The callback is fired when the events have been dispatched, but any
    55     // resulting behavior may also be asynchronous.
     55    // resulting behavior may also be asynchronous. Points are in "global" (WKWebView) coordinates.
    5656    void touchDownAtPoint(long x, long y, long touchCount, object callback);
    5757    void liftUpAtPoint(long x, long y, long touchCount, object callback);
     
    251251    void immediateZoomToScale(double scale); // Set the zoom scale in the UI process without animation.
    252252
     253    // Find the scroller for the given point in content ("absolute") coordinates, and do an immediate scroll.
     254    void immediateScrollElementAtContentPointToOffset(long x, long y, long xOffset, long yOffset);
     255
    253256    // View state
    254257    readonly attribute double zoomScale;
  • trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp

    r242069 r242773  
    394394}
    395395
     396void UIScriptController::immediateScrollElementAtContentPointToOffset(long x, long y, long xScrollOffset, long yScrollOffset)
     397{
     398}
     399
    396400void UIScriptController::immediateZoomToScale(double scale)
    397401{
  • trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h

    r242069 r242773  
    129129
    130130    void immediateScrollToOffset(long x, long y);
     131    void immediateScrollElementAtContentPointToOffset(long x, long y, long xScrollOffset, long yScrollOffset);
    131132    void immediateZoomToScale(double scale);
    132133
  • trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm

    r241971 r242773  
    559559}
    560560
     561static UIScrollView *enclosingScrollViewIncludingSelf(UIView *view)
     562{
     563    do {
     564        if ([view isKindOfClass:[UIScrollView self]])
     565            return static_cast<UIScrollView *>(view);
     566    } while ((view = [view superview]));
     567
     568    return nil;
     569}
     570
     571void UIScriptController::immediateScrollElementAtContentPointToOffset(long x, long y, long xScrollOffset, long yScrollOffset)
     572{
     573    UIView *contentView = platformContentView();
     574    UIView *hitView = [contentView hitTest:CGPointMake(x, y) withEvent:nil];
     575    UIScrollView *enclosingScrollView = enclosingScrollViewIncludingSelf(hitView);
     576    [enclosingScrollView setContentOffset:CGPointMake(xScrollOffset, yScrollOffset)];
     577}
     578
    561579void UIScriptController::immediateZoomToScale(double scale)
    562580{
Note: See TracChangeset for help on using the changeset viewer.