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
+2016-11-18 Simon Fraser <simon.fraser@apple.com>
+
+ Make it possible to test non-stable-state scrolling on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=164905
+
+ Reviewed by Dan Bernstein.
+
+ * scrollingcoordinator/ios/non-stable-viewport-scroll-expected.txt: Added.
+ * scrollingcoordinator/ios/non-stable-viewport-scroll.html: Added.
+
2016-11-19 Joanmarie Diggs <jdiggs@igalia.com>
AX: [ATK] Expose aria-busy via ATK_STATE_BUSY
--- /dev/null
+fixed
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 320.00 5013.00)
+ (visible rect 0.00, 1000.00 106.67 x 189.33)
+ (coverage rect 0.00, 1000.00 106.67 x 189.33)
+ (intersects coverage rect 1)
+ (contentsScale 6.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 320.00 5013.00)
+ (contentsOpaque 1)
+ (visible rect 0.00, 1000.00 106.67 x 189.33)
+ (coverage rect 0.00, 957.33 192.00 x 274.67)
+ (intersects coverage rect 1)
+ (contentsScale 6.00)
+ (children 1
+ (GraphicsLayer
+ (position 10.00 0.00)
+ (bounds 100.00 568.00)
+ (usingTiledLayer 1)
+ (contentsOpaque 1)
+ (drawsContent 1)
+ (visible rect 0.00, 0.00 100.00 x 568.00)
+ (coverage rect -10.00, 0.00 320.00 x 568.00)
+ (intersects coverage rect 1)
+ (contentsScale 6.00)
+ )
+ )
+ )
+ )
+)
+
--- /dev/null
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+ <meta name="viewport" content="initial-scale=1.0">
+ <style>
+ body {
+ height: 5000px;
+ margin: 0;
+ }
+
+ .fixed {
+ position: fixed;
+ top: 0;
+ left: 10px;
+ height: 100%;
+ width: 100px;
+ background-color: blue;
+ }
+ </style>
+ <script>
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ }
+
+ function getUnstableScrollScript(x, y)
+ {
+ return `(function() {
+ uiController.stableStateOverride = false;
+ uiController.immediateZoomToScale(3);
+ uiController.immediateScrollToOffset(0, 3000);
+
+ uiController.doAfterPresentationUpdate(function() {
+ uiController.uiScriptComplete();
+ });
+
+ })();`;
+ }
+
+ function doTest()
+ {
+ if (!testRunner.runUIScript)
+ return
+
+ testRunner.runUIScript(getUnstableScrollScript(), function() {
+ document.getElementById('layers').textContent = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS);
+ testRunner.notifyDone();
+ });
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+<div class="fixed">fixed</div>
+<pre id="layers"></pre>
+</body>
+</html>
2016-11-18 Simon Fraser <simon.fraser@apple.com>
+ Make it possible to test non-stable-state scrolling on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=164905
+
+ Reviewed by Dan Bernstein.
+
+ 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:
+
+2016-11-18 Simon Fraser <simon.fraser@apple.com>
+
[iOS WK2] Eliminate a source of flakiness in layout tests by forcing WebPage into "responsive" mode for all tests, with an internals override
https://bugs.webkit.org/show_bug.cgi?id=164980
if (isStableState && [scrollView respondsToSelector:@selector(_isInterruptingDeceleration)])
isStableState = ![scrollView performSelector:@selector(_isInterruptingDeceleration)];
+ if (NSNumber *stableOverride = self._stableStateOverride)
+ isStableState = stableOverride.boolValue;
+
[self _updateContentRectsWithState:isStableState];
}
return coordinator->scrollingTreeAsText();
}
+- (NSNumber *)_stableStateOverride
+{
+ // For subclasses to override.
+ return nil;
+}
+
#endif // PLATFORM(IOS)
#if PLATFORM(MAC)
@property (nonatomic, readonly) NSString *_scrollingTreeAsText WK_API_AVAILABLE(ios(WK_IOS_TBA));
-#endif
+@property (nonatomic, readonly) NSNumber *_stableStateOverride WK_API_AVAILABLE(ios(WK_IOS_TBA));
+
+#endif // TARGET_OS_IPHONE
#if !TARGET_OS_IPHONE
@property (nonatomic, readonly) BOOL _hasActiveVideoForControlsManager WK_API_AVAILABLE(macosx(10.12));
+2016-11-18 Simon Fraser <simon.fraser@apple.com>
+
+ Make it possible to test non-stable-state scrolling on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=164905
+
+ Reviewed by Dan Bernstein.
+
+ 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):
+
2016-11-19 Joanmarie Diggs <jdiggs@igalia.com>
AX: [ATK] Expose aria-busy via ATK_STATE_BUSY
static JSClassRef jsClass;
if (!jsClass) {
JSClassDefinition definition = kJSClassDefinitionEmpty;
- definition.className = "${type}";
+ definition.className = "@{[$type->name]}";
definition.parentClass = @{[$self->_parentClassRefGetterExpression($interface)]};
definition.staticValues = staticValues();
definition.staticFunctions = staticFunctions();
{
my ($self, $type, $argumentName) = @_;
- return "JSValueToBoolean(context, $argumentName)" if $type eq "boolean";
+ return "JSValueToNullableBoolean(context, $argumentName)" if $type->name eq "boolean" && $type->isNullable;
+ return "JSValueToBoolean(context, $argumentName)" if $type->name eq "boolean";
return "$argumentName" if $type->name eq "object";
return "JSRetainPtr<JSStringRef>(Adopt, JSValueToStringCopy(context, $argumentName, 0))" if $$self{codeGenerator}->IsStringType($type);
return "JSValueToNumber(context, $argumentName, 0)" if $$self{codeGenerator}->IsNonPointerType($type);
my ($self, $returnType, $expression) = @_;
return "JSValueMakeUndefined(context)" if $returnType->name eq "void";
+ return "JSValueMakeBooleanOrNull(context, ${expression})" if $returnType->name eq "boolean" && $returnType->isNullable;
return "JSValueMakeBoolean(context, ${expression})" if $returnType->name eq "boolean";
return "${expression}" if $returnType->name eq "object";
return "JSValueMakeNumber(context, ${expression})" if $$self{codeGenerator}->IsNonPointerType($returnType);
});
}
+void UIScriptController::doAfterPresentationUpdate(JSValueRef callback)
+{
+ return doAsyncTask(callback);
+}
+
void UIScriptController::zoomToScale(double scale, JSValueRef callback)
{
RefPtr<UIScriptController> protectedThis(this);
return nullptr;
}
-void UIScriptController::scrollToOffset(long, long)
+static CGPoint contentOffsetBoundedInValidRange(UIScrollView *scrollView, CGPoint contentOffset)
+{
+ UIEdgeInsets contentInsets = scrollView.contentInset;
+ CGSize contentSize = scrollView.contentSize;
+ CGSize scrollViewSize = scrollView.bounds.size;
+
+ CGFloat maxHorizontalOffset = contentSize.width + contentInsets.right - scrollViewSize.width;
+ contentOffset.x = std::min(maxHorizontalOffset, contentOffset.x);
+ contentOffset.x = std::max(-contentInsets.left, contentOffset.x);
+
+ CGFloat maxVerticalOffset = contentSize.height + contentInsets.bottom - scrollViewSize.height;
+ contentOffset.y = std::min(maxVerticalOffset, contentOffset.y);
+ contentOffset.y = std::max(-contentInsets.top, contentOffset.y);
+ return contentOffset;
+}
+
+void UIScriptController::scrollToOffset(long x, long y)
+{
+ [gWebScrollView setContentOffset:contentOffsetBoundedInValidRange(gWebScrollView, CGPointMake(x, y)) animated:YES];
+}
+
+void UIScriptController::immediateScrollToOffset(long x, long y)
{
+ [gWebScrollView setContentOffset:contentOffsetBoundedInValidRange(gWebScrollView, CGPointMake(x, y)) animated:NO];
+}
+
+void UIScriptController::immediateZoomToScale(double scale)
+{
+ [gWebScrollView setZoomScale:scale animated:NO];
}
void UIScriptController::keyboardAccessoryBarNext()
return gWebScrollView.maximumZoomScale;
}
+Optional<bool> UIScriptController::stableStateOverride() const
+{
+ return Nullopt;
+}
+
+void UIScriptController::setStableStateOverride(Optional<bool>)
+{
+}
+
+
JSObjectRef UIScriptController::contentVisibleRect() const
{
CGRect contentVisibleRect = [gWebBrowserView documentVisibleRect];
});
}
+void UIScriptController::doAfterPresentationUpdate(JSValueRef callback)
+{
+ return doAsyncTask(callback);
+}
+
void UIScriptController::insertText(JSStringRef, int, int)
{
}
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef JSWrappable_h
-#define JSWrappable_h
+#pragma once
#include <JavaScriptCore/JavaScript.h>
+#include <wtf/Optional.h>
#include <wtf/RefCounted.h>
namespace WTR {
virtual JSClassRef wrapperClass() = 0;
};
+inline JSValueRef JSValueMakeBooleanOrNull(JSContextRef context, Optional<bool> value)
+{
+ return value ? JSValueMakeBoolean(context, value.value()) : JSValueMakeNull(context);
+}
+
+inline Optional<bool> JSValueToNullableBoolean(JSContextRef context, JSValueRef value)
+{
+ return JSValueIsUndefined(context, value) || JSValueIsNull(context, value) ? Nullopt : Optional<bool>(JSValueToBoolean(context, value));
+}
+
inline JSValueRef JSValueMakeStringOrNull(JSContextRef context, JSStringRef stringOrNull)
{
return stringOrNull ? JSValueMakeString(context, stringOrNull) : JSValueMakeNull(context);
}
} // namespace WTR
-
-#endif // JSWrappable_h
interface UIScriptController {
void doAsyncTask(object callback); // Used to test the harness.
-
- void zoomToScale(double scale, object callback);
+ void doAfterPresentationUpdate(object callback); // Call the callback after sending a message to the WebProcess and receiving a subsequent update.
void simulateAccessibilitySettingsChangeNotification(object callback);
attribute object willBeginZoomingCallback;
attribute object didEndZoomingCallback;
+ void zoomToScale(double scale, object callback);
+
void scrollToOffset(long x, long y); // Initiate an animated scroll in the UI process.
attribute object didEndScrollingCallback;
+ void immediateScrollToOffset(long x, long y); // Set the scroll position in the UI process without animation.
+ void immediateZoomToScale(double scale); // Set the zoom scale in the UI process without animation.
+
// View state
readonly attribute double zoomScale;
readonly attribute double minimumZoomScale;
readonly attribute double maximumZoomScale;
+ // Overides the "in stable state" behavior of WKWebView (only applies to iOS)
+ // When false, content rect updates to the web process have inStableState=false, as if a scroll or zoom were in progress.
+ attribute boolean? stableStateOverride;
+
readonly attribute object contentVisibleRect; // Returned object has 'left', 'top', 'width', 'height' properties.
readonly attribute object selectionRangeViewRects; // An array of objects with 'left', 'top', 'width', and 'height' properties.
void simulateAccessibilitySettingsChangeNotification(JSValueRef)
{
}
+
+void UIScriptController::doAfterPresentationUpdate(JSValueRef)
+{
+}
#endif
void UIScriptController::setDidStartFormControlInteractionCallback(JSValueRef callback)
{
}
+void UIScriptController::immediateScrollToOffset(long x, long y)
+{
+}
+
+void UIScriptController::immediateZoomToScale(double scale)
+{
+}
+
void UIScriptController::keyboardAccessoryBarNext()
{
}
return 1;
}
+Optional<bool> UIScriptController::stableStateOverride() const
+{
+ return Nullopt;
+}
+
+void UIScriptController::setStableStateOverride(Optional<bool>)
+{
+}
+
JSObjectRef UIScriptController::contentVisibleRect() const
{
return nullptr;
#include "JSWrappable.h"
#include <JavaScriptCore/JSRetainPtr.h>
+#include <wtf/Optional.h>
#include <wtf/Ref.h>
namespace WebCore {
void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception);
void doAsyncTask(JSValueRef callback);
+ void doAfterPresentationUpdate(JSValueRef callback);
+
void zoomToScale(double scale, JSValueRef callback);
void simulateAccessibilitySettingsChangeNotification(JSValueRef callback);
void scrollToOffset(long x, long y);
+ void immediateScrollToOffset(long x, long y);
+ void immediateZoomToScale(double scale);
+
void setDidStartFormControlInteractionCallback(JSValueRef);
JSValueRef didStartFormControlInteractionCallback() const;
double zoomScale() const;
double minimumZoomScale() const;
double maximumZoomScale() const;
+
+ Optional<bool> stableStateOverride() const;
+ void setStableStateOverride(Optional<bool>);
JSObjectRef contentVisibleRect() const;
sub _classRefGetter
{
my ($self, $type) = @_;
+
return $$self{codeGenerator}->WK_lcfirst(_implementationClassName($type)) . "Class";
}
{
my ($self, $type, $argumentName) = @_;
+ return "JSValueToNullableBoolean(context, $argumentName)" if $type->name eq "boolean" && $type->isNullable;
return "JSValueToBoolean(context, $argumentName)" if $type->name eq "boolean";
return "$argumentName" if $type->name eq "object";
return "JSRetainPtr<JSStringRef>(Adopt, JSValueToStringCopy(context, $argumentName, 0))" if $$self{codeGenerator}->IsStringType($type);
my ($self, $returnType, $expression) = @_;
return "JSValueMakeUndefined(context)" if $returnType->name eq "void";
+ return "JSValueMakeBooleanOrNull(context, ${expression})" if $returnType->name eq "boolean" && $returnType->isNullable;
return "JSValueMakeBoolean(context, ${expression})" if $returnType->name eq "boolean";
return "${expression}" if $returnType->name eq "object";
return "JSValueMakeNumber(context, ${expression})" if $$self{codeGenerator}->IsNonPointerType($returnType);
@property (nonatomic, copy) void (^didHideKeyboardCallback)(void);
@property (nonatomic, copy) void (^didEndScrollingCallback)(void);
-- (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration;
-- (void)dealloc;
-
- (void)zoomToScale:(double)scale animated:(BOOL)animated completionHandler:(void (^)(void))completionHandler;
#endif
+@property (nonatomic, retain, setter=_setStableStateOverride:) NSNumber *_stableStateOverride;
+
@end
#endif // #if WK_API_ENABLED
#if WK_API_ENABLED
-@interface TestRunnerWKWebView ()
+@interface TestRunnerWKWebView () {
+ RetainPtr<NSNumber *> _stableStateOverride;
+}
+
@property (nonatomic, copy) void (^zoomToScaleCompletionHandler)(void);
@property (nonatomic, copy) void (^showKeyboardCompletionHandler)(void);
@property (nonatomic) BOOL isShowingKeyboard;
+
@end
@implementation TestRunnerWKWebView
if (self.didEndScrollingCallback)
self.didEndScrollingCallback();
}
+
+- (NSNumber *)_stableStateOverride
+{
+ return _stableStateOverride.get();
+}
+
+- (void)_setStableStateOverride:(NSNumber *)overrideBoolean
+{
+ _stableStateOverride = overrideBoolean;
+}
+
#endif
@end
cocoaResetStateToConsistentValues();
if (PlatformWebView* webView = mainWebView()) {
+ webView->platformView()._stableStateOverride = nil;
UIScrollView *scrollView = webView->platformView().scrollView;
[scrollView setZoomScale:1 animated:NO];
[scrollView setContentOffset:CGPointZero];
});
}
+void UIScriptController::doAfterPresentationUpdate(JSValueRef callback)
+{
+ TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
+
+ unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+ [webView _doAfterNextPresentationUpdate:^{
+ if (!m_context)
+ return;
+ m_context->asyncTaskComplete(callbackID);
+ }];
+}
+
void UIScriptController::zoomToScale(double scale, JSValueRef callback)
{
TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
[webView.scrollView setContentOffset:contentOffsetBoundedInValidRange(webView.scrollView, CGPointMake(x, y)) animated:YES];
}
+void UIScriptController::immediateScrollToOffset(long x, long y)
+{
+ TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
+ [webView.scrollView setContentOffset:contentOffsetBoundedInValidRange(webView.scrollView, CGPointMake(x, y)) animated:NO];
+}
+
+void UIScriptController::immediateZoomToScale(double scale)
+{
+ TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
+ [webView.scrollView setZoomScale:scale animated:NO];
+}
+
void UIScriptController::keyboardAccessoryBarNext()
{
TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
return webView.scrollView.maximumZoomScale;
}
+Optional<bool> UIScriptController::stableStateOverride() const
+{
+ TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
+ if (webView._stableStateOverride)
+ return webView._stableStateOverride.boolValue;
+
+ return Nullopt;
+}
+
+void UIScriptController::setStableStateOverride(Optional<bool> overrideValue)
+{
+ TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
+ if (overrideValue)
+ webView._stableStateOverride = @(overrideValue.value());
+ else
+ webView._stableStateOverride = nil;
+}
+
JSObjectRef UIScriptController::contentVisibleRect() const
{
TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
});
}
+void UIScriptController::doAfterPresentationUpdate(JSValueRef callback)
+{
+ return doAsyncTask(callback);
+}
+
void UIScriptController::insertText(JSStringRef text, int location, int length)
{
#if WK_API_ENABLED