WebKit Bugzilla
Attachment 361688 Details for
Bug 194313
: fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry.html does not work on iPad
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194313-20190211095003.patch (text/plain), 18.35 KB, created by
Wenson Hsieh
on 2019-02-11 09:50:04 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-02-11 09:50:04 PST
Size:
18.35 KB
patch
obsolete
>Subversion Revision: 241262 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 599cff15810379076119adfd200b1cb576a7ff2f..02fa43fd66408063f3e696b10f6c243ffdad6832 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,17 @@ >+2019-02-11 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry.html does not work on iPad >+ https://bugs.webkit.org/show_bug.cgi?id=194313 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Make `-dateTimePickerCalendarType` work on iPad by handling the case where the date picker control is a >+ WKDateTimePopover. This fixes UIScriptController::calendarType() returning null on iPad. >+ >+ * UIProcess/ios/forms/WKFormInputControl.mm: >+ (-[WKFormInputControl dateTimePickerCalendarType]): >+ (-[WKDateTimePopover calendarType]): >+ > 2019-02-11 Carlos Garcia Campos <cgarcia@igalia.com> > > [WPE] Do not try to create empty egl windows >diff --git a/Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm b/Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm >index 98e14678e17d46da99459f5b6d1d054e80d50459..cfed2d50a6c8ba03d4d2019e11e6a8cd0980a461 100644 >--- a/Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm >+++ b/Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm >@@ -53,6 +53,7 @@ @interface WKDateTimePopover : WKFormRotatingAccessoryPopover<WKFormControl> { > } > - (id)initWithView:(WKContentView *)view datePickerMode:(UIDatePickerMode)mode; > - (WKDateTimePopoverViewController *)viewController; >+@property (nonatomic, readonly) NSString *calendarType; > @end > > @interface WKDateTimePicker : NSObject<WKFormControl> { >@@ -239,7 +240,7 @@ @end > > // WKFormInputControl > @implementation WKFormInputControl { >- RetainPtr<id<WKFormControl>> _control; >+ RetainPtr<NSObject <WKFormControl>> _control; > } > > - (instancetype)initWithView:(WKContentView *)view >@@ -298,12 +299,18 @@ - (UIView *)assistantView > @end > > @implementation WKFormInputControl (WKTesting) >+ > - (NSString *)dateTimePickerCalendarType > { >- if ([(NSObject *)_control.get() isKindOfClass:WKDateTimePicker.class]) >+ if ([_control isKindOfClass:WKDateTimePicker.class]) > return [(WKDateTimePicker *)_control.get() calendarType]; >+ >+ if ([_control isKindOfClass:WKDateTimePopover.class]) >+ return [(WKDateTimePopover *)_control.get() calendarType]; >+ > return nil; > } >+ > @end > > @implementation WKDateTimePopoverViewController >@@ -388,6 +395,12 @@ - (UIView *)controlView > return nil; > } > >+- (NSString *)calendarType >+{ >+ WKDateTimePicker *dateTimePicker = (WKDateTimePicker *)self.viewController.innerControl; >+ return dateTimePicker.datePicker.calendar.calendarIdentifier; >+} >+ > @end > > #endif // PLATFORM(IOS_FAMILY) >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 03ba4dc9770d4cb31432a59060d90bf118092859..3e030bf4d631994b7563c6c9f0fcf017d39ebfe6 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,26 @@ >+2019-02-11 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry.html does not work on iPad >+ https://bugs.webkit.org/show_bug.cgi?id=194313 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a helper to determine whether the web view is presenting modal UI. >+ >+ * DumpRenderTree/ios/UIScriptControllerIOS.mm: >+ (WTR::UIScriptController::isPresentingModally const): >+ * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: >+ * TestRunnerShared/UIScriptContext/UIScriptController.cpp: >+ (WTR::UIScriptController::isPresentingModally const): >+ * TestRunnerShared/UIScriptContext/UIScriptController.h: >+ * WebKitTestRunner/UIScriptControllerCocoa.mm: >+ (WTR::UIScriptController::calendarType const): Deleted. >+ * WebKitTestRunner/ios/UIScriptControllerIOS.mm: >+ (WTR::UIScriptController::isPresentingModally const): >+ (WTR::UIScriptController::calendarType const): >+ * WebKitTestRunner/mac/UIScriptControllerMac.mm: >+ (WTR::UIScriptController::calendarType const): >+ > 2019-02-11 Philippe Normand <pnormand@igalia.com> > > [GStreamer] GstMappedBuffer testsuite build fails >diff --git a/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm b/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >index db11ad641562d1d3a3164294b65446df8f53a39c..e030cd65a0713ffa477ceabdff0a577267bd8c4a 100644 >--- a/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >+++ b/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm >@@ -175,6 +175,11 @@ void UIScriptController::selectFormAccessoryPickerRow(long rowIndex) > { > } > >+bool UIScriptController::isPresentingModally() const >+{ >+ return false; >+} >+ > JSRetainPtr<JSStringRef> UIScriptController::textContentType() const > { > return nullptr; >diff --git a/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl b/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >index e54467ff448a0a7c37070e9b7d0f18825c943143..3ce1eb56f7fa9550d5e99173eaefe5b78d3dd412 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >+++ b/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl >@@ -230,6 +230,7 @@ interface UIScriptController { > void setMinimumEffectiveWidth(double effectiveWidth); > > void resignFirstResponder(); >+ readonly attribute boolean isPresentingModally; > > readonly attribute double contentOffsetX; > readonly attribute double contentOffsetY; >diff --git a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >index 4b45d56fdc2cb2ca4dae0f66dd1f527eefe7c39e..f6d84d653c1370c927635c6db4f9bbe723368aff 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >+++ b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp >@@ -336,6 +336,11 @@ JSRetainPtr<JSStringRef> UIScriptController::formInputLabel() const > return nullptr; > } > >+bool UIScriptController::isPresentingModally() const >+{ >+ return false; >+} >+ > double UIScriptController::contentOffsetX() const > { > return 0; >diff --git a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >index 956c345c32f61351cfede1143f4a61c00e66c740..f77053b5fa4b2c344ad4d1f2032540e805d51ac3 100644 >--- a/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >+++ b/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h >@@ -114,6 +114,8 @@ public: > > JSObjectRef contentsOfUserInterfaceItem(JSStringRef) const; > void overridePreference(JSStringRef preference, JSStringRef value); >+ >+ bool isPresentingModally() const; > > double contentOffsetX() const; > double contentOffsetY() const; >diff --git a/Tools/WebKitTestRunner/UIScriptControllerCocoa.mm b/Tools/WebKitTestRunner/UIScriptControllerCocoa.mm >index 702e5185523314be8d975edcea194b841f0fa48e..b2b45dfde4cf35d05b6acf1a300ad6b664336d79 100644 >--- a/Tools/WebKitTestRunner/UIScriptControllerCocoa.mm >+++ b/Tools/WebKitTestRunner/UIScriptControllerCocoa.mm >@@ -180,19 +180,6 @@ void UIScriptController::setDefaultCalendarType(JSStringRef calendarIdentifier) > #endif > } > >-JSObjectRef UIScriptController::calendarType() const >-{ >-#if WK_API_ENABLED >- WKWebView *webView = TestController::singleton().mainWebView()->platformView(); >- UIView *contentView = [webView valueForKeyPath:@"_currentContentView"]; >- NSString *calendarTypeString = [contentView valueForKeyPath:@"formInputControl.dateTimePickerCalendarType"]; >- auto jsContext = m_context->jsContext(); >- return JSValueToObject(jsContext, [JSValue valueWithObject:calendarTypeString inContext:[JSContext contextWithJSGlobalContextRef:jsContext]].JSValueRef, nullptr); >-#else >- return nullptr; >-#endif >-} >- > JSRetainPtr<JSStringRef> UIScriptController::lastUndoLabel() const > { > return JSStringCreateWithCFString((__bridge CFStringRef)platformUndoManager().undoActionName); >diff --git a/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm b/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >index 4952765a0acfd3de3f182be28e2fe8e19395683b..6c10f06d03225b0e5094bb13a3e87d0777303121 100644 >--- a/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >+++ b/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >@@ -453,6 +453,12 @@ void UIScriptController::setTimePickerValue(long hour, long minute) > [webView setTimePickerValueToHour:hour minute:minute]; > } > >+bool UIScriptController::isPresentingModally() const >+{ >+ TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView(); >+ return !!webView.window.rootViewController.presentedViewController; >+} >+ > static CGPoint contentOffsetBoundedInValidRange(UIScrollView *scrollView, CGPoint contentOffset) > { > UIEdgeInsets contentInsets = scrollView.contentInset; >@@ -954,6 +960,15 @@ NSUndoManager *UIScriptController::platformUndoManager() const > return [(UIView *)[TestController::singleton().mainWebView()->platformView() valueForKeyPath:@"_currentContentView"] undoManager]; > } > >+JSObjectRef UIScriptController::calendarType() const >+{ >+ WKWebView *webView = TestController::singleton().mainWebView()->platformView(); >+ UIView *contentView = [webView valueForKeyPath:@"_currentContentView"]; >+ NSString *calendarTypeString = [contentView valueForKeyPath:@"formInputControl.dateTimePickerCalendarType"]; >+ auto jsContext = m_context->jsContext(); >+ return JSValueToObject(jsContext, [JSValue valueWithObject:calendarTypeString inContext:[JSContext contextWithJSGlobalContextRef:jsContext]].JSValueRef, nullptr); >+} >+ > } > > #endif // PLATFORM(IOS_FAMILY) >diff --git a/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm b/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm >index 757fa06bd78f1833f13b38cbc9b030f93419763f..7cc15311dbe874b94b23c4291443ed118ba872f6 100644 >--- a/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm >+++ b/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm >@@ -214,4 +214,9 @@ NSUndoManager *UIScriptController::platformUndoManager() const > return TestController::singleton().mainWebView()->platformView().undoManager; > } > >+JSObjectRef UIScriptController::calendarType() const >+{ >+ return nullptr; >+} >+ > } // namespace WTR >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index bdfaa5ca43e5c04b2131a32012042c7bf0c788c2..dc16669683cbc58b185b98573779f6dba4b791e8 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,40 @@ >+2019-02-11 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry.html does not work on iPad >+ https://bugs.webkit.org/show_bug.cgi?id=194313 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Adjusts an existing layout test to work on both iPhone and iPad simulators. >+ >+ * fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry-expected.txt: >+ * fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry.html: >+ >+ Make this test wait after blurring the currently focused element, such that tapping to focus the next form >+ control doesn't fail. Notably on iPad, not waiting for the popover to dismiss meant that subsequent taps would >+ be dispatched too soon, and hit-test to the popover view being dismissed rather than WKWebView. >+ >+ * platform/ipad/TestExpectations: >+ >+ Unskip the test on iPad. >+ >+ * resources/ui-helper.js: >+ >+ Add helpers to query whether or not the keyboard is shown, and whether or not a view controller is being modally >+ presented over the current root view controller (this is the case when interacting with date pickers on iPad). >+ >+ (window.UIHelper.isShowingKeyboard): >+ (window.UIHelper.isPresentingModally): >+ (window.UIHelper.deactivateFormControl): >+ >+ Add a new helper method to blur the given form control element and wait for web view chrome to finish dismissing >+ (on iOS, this is either the date picker input view in the keyboard on iPhone, or the date picker popover view >+ controller on iPad). >+ >+ (window.UIHelper.isShowingDataListSuggestions): >+ >+ Drive-by fix: remove an extraneous ternary conditional statement. >+ > 2019-02-11 Zan Dobersek <zdobersek@igalia.com> > > Unreviewed WPE gardening. Adding additional baselines after font variations >diff --git a/LayoutTests/fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry-expected.txt b/LayoutTests/fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry-expected.txt >index e5586993b106fa4ec5dd4b443c40da36b821cc3d..e7ba50ee25dee0dc3668606d27b808e743b540f4 100644 >--- a/LayoutTests/fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry-expected.txt >+++ b/LayoutTests/fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry-expected.txt >@@ -1,4 +1,5 @@ > >+ > Date input control marked as 'cc-exp' (default calendar set to japanese): > { calendarType = gregorian } > Date input control not marked as 'cc-exp' (default calendar set to japanese): >diff --git a/LayoutTests/fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry.html b/LayoutTests/fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry.html >index 8628b62a3682e33ae34aa03421e4fc6530ca7b3a..16f23495df7d917953e7cebe6803febd53bb1218 100644 >--- a/LayoutTests/fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry.html >+++ b/LayoutTests/fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry.html >@@ -11,12 +11,14 @@ > } > > #target0, #target1 { >- font-size: 150px; >+ font-size: 40px; >+ width: 100%; > } > </style> > </head> > <body> > <input type='date' id='target0' autocomplete='cc-exp'> >+ <br> > <input type='date' id='target1'> > <pre id="output"></pre> > <script> >@@ -32,13 +34,7 @@ > output.appendChild(paragraph); > } > >- function toString(value) >- { >- return `{ calendarType = ${value} }`; >- } >- > (async () => { >- > if (!window.testRunner || !testRunner.runUIScript) { > appendOutput(`This test checks if a gregorian calendar is presented when a date input control marked > as a credit card expiry date field (ie. through autocomplete='cc-exp') is tapped on Safari iOS. For >@@ -46,23 +42,16 @@ > return; > } > >- await UIHelper.setDefaultCalendarType("japanese"); >- await UIHelper.activateElement(target0); >- appendOutput("Date input control marked as 'cc-exp' (default calendar set to japanese):"); >- appendOutput(toString(await UIHelper.calendarType())); >- >- await UIHelper.activateElement(target1); >- appendOutput("Date input control not marked as 'cc-exp' (default calendar set to japanese):"); >- appendOutput(toString(await UIHelper.calendarType())); >- >- await UIHelper.setDefaultCalendarType("gregorian"); >- await UIHelper.activateElement(target0); >- appendOutput("Date input control marked as 'cc-exp' (default calendar set to gregorian):"); >- appendOutput(toString(await UIHelper.calendarType())); >- >- await UIHelper.activateElement(target1); >- appendOutput("Date input control not marked as 'cc-exp' (default calendar set to gregorian):"); >- appendOutput(toString(await UIHelper.calendarType())); >+ for (const calendarType of ["japanese", "gregorian"]) { >+ await UIHelper.setDefaultCalendarType(calendarType); >+ for (const element of [target0, target1]) { >+ await UIHelper.activateFormControl(element); >+ const isCreditCardField = element.getAttribute("autocomplete") === "cc-exp"; >+ appendOutput(`Date input control${isCreditCardField ? "" : " not"} marked as 'cc-exp' (default calendar set to ${calendarType}):`); >+ appendOutput(`{ calendarType = ${await UIHelper.calendarType()} }`); >+ await UIHelper.deactivateFormControl(element); >+ } >+ } > > testRunner.notifyDone(); > >diff --git a/LayoutTests/platform/ipad/TestExpectations b/LayoutTests/platform/ipad/TestExpectations >index dbbc20939f488084998b4e447331496bf8fe0563..515f628c930a0399f6917ac5e06ad039162f12d4 100644 >--- a/LayoutTests/platform/ipad/TestExpectations >+++ b/LayoutTests/platform/ipad/TestExpectations >@@ -46,6 +46,4 @@ webkit.org/b/194259 fast/events/ios/rotation/resize-iframe-after-orientation-cha > webkit.org/b/194259 fast/events/ios/rotation/safari-like-rotation.html [ Skip ] > webkit.org/b/194259 fast/events/ios/viewport-no-width-value-allows-double-tap.html [ Skip ] > >-webkit.org/b/194313 fast/forms/ios/force-gregorian-calendar-for-credit-card-expiry.html [ Skip ] >- > webkit.org/b/194314 fast/forms/ios/scroll-to-reveal-focused-select.html >diff --git a/LayoutTests/resources/ui-helper.js b/LayoutTests/resources/ui-helper.js >index fe546a8c865013de4ed045ecc6acd0e23bbbeac3..31aac7e1ef7afee0c451a28c2277f9f8b2a8b529 100644 >--- a/LayoutTests/resources/ui-helper.js >+++ b/LayoutTests/resources/ui-helper.js >@@ -219,6 +219,37 @@ window.UIHelper = class UIHelper { > }); > } > >+ static isShowingKeyboard() >+ { >+ return new Promise(resolve => { >+ testRunner.runUIScript("uiController.isShowingKeyboard", result => resolve(result === "true")); >+ }); >+ } >+ >+ static isPresentingModally() >+ { >+ return new Promise(resolve => { >+ testRunner.runUIScript("uiController.isPresentingModally", result => resolve(result === "true")); >+ }); >+ } >+ >+ static deactivateFormControl(element) >+ { >+ if (!this.isWebKit2() || !this.isIOS()) { >+ element.blur(); >+ return Promise.resolve(); >+ } >+ >+ return new Promise(async resolve => { >+ element.blur(); >+ while (await this.isPresentingModally()) >+ continue; >+ while (await this.isShowingKeyboard()) >+ continue; >+ resolve(); >+ }); >+ } >+ > static waitForKeyboardToHide() > { > if (!this.isWebKit2() || !this.isIOS()) >@@ -418,7 +449,7 @@ window.UIHelper = class UIHelper { > return new Promise(resolve => { > testRunner.runUIScript(`(() => { > uiController.uiScriptComplete(uiController.isShowingDataListSuggestions); >- })()`, result => resolve(result === "true" ? true : false)); >+ })()`, result => resolve(result === "true")); > }); > } >
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 194313
:
361684
| 361688