Make it possible to test non-stable-state scrolling on iOS
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 19 Nov 2016 19:02:04 +0000 (19:02 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 19 Nov 2016 19:02:04 +0000 (19:02 +0000)
commitf0cb4d86d1d72f51ef66cdceea56f8462c24cbf7
tree7661376888c9ff978cd536af67bb81413fddb7f4
parentd7c871abd99d8bc4806e73853fbda347272a4e73
Make it possible to test non-stable-state scrolling on iOS
https://bugs.webkit.org/show_bug.cgi?id=164905

Reviewed by Dan Bernstein.

Source/WebKit2:

Make it possible for an iOS layout test to force every visible rect update
from the UI process to the web process to be in a non-stable state. This emulates
what happens during panning and zooming interactions, and allows us to test the
scrolling and layer trees in these transient states.

This is done by adding a testing property on WKWebView, _stableStateOverride, whose
getters and setters are overridden in TestRunnerWKWebView. When non-nil, we _updateVisibleContentRectAfterScrollInView
consults the NSNumber's boolValue and uses it to override the stable state.

To facilitate this kind of testing, also add immediateScrollToOffset() and
immediateZoomToScale() to UIScriptController. Finally, add doAfterPresentationUpdate()
which provides a callback that fires after one trip to the web process and back.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _updateVisibleContentRectAfterScrollInView:]):
(-[WKWebView _stableStateOverride]):
(-[WKWebView _setStableStateOverride:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:

Tools:

Make it possible for an iOS layout test to force every visible rect update
from the UI process to the web process to be in a non-stable state. This emulates
what happens during panning and zooming interactions, and allows us to test the
scrolling and layer trees in these transient states.

This is done by adding a testing property on WKWebView, _stableStateOverride, whose
getters and setters are overridden in TestRunnerWKWebView. When non-nil, we _updateVisibleContentRectAfterScrollInView
consults the NSNumber's boolValue and uses it to override the stable state.

To facilitate this kind of testing, also add immediateScrollToOffset() and
immediateZoomToScale() to UIScriptController. Finally, add doAfterPresentationUpdate()
which provides a callback that fires after one trip to the web process and back.

Add code generation support for optional boolean attributes in IDL.

Align CodeGeneratorDumpRenderTree.pm and CodeGeneratorTestRunner.pm.

* DumpRenderTree/Bindings/CodeGeneratorDumpRenderTree.pm:
(_generateImplementationFile):
(_platformTypeConstructor):
(_returnExpression):
* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::doAfterPresentationUpdate):
(WTR::contentOffsetBoundedInValidRange):
(WTR::UIScriptController::scrollToOffset):
(WTR::UIScriptController::immediateScrollToOffset):
(WTR::UIScriptController::immediateZoomToScale):
(WTR::UIScriptController::stableStateOverride):
(WTR::UIScriptController::setStableStateOverride):
* DumpRenderTree/mac/UIScriptControllerMac.mm:
(WTR::UIScriptController::doAfterPresentationUpdate):
* TestRunnerShared/Bindings/JSWrappable.h:
(WTR::JSValueMakeBooleanOrNull):
(WTR::JSValueToNullableBoolean):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::immediateScrollToOffset):
(WTR::UIScriptController::immediateZoomToScale):
(WTR::UIScriptController::stableStateOverride):
(WTR::UIScriptController::setStableStateOverride):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm:
(_classRefGetter):
(_platformTypeConstructor):
(_returnExpression):
* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView dealloc]):
(-[TestRunnerWKWebView _stableStateOverride]):
(-[TestRunnerWKWebView _setStableStateOverride:]):
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::doAsyncTask):
(WTR::UIScriptController::doAfterPresentationUpdate):
(WTR::UIScriptController::zoomToScale):
(WTR::UIScriptController::immediateScrollToOffset):
(WTR::UIScriptController::immediateZoomToScale):
(WTR::UIScriptController::stableStateOverride):
(WTR::UIScriptController::setStableStateOverride):
* WebKitTestRunner/mac/UIScriptControllerMac.mm:
(WTR::UIScriptController::doAfterPresentationUpdate):

LayoutTests:

* scrollingcoordinator/ios/non-stable-viewport-scroll-expected.txt: Added.
* scrollingcoordinator/ios/non-stable-viewport-scroll.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208926 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/scrollingcoordinator/ios/non-stable-viewport-scroll-expected.txt [new file with mode: 0644]
LayoutTests/scrollingcoordinator/ios/non-stable-viewport-scroll.html [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
Tools/ChangeLog
Tools/DumpRenderTree/Bindings/CodeGeneratorDumpRenderTree.pm
Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm
Tools/DumpRenderTree/mac/UIScriptControllerMac.mm
Tools/TestRunnerShared/Bindings/JSWrappable.h
Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp
Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm
Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h
Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm
Tools/WebKitTestRunner/ios/TestControllerIOS.mm
Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm