⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 242979 in webkit


Ignore:
Timestamp:
Mar 14, 2019, 6:10:09 PM (7 years ago)
Author:
Simon Fraser
Message:

Make it possible to test scrolling tree layer manipulation more easily
https://bugs.webkit.org/show_bug.cgi?id=195780

Reviewed by Tim Horton.
Source/WebKit:

Add a boolean attribute 'scrollUpdatesDisabled' on UIScriptController that
cuts off communication of scrolling tree scrolls back to the web process
(in RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll()). This
allows tests to trigger scrolls which run the scrolling tree layer positioning
logic, but never get another commit from the web process that might mask
scrolling tree bugs.

WKWebView's testing protocol get @property _scrollingUpdatesDisabledForTesting,
whose getters and setters are overridden by TestRunnerWKWebView. Plumbing
via PageClient and WebPageProxy makes this flag reachable by RemoteScrollingCoordinatorProxy.

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _scrollingUpdatesDisabledForTesting]):
(-[WKWebView _setScrollingUpdatesDisabledForTesting:]):

  • UIProcess/API/Cocoa/WKWebViewPrivate.h:
  • UIProcess/Cocoa/PageClientImplCocoa.h:
  • UIProcess/Cocoa/PageClientImplCocoa.mm:

(WebKit::PageClientImplCocoa::scrollingUpdatesDisabledForTesting):

  • UIProcess/Cocoa/WebPageProxyCocoa.mm:

(WebKit::WebPageProxy::scrollingUpdatesDisabledForTesting):

  • UIProcess/PageClient.h:

(WebKit::PageClient::scrollingUpdatesDisabledForTesting):

  • UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:

(WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):

  • UIProcess/WebPageProxy.h:

Tools:

Add a boolean attribute 'scrollUpdatesDisabled' on UIScriptController that
cuts off communication of scrolling tree scrolls back to the web process
(in RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll()). This
allows tests to trigger scrolls which run the scrolling tree layer positioning
logic, but never get another commit from the web process that might mask
scrolling tree bugs.

WKWebView's testing protocol get @property _scrollingUpdatesDisabledForTesting,
whose getters and setters are overridden by TestRunnerWKWebView. Plumbing
via PageClient and WebPageProxy makes this flag reachable by RemoteScrollingCoordinatorProxy.

  • DumpRenderTree/ios/UIScriptControllerIOS.mm:

(WTR::UIScriptController::scrollUpdatesDisabled const):
(WTR::UIScriptController::setScrollUpdatesDisabled):

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

(WTR::UIScriptController::scrollUpdatesDisabled const):
(WTR::UIScriptController::setScrollUpdatesDisabled):

  • TestRunnerShared/UIScriptContext/UIScriptController.h:
  • WebKitTestRunner/cocoa/TestRunnerWKWebView.h:
  • WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:

(-[TestRunnerWKWebView _scrollingUpdatesDisabledForTesting]):
(-[TestRunnerWKWebView _setScrollingUpdatesDisabledForTesting:]):

  • WebKitTestRunner/ios/TestControllerIOS.mm:

(WTR::TestController::platformResetStateToConsistentValues):

  • WebKitTestRunner/ios/UIScriptControllerIOS.mm:

(WTR::UIScriptController::scrollUpdatesDisabled const):
(WTR::UIScriptController::setScrollUpdatesDisabled):

LayoutTests:

Add a boolean attribute 'scrollUpdatesDisabled' on UIScriptController that
cuts off communication of scrolling tree scrolls back to the web process
(in RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll()). This
allows tests to trigger scrolls which run the scrolling tree layer positioning
logic, but never get another commit from the web process that might mask
scrolling tree bugs.

WKWebView's testing protocol get @property _scrollingUpdatesDisabledForTesting,
whose getters and setters are overridden by TestRunnerWKWebView. Plumbing
via PageClient and WebPageProxy makes this flag reachable by RemoteScrollingCoordinatorProxy.

  • resources/ui-helper.js: Some 'async' functions that awaited promises should just return

the promise.
(window.UIHelper.immediateScrollTo):
(window.UIHelper.immediateUnstableScrollTo):
(window.UIHelper.async.delayFor): Deleted.
(window.UIHelper.async.immediateScrollTo): Deleted.
(window.UIHelper.async.immediateUnstableScrollTo): Deleted.

Location:
trunk
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r242974 r242979  
     12019-03-14  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Make it possible to test scrolling tree layer manipulation more easily
     4        https://bugs.webkit.org/show_bug.cgi?id=195780
     5
     6        Reviewed by Tim Horton.
     7
     8        Add a boolean attribute 'scrollUpdatesDisabled' on UIScriptController that
     9        cuts off communication of scrolling tree scrolls back to the web process
     10        (in RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll()). This
     11        allows tests to trigger scrolls which run the scrolling tree layer positioning
     12        logic, but never get another commit from the web process that might mask
     13        scrolling tree bugs.
     14       
     15        WKWebView's testing protocol get @property _scrollingUpdatesDisabledForTesting,
     16        whose getters and setters are overridden by TestRunnerWKWebView. Plumbing
     17        via PageClient and WebPageProxy makes this flag reachable by RemoteScrollingCoordinatorProxy.
     18
     19        * resources/ui-helper.js: Some 'async' functions that awaited promises should just return
     20        the promise.
     21        (window.UIHelper.immediateScrollTo):
     22        (window.UIHelper.immediateUnstableScrollTo):
     23        (window.UIHelper.async.delayFor): Deleted.
     24        (window.UIHelper.async.immediateScrollTo): Deleted.
     25        (window.UIHelper.async.immediateUnstableScrollTo): Deleted.
     26
    1272019-03-14  Justin Fan  <justin_fan@apple.com>
    228
  • trunk/LayoutTests/resources/ui-helper.js

    r242757 r242979  
    223223    }
    224224
    225     static async delayFor(ms)
     225    static delayFor(ms)
    226226    {
    227227        return new Promise(resolve => setTimeout(resolve, ms));
    228228    }
    229229   
    230     static async immediateScrollTo(x, y)
     230    static immediateScrollTo(x, y)
    231231    {
    232232        if (!this.isWebKit2()) {
     
    235235        }
    236236
    237         await new Promise(resolve => {
     237        return new Promise(resolve => {
    238238            testRunner.runUIScript(`
    239239                uiController.immediateScrollToOffset(${x}, ${y});`, resolve);
     
    241241    }
    242242
    243     static async immediateUnstableScrollTo(x, y)
     243    static immediateUnstableScrollTo(x, y)
    244244    {
    245245        if (!this.isWebKit2()) {
     
    248248        }
    249249
    250         await new Promise(resolve => {
     250        return new Promise(resolve => {
    251251            testRunner.runUIScript(`
    252252                uiController.stableStateOverride = false;
  • trunk/Source/WebKit/ChangeLog

    r242975 r242979  
     12019-03-14  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Make it possible to test scrolling tree layer manipulation more easily
     4        https://bugs.webkit.org/show_bug.cgi?id=195780
     5
     6        Reviewed by Tim Horton.
     7
     8        Add a boolean attribute 'scrollUpdatesDisabled' on UIScriptController that
     9        cuts off communication of scrolling tree scrolls back to the web process
     10        (in RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll()). This
     11        allows tests to trigger scrolls which run the scrolling tree layer positioning
     12        logic, but never get another commit from the web process that might mask
     13        scrolling tree bugs.
     14       
     15        WKWebView's testing protocol get @property _scrollingUpdatesDisabledForTesting,
     16        whose getters and setters are overridden by TestRunnerWKWebView. Plumbing
     17        via PageClient and WebPageProxy makes this flag reachable by RemoteScrollingCoordinatorProxy.
     18
     19        * UIProcess/API/Cocoa/WKWebView.mm:
     20        (-[WKWebView _scrollingUpdatesDisabledForTesting]):
     21        (-[WKWebView _setScrollingUpdatesDisabledForTesting:]):
     22        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
     23        * UIProcess/Cocoa/PageClientImplCocoa.h:
     24        * UIProcess/Cocoa/PageClientImplCocoa.mm:
     25        (WebKit::PageClientImplCocoa::scrollingUpdatesDisabledForTesting):
     26        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
     27        (WebKit::WebPageProxy::scrollingUpdatesDisabledForTesting):
     28        * UIProcess/PageClient.h:
     29        (WebKit::PageClient::scrollingUpdatesDisabledForTesting):
     30        * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
     31        (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
     32        * UIProcess/WebPageProxy.h:
     33
    1342019-03-14  Youenn Fablet  <youenn@apple.com>
    235
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

    r242968 r242979  
    71147114}
    71157115
     7116- (BOOL)_scrollingUpdatesDisabledForTesting
     7117{
     7118    // For subclasses to override;
     7119    return NO;
     7120}
     7121
     7122- (void)_setScrollingUpdatesDisabledForTesting:(BOOL)disabled
     7123{
     7124}
     7125
    71167126// Execute the supplied block after the next transaction from the WebProcess.
    71177127- (void)_doAfterNextPresentationUpdate:(void (^)(void))updateBlock
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h

    r242696 r242979  
    552552@property (nonatomic, readonly) _WKFrameHandle *_mainFrame WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
    553553
     554@property (nonatomic, setter=_setScrollingUpdatesDisabledForTesting:) BOOL _scrollingUpdatesDisabledForTesting WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     555
    554556- (void)_processWillSuspendImminentlyForTesting;
    555557- (void)_processDidResumeForTesting;
  • trunk/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h

    r238726 r242979  
    4444    void isPlayingAudioDidChange() final;
    4545
     46    bool scrollingUpdatesDisabledForTesting() final;
     47
    4648#if ENABLE(ATTACHMENT_ELEMENT)
    4749    void didInsertAttachment(API::Attachment&, const String& source) final;
  • trunk/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm

    r242339 r242979  
    4242}
    4343
     44bool PageClientImplCocoa::scrollingUpdatesDisabledForTesting()
     45{
     46    return [m_webView _scrollingUpdatesDisabledForTesting];
     47}
     48
    4449#if ENABLE(ATTACHMENT_ELEMENT)
    4550
  • trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm

    r242748 r242979  
    136136}
    137137
     138bool WebPageProxy::scrollingUpdatesDisabledForTesting()
     139{
     140    return pageClient().scrollingUpdatesDisabledForTesting();
     141}
     142
    138143#if ENABLE(DRAG_SUPPORT)
    139144
  • trunk/Source/WebKit/UIProcess/PageClient.h

    r242757 r242979  
    424424    virtual void isPlayingAudioWillChange() = 0;
    425425    virtual void isPlayingAudioDidChange() = 0;
     426
    426427    virtual void pinnedStateWillChange() { }
    427428    virtual void pinnedStateDidChange() { }
     429    virtual bool scrollingUpdatesDisabledForTesting() { return false; }
    428430
    429431    virtual bool hasSafeBrowsingWarning() const { return false; }
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp

    r242913 r242979  
    205205        return;
    206206
     207    if (m_webPageProxy.scrollingUpdatesDisabledForTesting())
     208        return;
     209
    207210#if PLATFORM(IOS_FAMILY)
    208211    m_webPageProxy.scrollingNodeScrollViewDidScroll();
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r242952 r242979  
    13101310#endif
    13111311
     1312    bool scrollingUpdatesDisabledForTesting();
     1313
    13121314    void installActivityStateChangeCompletionHandler(Function<void()>&&);
    13131315
  • trunk/Tools/ChangeLog

    r242975 r242979  
     12019-03-14  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Make it possible to test scrolling tree layer manipulation more easily
     4        https://bugs.webkit.org/show_bug.cgi?id=195780
     5
     6        Reviewed by Tim Horton.
     7       
     8        Add a boolean attribute 'scrollUpdatesDisabled' on UIScriptController that
     9        cuts off communication of scrolling tree scrolls back to the web process
     10        (in RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll()). This
     11        allows tests to trigger scrolls which run the scrolling tree layer positioning
     12        logic, but never get another commit from the web process that might mask
     13        scrolling tree bugs.
     14       
     15        WKWebView's testing protocol get @property _scrollingUpdatesDisabledForTesting,
     16        whose getters and setters are overridden by TestRunnerWKWebView. Plumbing
     17        via PageClient and WebPageProxy makes this flag reachable by RemoteScrollingCoordinatorProxy.
     18
     19        * DumpRenderTree/ios/UIScriptControllerIOS.mm:
     20        (WTR::UIScriptController::scrollUpdatesDisabled const):
     21        (WTR::UIScriptController::setScrollUpdatesDisabled):
     22        * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
     23        * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
     24        (WTR::UIScriptController::scrollUpdatesDisabled const):
     25        (WTR::UIScriptController::setScrollUpdatesDisabled):
     26        * TestRunnerShared/UIScriptContext/UIScriptController.h:
     27        * WebKitTestRunner/cocoa/TestRunnerWKWebView.h:
     28        * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
     29        (-[TestRunnerWKWebView _scrollingUpdatesDisabledForTesting]):
     30        (-[TestRunnerWKWebView _setScrollingUpdatesDisabledForTesting:]):
     31        * WebKitTestRunner/ios/TestControllerIOS.mm:
     32        (WTR::TestController::platformResetStateToConsistentValues):
     33        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
     34        (WTR::UIScriptController::scrollUpdatesDisabled const):
     35        (WTR::UIScriptController::setScrollUpdatesDisabled):
     36
    1372019-03-14  Youenn Fablet  <youenn@apple.com>
    238
  • trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm

    r242773 r242979  
    239239}
    240240
     241bool UIScriptController::scrollUpdatesDisabled() const
     242{
     243    return false;
     244}
     245
     246void UIScriptController::setScrollUpdatesDisabled(bool)
     247{
     248}
     249
    241250void UIScriptController::scrollToOffset(long x, long y)
    242251{
  • trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl

    r242773 r242979  
    245245    readonly attribute double contentOffsetY;
    246246
     247    attribute boolean scrollUpdatesDisabled; // Turns off notifications back to the web process after scrolls (used for testing scrolling tree).
     248
    247249    void scrollToOffset(long x, long y); // Initiate an animated scroll in the UI process.
    248250    attribute object didEndScrollingCallback;
  • trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp

    r242773 r242979  
    386386}
    387387
     388bool UIScriptController::scrollUpdatesDisabled() const
     389{
     390    return false;
     391}
     392
     393void UIScriptController::setScrollUpdatesDisabled(bool)
     394{
     395}
     396
    388397void UIScriptController::scrollToOffset(long x, long y)
    389398{
  • trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h

    r242773 r242979  
    126126    double contentOffsetY() const;
    127127
     128    bool scrollUpdatesDisabled() const;
     129    void setScrollUpdatesDisabled(bool);
     130
    128131    void scrollToOffset(long x, long y);
    129132
  • trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h

    r242339 r242979  
    6262
    6363@property (nonatomic, retain, setter=_setStableStateOverride:) NSNumber *_stableStateOverride;
     64@property (nonatomic, setter=_setScrollingUpdatesDisabledForTesting:) BOOL _scrollingUpdatesDisabledForTesting;
    6465
    6566@end
  • trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm

    r242339 r242979  
    4848@interface TestRunnerWKWebView () <WKUIDelegatePrivate> {
    4949    RetainPtr<NSNumber> m_stableStateOverride;
    50     BOOL m_isInteractingWithFormControl;
     50    BOOL _isInteractingWithFormControl;
     51    BOOL _scrollingUpdatesDisabled;
    5152}
    5253
     
    109110- (void)didStartFormControlInteraction
    110111{
    111     m_isInteractingWithFormControl = YES;
     112    _isInteractingWithFormControl = YES;
    112113
    113114    if (self.didStartFormControlInteractionCallback)
     
    117118- (void)didEndFormControlInteraction
    118119{
    119     m_isInteractingWithFormControl = NO;
     120    _isInteractingWithFormControl = NO;
    120121
    121122    if (self.didEndFormControlInteractionCallback)
     
    125126- (BOOL)isInteractingWithFormControl
    126127{
    127     return m_isInteractingWithFormControl;
     128    return _isInteractingWithFormControl;
    128129}
    129130
     
    235236}
    236237
     238- (BOOL)_scrollingUpdatesDisabledForTesting
     239{
     240    return _scrollingUpdatesDisabled;
     241}
     242
     243- (void)_setScrollingUpdatesDisabledForTesting:(BOOL)disabled
     244{
     245    _scrollingUpdatesDisabled = disabled;
     246}
     247
    237248- (void)_didEndRotation
    238249{
  • trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm

    r242621 r242979  
    147147        TestRunnerWKWebView *webView = platformWebView->platformView();
    148148        webView._stableStateOverride = nil;
     149        webView._scrollingUpdatesDisabledForTesting = NO;
    149150        webView.usesSafariLikeRotation = NO;
    150151        webView.overrideSafeAreaInsets = UIEdgeInsetsZero;
  • trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm

    r242773 r242979  
    547547}
    548548
     549bool UIScriptController::scrollUpdatesDisabled() const
     550{
     551    TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
     552    return webView._scrollingUpdatesDisabledForTesting;
     553}
     554
     555void UIScriptController::setScrollUpdatesDisabled(bool disabled)
     556{
     557    TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
     558    webView._scrollingUpdatesDisabledForTesting = disabled;
     559}
     560
    549561void UIScriptController::scrollToOffset(long x, long y)
    550562{
Note: See TracChangeset for help on using the changeset viewer.