Title: [279475] trunk/Source
- Revision
- 279475
- Author
- akeer...@apple.com
- Date
- 2021-07-01 11:34:39 -0700 (Thu, 01 Jul 2021)
Log Message
[iOS] <select> menus should scroll to the selected option
https://bugs.webkit.org/show_bug.cgi?id=227562
<rdar://problem/77887668>
Reviewed by Wenson Hsieh.
Source/WebKit:
Before iOS 15, <select> pickers were implemented using UIPickerView on
iPhone and UITableView on iPad. Both these views gave WebKit the ability
to scroll the view to the currently selected option.
In iOS 15, <select> options are displayed in a context menu. WebKit does
not have access to the menu's view hierarchy, and must rely on UIKit to
perform the scrolling behavior.
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectPicker createMenu]):
Adopt UIMenuOptionsSingleSelection to obtain UIKit behaviors for popup menus.
Source/WTF:
* wtf/PlatformHave.h:
Add HAVE(UIMENUOPTIONS_SINGLE_SELECTION).
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (279474 => 279475)
--- trunk/Source/WTF/ChangeLog 2021-07-01 18:24:30 UTC (rev 279474)
+++ trunk/Source/WTF/ChangeLog 2021-07-01 18:34:39 UTC (rev 279475)
@@ -1,3 +1,15 @@
+2021-07-01 Aditya Keerthi <akeer...@apple.com>
+
+ [iOS] <select> menus should scroll to the selected option
+ https://bugs.webkit.org/show_bug.cgi?id=227562
+ <rdar://problem/77887668>
+
+ Reviewed by Wenson Hsieh.
+
+ * wtf/PlatformHave.h:
+
+ Add HAVE(UIMENUOPTIONS_SINGLE_SELECTION).
+
2021-07-01 Youenn Fablet <you...@apple.com>
[Cocoa] Migrate WebRTC UDP socket handling to NW API
Modified: trunk/Source/WTF/wtf/PlatformHave.h (279474 => 279475)
--- trunk/Source/WTF/wtf/PlatformHave.h 2021-07-01 18:24:30 UTC (rev 279474)
+++ trunk/Source/WTF/wtf/PlatformHave.h 2021-07-01 18:34:39 UTC (rev 279475)
@@ -1027,6 +1027,7 @@
#if (PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150000
#define HAVE_UICONTEXTMENU_STYLE_CUSTOM_PRESENTATION 1
#define HAVE_UIDATEPICKER_INSETS 1
+#define HAVE_UIMENUOPTIONS_SINGLE_SELECTION 1
#endif
#if (((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150000) \
Modified: trunk/Source/WebKit/ChangeLog (279474 => 279475)
--- trunk/Source/WebKit/ChangeLog 2021-07-01 18:24:30 UTC (rev 279474)
+++ trunk/Source/WebKit/ChangeLog 2021-07-01 18:34:39 UTC (rev 279475)
@@ -1,3 +1,24 @@
+2021-07-01 Aditya Keerthi <akeer...@apple.com>
+
+ [iOS] <select> menus should scroll to the selected option
+ https://bugs.webkit.org/show_bug.cgi?id=227562
+ <rdar://problem/77887668>
+
+ Reviewed by Wenson Hsieh.
+
+ Before iOS 15, <select> pickers were implemented using UIPickerView on
+ iPhone and UITableView on iPad. Both these views gave WebKit the ability
+ to scroll the view to the currently selected option.
+
+ In iOS 15, <select> options are displayed in a context menu. WebKit does
+ not have access to the menu's view hierarchy, and must rely on UIKit to
+ perform the scrolling behavior.
+
+ * UIProcess/ios/forms/WKFormSelectPicker.mm:
+ (-[WKSelectPicker createMenu]):
+
+ Adopt UIMenuOptionsSingleSelection to obtain UIKit behaviors for popup menus.
+
2021-07-01 Jer Noble <jer.no...@apple.com>
[Mac] Adopt async GroupActivity.sessions() iterable instead of GroupSessionObserver
Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm (279474 => 279475)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm 2021-07-01 18:24:30 UTC (rev 279474)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm 2021-07-01 18:34:39 UTC (rev 279475)
@@ -596,7 +596,12 @@
currentIndex++;
}
- return [UIMenu menuWithTitle:@"" image:nil identifier:nil options:UIMenuOptionsPrivateRemoveLineLimitForChildren children:items];
+ UIMenuOptions options = UIMenuOptionsPrivateRemoveLineLimitForChildren;
+#if HAVE(UIMENUOPTIONS_SINGLE_SELECTION)
+ options |= UIMenuOptionsSingleSelection;
+#endif
+
+ return [UIMenu menuWithTitle:@"" image:nil identifier:nil options:options children:items];
}
- (UIAction *)actionForOptionItem:(const OptionItem&)option withIndex:(NSInteger)optionIndex
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes