Title: [278957] trunk
Revision
278957
Author
wenson_hs...@apple.com
Date
2021-06-16 15:18:38 -0700 (Wed, 16 Jun 2021)

Log Message

[watchOS] Reenable modern text input UI for non-numeric text input types
https://bugs.webkit.org/show_bug.cgi?id=226988
rdar://78102953

Reviewed by Tim Horton.

Source/WebKit:

Refactor text input logic on watchOS such that we're able to present the new ("modern") UI for scribble text
input on watchOS 8, rather than legacy (in-process) scribble UI. Overall, this patch removes
WKQuickboardListViewController altogether. This had two subclasses: WKSelectMenuListViewController (used for
focused single and multiple select elements) and WKTextInputListViewController (used for text input types).
WKSelectMenuListViewController now inherits directly from PUICQuickboardListViewController, and
WKTextInputListViewController now inherits from PUICQuickboardMessageViewController; this inheritance from
PUICQuickboardMessageViewController instead of PUICQuickboardListViewController allows the
WKTextInputListViewController to show text suggestions using `-setMessages:` on
PUICQuickboardMessageViewController, instead of relying on custom WebKit code to insert text suggestions.

This means that we move the following pieces of functionality out of WKQuickboardListViewController, and into
either WKSelectMenuListViewController or WKTextInputListViewController:

1. Support for inserting and updating context views (i.e. the domain name header view in Quickboard) =>
WKTextInputListViewController.

2. Logic for determining whether or not we should show language selection UI => WKTextInputListViewController.

3. Support for laying out custom collection view cells in Quickboard => WKSelectMenuListViewController.

* Platform/spi/watchos/PepperUICoreSPI.h:
* SourcesCocoa.txt:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView createQuickboardTextInputContext]):
(-[WKContentView _createQuickboardController:]):

Refactor logic to create a PUICTextInputContext from the current focused element information out into a separate
helper method, `-createQuickboardTextInputContext`, and use it when both directly launching into
PUICQuickboardController and WKTextInputListViewController.

(canUseQuickboardControllerFor):

Remove a comment, now that we intend to continue using WKTextInputListViewController for non-keychain-AutoFill-
compatible text fields moving forward.

(-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
(-[WKContentView allowsLanguageSelectionForListViewController:]):
(-[WKContentView textInputContextForListViewController:]):
(-[WKContentView textContentTypeForTesting]):
(-[WKContentView viewController:inputContextViewHeightForSize:]): Deleted.

Remove this delegate method, which was (effectively) unused since we just ask for
`-inputContextViewForViewController:` from the input delegate anyways.

(-[WKContentView allowsLanguageSelectionMenuForListViewController:]): Deleted.

Rename this to `-allowsLanguageSelectionForListViewController:`.

(-[WKContentView textContentTypeForListViewController:]): Deleted.

Replace this with `-textInputContextForListViewController:`, which returns a whole PUICTextInputContext instead
of just a text content type.

(-[WKContentView textSuggestionsForListViewController:]): Deleted.
(-[WKContentView listViewController:didSelectTextSuggestion:]): Deleted.

Remove several delegate methods that are no longer needed.

* UIProcess/ios/forms/WKDatePickerViewController.h:
* UIProcess/ios/forms/WKDatePickerViewController.mm:
(-[WKDatePickerViewController viewWillAppear:]):

Remove some (defunct) logic for overriding the status bar when showing Quickboard input view controllers. This
status bar mechanism (which was previously used to show label text for form controls) hasn't worked since
watchOS 6, and we need to implement this in a way that doesn't use PUICStatusBarGlobalContextViewAssertion.

* UIProcess/ios/forms/WKQuickboardListViewController.mm: Removed.
* UIProcess/ios/forms/WKQuickboardViewControllerDelegate.h: Renamed from Source/WebKit/UIProcess/ios/forms/WKQuickboardListViewController.h.
* UIProcess/ios/forms/WKSelectMenuListViewController.h:
* UIProcess/ios/forms/WKSelectMenuListViewController.mm:
(-[WKSelectMenuItemCell topToLabelBaselineSpecValue]):
(-[WKSelectMenuItemCell baselineToBottomSpecValue]):
(-[WKSelectMenuCollectionViewItemCell topToLabelBaselineSpecValue]):
(-[WKSelectMenuCollectionViewItemCell baselineToBottomSpecValue]):
(-[WKSelectMenuListViewController initWithDelegate:]):

See above comment for more details.

* UIProcess/ios/forms/WKTextInputListViewController.h:
* UIProcess/ios/forms/WKTextInputListViewController.mm:
(-[WKTextInputListViewController initWithDelegate:]):
(-[WKTextInputListViewController reloadContextView]):
(-[WKTextInputListViewController updateContextViewIfNeeded]):

Move logic for showing and updating the context view out of WKQuickboardListViewController, and into
WKTextInputListViewController. See comments above.

(-[WKTextInputListViewController requiresNumericInput]):
(-[WKTextInputListViewController additionalTrayButtons]):
(-[WKTextInputListViewController updateTextSuggestions:]):
(-[WKTextInputListViewController headerContentViewHeight]):
(-[WKTextInputListViewController headerContentView]):
(-[WKTextInputListViewController shouldShowLanguageButton]):
(-[WKTextInputListViewController supportsDictationInput]):
(-[WKTextInputListViewController shouldShowTrayView]):
(-[WKTextInputListViewController shouldShowTextField]):

Override this and return YES for text input types that don't require an additional numeric input tray button.
This allows PUICQuickboardMessageViewController to show a native text field containing the input text inside
quickboard, which (when tapped) presents modern text input UI.

Since showing the text field is apparently mutually exclusive to showing a tray view, we additionally override
`-shouldShowTrayView` and return NO for non-numeric text inputs.

(-[WKTextInputListViewController supportsArouetInput]):
(-[WKTextInputListViewController viewDidLoad]): Deleted.
(-[WKTextInputListViewController willPresentArouetViewController:]): Deleted.

There's no need to override this delegate method anymore, since the PUICTextInputContext's `-initialText` is
sufficient to ensure that the scribble text input UI is prepopulated with the focused text field's initial text
content.

(-[WKTextInputListViewController reloadTextSuggestions]): Deleted.

Rename this to `-updateTextSuggestions:`, and make it take a list of UITextSuggestions. This makes the code a
bit easier to follow and allows us to remove the `-textSuggestionsForListViewController:` delegate method.

(-[WKTextInputListViewController didSelectListItemAtIndexPath:]): Deleted.
(-[WKTextInputListViewController didSelectListItem:]): Deleted.
(-[WKTextInputListViewController _didSelectListItem:]): Deleted.
(-[WKTextInputListViewController numberOfListItems]): Deleted.
(-[WKTextInputListViewController heightForListItem:width:]): Deleted.
(-[WKTextInputListViewController cellForListItem:]): Deleted.
(-[WKTextInputListViewController listItemCellReuseIdentifier]): Deleted.
(-[WKTextInputListViewController listItemCellClass]): Deleted.
(-[WKTextInputListViewController itemCellForListItem:forIndexPath:]): Deleted.

Remove all this code for showing text suggestions in Quickboard UI. Since WKTextInputListViewController is now a
subclass of PUICQuickboardMessageViewController, we can now simply use the `-messages` property of to populate
quickboard with text suggestions.

* UIProcess/ios/forms/WKTimePickerViewController.h:
* WebKit.xcodeproj/project.pbxproj:

WebKitLibraries:

* WebKitPrivateFrameworkStubs/watchos/7/PepperUICore.framework/PepperUICore.tbd:
* WebKitPrivateFrameworkStubs/watchos/8/PepperUICore.framework/PepperUICore.tbd:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (278956 => 278957)


--- trunk/Source/WebKit/ChangeLog	2021-06-16 22:04:18 UTC (rev 278956)
+++ trunk/Source/WebKit/ChangeLog	2021-06-16 22:18:38 UTC (rev 278957)
@@ -1,3 +1,145 @@
+2021-06-16  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [watchOS] Reenable modern text input UI for non-numeric text input types
+        https://bugs.webkit.org/show_bug.cgi?id=226988
+        rdar://78102953
+
+        Reviewed by Tim Horton.
+
+        Refactor text input logic on watchOS such that we're able to present the new ("modern") UI for scribble text
+        input on watchOS 8, rather than legacy (in-process) scribble UI. Overall, this patch removes
+        WKQuickboardListViewController altogether. This had two subclasses: WKSelectMenuListViewController (used for
+        focused single and multiple select elements) and WKTextInputListViewController (used for text input types).
+        WKSelectMenuListViewController now inherits directly from PUICQuickboardListViewController, and
+        WKTextInputListViewController now inherits from PUICQuickboardMessageViewController; this inheritance from
+        PUICQuickboardMessageViewController instead of PUICQuickboardListViewController allows the
+        WKTextInputListViewController to show text suggestions using `-setMessages:` on
+        PUICQuickboardMessageViewController, instead of relying on custom WebKit code to insert text suggestions.
+
+        This means that we move the following pieces of functionality out of WKQuickboardListViewController, and into
+        either WKSelectMenuListViewController or WKTextInputListViewController:
+
+        1. Support for inserting and updating context views (i.e. the domain name header view in Quickboard) =>
+        WKTextInputListViewController.
+
+        2. Logic for determining whether or not we should show language selection UI => WKTextInputListViewController.
+
+        3. Support for laying out custom collection view cells in Quickboard => WKSelectMenuListViewController.
+
+        * Platform/spi/watchos/PepperUICoreSPI.h:
+        * SourcesCocoa.txt:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView createQuickboardTextInputContext]):
+        (-[WKContentView _createQuickboardController:]):
+
+        Refactor logic to create a PUICTextInputContext from the current focused element information out into a separate
+        helper method, `-createQuickboardTextInputContext`, and use it when both directly launching into
+        PUICQuickboardController and WKTextInputListViewController.
+
+        (canUseQuickboardControllerFor):
+
+        Remove a comment, now that we intend to continue using WKTextInputListViewController for non-keychain-AutoFill-
+        compatible text fields moving forward.
+
+        (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
+        (-[WKContentView allowsLanguageSelectionForListViewController:]):
+        (-[WKContentView textInputContextForListViewController:]):
+        (-[WKContentView textContentTypeForTesting]):
+        (-[WKContentView viewController:inputContextViewHeightForSize:]): Deleted.
+
+        Remove this delegate method, which was (effectively) unused since we just ask for
+        `-inputContextViewForViewController:` from the input delegate anyways.
+
+        (-[WKContentView allowsLanguageSelectionMenuForListViewController:]): Deleted.
+
+        Rename this to `-allowsLanguageSelectionForListViewController:`.
+
+        (-[WKContentView textContentTypeForListViewController:]): Deleted.
+
+        Replace this with `-textInputContextForListViewController:`, which returns a whole PUICTextInputContext instead
+        of just a text content type.
+
+        (-[WKContentView textSuggestionsForListViewController:]): Deleted.
+        (-[WKContentView listViewController:didSelectTextSuggestion:]): Deleted.
+
+        Remove several delegate methods that are no longer needed.
+
+        * UIProcess/ios/forms/WKDatePickerViewController.h:
+        * UIProcess/ios/forms/WKDatePickerViewController.mm:
+        (-[WKDatePickerViewController viewWillAppear:]):
+
+        Remove some (defunct) logic for overriding the status bar when showing Quickboard input view controllers. This
+        status bar mechanism (which was previously used to show label text for form controls) hasn't worked since
+        watchOS 6, and we need to implement this in a way that doesn't use PUICStatusBarGlobalContextViewAssertion.
+
+        * UIProcess/ios/forms/WKQuickboardListViewController.mm: Removed.
+        * UIProcess/ios/forms/WKQuickboardViewControllerDelegate.h: Renamed from Source/WebKit/UIProcess/ios/forms/WKQuickboardListViewController.h.
+        * UIProcess/ios/forms/WKSelectMenuListViewController.h:
+        * UIProcess/ios/forms/WKSelectMenuListViewController.mm:
+        (-[WKSelectMenuItemCell topToLabelBaselineSpecValue]):
+        (-[WKSelectMenuItemCell baselineToBottomSpecValue]):
+        (-[WKSelectMenuCollectionViewItemCell topToLabelBaselineSpecValue]):
+        (-[WKSelectMenuCollectionViewItemCell baselineToBottomSpecValue]):
+        (-[WKSelectMenuListViewController initWithDelegate:]):
+
+        See above comment for more details.
+
+        * UIProcess/ios/forms/WKTextInputListViewController.h:
+        * UIProcess/ios/forms/WKTextInputListViewController.mm:
+        (-[WKTextInputListViewController initWithDelegate:]):
+        (-[WKTextInputListViewController reloadContextView]):
+        (-[WKTextInputListViewController updateContextViewIfNeeded]):
+
+        Move logic for showing and updating the context view out of WKQuickboardListViewController, and into
+        WKTextInputListViewController. See comments above.
+
+        (-[WKTextInputListViewController requiresNumericInput]):
+        (-[WKTextInputListViewController additionalTrayButtons]):
+        (-[WKTextInputListViewController updateTextSuggestions:]):
+        (-[WKTextInputListViewController headerContentViewHeight]):
+        (-[WKTextInputListViewController headerContentView]):
+        (-[WKTextInputListViewController shouldShowLanguageButton]):
+        (-[WKTextInputListViewController supportsDictationInput]):
+        (-[WKTextInputListViewController shouldShowTrayView]):
+        (-[WKTextInputListViewController shouldShowTextField]):
+
+        Override this and return YES for text input types that don't require an additional numeric input tray button.
+        This allows PUICQuickboardMessageViewController to show a native text field containing the input text inside
+        quickboard, which (when tapped) presents modern text input UI.
+
+        Since showing the text field is apparently mutually exclusive to showing a tray view, we additionally override
+        `-shouldShowTrayView` and return NO for non-numeric text inputs.
+
+        (-[WKTextInputListViewController supportsArouetInput]):
+        (-[WKTextInputListViewController viewDidLoad]): Deleted.
+        (-[WKTextInputListViewController willPresentArouetViewController:]): Deleted.
+
+        There's no need to override this delegate method anymore, since the PUICTextInputContext's `-initialText` is
+        sufficient to ensure that the scribble text input UI is prepopulated with the focused text field's initial text
+        content.
+
+        (-[WKTextInputListViewController reloadTextSuggestions]): Deleted.
+
+        Rename this to `-updateTextSuggestions:`, and make it take a list of UITextSuggestions. This makes the code a
+        bit easier to follow and allows us to remove the `-textSuggestionsForListViewController:` delegate method.
+
+        (-[WKTextInputListViewController didSelectListItemAtIndexPath:]): Deleted.
+        (-[WKTextInputListViewController didSelectListItem:]): Deleted.
+        (-[WKTextInputListViewController _didSelectListItem:]): Deleted.
+        (-[WKTextInputListViewController numberOfListItems]): Deleted.
+        (-[WKTextInputListViewController heightForListItem:width:]): Deleted.
+        (-[WKTextInputListViewController cellForListItem:]): Deleted.
+        (-[WKTextInputListViewController listItemCellReuseIdentifier]): Deleted.
+        (-[WKTextInputListViewController listItemCellClass]): Deleted.
+        (-[WKTextInputListViewController itemCellForListItem:forIndexPath:]): Deleted.
+
+        Remove all this code for showing text suggestions in Quickboard UI. Since WKTextInputListViewController is now a
+        subclass of PUICQuickboardMessageViewController, we can now simply use the `-messages` property of to populate
+        quickboard with text suggestions.
+
+        * UIProcess/ios/forms/WKTimePickerViewController.h:
+        * WebKit.xcodeproj/project.pbxproj:
+
 2021-06-16  Chris Dumez  <cdu...@apple.com>
 
         Enable release logging in the network process for ephemeral sessions

Modified: trunk/Source/WebKit/Platform/spi/watchos/PepperUICoreSPI.h (278956 => 278957)


--- trunk/Source/WebKit/Platform/spi/watchos/PepperUICoreSPI.h	2021-06-16 22:04:18 UTC (rev 278956)
+++ trunk/Source/WebKit/Platform/spi/watchos/PepperUICoreSPI.h	2021-06-16 22:18:38 UTC (rev 278957)
@@ -39,9 +39,9 @@
 #import <PepperUICore/PUICPickerView_Private.h>
 #import <PepperUICore/PUICQuickboardArouetViewController.h>
 #import <PepperUICore/PUICQuickboardLanguageController.h>
-#import <PepperUICore/PUICQuickboardListViewController.h>
 #import <PepperUICore/PUICQuickboardListViewControllerSubclass.h>
 #import <PepperUICore/PUICQuickboardListViewSpecs.h>
+#import <PepperUICore/PUICQuickboardMessageViewController.h>
 #import <PepperUICore/PUICQuickboardViewController.h>
 #import <PepperUICore/PUICQuickboardViewController_Private.h>
 #import <PepperUICore/PUICResources.h>
@@ -232,11 +232,16 @@
 @property (nonatomic, readonly) PUICTableView *listView;
 @property (strong, nonatomic, readonly) PUICQuickboardListViewSpecs *specs;
 @property (nonatomic, copy) UITextContentType textContentType;
+@property (nonatomic, strong) PUICTextInputContext *textInputContext;
 - (instancetype)initWithDelegate:(id <PUICQuickboardViewControllerDelegate>)delegate dictationMode:(PUICDictationMode)dictationMode NS_DESIGNATED_INITIALIZER;
 - (void)reloadListItems;
 - (void)reloadHeaderContentView;
 @end
 
+@interface PUICQuickboardMessageViewController : PUICQuickboardListViewController
+@property (nonatomic, copy) NSArray *messages;
+@end
+
 @interface PUICQuickboardArouetViewController : PUICQuickboardViewController
 @property (nonatomic, copy, nullable) UITextContentType textContentType;
 - (void)setInputText:(nullable NSString *)inputText selectionRange:(NSRange)selectionRange;

Modified: trunk/Source/WebKit/SourcesCocoa.txt (278956 => 278957)


--- trunk/Source/WebKit/SourcesCocoa.txt	2021-06-16 22:04:18 UTC (rev 278956)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2021-06-16 22:18:38 UTC (rev 278957)
@@ -453,7 +453,6 @@
 UIProcess/ios/forms/WKFormSelectPopover.mm
 UIProcess/ios/forms/WKNumberPadView.mm
 UIProcess/ios/forms/WKNumberPadViewController.mm
-UIProcess/ios/forms/WKQuickboardListViewController.mm
 UIProcess/ios/forms/WKSelectMenuListViewController.mm
 UIProcess/ios/forms/WKTextInputListViewController.mm
 UIProcess/ios/forms/WKTimePickerViewController.mm

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (278956 => 278957)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-06-16 22:04:18 UTC (rev 278956)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-06-16 22:18:38 UTC (rev 278957)
@@ -64,7 +64,7 @@
 #import "WKPreviewActionItemIdentifiers.h"
 #import "WKPreviewActionItemInternal.h"
 #import "WKPreviewElementInfoInternal.h"
-#import "WKQuickboardListViewController.h"
+#import "WKQuickboardViewControllerDelegate.h"
 #import "WKSelectMenuListViewController.h"
 #import "WKSyntheticFlagsChangedWebEvent.h"
 #import "WKTextInputListViewController.h"
@@ -6666,22 +6666,24 @@
     [self setInputDelegate:nil];
 }
 
-#if HAVE(QUICKBOARD_CONTROLLER)
-
-- (RetainPtr<PUICQuickboardController>)_createQuickboardController:(UIViewController *)presentingViewController
+- (RetainPtr<PUICTextInputContext>)createQuickboardTextInputContext
 {
-    auto quickboardController = adoptNS([[PUICQuickboardController alloc] init]);
-
-    auto suggestions = adoptNS([[NSMutableArray<NSString *> alloc] initWithCapacity:[_formInputSession suggestions].count]);
-    for (UITextSuggestion *suggestion in [_formInputSession suggestions])
-        [suggestions addObject:suggestion.inputText];
-
     auto context = adoptNS([[PUICTextInputContext alloc] init]);
     [self _updateTextInputTraits:context.get()];
-    [context setSuggestions:suggestions.get()];
     [context setInitialText:_focusedElementInformation.value];
+#if HAVE(QUICKBOARD_CONTROLLER)
     [context setAcceptsEmoji:YES];
     [context setShouldPresentModernTextInputUI:YES];
+#endif
+    return context;
+}
+
+#if HAVE(QUICKBOARD_CONTROLLER)
+
+- (RetainPtr<PUICQuickboardController>)_createQuickboardController:(UIViewController *)presentingViewController
+{
+    auto quickboardController = adoptNS([[PUICQuickboardController alloc] init]);
+    auto context = self.createQuickboardTextInputContext;
     [quickboardController setQuickboardPresentingViewController:presentingViewController];
     [quickboardController setExcludedFromScreenCapture:[context isSecureTextEntry]];
     [quickboardController setTextInputContext:context.get()];
@@ -6692,7 +6694,6 @@
 
 static bool canUseQuickboardControllerFor(UITextContentType type)
 {
-    // We can remove this restriction once PUICQuickboardController supports displaying text suggestion strings that are not login credentials.
     return [type isEqualToString:UITextContentTypeUsername] || [type isEqualToString:UITextContentTypePassword] || [type isEqualToString:UITextContentTypeEmailAddress];
 }
 
@@ -6931,7 +6932,7 @@
     if (_isBlurringFocusedElement || ![_presentedFullScreenInputViewController isKindOfClass:[WKTextInputListViewController class]])
         return;
 
-    [(WKTextInputListViewController *)_presentedFullScreenInputViewController reloadTextSuggestions];
+    [(WKTextInputListViewController *)_presentedFullScreenInputViewController updateTextSuggestions:[_focusedFormControlView suggestions]];
 }
 
 #pragma mark - WKSelectMenuListViewControllerDelegate
@@ -9196,17 +9197,8 @@
 
 #pragma mark - WKQuickboardViewControllerDelegate
 
-- (CGFloat)viewController:(PUICQuickboardViewController *)controller inputContextViewHeightForSize:(CGSize)size
+- (BOOL)allowsLanguageSelectionForListViewController:(PUICQuickboardViewController *)controller
 {
-    id <_WKInputDelegate> delegate = self.webView._inputDelegate;
-    if (![delegate respondsToSelector:@selector(_webView:focusedElementContextViewHeightForFittingSize:inputSession:)])
-        return 0;
-
-    return [delegate _webView:self.webView focusedElementContextViewHeightForFittingSize:size inputSession:_formInputSession.get()];
-}
-
-- (BOOL)allowsLanguageSelectionMenuForListViewController:(PUICQuickboardViewController *)controller
-{
     switch (_focusedElementInformation.elementType) {
     case WebKit::InputType::ContentEditable:
     case WebKit::InputType::Text:
@@ -9272,22 +9264,11 @@
     }
 }
 
-- (NSString *)textContentTypeForListViewController:(WKTextInputListViewController *)controller
+- (PUICTextInputContext *)textInputContextForListViewController:(WKTextInputListViewController *)controller
 {
-    return self.textContentTypeForQuickboard;
+    return self.createQuickboardTextInputContext.autorelease();
 }
 
-- (NSArray<UITextSuggestion *> *)textSuggestionsForListViewController:(WKTextInputListViewController *)controller
-{
-    return [_focusedFormControlView suggestions];
-}
-
-- (void)listViewController:(WKTextInputListViewController *)controller didSelectTextSuggestion:(UITextSuggestion *)suggestion
-{
-    [self insertTextSuggestion:suggestion];
-    [self dismissQuickboardViewControllerAndRevealFocusedFormOverlayIfNecessary:controller];
-}
-
 - (BOOL)allowsDictationInputForListViewController:(PUICQuickboardViewController *)controller
 {
     return _focusedElementInformation.elementType != WebKit::InputType::Password;
@@ -9303,10 +9284,8 @@
 }
 #endif
 
+#if ENABLE(APP_HIGHLIGHTS)
 
-
-
-#if ENABLE(APP_HIGHLIGHTS)
 - (void)setUpAppHighlightMenusIfNeeded
 {
     if (!_page->preferences().appHighlightsEnabled() || !self.window || !_page->editorState().selectionIsRange)
@@ -10363,7 +10342,7 @@
 {
 #if HAVE(PEPPER_UI_CORE)
     if ([_presentedFullScreenInputViewController isKindOfClass:[WKTextInputListViewController class]])
-        return [self textContentTypeForListViewController:(WKTextInputListViewController *)_presentedFullScreenInputViewController.get()];
+        return [(WKTextInputListViewController *)_presentedFullScreenInputViewController textInputContext].textContentType;
 #if HAVE(QUICKBOARD_CONTROLLER)
     if (_presentedQuickboardController)
         return [_presentedQuickboardController textInputContext].textContentType;

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKDatePickerViewController.h (278956 => 278957)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKDatePickerViewController.h	2021-06-16 22:04:18 UTC (rev 278956)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKDatePickerViewController.h	2021-06-16 22:18:38 UTC (rev 278957)
@@ -25,7 +25,7 @@
 
 #if HAVE(PEPPER_UI_CORE)
 
-#import "WKQuickboardListViewController.h"
+#import "WKQuickboardViewControllerDelegate.h"
 
 @interface WKDatePickerViewController : PUICQuickboardViewController
 

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKDatePickerViewController.mm (278956 => 278957)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKDatePickerViewController.mm	2021-06-16 22:04:18 UTC (rev 278956)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKDatePickerViewController.mm	2021-06-16 22:18:38 UTC (rev 278957)
@@ -306,8 +306,6 @@
     _statusBarAssertion = [[PUICApplication sharedPUICApplication] _takeStatusBarGlobalContextAssertionAnimated:NO];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleStatusBarNavigation) name:PUICStatusBarNavigationBackButtonPressedNotification object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleStatusBarNavigation) name:PUICStatusBarTitleTappedNotification object:nil];
-
-    configureStatusBarForController(self, self.delegate);
 }
 
 - (void)viewDidAppear:(BOOL)animated

Deleted: trunk/Source/WebKit/UIProcess/ios/forms/WKQuickboardListViewController.h (278956 => 278957)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKQuickboardListViewController.h	2021-06-16 22:04:18 UTC (rev 278956)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKQuickboardListViewController.h	2021-06-16 22:18:38 UTC (rev 278957)
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if HAVE(PEPPER_UI_CORE)
-
-#import "PepperUICoreSPI.h"
-
-@interface WKQuickboardListItemCell : PUICQuickboardListItemCell
-@end
-
-#if HAVE(QUICKBOARD_COLLECTION_VIEWS)
-@interface WKQuickboardListCollectionViewItemCell : PUICQuickboardListCollectionViewItemCell
-@end
-#endif
-
-@class WKQuickboardListViewController;
-
-@protocol WKQuickboardViewControllerDelegate <PUICQuickboardViewControllerDelegate>
-
-- (CGFloat)viewController:(PUICQuickboardViewController *)controller inputContextViewHeightForSize:(CGSize)size;
-- (UIView *)inputContextViewForViewController:(PUICQuickboardViewController *)controller;
-- (NSString *)inputLabelTextForViewController:(PUICQuickboardViewController *)controller;
-- (NSString *)initialValueForViewController:(PUICQuickboardViewController *)controller;
-- (BOOL)shouldDisplayInputContextViewForListViewController:(PUICQuickboardViewController *)controller;
-- (BOOL)allowsLanguageSelectionMenuForListViewController:(PUICQuickboardViewController *)controller;
-
-@end
-
-@interface WKQuickboardListViewController : PUICQuickboardListViewController
-
-- (instancetype)initWithDelegate:(id <WKQuickboardViewControllerDelegate>)delegate NS_DESIGNATED_INITIALIZER;
-- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
-- (instancetype)initWithDelegate:(id<PUICQuickboardViewControllerDelegate>)delegate dictationMode:(PUICDictationMode)dictationMode NS_UNAVAILABLE;
-
-- (void)reloadContextView;
-
-@property (nonatomic, weak) id <WKQuickboardViewControllerDelegate> delegate;
-
-@end
-
-void configureStatusBarForController(PUICQuickboardViewController *, id <WKQuickboardViewControllerDelegate>);
-
-#endif // HAVE(PEPPER_UI_CORE)

Deleted: trunk/Source/WebKit/UIProcess/ios/forms/WKQuickboardListViewController.mm (278956 => 278957)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKQuickboardListViewController.mm	2021-06-16 22:04:18 UTC (rev 278956)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKQuickboardListViewController.mm	2021-06-16 22:18:38 UTC (rev 278957)
@@ -1,201 +0,0 @@
-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "WKQuickboardListViewController.h"
-
-#if HAVE(PEPPER_UI_CORE)
-
-#import <wtf/RetainPtr.h>
-
-static const CGFloat itemCellTopToLabelBaseline = 26;
-static const CGFloat itemCellBaselineToBottom = 8;
-
-@implementation WKQuickboardListItemCell
-
-- (CGFloat)topToLabelBaselineSpecValue
-{
-    return itemCellTopToLabelBaseline;
-}
-
-- (CGFloat)baselineToBottomSpecValue
-{
-    return itemCellBaselineToBottom;
-}
-
-@end
-
-#if HAVE(QUICKBOARD_COLLECTION_VIEWS)
-
-@implementation WKQuickboardListCollectionViewItemCell
-
-- (CGFloat)topToLabelBaselineSpecValue
-{
-    return itemCellTopToLabelBaseline;
-}
-
-- (CGFloat)baselineToBottomSpecValue
-{
-    return itemCellBaselineToBottom;
-}
-
-@end
-
-#endif // HAVE(QUICKBOARD_COLLECTION_VIEWS)
-
-@interface WKQuickboardListViewController () <PUICQuickboardLanguageControllerDelegate>
-@end
-
-@implementation WKQuickboardListViewController {
-    BOOL _contextViewNeedsUpdate;
-    RetainPtr<UIView> _contextView;
-    RetainPtr<PUICStatusBarGlobalContextViewAssertion> _statusBarAssertion;
-}
-
-@dynamic delegate;
-
-- (instancetype)initWithDelegate:(id <WKQuickboardViewControllerDelegate>)delegate
-{
-    if (self = [super initWithDelegate:delegate dictationMode:PUICDictationModeText])
-        _contextViewNeedsUpdate = YES;
-
-    return self;
-}
-
-- (void)updateContextViewIfNeeded
-{
-    if (!_contextViewNeedsUpdate)
-        return;
-
-    auto previousContextView = _contextView;
-    if ([self.delegate shouldDisplayInputContextViewForListViewController:self])
-        _contextView = [self.delegate inputContextViewForViewController:self];
-    else
-        _contextView = nil;
-
-    _contextViewNeedsUpdate = NO;
-}
-
-- (BOOL)prefersStatusBarHidden
-{
-    return NO;
-}
-
-- (void)viewWillAppear:(BOOL)animated
-{
-    [super viewWillAppear:animated];
-
-    _statusBarAssertion = [[PUICApplication sharedPUICApplication] _takeStatusBarGlobalContextAssertionAnimated:NO];
-
-    NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
-    [center addObserver:self selector:@selector(_handleStatusBarNavigation) name:PUICStatusBarNavigationBackButtonPressedNotification object:nil];
-    [center addObserver:self selector:@selector(_handleStatusBarNavigation) name:PUICStatusBarTitleTappedNotification object:nil];
-
-    configureStatusBarForController(self, self.delegate);
-}
-
-- (void)viewDidDisappear:(BOOL)animated
-{
-    [super viewDidDisappear:animated];
-
-    _statusBarAssertion = nil;
-
-    NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
-    [center removeObserver:self name:PUICStatusBarNavigationBackButtonPressedNotification object:nil];
-    [center removeObserver:self name:PUICStatusBarTitleTappedNotification object:nil];
-}
-
-- (void)_handleStatusBarNavigation
-{
-    [self.delegate quickboardInputCancelled:self];
-}
-
-- (void)reloadContextView
-{
-    _contextViewNeedsUpdate = YES;
-    [self reloadHeaderContentView];
-}
-
-ALLOW_DEPRECATED_IMPLEMENTATIONS_BEGIN
-
-- (PUICActionController *)actionController
-{
-    if (![self.delegate allowsLanguageSelectionMenuForListViewController:self])
-        return nil;
-
-    PUICActionItem *languageSelectionActionItem = [self.languageController languageSelectionActionItemForViewController:self];
-    auto actionGroup = adoptNS([[PUICActionGroup alloc] initWithActionItems:@[ languageSelectionActionItem ] actionStyle:PUICActionStyleAutomatic]);
-    return adoptNS([[PUICActionController alloc] initWithActionGroup:actionGroup.get()]).autorelease();
-}
-
-ALLOW_DEPRECATED_IMPLEMENTATIONS_END
-
-#pragma mark - PUICQuickboardLanguageControllerDelegate
-
-- (void)languageControllerDidChangePrimaryLanguage:(PUICQuickboardLanguageController *)languageController
-{
-    if ([self.delegate respondsToSelector:@selector(quickboard:languageDidChange:)])
-        [self.delegate quickboard:self languageDidChange:languageController.primaryLanguage];
-}
-
-#pragma mark - Quickboard subclassing
-
-- (CGFloat)headerContentViewHeight
-{
-    [self updateContextViewIfNeeded];
-
-    return [_contextView sizeThatFits:self.contentView.bounds.size].height;
-}
-
-- (UIView *)headerContentView
-{
-    [self updateContextViewIfNeeded];
-
-    CGFloat viewWidth = CGRectGetWidth(self.contentView.bounds);
-    CGSize sizeThatFits = [_contextView sizeThatFits:self.contentView.bounds.size];
-    [_contextView setFrame:CGRectMake((viewWidth - sizeThatFits.width) / 2, 0, sizeThatFits.width, sizeThatFits.height)];
-    [_contextView layoutSubviews];
-    return _contextView.get();
-}
-
-@end
-
-void configureStatusBarForController(PUICQuickboardViewController *controller, id <WKQuickboardViewControllerDelegate> delegate)
-{
-    // An internal client (e.g. Safari's modal sheet) may have moved the status bar offscreen.
-    // Before updating the status bar, make sure that we bring the status bar back to its original position.
-    PUICStatusBar *statusBar = [PUICApplication sharedPUICApplication]._puicStatusBar;
-    statusBar.frame = CGRect { CGPointZero, statusBar.frame.size };
-
-    PUICApplicationStatusBarItem *item = controller.puic_applicationStatusBarItem;
-    item.title = [delegate inputLabelTextForViewController:controller];
-    item.titleColor = [UIColor systemBlueColor];
-    item.navUIBackButtonDisabled = NO;
-    item.showNavigationUI = YES;
-    item.titleInteractive = YES;
-    [item commitChangesAnimated:NO];
-}
-
-#endif // HAVE(PEPPER_UI_CORE)

Copied: trunk/Source/WebKit/UIProcess/ios/forms/WKQuickboardViewControllerDelegate.h (from rev 278955, trunk/Source/WebKit/UIProcess/ios/forms/WKQuickboardListViewController.h) (0 => 278957)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKQuickboardViewControllerDelegate.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKQuickboardViewControllerDelegate.h	2021-06-16 22:18:38 UTC (rev 278957)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE(PEPPER_UI_CORE)
+
+#import "PepperUICoreSPI.h"
+
+@protocol WKQuickboardViewControllerDelegate <PUICQuickboardViewControllerDelegate>
+
+- (NSString *)inputLabelTextForViewController:(PUICQuickboardViewController *)controller;
+- (NSString *)initialValueForViewController:(PUICQuickboardViewController *)controller;
+
+@end
+
+#endif // HAVE(PEPPER_UI_CORE)

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKSelectMenuListViewController.h (278956 => 278957)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKSelectMenuListViewController.h	2021-06-16 22:04:18 UTC (rev 278956)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKSelectMenuListViewController.h	2021-06-16 22:18:38 UTC (rev 278957)
@@ -25,7 +25,7 @@
 
 #if HAVE(PEPPER_UI_CORE)
 
-#import "WKQuickboardListViewController.h"
+#import "WKQuickboardViewControllerDelegate.h"
 
 @class WKSelectMenuListViewController;
 
@@ -41,9 +41,11 @@
 
 @end
 
-@interface WKSelectMenuListViewController : WKQuickboardListViewController
+@interface WKSelectMenuListViewController : PUICQuickboardListViewController
 
 - (instancetype)initWithDelegate:(id <WKSelectMenuListViewControllerDelegate>)delegate NS_DESIGNATED_INITIALIZER;
+- (instancetype)initWithDelegate:(id <PUICQuickboardViewControllerDelegate>)delegate dictationMode:(PUICDictationMode)dictationMode NS_UNAVAILABLE;
+- (instancetype)initWithCoder:(NSCoder *)coder NS_UNAVAILABLE;
 
 @property (nonatomic, weak) id <WKSelectMenuListViewControllerDelegate> delegate;
 

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKSelectMenuListViewController.mm (278956 => 278957)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKSelectMenuListViewController.mm	2021-06-16 22:04:18 UTC (rev 278956)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKSelectMenuListViewController.mm	2021-06-16 22:18:38 UTC (rev 278957)
@@ -43,8 +43,11 @@
     PUICQuickboardListSectionContentUnavailable,
 };
 
-// FIXME: This method can be removed when <rdar://problem/57807445> lands in a build.
-@interface WKSelectMenuItemCell : WKQuickboardListItemCell
+static constexpr CGFloat itemCellTopToLabelBaseline = 26;
+static constexpr CGFloat itemCellBaselineToBottom = 8;
+
+// FIXME: This can be removed when <rdar://problem/57807445> lands in a build.
+@interface WKSelectMenuItemCell : PUICQuickboardListItemCell
 @property (nonatomic, readonly) UIImageView *imageView;
 @end
 
@@ -52,7 +55,7 @@
     RetainPtr<UIImageView> _imageView;
 }
 
-- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
+- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
 {
     if (!(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]))
         return nil;
@@ -71,11 +74,21 @@
     return _imageView.get();
 }
 
+- (CGFloat)topToLabelBaselineSpecValue
+{
+    return itemCellTopToLabelBaseline;
+}
+
+- (CGFloat)baselineToBottomSpecValue
+{
+    return itemCellBaselineToBottom;
+}
+
 @end
 
 #if HAVE(QUICKBOARD_COLLECTION_VIEWS)
 
-@interface WKSelectMenuCollectionViewItemCell : WKQuickboardListCollectionViewItemCell
+@interface WKSelectMenuCollectionViewItemCell : PUICQuickboardListCollectionViewItemCell
 @property (nonatomic, readonly) UIImageView *imageView;
 @end
 
@@ -102,6 +115,16 @@
     return _imageView.get();
 }
 
+- (CGFloat)topToLabelBaselineSpecValue
+{
+    return itemCellTopToLabelBaseline;
+}
+
+- (CGFloat)baselineToBottomSpecValue
+{
+    return itemCellBaselineToBottom;
+}
+
 @end
 
 #endif // HAVE(QUICKBOARD_COLLECTION_VIEWS)
@@ -115,7 +138,7 @@
 
 - (instancetype)initWithDelegate:(id <WKSelectMenuListViewControllerDelegate>)delegate
 {
-    return [super initWithDelegate:delegate];
+    return [super initWithDelegate:delegate dictationMode:PUICDictationModeText];
 }
 
 - (void)viewDidLoad

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKTextInputListViewController.h (278956 => 278957)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKTextInputListViewController.h	2021-06-16 22:04:18 UTC (rev 278956)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKTextInputListViewController.h	2021-06-16 22:18:38 UTC (rev 278957)
@@ -27,7 +27,7 @@
 
 #if HAVE(PEPPER_UI_CORE)
 
-#import "WKQuickboardListViewController.h"
+#import "WKQuickboardViewControllerDelegate.h"
 
 typedef NS_ENUM(NSInteger, WKNumberPadInputMode) {
     WKNumberPadInputModeNone,
@@ -41,17 +41,21 @@
 @protocol WKTextInputListViewControllerDelegate <WKQuickboardViewControllerDelegate>
 
 - (WKNumberPadInputMode)numericInputModeForListViewController:(WKTextInputListViewController *)controller;
-- (NSString *)textContentTypeForListViewController:(WKTextInputListViewController *)controller;
-- (NSArray<UITextSuggestion *> *)textSuggestionsForListViewController:(WKTextInputListViewController *)controller;
-- (void)listViewController:(WKTextInputListViewController *)controller didSelectTextSuggestion:(UITextSuggestion *)suggestion;
-- (BOOL)allowsDictationInputForListViewController:(PUICQuickboardViewController *)controller;
+- (PUICTextInputContext *)textInputContextForListViewController:(WKTextInputListViewController *)controller;
+- (UIView *)inputContextViewForViewController:(PUICQuickboardViewController *)controller;
+- (BOOL)allowsDictationInputForListViewController:(WKTextInputListViewController *)controller;
+- (BOOL)allowsLanguageSelectionForListViewController:(WKTextInputListViewController *)controller;
+- (BOOL)shouldDisplayInputContextViewForListViewController:(PUICQuickboardViewController *)controller;
 
 @end
 
-@interface WKTextInputListViewController : WKQuickboardListViewController
+@interface WKTextInputListViewController : PUICQuickboardMessageViewController
 
 - (instancetype)initWithDelegate:(id <WKTextInputListViewControllerDelegate>)delegate NS_DESIGNATED_INITIALIZER;
-- (void)reloadTextSuggestions;
+- (instancetype)initWithDelegate:(id <PUICQuickboardViewControllerDelegate>)delegate dictationMode:(PUICDictationMode)dictationMode NS_UNAVAILABLE;
+- (instancetype)initWithCoder:(NSCoder *)coder NS_UNAVAILABLE;
+- (void)updateTextSuggestions:(NSArray<UITextSuggestion *> *)suggestions;
+- (void)reloadContextView;
 
 @property (nonatomic, weak) id <WKTextInputListViewControllerDelegate> delegate;
 

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKTextInputListViewController.mm (278956 => 278957)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKTextInputListViewController.mm	2021-06-16 22:04:18 UTC (rev 278956)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKTextInputListViewController.mm	2021-06-16 22:18:38 UTC (rev 278957)
@@ -31,11 +31,9 @@
 #import "WKNumberPadViewController.h"
 #import <wtf/RetainPtr.h>
 
-static const CGFloat textSuggestionButtonHeight = 44;
-static const CGFloat textSuggestionLabelHorizontalMargin = 9;
-static NSString *textSuggestionCellReuseIdentifier = @"WebKitQuickboardTextSuggestionCell";
-
 @implementation WKTextInputListViewController {
+    BOOL _contextViewNeedsUpdate;
+    RetainPtr<UIView> _contextView;
     RetainPtr<WKNumberPadViewController> _numberPadViewController;
 }
 
@@ -43,32 +41,42 @@
 
 - (instancetype)initWithDelegate:(id <WKTextInputListViewControllerDelegate>)delegate
 {
-    if (!(self = [super initWithDelegate:delegate]))
+    if (!(self = [super initWithDelegate:delegate dictationMode:PUICDictationModeText]))
         return nil;
 
-    self.textContentType = [self.delegate textContentTypeForListViewController:self];
+    _contextViewNeedsUpdate = YES;
+    self.textInputContext = [self.delegate textInputContextForListViewController:self];
     return self;
 }
 
-- (void)viewDidLoad
+- (void)reloadContextView
 {
-    [super viewDidLoad];
-
-    self.headerView.hidden = YES;
+    _contextViewNeedsUpdate = YES;
+    [self reloadHeaderContentView];
 }
 
-- (void)willPresentArouetViewController:(PUICQuickboardArouetViewController *)quickboard
+- (void)updateContextViewIfNeeded
 {
-    NSString *initialText = [self.delegate initialValueForViewController:self];
-    if (initialText.length)
-        [quickboard setInputText:initialText selectionRange:NSMakeRange(initialText.length, 0)];
+    if (!_contextViewNeedsUpdate)
+        return;
 
-    quickboard.minTextLengthForEnablingAccept = 0;
+    auto previousContextView = _contextView;
+    if ([self.delegate shouldDisplayInputContextViewForListViewController:self])
+        _contextView = [self.delegate inputContextViewForViewController:self];
+    else
+        _contextView = nil;
+
+    _contextViewNeedsUpdate = NO;
 }
 
+- (BOOL)requiresNumericInput
+{
+    return [self.delegate numericInputModeForListViewController:self] != WKNumberPadInputModeNone;
+}
+
 - (NSArray *)additionalTrayButtons
 {
-    if ([self.delegate numericInputModeForListViewController:self] == WKNumberPadInputModeNone)
+    if (!self.requiresNumericInput)
         return @[ ];
 
 #if HAVE(PUIC_BUTTON_TYPE_PILL)
@@ -99,9 +107,14 @@
     [self presentViewController:_numberPadViewController.get() animated:YES completion:nil];
 }
 
-- (void)reloadTextSuggestions
+- (void)updateTextSuggestions:(NSArray<UITextSuggestion *> *)suggestions
 {
-    [self reloadListItems];
+    auto messages = adoptNS([[NSMutableArray<NSAttributedString *> alloc] initWithCapacity:suggestions.count]);
+    for (UITextSuggestion *suggestion in suggestions) {
+        auto attributedString = adoptNS([[NSAttributedString alloc] initWithString:suggestion.displayText]);
+        [messages addObject:attributedString.get()];
+    }
+    self.messages = messages.get();
 }
 
 - (void)enterText:(NSString *)text
@@ -111,109 +124,46 @@
 
 #pragma mark - Quickboard subclassing
 
-- (BOOL)supportsDictationInput
+- (CGFloat)headerContentViewHeight
 {
-    return [self.delegate allowsDictationInputForListViewController:self];
-}
+    [self updateContextViewIfNeeded];
 
-- (void)didSelectListItemAtIndexPath:(NSIndexPath *)indexPath
-{
-    [self _didSelectListItem:indexPath.row];
+    return [_contextView sizeThatFits:self.contentView.bounds.size].height;
 }
 
-// FIXME: This method can be removed when <rdar://problem/57807445> lands in a build.
-- (void)didSelectListItem:(NSInteger)itemNumber
+- (UIView *)headerContentView
 {
-    [self _didSelectListItem:itemNumber];
-}
+    [self updateContextViewIfNeeded];
 
-- (void)_didSelectListItem:(NSInteger)itemNumber
-{
-    NSArray<UITextSuggestion *> *textSuggestions = [self.delegate textSuggestionsForListViewController:self];
-    if (textSuggestions.count <= static_cast<NSUInteger>(itemNumber)) {
-        ASSERT_NOT_REACHED();
-        return;
-    }
-
-    [self.delegate listViewController:self didSelectTextSuggestion:[textSuggestions objectAtIndex:itemNumber]];
+    CGFloat viewWidth = CGRectGetWidth(self.contentView.bounds);
+    CGSize sizeThatFits = [_contextView sizeThatFits:self.contentView.bounds.size];
+    [_contextView setFrame:CGRectMake((viewWidth - sizeThatFits.width) / 2, 0, sizeThatFits.width, sizeThatFits.height)];
+    return _contextView.get();
 }
 
-- (NSInteger)numberOfListItems
+- (BOOL)shouldShowLanguageButton
 {
-    return [self.delegate textSuggestionsForListViewController:self].count;
+    return [self.delegate allowsLanguageSelectionForListViewController:self];
 }
 
-- (CGFloat)heightForListItem:(NSInteger)itemNumber width:(CGFloat)width
+- (BOOL)supportsDictationInput
 {
-    return textSuggestionButtonHeight;
+    return [self.delegate allowsDictationInputForListViewController:self];
 }
 
-// FIXME: This method can be removed when <rdar://problem/57807445> lands in a build.
-- (PUICQuickboardListItemCell *)cellForListItem:(NSInteger)itemNumber
+- (BOOL)shouldShowTrayView
 {
-    NSArray<UITextSuggestion *> *textSuggestions = [self.delegate textSuggestionsForListViewController:self];
-    if (textSuggestions.count <= static_cast<NSUInteger>(itemNumber)) {
-        ASSERT_NOT_REACHED();
-        return nil;
-    }
-
-    UITextSuggestion *textSuggestion = [textSuggestions objectAtIndex:itemNumber];
-    auto reusableCell = retainPtr([self.listView dequeueReusableCellWithIdentifier:textSuggestionCellReuseIdentifier]);
-    if (!reusableCell) {
-        reusableCell = adoptNS([[WKQuickboardListItemCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:textSuggestionCellReuseIdentifier]);
-        [reusableCell itemLabel].numberOfLines = 1;
-        [reusableCell itemLabel].lineBreakMode = NSLineBreakByTruncatingTail;
-        [reusableCell itemLabel].allowsDefaultTighteningForTruncation = YES;
-    }
-
-    CGFloat viewWidth = CGRectGetWidth(self.listView.bounds);
-    [reusableCell configureForText:textSuggestion.displayText width:viewWidth];
-
-    // The default behavior of -configureForText:width: causes the text label to run off the end of the cell.
-    // Adjust for this by shrinking the label width to actually fit the bounds of the cell.
-    [reusableCell itemLabel].frame = UIRectInset([reusableCell contentView].bounds, 0, textSuggestionLabelHorizontalMargin, 0, textSuggestionLabelHorizontalMargin);
-    return reusableCell.autorelease();
+    return self.requiresNumericInput;
 }
 
-- (NSString *)listItemCellReuseIdentifier
+- (BOOL)shouldShowTextField
 {
-    return textSuggestionCellReuseIdentifier;
+    return !self.requiresNumericInput;
 }
 
-#if HAVE(QUICKBOARD_COLLECTION_VIEWS)
-
-- (Class)listItemCellClass
-{
-    return [WKQuickboardListCollectionViewItemCell class];
-}
-
-- (PUICQuickboardListCollectionViewItemCell *)itemCellForListItem:(NSInteger)itemNumber forIndexPath:(NSIndexPath *)indexPath
-{
-    NSArray<UITextSuggestion *> *textSuggestions = [self.delegate textSuggestionsForListViewController:self];
-    if (textSuggestions.count <= static_cast<NSUInteger>(itemNumber)) {
-        ASSERT_NOT_REACHED();
-        return nil;
-    }
-
-    UITextSuggestion *textSuggestion = [textSuggestions objectAtIndex:itemNumber];
-    auto reusableCell = retainPtr([self.collectionView dequeueReusableCellWithReuseIdentifier:textSuggestionCellReuseIdentifier forIndexPath:indexPath]);
-
-    [reusableCell bodyLabel].numberOfLines = 1;
-    [reusableCell bodyLabel].lineBreakMode = NSLineBreakByTruncatingTail;
-    [reusableCell bodyLabel].allowsDefaultTighteningForTruncation = YES;
-    [reusableCell setText:textSuggestion.displayText];
-
-    // The default behavior of -configureForText:width: causes the text label to run off the end of the cell.
-    // Adjust for this by shrinking the label width to actually fit the bounds of the cell.
-    [reusableCell bodyLabel].frame = UIRectInset([reusableCell contentView].bounds, 0, textSuggestionLabelHorizontalMargin, 0, textSuggestionLabelHorizontalMargin);
-    return reusableCell.autorelease();
-}
-
-#endif // HAVE(QUICKBOARD_COLLECTION_VIEWS)
-
 - (BOOL)supportsArouetInput
 {
-    return [self.delegate numericInputModeForListViewController:self] == WKNumberPadInputModeNone;
+    return !self.requiresNumericInput;
 }
 
 @end

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKTimePickerViewController.h (278956 => 278957)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKTimePickerViewController.h	2021-06-16 22:04:18 UTC (rev 278956)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKTimePickerViewController.h	2021-06-16 22:18:38 UTC (rev 278957)
@@ -25,7 +25,7 @@
 
 #if HAVE(PEPPER_UI_CORE)
 
-#import "WKQuickboardListViewController.h"
+#import "WKQuickboardViewControllerDelegate.h"
 
 @interface WKTimePickerViewController : PUICQuickboardViewController
 

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (278956 => 278957)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-06-16 22:04:18 UTC (rev 278956)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-06-16 22:18:38 UTC (rev 278957)
@@ -2037,7 +2037,7 @@
 		F4CB09E5225D5A0900891487 /* WebsiteMediaSourcePolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = F4CB09E4225D5A0300891487 /* WebsiteMediaSourcePolicy.h */; };
 		F4CF1E9D25E40DCC000F9D73 /* GestureRecognizerConsistencyEnforcer.h in Headers */ = {isa = PBXBuildFile; fileRef = F4CF1E9B25E40DCC000F9D73 /* GestureRecognizerConsistencyEnforcer.h */; };
 		F4D5F51D206087A10038BBA8 /* WKTextInputListViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = F4D5F519206087A00038BBA8 /* WKTextInputListViewController.h */; };
-		F4D5F51F206087A10038BBA8 /* WKQuickboardListViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = F4D5F51B206087A10038BBA8 /* WKQuickboardListViewController.h */; };
+		F4D5F51F206087A10038BBA8 /* WKQuickboardViewControllerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = F4D5F51B206087A10038BBA8 /* WKQuickboardViewControllerDelegate.h */; };
 		F4DB54E62319E733009E3155 /* WKHighlightLongPressGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = F4DB54E42319E733009E3155 /* WKHighlightLongPressGestureRecognizer.h */; };
 		F4EC94E32356CC57000BB614 /* ApplicationServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 29D04E2821F7C73D0076741D /* ApplicationServicesSPI.h */; };
 		F4FE0A3B24632B60002631E1 /* CocoaColor.h in Headers */ = {isa = PBXBuildFile; fileRef = F4FE0A3A24632B10002631E1 /* CocoaColor.h */; };
@@ -6001,8 +6001,7 @@
 		F4CF1E9C25E40DCC000F9D73 /* GestureRecognizerConsistencyEnforcer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = GestureRecognizerConsistencyEnforcer.mm; path = ios/GestureRecognizerConsistencyEnforcer.mm; sourceTree = "<group>"; };
 		F4D5F519206087A00038BBA8 /* WKTextInputListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKTextInputListViewController.h; path = ios/forms/WKTextInputListViewController.h; sourceTree = "<group>"; };
 		F4D5F51A206087A10038BBA8 /* WKTextInputListViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKTextInputListViewController.mm; path = ios/forms/WKTextInputListViewController.mm; sourceTree = "<group>"; };
-		F4D5F51B206087A10038BBA8 /* WKQuickboardListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKQuickboardListViewController.h; path = ios/forms/WKQuickboardListViewController.h; sourceTree = "<group>"; };
-		F4D5F51C206087A10038BBA8 /* WKQuickboardListViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKQuickboardListViewController.mm; path = ios/forms/WKQuickboardListViewController.mm; sourceTree = "<group>"; };
+		F4D5F51B206087A10038BBA8 /* WKQuickboardViewControllerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKQuickboardViewControllerDelegate.h; path = ios/forms/WKQuickboardViewControllerDelegate.h; sourceTree = "<group>"; };
 		F4DB54E42319E733009E3155 /* WKHighlightLongPressGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKHighlightLongPressGestureRecognizer.h; path = ios/WKHighlightLongPressGestureRecognizer.h; sourceTree = "<group>"; };
 		F4DB54E52319E733009E3155 /* WKHighlightLongPressGestureRecognizer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKHighlightLongPressGestureRecognizer.mm; path = ios/WKHighlightLongPressGestureRecognizer.mm; sourceTree = "<group>"; };
 		F4F59AD32065A5C9006CAA46 /* WKSelectMenuListViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKSelectMenuListViewController.mm; path = ios/forms/WKSelectMenuListViewController.mm; sourceTree = "<group>"; };
@@ -11373,8 +11372,7 @@
 				2EA7B3D42026CF23009CE5AC /* WKNumberPadView.mm */,
 				2EA7B3CF2026CEF8009CE5AC /* WKNumberPadViewController.h */,
 				2EA7B3D02026CEF8009CE5AC /* WKNumberPadViewController.mm */,
-				F4D5F51B206087A10038BBA8 /* WKQuickboardListViewController.h */,
-				F4D5F51C206087A10038BBA8 /* WKQuickboardListViewController.mm */,
+				F4D5F51B206087A10038BBA8 /* WKQuickboardViewControllerDelegate.h */,
 				F4F59AD42065A5CA006CAA46 /* WKSelectMenuListViewController.h */,
 				F4F59AD32065A5C9006CAA46 /* WKSelectMenuListViewController.mm */,
 				F4D5F519206087A00038BBA8 /* WKTextInputListViewController.h */,
@@ -12912,7 +12910,7 @@
 				512F58FC12A88A5400629530 /* WKProtectionSpace.h in Headers */,
 				5272D4C91E735F0900EB4290 /* WKProtectionSpaceNS.h in Headers */,
 				518ACAEA12AEE6BB00B04B83 /* WKProtectionSpaceTypes.h in Headers */,
-				F4D5F51F206087A10038BBA8 /* WKQuickboardListViewController.h in Headers */,
+				F4D5F51F206087A10038BBA8 /* WKQuickboardViewControllerDelegate.h in Headers */,
 				1AD01BCD1905D54900C9C45F /* WKReloadFrameErrorRecoveryAttempter.h in Headers */,
 				1A9E329B1822E1CC00F5D04C /* WKRemoteObject.h in Headers */,
 				1A9E329F1822FEDD00F5D04C /* WKRemoteObjectCoder.h in Headers */,

Modified: trunk/WebKitLibraries/ChangeLog (278956 => 278957)


--- trunk/WebKitLibraries/ChangeLog	2021-06-16 22:04:18 UTC (rev 278956)
+++ trunk/WebKitLibraries/ChangeLog	2021-06-16 22:18:38 UTC (rev 278957)
@@ -1,3 +1,14 @@
+2021-06-16  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [watchOS] Reenable modern text input UI for non-numeric text input types
+        https://bugs.webkit.org/show_bug.cgi?id=226988
+        rdar://78102953
+
+        Reviewed by Tim Horton.
+
+        * WebKitPrivateFrameworkStubs/watchos/7/PepperUICore.framework/PepperUICore.tbd:
+        * WebKitPrivateFrameworkStubs/watchos/8/PepperUICore.framework/PepperUICore.tbd:
+
 2021-06-15  Jonathan Bedard  <jbed...@apple.com>
 
         [tvOS 15] Support building WebKit

Modified: trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/watchos/7/PepperUICore.framework/PepperUICore.tbd (278956 => 278957)


--- trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/watchos/7/PepperUICore.framework/PepperUICore.tbd	2021-06-16 22:04:18 UTC (rev 278956)
+++ trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/watchos/7/PepperUICore.framework/PepperUICore.tbd	2021-06-16 22:18:38 UTC (rev 278957)
@@ -8,5 +8,5 @@
     objc-classes:    [ PUICQuickboardListTrayButton, PUICActionGroup, PUICQuickboardListItemCell, PUICActionController,
                        PUICCrownInputSequencer, PUICPickerView, PUICQuickboardListItemCell, PUICQuickboardListViewController,
                        PUICApplication, PUICResources, PUICQuickboardViewController, PUICQuickboardListViewController,
-                       PUICQuickboardViewController, PUICPickerView ]
+                       PUICQuickboardViewController, PUICPickerView, PUICTextInputContext, PUICQuickboardMessageViewController ]
 ...

Modified: trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/watchos/8/PepperUICore.framework/PepperUICore.tbd (278956 => 278957)


--- trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/watchos/8/PepperUICore.framework/PepperUICore.tbd	2021-06-16 22:04:18 UTC (rev 278956)
+++ trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/watchos/8/PepperUICore.framework/PepperUICore.tbd	2021-06-16 22:18:38 UTC (rev 278957)
@@ -9,5 +9,5 @@
                        PUICCrownInputSequencer, PUICPickerView, PUICQuickboardListItemCell, PUICQuickboardListViewController,
                        PUICApplication, PUICResources, PUICQuickboardViewController, PUICQuickboardListViewController,
                        PUICQuickboardViewController, PUICPickerView, PUICTextInputContext, PUICQuickboardController,
-                       PUICQuickboardRemoteViewController ]
+                       PUICQuickboardRemoteViewController, PUICQuickboardMessageViewController ]
 ...
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to