Title: [278731] trunk/Source/WebKit
Revision
278731
Author
akeer...@apple.com
Date
2021-06-10 14:03:00 -0700 (Thu, 10 Jun 2021)

Log Message

[iOS] VinylWall app crashes when tapping on 'format' dropdown menu in 'Add Record' menu
https://bugs.webkit.org/show_bug.cgi?id=226886
<rdar://problem/77207322>

Reviewed by Tim Horton.

The VinylWall app contains a WKWebView, and uses <select> to let users
choose options. With the new form controls on iOS, tapping on a <select>
presents a UIContextMenuInteraction, rather than a picker wheel or
popover. However, UIContextMenuInteraction is not supported on apps
linked against an SDK older than iOS 14, resulting in this crash.

To fix, perform a linked-on-or-after check before showing the new UI
for <select> and <input type=text> with a <datalist>. If the check
fails, fallback to the old UI. We already have this check in place for
other context menus in `-[WKContentView _shouldUseContextMenus]`, so we
reuse that method.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]):
(-[WKContentView _elementTypeRequiresAccessoryView:]):
(-[WKContentView _shouldUseContextMenusForFormControls]):
* UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
(WebKit::WebDataListSuggestionsDropdownIOS::show):
* UIProcess/ios/forms/WKFormSelectControl.mm:
(-[WKFormSelectControl initWithView:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (278730 => 278731)


--- trunk/Source/WebKit/ChangeLog	2021-06-10 20:56:57 UTC (rev 278730)
+++ trunk/Source/WebKit/ChangeLog	2021-06-10 21:03:00 UTC (rev 278731)
@@ -1,3 +1,33 @@
+2021-06-10  Aditya Keerthi  <akeer...@apple.com>
+
+        [iOS] VinylWall app crashes when tapping on 'format' dropdown menu in 'Add Record' menu
+        https://bugs.webkit.org/show_bug.cgi?id=226886
+        <rdar://problem/77207322>
+
+        Reviewed by Tim Horton.
+
+        The VinylWall app contains a WKWebView, and uses <select> to let users
+        choose options. With the new form controls on iOS, tapping on a <select>
+        presents a UIContextMenuInteraction, rather than a picker wheel or
+        popover. However, UIContextMenuInteraction is not supported on apps
+        linked against an SDK older than iOS 14, resulting in this crash.
+
+        To fix, perform a linked-on-or-after check before showing the new UI
+        for <select> and <input type=text> with a <datalist>. If the check
+        fails, fallback to the old UI. We already have this check in place for
+        other context menus in `-[WKContentView _shouldUseContextMenus]`, so we
+        reuse that method.
+
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]):
+        (-[WKContentView _elementTypeRequiresAccessoryView:]):
+        (-[WKContentView _shouldUseContextMenusForFormControls]):
+        * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
+        (WebKit::WebDataListSuggestionsDropdownIOS::show):
+        * UIProcess/ios/forms/WKFormSelectControl.mm:
+        (-[WKFormSelectControl initWithView:]):
+
 2021-06-10  Tim Horton  <timothy_hor...@apple.com>
 
         REGRESSION (r277820): Trackpad interaction in Web Content is not working on iOS or macCatalyst

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (278730 => 278731)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2021-06-10 20:56:57 UTC (rev 278730)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2021-06-10 21:03:00 UTC (rev 278731)
@@ -696,6 +696,7 @@
 - (void)clearTextIndicator:(WebCore::TextIndicatorDismissalAnimation)animation;
 
 @property (nonatomic, readonly) BOOL _shouldUseContextMenus;
+@property (nonatomic, readonly) BOOL _shouldUseContextMenusForFormControls;
 @property (nonatomic, readonly) BOOL _shouldAvoidResizingWhenInputViewBoundsChange;
 @property (nonatomic, readonly) BOOL _shouldAvoidScrollingWhenFocusedContentIsVisible;
 @property (nonatomic, readonly) BOOL _shouldUseLegacySelectPopoverDismissalBehavior;

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (278730 => 278731)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-06-10 20:56:57 UTC (rev 278730)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-06-10 21:03:00 UTC (rev 278731)
@@ -2190,7 +2190,7 @@
         return NO;
     case WebKit::InputType::Select: {
 #if ENABLE(IOS_FORM_CONTROL_REFRESH)
-        if ([self _formControlRefreshEnabled])
+        if (self._shouldUseContextMenusForFormControls)
             return NO;
 #endif
         return !WebKit::currentUserInterfaceIdiomIsPadOrMac();
@@ -3263,7 +3263,7 @@
         return false;
     case WebKit::InputType::Select: {
 #if ENABLE(IOS_FORM_CONTROL_REFRESH)
-        if ([self _formControlRefreshEnabled])
+        if (self._shouldUseContextMenusForFormControls)
             return NO;
 #endif
         return !WebKit::currentUserInterfaceIdiomIsPadOrMac();
@@ -7652,6 +7652,14 @@
     return NO;
 }
 
+- (BOOL)_shouldUseContextMenusForFormControls
+{
+#if ENABLE(IOS_FORM_CONTROL_REFRESH)
+    return self._formControlRefreshEnabled && self._shouldUseContextMenus;
+#endif
+    return NO;
+}
+
 - (BOOL)_shouldAvoidResizingWhenInputViewBoundsChange
 {
     return _focusedElementInformation.shouldAvoidResizingWhenInputViewBoundsChange;

Modified: trunk/Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm (278730 => 278731)


--- trunk/Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm	2021-06-10 20:56:57 UTC (rev 278730)
+++ trunk/Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm	2021-06-10 21:03:00 UTC (rev 278731)
@@ -109,7 +109,7 @@
     WebCore::DataListSuggestionActivationType type = information.activationType;
 
 #if ENABLE(IOS_FORM_CONTROL_REFRESH)
-    if ([m_contentView _formControlRefreshEnabled]) {
+    if (m_contentView._shouldUseContextMenusForFormControls) {
         m_suggestionsControl = adoptNS([[WKDataListSuggestionsDropdown alloc] initWithInformation:WTFMove(information) inView:m_contentView]);
         [m_suggestionsControl showSuggestionsDropdown:*this activationType:type];
         return;

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.mm (278730 => 278731)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.mm	2021-06-10 20:56:57 UTC (rev 278730)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectControl.mm	2021-06-10 21:03:00 UTC (rev 278731)
@@ -76,7 +76,7 @@
     RetainPtr<NSObject <WKFormControl>> control;
 
 #if ENABLE(IOS_FORM_CONTROL_REFRESH)
-    if ([view _formControlRefreshEnabled]) {
+    if (view._shouldUseContextMenusForFormControls) {
         if (view.focusedElementInformation.isMultiSelect)
             control = adoptNS([[WKSelectMultiplePicker alloc] initWithView:view]);
         else
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to