WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch (Rebased copy of Dan's patch)
bug-196360-20190409132457.patch (text/plain), 26.94 KB, created by
Brent Fulgham
on 2019-04-09 13:24:58 PDT
(
hide
)
Description:
Patch (Rebased copy of Dan's patch)
Filename:
MIME Type:
Creator:
Brent Fulgham
Created:
2019-04-09 13:24:58 PDT
Size:
26.94 KB
patch
obsolete
>Subversion Revision: 244094 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index a3806ac1e7bd0b4aabd0ed85a1b0a6f97d599b8d..cf250ffa8471165e9271267f0c1091644c774767 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,28 @@ >+2019-04-09 Daniel Bates <dabates@apple.com> >+ >+ [iPad] Should open popover when the spacebar is pressed >+ https://bugs.webkit.org/show_bug.cgi?id=196360 >+ <rdar://problem/49389129> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Pressing the spacebar should open the popover for a focused popup button (e.g. <select>) on iOS >+ just like it does on the Mac. >+ >+ For now, we keep the iPhone behavior of blurring the element when the Done button is pressed and >+ hence pressing spacebar does nothing (because there is no focused element). >+ >+ * UIProcess/ios/WKContentViewInteraction.h: >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView accessoryOpen]): Added. Extracted the logic from -_elementDidFocus to scroll to >+ the focused element, update the accessory and then tell the accessory to begin editing. >+ (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): >+ Write in terms of -accessoryOpen. >+ * UIProcess/ios/forms/WKFormPeripheralBase.mm: >+ (-[WKFormPeripheralBase handleKeyEvent:]): Interpret the spacebar when the peripheral is closed (!_editing) >+ and call -accessoryOpen to ultimately call back to this peripheral to tell it to begin editing, >+ which will cause the popover to appear again. >+ > 2019-04-09 Andy Estes <aestes@apple.com> > > [Apple Pay] Add release logging to PaymentCoordinator >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >index ad2fe6e236f28629f78941bdd35a42afebea0643..7fdd14682988a16d9ac4160be7866e27a5687914 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >@@ -428,7 +428,6 @@ FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW) > - (void)_showPlaybackTargetPicker:(BOOL)hasVideo fromRect:(const WebCore::IntRect&)elementRect routeSharingPolicy:(WebCore::RouteSharingPolicy)policy routingContextUID:(NSString *)contextUID; > - (void)_showRunOpenPanel:(API::OpenPanelParameters*)parameters resultListener:(WebKit::WebOpenPanelResultListenerProxy*)listener; > - (void)_showShareSheet:(const WebCore::ShareDataWithParsedURL&)shareData completionHandler:(WTF::CompletionHandler<void(bool)>&&)completionHandler; >-- (void)accessoryDone; > - (void)dismissFilePicker; > - (void)_didHandleKeyEvent:(::WebEvent *)event eventWasHandled:(BOOL)eventWasHandled; > - (Vector<WebKit::OptionItem>&) focusedSelectElementOptions; >@@ -449,6 +448,11 @@ FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW) > - (WKFormInputSession *)_formInputSession; > - (void)_didChangeWebViewEditability; > >+// UIWebFormAccessoryDelegate protocol >+- (void)accessoryDone; >+ >+- (void)accessoryOpen; >+ > - (void)_requestDOMPasteAccessWithElementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler; > > @property (nonatomic, readonly) WebKit::InteractionInformationAtPosition currentPositionInformation; >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 09e96ab028221144378f15bcba46d4dacf046282..354189e249fc694b8265ec04772eadfbb3ad4922 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -3807,6 +3807,15 @@ - (UIWebFormAccessory *)formAccessoryView > return _formAccessoryView.get(); > } > >+- (void)accessoryOpen >+{ >+ if (!_inputPeripheral) >+ return; >+ [self _zoomToRevealFocusedElement]; >+ [self _updateAccessory]; >+ [_inputPeripheral beginEditing]; >+} >+ > - (void)_updateAccessory > { > auto* accessoryView = self.formAccessoryView; // Creates one, if needed. >@@ -4999,9 +5008,7 @@ - (void)_elementDidFocus:(const WebKit::FocusedElementInformation&)information u > if (_inputPeripheral) { > if (!self.isFirstResponder) > [self becomeFirstResponder]; >- [self _zoomToRevealFocusedElement]; >- [self _updateAccessory]; >- [_inputPeripheral beginEditing]; >+ [self accessoryOpen]; > } > return; > } >diff --git a/Source/WebKit/UIProcess/ios/forms/WKFormPeripheralBase.mm b/Source/WebKit/UIProcess/ios/forms/WKFormPeripheralBase.mm >index 5f2896938e02546d919b2cb7ceabcbc92348cfee..841527b0c5be8230c3f1698027e3c5a4f72545bb 100644 >--- a/Source/WebKit/UIProcess/ios/forms/WKFormPeripheralBase.mm >+++ b/Source/WebKit/UIProcess/ios/forms/WKFormPeripheralBase.mm >@@ -84,6 +84,10 @@ - (BOOL)handleKeyEvent:(UIEvent *)event > [_view accessoryDone]; > return YES; > } >+ if (!_editing && keyEvent._keyCode == kHIDUsage_KeyboardSpacebar) { >+ [_view accessoryOpen]; >+ return YES; >+ } > return NO; > } > >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index b26f63c57819f19eef5fcf8198cc5c29e4e76e85..5e54066b052384a10d8e6d4c7ae0cb435dffe871 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,39 @@ >+2019-04-09 Daniel Bates <dabates@apple.com> >+ >+ [iPad] Should open popover when the spacebar is pressed >+ https://bugs.webkit.org/show_bug.cgi?id=196360 >+ <rdar://problem/49389129> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add testing infrastructure to support waiting for a popover to be presented or dismissed. >+ >+ * DumpRenderTree/ios/UIScriptControllerIOS.mm: >+ (WTR::UIScriptController::isShowingPopover const): Added. >+ (WTR::UIScriptController::platformSetWillPresentPopoverCallback): Added. >+ (WTR::UIScriptController::platformSetDidDismissPopoverCallback): Added. >+ * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: >+ * TestRunnerShared/UIScriptContext/UIScriptContext.h: >+ * TestRunnerShared/UIScriptContext/UIScriptController.cpp: >+ (WTR::UIScriptController::setWillPresentPopoverCallback): Added. >+ (WTR::UIScriptController::willPresentPopoverCallback const): Added. >+ (WTR::UIScriptController::setDidDismissPopoverCallback): Added. >+ (WTR::UIScriptController::didDismissPopoverCallback const): Added. >+ (WTR::UIScriptController::isShowingPopover const): Added. >+ (WTR::UIScriptController::platformSetWillPresentPopoverCallback): Added. >+ (WTR::UIScriptController::platformSetDidDismissPopoverCallback): Added. >+ * TestRunnerShared/UIScriptContext/UIScriptController.h: >+ * WebKitTestRunner/cocoa/TestRunnerWKWebView.h: >+ * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm: >+ (-[TestRunnerWKWebView initWithFrame:configuration:]): Update some state. >+ (-[TestRunnerWKWebView resetInteractionCallbacks]): Ditto. >+ (-[TestRunnerWKWebView _willPresentPopover]): Added. >+ (-[TestRunnerWKWebView _didDismissPopover]): Added. >+ * WebKitTestRunner/ios/UIScriptControllerIOS.mm: >+ (WTR::UIScriptController::isShowingPopover const): Added. >+ (WTR::UIScriptController::platformSetWillPresentPopoverCallback): Added. >+ (WTR::UIScriptController::platformSetDidDismissPopoverCallback): Added. >+ > 2019-04-09 Alex Christensen <achristensen@webkit.org> > > Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page >diff --git a/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm b/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >index 22d55abc12bb9cb81ac746dd0a48876472ffeb51..2ee91b07a3ab6078e8e004a2e0e7090e9d799022 100644 >--- a/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >+++ b/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >@@ -353,6 +353,19 @@ void UIScriptController::platformSetDidHideMenuCallback() > { > } > >+bool UIScriptController::isShowingPopover() const >+{ >+ return false; >+} >+ >+void UIScriptController::platformSetWillPresentPopoverCallback() >+{ >+} >+ >+void UIScriptController::platformSetDidDismissPopoverCallback() >+{ >+} >+ > JSObjectRef UIScriptController::rectForMenuAction(JSStringRef) const > { > return nullptr; >diff --git a/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl b/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >index eecb2060eb6b2e129f8b12d3cc520bf557fa0f7c..23fe3265c618d3b8a2756338f1740ff94fb43d50 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >+++ b/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >@@ -231,6 +231,10 @@ interface UIScriptController { > readonly attribute object menuRect; > object rectForMenuAction(DOMString action); > >+ readonly attribute boolean isShowingPopover; >+ attribute object willPresentPopoverCallback; >+ attribute object didDismissPopoverCallback; >+ > attribute object willBeginZoomingCallback; > attribute object didEndZoomingCallback; > >diff --git a/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.h b/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.h >index 8040647a23f237618a3ebd65d76227e8c4a2b6df..47ffe8fb1c45eb6360f91b7593e03213117aad29 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.h >+++ b/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.h >@@ -56,6 +56,8 @@ typedef enum { > CallbackTypeDidHideKeyboard, > CallbackTypeDidShowMenu, > CallbackTypeDidHideMenu, >+ CallbackTypeWillPresentPopover, >+ CallbackTypeDidDismissPopover, > CallbackTypeDidEndScrolling, > CallbackTypeDidStartFormControlInteraction, > CallbackTypeDidEndFormControlInteraction, >diff --git a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >index 23e42d124b1e9eccb7eb9369dea2b4bdb6fac6af..6faab08387eef13391593efebeb4d119b7ce6f23 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >+++ b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >@@ -227,6 +227,28 @@ JSValueRef UIScriptController::didHideMenuCallback() const > return m_context->callbackWithID(CallbackTypeDidHideMenu); > } > >+void UIScriptController::setWillPresentPopoverCallback(JSValueRef callback) >+{ >+ m_context->registerCallback(callback, CallbackTypeWillPresentPopover); >+ platformSetWillPresentPopoverCallback(); >+} >+ >+JSValueRef UIScriptController::willPresentPopoverCallback() const >+{ >+ return m_context->callbackWithID(CallbackTypeWillPresentPopover); >+} >+ >+void UIScriptController::setDidDismissPopoverCallback(JSValueRef callback) >+{ >+ m_context->registerCallback(callback, CallbackTypeDidDismissPopover); >+ platformSetDidDismissPopoverCallback(); >+} >+ >+JSValueRef UIScriptController::didDismissPopoverCallback() const >+{ >+ return m_context->callbackWithID(CallbackTypeDidDismissPopover); >+} >+ > #if !PLATFORM(COCOA) > > void UIScriptController::zoomToScale(double, JSValueRef) >@@ -553,6 +575,19 @@ void UIScriptController::platformSetDidHideMenuCallback() > { > } > >+bool UIScriptController::isShowingPopover() const >+{ >+ return false; >+} >+ >+void UIScriptController::platformSetWillPresentPopoverCallback() >+{ >+} >+ >+void UIScriptController::platformSetDidDismissPopoverCallback() >+{ >+} >+ > JSObjectRef UIScriptController::menuRect() const > { > return nullptr; >diff --git a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >index e41f8a373918836153d9b32e9edb02edad993616..f24cc7eb79b656becdf8fcab6375d7923f4ea997 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >+++ b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >@@ -166,10 +166,15 @@ public: > > void setDidHideMenuCallback(JSValueRef); > JSValueRef didHideMenuCallback() const; >- > void setDidShowMenuCallback(JSValueRef); > JSValueRef didShowMenuCallback() const; > >+ bool isShowingPopover() const; >+ void setDidDismissPopoverCallback(JSValueRef); >+ JSValueRef didDismissPopoverCallback() const; >+ void setWillPresentPopoverCallback(JSValueRef); >+ JSValueRef willPresentPopoverCallback() const; >+ > bool isShowingMenu() const; > JSObjectRef rectForMenuAction(JSStringRef action) const; > JSObjectRef menuRect() const; >@@ -250,6 +255,8 @@ private: > void platformSetDidHideKeyboardCallback(); > void platformSetDidShowMenuCallback(); > void platformSetDidHideMenuCallback(); >+ void platformSetWillPresentPopoverCallback(); >+ void platformSetDidDismissPopoverCallback(); > void platformSetDidEndScrollingCallback(); > void platformClearAllCallbacks(); > void platformPlayBackEventStream(JSStringRef, JSValueRef); >diff --git a/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h b/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h >index bcd62df66e86d59ec7599de81254aec958db002d..96e515261b2588f3736e688915171a099c4e864e 100644 >--- a/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h >+++ b/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h >@@ -43,6 +43,8 @@ > @property (nonatomic, copy) void (^didHideKeyboardCallback)(void); > @property (nonatomic, copy) void (^didShowMenuCallback)(void); > @property (nonatomic, copy) void (^didHideMenuCallback)(void); >+@property (nonatomic, copy) void (^willPresentPopoverCallback)(void); >+@property (nonatomic, copy) void (^didDismissPopoverCallback)(void); > @property (nonatomic, copy) void (^didEndScrollingCallback)(void); > @property (nonatomic, copy) void (^rotationDidEndCallback)(void); > @property (nonatomic, copy) NSString *accessibilitySpeakSelectionContent; >@@ -56,6 +58,7 @@ > > @property (nonatomic, readonly, getter=isShowingKeyboard) BOOL showingKeyboard; > @property (nonatomic, readonly, getter=isShowingMenu) BOOL showingMenu; >+@property (nonatomic, readonly, getter=isShowingPopover) BOOL showingPopover; > @property (nonatomic, assign) BOOL usesSafariLikeRotation; > @property (nonatomic, readonly, getter=isInteractingWithFormControl) BOOL interactingWithFormControl; > >diff --git a/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm b/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm >index 14d5d59fc349a7adf2fa7800507b074aa7c3b68e..258080e479eedab74fd701ce3832d4da8513a2b2 100644 >--- a/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm >+++ b/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm >@@ -55,6 +55,7 @@ @property (nonatomic, copy) void (^zoomToScaleCompletionHandler)(void); > @property (nonatomic, copy) void (^retrieveSpeakSelectionContentCompletionHandler)(void); > @property (nonatomic, getter=isShowingKeyboard, setter=setIsShowingKeyboard:) BOOL showingKeyboard; > @property (nonatomic, getter=isShowingMenu, setter=setIsShowingMenu:) BOOL showingMenu; >+@property (nonatomic, getter=isShowingPopover, setter=setIsShowingPopover:) BOOL showingPopover; > > @end > >@@ -79,6 +80,8 @@ - (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguratio > [center addObserver:self selector:@selector(_invokeHideKeyboardCallbackIfNecessary) name:UIKeyboardDidHideNotification object:nil]; > [center addObserver:self selector:@selector(_didShowMenu) name:UIMenuControllerDidShowMenuNotification object:nil]; > [center addObserver:self selector:@selector(_didHideMenu) name:UIMenuControllerDidHideMenuNotification object:nil]; >+ [center addObserver:self selector:@selector(_willPresentPopover) name:@"UIPopoverControllerWillPresentPopoverNotification" object:nil]; >+ [center addObserver:self selector:@selector(_didDismissPopover) name:@"UIPopoverControllerDidDismissPopoverNotification" object:nil]; > self.UIDelegate = self; > } > return self; >@@ -141,6 +144,8 @@ - (void)resetInteractionCallbacks > self.didHideKeyboardCallback = nil; > self.didShowMenuCallback = nil; > self.didHideMenuCallback = nil; >+ self.willPresentPopoverCallback = nil; >+ self.didDismissPopoverCallback = nil; > self.didEndScrollingCallback = nil; > self.rotationDidEndCallback = nil; > } >@@ -200,6 +205,26 @@ - (void)_didHideMenu > self.didHideMenuCallback(); > } > >+- (void)_willPresentPopover >+{ >+ if (self.showingPopover) >+ return; >+ >+ self.showingPopover = YES; >+ if (self.willPresentPopoverCallback) >+ self.willPresentPopoverCallback(); >+} >+ >+- (void)_didDismissPopover >+{ >+ if (!self.showingPopover) >+ return; >+ >+ self.showingPopover = NO; >+ if (self.didDismissPopoverCallback) >+ self.didDismissPopoverCallback(); >+} >+ > - (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view > { > [super scrollViewWillBeginZooming:scrollView withView:view]; >diff --git a/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm b/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >index aa9d84885aaa880d3981eedd4fa38499a7f8f16f..d2496787a83ec01ce746077f036e16a56527f2c0 100644 >--- a/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >+++ b/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >@@ -907,6 +907,29 @@ void UIScriptController::platformSetDidHideMenuCallback() > }; > } > >+bool UIScriptController::isShowingPopover() const >+{ >+ return TestController::singleton().mainWebView()->platformView().showingPopover; >+} >+ >+void UIScriptController::platformSetWillPresentPopoverCallback() >+{ >+ TestController::singleton().mainWebView()->platformView().willPresentPopoverCallback = ^{ >+ if (!m_context) >+ return; >+ m_context->fireCallback(CallbackTypeWillPresentPopover); >+ }; >+} >+ >+void UIScriptController::platformSetDidDismissPopoverCallback() >+{ >+ TestController::singleton().mainWebView()->platformView().didDismissPopoverCallback = ^{ >+ if (!m_context) >+ return; >+ m_context->fireCallback(CallbackTypeDidDismissPopover); >+ }; >+} >+ > JSObjectRef UIScriptController::rectForMenuAction(JSStringRef jsAction) const > { > auto action = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, jsAction)); >@@ -974,6 +997,8 @@ void UIScriptController::platformClearAllCallbacks() > webView.willBeginZoomingCallback = nil; > webView.didHideKeyboardCallback = nil; > webView.didShowKeyboardCallback = nil; >+ webView.willPresentPopoverCallback = nil; >+ webView.didDismissPopoverCallback = nil; > webView.didEndScrollingCallback = nil; > webView.rotationDidEndCallback = nil; > } >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 98ef6361c3d4b0a9dddc5e01c10a80a407c6524d..68977465917d9341eac953a7130422a6da5a2bc6 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,22 @@ >+2019-04-09 Daniel Bates <dabates@apple.com> >+ >+ [iPad] Should open popover when the spacebar is pressed >+ https://bugs.webkit.org/show_bug.cgi?id=196360 >+ <rdar://problem/49389129> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add an iPad-specific test to ensure that pressing the spacebar opens the popover and scrolls >+ the form control into view. >+ >+ * fast/forms/ios/ipad/open-picker-using-keyboard-expected.txt: Added. >+ * fast/forms/ios/ipad/open-picker-using-keyboard.html: Added. >+ * platform/ios/TestExpectations: Skip tests in fast/forms/ios/ipad. We will unskip for iPad below. >+ * platform/ipad/TestExpectations: Mark tests in fast/forms/ios/ipad as PASS so we run them. >+ * resources/ui-helper.js: >+ (window.UIHelper.waitForPopoverToPresent): >+ (window.UIHelper.waitForPopoverToDismiss): >+ > 2019-04-09 Youenn Fablet <youenn@apple.com> > > Refresh WPT service worker expectations >diff --git a/LayoutTests/fast/forms/ios/ipad/open-picker-using-keyboard-expected.txt b/LayoutTests/fast/forms/ios/ipad/open-picker-using-keyboard-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..86c30dac606b1a5fa89a35c570b6246fbca3f4d8 >--- /dev/null >+++ b/LayoutTests/fast/forms/ios/ipad/open-picker-using-keyboard-expected.txt >@@ -0,0 +1,22 @@ >+Tests that pressing the spacebar and Escape to open and close the popover work, do not cause a value change, and that we scroll the form control into view when the popover is opened. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+ >+After tab focused: >+PASS document.getElementById("test").value is "First" >+ >+After dismissing popover by pressing Escape: >+PASS document.getElementById("test").value is "First" >+ >+After opening popover by pressing spacebar: >+PASS document.getElementById("test").value is "First" >+ >+After scrolling the page and pressing spacebar: >+PASS window.scrollY is non-zero. >+PASS window.scrollY is 0 >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/fast/forms/ios/ipad/open-picker-using-keyboard.html b/LayoutTests/fast/forms/ios/ipad/open-picker-using-keyboard.html >new file mode 100644 >index 0000000000000000000000000000000000000000..46dcd95ee94b473cb921e7e01b1282ed414dd6c1 >--- /dev/null >+++ b/LayoutTests/fast/forms/ios/ipad/open-picker-using-keyboard.html >@@ -0,0 +1,107 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<meta name="viewport" content="width=800"> >+<script src="../../../../resources/js-test.js"></script> >+<script src="../../../../resources/ui-helper.js"></script> >+</head> >+<body style="height: 4096px"> >+<!-- Place the test container above the console output to avoid the need to compensate for page scroll. --> >+<div id="test-container"> >+ <p><select id="test"> >+ <option>First</option> >+ <option>Second</option> >+ </select></p> >+</div> >+<p id="description"></p> >+<div id="console"></div> >+<script> >+window.jsTestIsAsync = true; >+ >+let expectedValue; >+ >+const modifierDisplayNameMap = { >+ "altKey": "Option", >+ "ctrlKey": "Control", >+ "metaKey": "Command", >+ "shiftKey": "Shift", >+ "capsLockKey": "Caps Lock", >+} >+ >+class KeyCommand { >+ constructor(key, modifiers = []) >+ { >+ this.key = key; >+ this.modifiers = modifiers; >+ } >+ >+ toString() >+ { >+ let readableCommand = this.modifiers.map((modifier) => modifierDisplayNameMap[modifier]); >+ readableCommand.push(this.key); >+ return readableCommand.join(" + "); >+ } >+} >+ >+function done() >+{ >+ let testContainer = document.getElementById("test-container"); >+ document.body.removeChild(testContainer); >+ finishJSTest() >+} >+ >+async function runTest() >+{ >+ if (!window.testRunner) { >+ testFailed("Must be run in WebKitTestRunner."); >+ done(); >+ return; >+ } >+ >+ async function testScrollIntoView() { >+ shouldBeNonZero("window.scrollY"); >+ async function handleScroll() { >+ if (window.scrollY) >+ return; >+ shouldBeZero("window.scrollY"); >+ await UIHelper.waitForPopoverToPresent(); >+ UIHelper.keyDown("escape"); >+ await UIHelper.waitForPopoverToDismiss(); >+ done(); >+ } >+ // The scroll initiated by pressing the spacebar is animated. Multiple scroll events are >+ // dispatched. We want to wait until the page scrolls to the top before continuing to ensure >+ // consistent test results. >+ window.addEventListener("scroll", handleScroll); >+ UIHelper.keyDown(" "); >+ } >+ >+ async function handleFocus() { >+ debug("<br>After tab focused:"); >+ shouldBeEqualToString('document.getElementById("test").value', expectedValue); >+ debug("<br>After dismissing popover by pressing Escape:"); >+ UIHelper.keyDown("escape"); >+ await UIHelper.waitForPopoverToDismiss(); >+ shouldBeEqualToString('document.getElementById("test").value', expectedValue); >+ debug("<br>After opening popover by pressing spacebar:"); >+ UIHelper.keyDown(" "); >+ await UIHelper.waitForPopoverToPresent(); >+ shouldBeEqualToString('document.getElementById("test").value', expectedValue); >+ UIHelper.keyDown("escape"); >+ await UIHelper.waitForPopoverToDismiss(); >+ debug("<br>After scrolling the page and pressing spacebar:"); >+ window.addEventListener("scroll", testScrollIntoView, { once: true }); >+ window.scrollTo(0, document.body.scrollHeight); // Scroll to the bottom of the page. >+ } >+ let elementToTest = document.getElementById("test"); >+ expectedValue = elementToTest.value; >+ elementToTest.addEventListener("focus", handleFocus, { once: true }); >+ UIHelper.keyDown("\t", ["altKey"]); >+} >+ >+description("Tests that pressing the spacebar and Escape to open and close the popover work, do not cause a value change, and that we scroll the form control into view when the popover is opened."); >+ >+runTest(); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/platform/ios/TestExpectations b/LayoutTests/platform/ios/TestExpectations >index 7a5173b27b9655a9323efea53d81ce9c793199b5..6bcd4cdaa4b5404a5b9543f90fb3815baaa17b24 100644 >--- a/LayoutTests/platform/ios/TestExpectations >+++ b/LayoutTests/platform/ios/TestExpectations >@@ -25,6 +25,7 @@ http/tests/gzip-content-encoding [ Pass ] > > # iPad-specific tests skipped here and re-enabled in platform/ipad > fast/events/ios/ipad [ Skip ] >+fast/forms/ios/ipad [ Skip ] > > ### > # Unsupported and disabled features >diff --git a/LayoutTests/platform/ipad/TestExpectations b/LayoutTests/platform/ipad/TestExpectations >index 515f628c930a0399f6917ac5e06ad039162f12d4..1467c3085ce0ee87e824eccf32a8edb7d5693eda 100644 >--- a/LayoutTests/platform/ipad/TestExpectations >+++ b/LayoutTests/platform/ipad/TestExpectations >@@ -1,3 +1,5 @@ >+fast/forms/ios/ipad [ Pass ] >+ > # iPads don't zoom when form elements are focused > fast/forms/ios/accessory-bar-navigation.html [ Skip ] > fast/forms/ios/choose-select-option.html [ Skip ] >diff --git a/LayoutTests/resources/ui-helper.js b/LayoutTests/resources/ui-helper.js >index 8399b798bd85671ba841d50844f91e1c461d231b..94f0faa228cb2105b0a80f219149df1740265792 100644 >--- a/LayoutTests/resources/ui-helper.js >+++ b/LayoutTests/resources/ui-helper.js >@@ -382,6 +382,38 @@ window.UIHelper = class UIHelper { > }); > } > >+ static waitForPopoverToPresent() >+ { >+ if (!this.isWebKit2() || !this.isIOS()) >+ return Promise.resolve(); >+ >+ return new Promise(resolve => { >+ testRunner.runUIScript(` >+ (function() { >+ if (uiController.isShowingPopover) >+ uiController.uiScriptComplete(); >+ else >+ uiController.willPresentPopoverCallback = () => uiController.uiScriptComplete(); >+ })()`, resolve); >+ }); >+ } >+ >+ static waitForPopoverToDismiss() >+ { >+ if (!this.isWebKit2() || !this.isIOS()) >+ return Promise.resolve(); >+ >+ return new Promise(resolve => { >+ testRunner.runUIScript(` >+ (function() { >+ if (uiController.isShowingPopover) >+ uiController.didDismissPopoverCallback = () => uiController.uiScriptComplete(); >+ else >+ uiController.uiScriptComplete(); >+ })()`, resolve); >+ }); >+ } >+ > static waitForKeyboardToHide() > { > if (!this.isWebKit2() || !this.isIOS())
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 196360
:
366215
|
366218
| 367068