Title: [263001] trunk/Source/WebKit
- Revision
- 263001
- Author
- [email protected]
- Date
- 2020-06-13 11:14:14 -0700 (Sat, 13 Jun 2020)
Log Message
[Mac Catalyst] Color inputs and selects fail to display popovers when clicked
https://bugs.webkit.org/show_bug.cgi?id=213157
<rdar://problem/64004135>
Reviewed by Tim Horton.
In Mac Catalyst, presenting popovers using `UIPopoverController` causes the first responder to change. This
means that the WKContentView will resign first responder, which in turn causes the currently presented popover
to be dismissed. This means that popovers for color inputs and select elements will be dismissed immediately
after presentation.
To mitigate this, adapt the approach taken in r259840 to `WKColorPopover` and `WKSelectPopover` by teaching the
base class (`WKRotatingPopover`) to temporarily preserve the focused element in light of first responder changes
while presenting a popover on Mac Catalyst.
* UIProcess/ios/forms/WKFormPopover.mm:
(-[WKRotatingPopover presentPopoverAnimated:]):
(-[WKRotatingPopover dismissPopoverAnimated:]):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (263000 => 263001)
--- trunk/Source/WebKit/ChangeLog 2020-06-13 16:42:58 UTC (rev 263000)
+++ trunk/Source/WebKit/ChangeLog 2020-06-13 18:14:14 UTC (rev 263001)
@@ -1,3 +1,24 @@
+2020-06-13 Wenson Hsieh <[email protected]>
+
+ [Mac Catalyst] Color inputs and selects fail to display popovers when clicked
+ https://bugs.webkit.org/show_bug.cgi?id=213157
+ <rdar://problem/64004135>
+
+ Reviewed by Tim Horton.
+
+ In Mac Catalyst, presenting popovers using `UIPopoverController` causes the first responder to change. This
+ means that the WKContentView will resign first responder, which in turn causes the currently presented popover
+ to be dismissed. This means that popovers for color inputs and select elements will be dismissed immediately
+ after presentation.
+
+ To mitigate this, adapt the approach taken in r259840 to `WKColorPopover` and `WKSelectPopover` by teaching the
+ base class (`WKRotatingPopover`) to temporarily preserve the focused element in light of first responder changes
+ while presenting a popover on Mac Catalyst.
+
+ * UIProcess/ios/forms/WKFormPopover.mm:
+ (-[WKRotatingPopover presentPopoverAnimated:]):
+ (-[WKRotatingPopover dismissPopoverAnimated:]):
+
2020-06-13 Sam Weinig <[email protected]>
Extended Color: Experiment with strongly typed ColorComponents
Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormPopover.mm (263000 => 263001)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormPopover.mm 2020-06-13 16:42:58 UTC (rev 263000)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormPopover.mm 2020-06-13 18:14:14 UTC (rev 263001)
@@ -75,6 +75,7 @@
WKContentView *_view;
BOOL _isRotating;
+ BOOL _isPreservingFocus;
CGPoint _presentationPoint;
RetainPtr<UIPopoverController> _popoverController;
id <WKRotatingPopoverDelegate> _dismissionDelegate;
@@ -132,6 +133,13 @@
- (void)presentPopoverAnimated:(BOOL)animated
{
+#if PLATFORM(MACCATALYST)
+ if (!_isPreservingFocus) {
+ _isPreservingFocus = YES;
+ [_view preserveFocus];
+ }
+#endif
+
UIPopoverArrowDirection directions = [self popoverArrowDirections];
BOOL presentWithPoint = !CGPointEqualToPoint(self.presentationPoint, CGPointZero);
@@ -152,6 +160,13 @@
- (void)dismissPopoverAnimated:(BOOL)animated
{
+#if PLATFORM(MACCATALYST)
+ if (_isPreservingFocus) {
+ _isPreservingFocus = NO;
+ [_view releaseFocus];
+ }
+#endif
+
[_popoverController dismissPopoverAnimated:animated];
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes