[webkit-changes] [WebKit/WebKit] c9ac0c: REGRESSION (268069 at main): [iOS] Date picker fails ...
Wenson Hsieh
noreply at github.com
Mon Sep 25 18:33:31 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c9ac0cb7dfabcbf5aacdfecfde49b7b9f8936683
https://github.com/WebKit/WebKit/commit/c9ac0cb7dfabcbf5aacdfecfde49b7b9f8936683
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2023-09-25 (Mon, 25 Sep 2023)
Changed paths:
A LayoutTests/fast/forms/ios/show-and-dismiss-date-input-after-tapping-done-expected.txt
A LayoutTests/fast/forms/ios/show-and-dismiss-date-input-after-tapping-done.html
M Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
M Source/WebKit/UIProcess/ios/forms/WKDatePickerPopoverController.h
M Source/WebKit/UIProcess/ios/forms/WKDatePickerPopoverController.mm
M Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.h
M Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm
Log Message:
-----------
REGRESSION (268069 at main): [iOS] Date picker fails to present after dismissing with Done button
https://bugs.webkit.org/show_bug.cgi?id=262070
Reviewed by Aditya Keerthi.
After the changes in 268069 at main, tapping a datetime input after previously focusing and dismissing
it using the Done button silently fails to show the date picker popover a second time. This is
because we don't get a call to the `-presentationControllerDidDismiss:` delegate method in this case
where we're programmatically driving the dismissal of the popover; instead, we only get a call to
the completion handler of `-dismissViewControllerAnimated:completion:`.
I had actually caught (and prevented) this bug for Catalyst, which prompted me to add the call to
`-datePickerPopoverControllerDidDismiss:` in the completion handler specifically for Catalyst, but
for some reason didn't see that it also affected iOS as well. The fix here is simply:
1. Remove the `PLATFORM(MACCATALYST)` in the completion handler of the dismissal animation, and...
2. Make the logic around invoking `-datePickerPopoverControllerDidDismiss:` robust in the case
where both the popover controller delegate method and completion block are invoked (which seems
to be the case for month and time inputs, which use `UIDatePickerStyleWheels` instead of the
inline style).
This was also almost caught by the existing test `fast/forms/ios/show-and-dismiss-date-input.html`,
but that test dismisses the date picker by tapping elsewhere on the screen, which narrowly avoids
this bug since we get a delegate call to `-presentationControllerDidDismiss:` in that case. We add
a new layout test that works similarly to this test, but instead simulates tapping the Done button
to dismiss the date picker.
* LayoutTests/fast/forms/ios/show-and-dismiss-date-input-after-tapping-done-expected.txt: Added.
* LayoutTests/fast/forms/ios/show-and-dismiss-date-input-after-tapping-done.html: Added.
Add a new layout test to exercise this fix.
* Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView dismissFormAccessoryView]):
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dismissFormAccessoryView]):
Augment existing test-only SPI to dismiss the date picker by simulating tapping the Done button when
a date picker popover is shown.
* Source/WebKit/UIProcess/ios/forms/WKDatePickerPopoverController.h:
* Source/WebKit/UIProcess/ios/forms/WKDatePickerPopoverController.mm:
(-[WKDatePickerPopoverController dismissDatePicker]):
(-[WKDatePickerPopoverController presentInView:sourceRect:interactionBounds:completion:]):
(-[WKDatePickerPopoverController _dispatchPopoverControllerDidDismissIfNeeded]):
(-[WKDatePickerPopoverController presentationControllerDidDismiss:]):
* Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.h:
* Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm:
(-[WKDateTimePicker datePickerController]):
(-[WKDateTimeInputControl setTimePickerHour:minute:]):
(-[WKDateTimeInputControl dateTimePickerCalendarType]):
(-[WKDateTimeInputControl timePickerValueHour]):
(-[WKDateTimeInputControl timePickerValueMinute]):
(-[WKDateTimeInputControl dismissWithAnimation]):
Canonical link: https://commits.webkit.org/268425@main
More information about the webkit-changes
mailing list