Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 297cfba751db9ceee51fe4459c55fcc0b8365e8c
https://github.com/WebKit/WebKit/commit/297cfba751db9ceee51fe4459c55fcc0b8365e8c
Author: Wenson Hsieh <[email protected]>
Date: 2023-10-02 (Mon, 02 Oct 2023)
Changed paths:
A
LayoutTests/fast/forms/ios/show-and-dismiss-date-input-in-landscape-expected.txt
A LayoutTests/fast/forms/ios/show-and-dismiss-date-input-in-landscape.html
M LayoutTests/fast/forms/ios/time-picker-value-change.html
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:
-----------
[iOS] Date picker is clipped in landscape mode on some narrower iPhone models
https://bugs.webkit.org/show_bug.cgi?id=262451
rdar://116317686
Reviewed by Aditya Keerthi and Abrar Rahman Protyasha.
On iPhone models where the screen is narrower than 400 pt, focusing a date
input while in landscape
orientation causes the bottom of the date picker (along with the accessory view
containing "Done"
and "Reset" buttons) to become clipped. This is because, despite the fact that
the date picker
popover lays out in undocked (arrow-less) mode in the center of the window, the
window still isn't
tall enough to accomodate the full height of the date picker, whose layout is
unable to compress
vertically to fit within the height of the window. This means that even if we
adjust the height
constraint of the date picker and its containing view to be contained within
the window, the date
picker will just clip itself to fit within the new height.
`_UIDatePickerOverlayPresentation` (which we stopped using in 268069@main)
solved this problem by
scaling the entire content view in the popover to fit within the new size by
setting a transform on
the content view containing the date picker and accessory view. We adopt a
similar solution here,
and apply a transform to the `WKDatePickerPopoverView` if needed during view
layout to fit within
the bounds of the view.
Note that we also need to add a new width constraint that fits the popover
container view to the
content view to scale alongside the new `targetScale`; otherwise, the popover's
view will be wider
than the content view itself, which leads to unnecessary left and right margins.
To test this, we:
1. Add a layout test to rotate the device to landscape orientation and tap on
a date input.
2. Add a release assertion when simulating date picker dismissal by tapping on
the Done button, to
crash if the accessory view can't be hit-tested to (e.g. clipped).
Without this fix, we'll crash in the new release assert in
`-assertAccessoryViewCanBeHitTested`.
*
LayoutTests/fast/forms/ios/show-and-dismiss-date-input-in-landscape-expected.txt:
Added.
* LayoutTests/fast/forms/ios/show-and-dismiss-date-input-in-landscape.html:
Added.
* LayoutTests/fast/forms/ios/time-picker-value-change.html:
Adjust an existing layout test to wait for the context menu to finish
presenting before interacting
with the accessory view's "Done" button, in order to avoid hitting the new
assertion under
`-dismissWithAnimation`.
* Source/WebKit/UIProcess/ios/forms/WKDatePickerPopoverController.h:
* Source/WebKit/UIProcess/ios/forms/WKDatePickerPopoverController.mm:
(-[WKDatePickerPopoverView estimatedMaximumPopoverSize]):
Drive-by fix: increase the extra padding before falling back to arrow-less
presentation to 80 pt; I
discovered that on an iPhone 12 with 60 pt, it's still possible to end up
squishing (but not quite
totally clipping) the accessory view in some cases.
(-[WKDatePickerPopoverController assertAccessoryViewCanBeHitTestedForTesting]):
Add some logic to sanity check that the accessory view can actually be
hit-tested (relative to the
popover's content view) when simulating tapping the "Done" button to dismiss
the date picker.
(-[WKDatePickerPopoverController viewDidLoad]):
(-[WKDatePickerPopoverController viewWillLayoutSubviews]):
(-[WKDatePickerPopoverController _scaleDownToFitHeightIfNeeded]):
This is the main fix; see above for more details.
* Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.h:
* Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm:
(-[WKDateTimeInputControl dismissWithAnimationForTesting]):
(-[WKDateTimeInputControl dismissWithAnimation]): Deleted.
Add a `ForTesting` suffix to this testing-only method.
Canonical link: https://commits.webkit.org/268753@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes