Title: [230547] trunk/Source/WebKit
Revision
230547
Author
wenson_hs...@apple.com
Date
2018-04-11 14:06:48 -0700 (Wed, 11 Apr 2018)

Log Message

[Extra zoom mode] Support pushing input view controllers onto the navigation stack
https://bugs.webkit.org/show_bug.cgi?id=184397
<rdar://problem/39265294>

Reviewed by Timothy Hatcher.

Currently, all input view controllers in extra zoom mode are presented modally. However, the latest iteration of
the HI specification depicts most of these view controllers (with the exception of time pickers) being presented
and dismissed via navigation stack. Since WebKit's iOS API surface doesn't force clients to embed WKWebViews
within a view controller with a corresponding UINavigationController, we cannot always guarantee that UI
presented when focusing form controls in a web view will be pushed onto the navigation stack; as such, the
approach taken in this patch will automatically allow WKWebView clients that already embed WKWebViews within a
UINavigationController to hook into this behavior, with modal presentation as a fallback.

At a high level, this patch makes the following tweaks to implement this behavior:

1. Store the currently presented view controller using a single member variable
   (_presentedFullScreenInputViewController) instead of having one for each type. This makes bookkeepping around
   which view controller to present or dismiss much more straightforward.

2. Replace WKFocusedFormControlViewController with just WKFocusedFormControlView. This addresses problems with
   pushing an input view controller onto the navigation stack after presenting the focused form control view
   controller modally. Now, we'll only need to present or push one view controller on the navigation stack.

3. Remove -handleWheelEvent: forwarding to date and time pickers. Pushing date picker view controllers onto the
   navigation stack rather than presenting them modally means that we end up in a state where neither the
   WKContentView nor WKTimePickerViewController are first responder, which renders time pickers unusable.
   Instead, have the WKTimePickerViewController actually become first responder when presenting.

4. Lastly, and most importantly: change -presentViewControllerForCurrentAssistedNode and
   -dismissAllInputViewControllers to try and push onto a navigation stack if possible, and fall back to modal
   presentation.

* UIProcess/ios/WKContentViewInteraction.h:

Remove the separate member variables for each type of input view controller, and instead have one to keep track
of the current (and only) presented input view controller.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _willStartScrollingOrZooming]):
(-[WKContentView _didEndScrollingOrZooming]):
(-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
(-[WKContentView _stopAssistingNode]):

Boilerplate renaming of _focusedFormControlViewController => _focusedFormControlView.

(-[WKContentView reloadContextViewForPresentedListViewController]):

Adjust for consolidation of the different input view controller member variables to a single member (see changes
in WKContentViewInteraction.h).

(-[WKContentView addFocusedFormControlOverlay]):
(-[WKContentView removeFocusedFormControlOverlay]):
(-[WKContentView presentViewControllerForCurrentAssistedNode]):
(-[WKContentView dismissAllInputViewControllers:]):

Add an `animated` argument. In the case where a different view controller was presented after presenting the
input view controller, this allows us to dismiss the other view controller with animation, and directly reveal
the web view or focus overlay underneath.

(-[WKContentView focusedFormControlViewDidSubmit:]):
(-[WKContentView focusedFormControlViewDidCancel:]):
(-[WKContentView focusedFormControlViewDidBeginEditing:]):
(-[WKContentView rectForFocusedFormControlView:]):
(-[WKContentView nextRectForFocusedFormControlView:]):
(-[WKContentView previousRectForFocusedFormControlView:]):
(-[WKContentView scrollViewForFocusedFormControlView:]):
(-[WKContentView actionNameForFocusedFormControlView:]):
(-[WKContentView focusedFormControlViewDidRequestNextNode:]):
(-[WKContentView focusedFormControlViewDidRequestPreviousNode:]):
(-[WKContentView hasNextNodeForFocusedFormControlView:]):
(-[WKContentView hasPreviousNodeForFocusedFormControlView:]):
(-[WKContentView focusedFormControllerDidUpdateSuggestions:]):

Boilerplate renaming of focus overlay delegate methods.

(-[WKContentView _wheelChangedWithEvent:]):

Remove event forwarding hacks for date and time inputs, now that they directly become first responder.

(-[WKContentView presentFocusedFormControlViewController:]): Deleted.
(-[WKContentView dismissFocusedFormControlViewController:]): Deleted.

Renamed to -addFocusedFormControlOverlay and -removeFocusedFormControlOverlay.

(-[WKContentView dismissAllInputViewControllers]): Deleted.
(-[WKContentView focusedFormControlControllerDidSubmit:]): Deleted.
(-[WKContentView focusedFormControlControllerDidCancel:]): Deleted.
(-[WKContentView focusedFormControlControllerDidBeginEditing:]): Deleted.
(-[WKContentView rectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
(-[WKContentView nextRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
(-[WKContentView previousRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
(-[WKContentView scrollViewForFocusedFormControlController:]): Deleted.
(-[WKContentView actionNameForFocusedFormControlController:]): Deleted.
(-[WKContentView focusedFormControlControllerDidRequestNextNode:]): Deleted.
(-[WKContentView focusedFormControlControllerDidRequestPreviousNode:]): Deleted.
(-[WKContentView hasNextNodeForFocusedFormControlController:]): Deleted.
(-[WKContentView hasPreviousNodeForFocusedFormControlController:]): Deleted.
* UIProcess/ios/forms/WKFocusedFormControlViewController.h: Removed.
* UIProcess/ios/forms/WKFocusedFormControlViewController.mm: Removed.

Completely remove WKFocusedFormControlViewController; instead, just directly place the focused form overlay in
the WKWebView's hierarchy. In the case where we have a navigation stack to push to, we can no longer modally
present the focused form overlay as a separate view controller using the UINavigationController, and then
immediately push the input view controller on top of the navigation stack, since the navigation stack isn't
updated until after the animation of the focused form overlay presentation is complete. Rather than hack around
this limitation by dispatch_after-ing after presenting the overlay's view controller, we should just make the
overlay a view. This also fixes the case where a client embedding a WKWebView that is smaller than the bounds of
the screen will no longer see the entire screen dim when focusing an input, but instead, just the web content.

* WebKit.xcodeproj/project.pbxproj:

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (230546 => 230547)


--- trunk/Source/WebKit/ChangeLog	2018-04-11 20:58:18 UTC (rev 230546)
+++ trunk/Source/WebKit/ChangeLog	2018-04-11 21:06:48 UTC (rev 230547)
@@ -1,3 +1,117 @@
+2018-04-11  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [Extra zoom mode] Support pushing input view controllers onto the navigation stack
+        https://bugs.webkit.org/show_bug.cgi?id=184397
+        <rdar://problem/39265294>
+
+        Reviewed by Timothy Hatcher.
+
+        Currently, all input view controllers in extra zoom mode are presented modally. However, the latest iteration of
+        the HI specification depicts most of these view controllers (with the exception of time pickers) being presented
+        and dismissed via navigation stack. Since WebKit's iOS API surface doesn't force clients to embed WKWebViews
+        within a view controller with a corresponding UINavigationController, we cannot always guarantee that UI
+        presented when focusing form controls in a web view will be pushed onto the navigation stack; as such, the
+        approach taken in this patch will automatically allow WKWebView clients that already embed WKWebViews within a
+        UINavigationController to hook into this behavior, with modal presentation as a fallback.
+
+        At a high level, this patch makes the following tweaks to implement this behavior:
+
+        1. Store the currently presented view controller using a single member variable
+           (_presentedFullScreenInputViewController) instead of having one for each type. This makes bookkeepping around
+           which view controller to present or dismiss much more straightforward.
+
+        2. Replace WKFocusedFormControlViewController with just WKFocusedFormControlView. This addresses problems with
+           pushing an input view controller onto the navigation stack after presenting the focused form control view
+           controller modally. Now, we'll only need to present or push one view controller on the navigation stack.
+
+        3. Remove -handleWheelEvent: forwarding to date and time pickers. Pushing date picker view controllers onto the
+           navigation stack rather than presenting them modally means that we end up in a state where neither the
+           WKContentView nor WKTimePickerViewController are first responder, which renders time pickers unusable.
+           Instead, have the WKTimePickerViewController actually become first responder when presenting.
+
+        4. Lastly, and most importantly: change -presentViewControllerForCurrentAssistedNode and
+           -dismissAllInputViewControllers to try and push onto a navigation stack if possible, and fall back to modal
+           presentation.
+
+        * UIProcess/ios/WKContentViewInteraction.h:
+
+        Remove the separate member variables for each type of input view controller, and instead have one to keep track
+        of the current (and only) presented input view controller.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _willStartScrollingOrZooming]):
+        (-[WKContentView _didEndScrollingOrZooming]):
+        (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
+        (-[WKContentView _stopAssistingNode]):
+
+        Boilerplate renaming of _focusedFormControlViewController => _focusedFormControlView.
+
+        (-[WKContentView reloadContextViewForPresentedListViewController]):
+
+        Adjust for consolidation of the different input view controller member variables to a single member (see changes
+        in WKContentViewInteraction.h).
+
+        (-[WKContentView addFocusedFormControlOverlay]):
+        (-[WKContentView removeFocusedFormControlOverlay]):
+        (-[WKContentView presentViewControllerForCurrentAssistedNode]):
+        (-[WKContentView dismissAllInputViewControllers:]):
+
+        Add an `animated` argument. In the case where a different view controller was presented after presenting the
+        input view controller, this allows us to dismiss the other view controller with animation, and directly reveal
+        the web view or focus overlay underneath.
+
+        (-[WKContentView focusedFormControlViewDidSubmit:]):
+        (-[WKContentView focusedFormControlViewDidCancel:]):
+        (-[WKContentView focusedFormControlViewDidBeginEditing:]):
+        (-[WKContentView rectForFocusedFormControlView:]):
+        (-[WKContentView nextRectForFocusedFormControlView:]):
+        (-[WKContentView previousRectForFocusedFormControlView:]):
+        (-[WKContentView scrollViewForFocusedFormControlView:]):
+        (-[WKContentView actionNameForFocusedFormControlView:]):
+        (-[WKContentView focusedFormControlViewDidRequestNextNode:]):
+        (-[WKContentView focusedFormControlViewDidRequestPreviousNode:]):
+        (-[WKContentView hasNextNodeForFocusedFormControlView:]):
+        (-[WKContentView hasPreviousNodeForFocusedFormControlView:]):
+        (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
+
+        Boilerplate renaming of focus overlay delegate methods.
+
+        (-[WKContentView _wheelChangedWithEvent:]):
+
+        Remove event forwarding hacks for date and time inputs, now that they directly become first responder.
+
+        (-[WKContentView presentFocusedFormControlViewController:]): Deleted.
+        (-[WKContentView dismissFocusedFormControlViewController:]): Deleted.
+
+        Renamed to -addFocusedFormControlOverlay and -removeFocusedFormControlOverlay.
+
+        (-[WKContentView dismissAllInputViewControllers]): Deleted.
+        (-[WKContentView focusedFormControlControllerDidSubmit:]): Deleted.
+        (-[WKContentView focusedFormControlControllerDidCancel:]): Deleted.
+        (-[WKContentView focusedFormControlControllerDidBeginEditing:]): Deleted.
+        (-[WKContentView rectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
+        (-[WKContentView nextRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
+        (-[WKContentView previousRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
+        (-[WKContentView scrollViewForFocusedFormControlController:]): Deleted.
+        (-[WKContentView actionNameForFocusedFormControlController:]): Deleted.
+        (-[WKContentView focusedFormControlControllerDidRequestNextNode:]): Deleted.
+        (-[WKContentView focusedFormControlControllerDidRequestPreviousNode:]): Deleted.
+        (-[WKContentView hasNextNodeForFocusedFormControlController:]): Deleted.
+        (-[WKContentView hasPreviousNodeForFocusedFormControlController:]): Deleted.
+        * UIProcess/ios/forms/WKFocusedFormControlViewController.h: Removed.
+        * UIProcess/ios/forms/WKFocusedFormControlViewController.mm: Removed.
+
+        Completely remove WKFocusedFormControlViewController; instead, just directly place the focused form overlay in
+        the WKWebView's hierarchy. In the case where we have a navigation stack to push to, we can no longer modally
+        present the focused form overlay as a separate view controller using the UINavigationController, and then
+        immediately push the input view controller on top of the navigation stack, since the navigation stack isn't
+        updated until after the animation of the focused form overlay presentation is complete. Rather than hack around
+        this limitation by dispatch_after-ing after presenting the overlay's view controller, we should just make the
+        overlay a view. This also fixes the case where a client embedding a WKWebView that is smaller than the bounds of
+        the screen will no longer see the entire screen dim when focusing an input, but instead, just the web content.
+
+        * WebKit.xcodeproj/project.pbxproj:
+
 2018-04-11  Youenn Fablet  <you...@apple.com>
 
         Pass FetchOptions and SecurityOrigin as load parameters from WebProcess to NetworkProcess

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (230546 => 230547)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2018-04-11 20:58:18 UTC (rev 230546)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2018-04-11 21:06:48 UTC (rev 230547)
@@ -84,11 +84,7 @@
 @class _UIWebHighlightLongPressGestureRecognizer;
 
 #if ENABLE(EXTRA_ZOOM_MODE)
-@class WKDatePickerViewController;
-@class WKFocusedFormControlViewController;
-@class WKSelectMenuListViewController;
-@class WKTextInputListViewController;
-@class WKTimePickerViewController;
+@class WKFocusedFormControlView;
 #endif
 
 typedef void (^UIWKAutocorrectionCompletionHandler)(UIWKAutocorrectionRects *rectsForInput);
@@ -251,11 +247,9 @@
 #endif
 
 #if ENABLE(EXTRA_ZOOM_MODE)
-    RetainPtr<WKDatePickerViewController> _datePickerViewController;
-    RetainPtr<WKTextInputListViewController> _textInputListViewController;
-    RetainPtr<WKFocusedFormControlViewController> _focusedFormControlViewController;
-    RetainPtr<WKSelectMenuListViewController> _selectMenuListViewController;
-    RetainPtr<WKTimePickerViewController> _timePickerViewController;
+    RetainPtr<WKFocusedFormControlView> _focusedFormControlView;
+    RetainPtr<UIViewController> _presentedFullScreenInputViewController;
+    RetainPtr<UINavigationController> _inputNavigationViewControllerForFullScreenInputs;
 
     BOOL _shouldRestoreFirstResponderStatusAfterLosingFocus;
 #endif

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (230546 => 230547)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-04-11 20:58:18 UTC (rev 230546)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-04-11 21:06:48 UTC (rev 230547)
@@ -42,7 +42,7 @@
 #import "WKActionSheetAssistant.h"
 #import "WKDatePickerViewController.h"
 #import "WKError.h"
-#import "WKFocusedFormControlViewController.h"
+#import "WKFocusedFormControlView.h"
 #import "WKFormControlListViewController.h"
 #import "WKFormInputControl.h"
 #import "WKFormSelectControl.h"
@@ -125,7 +125,7 @@
 
 #if ENABLE(EXTRA_ZOOM_MODE)
 
-@interface WKContentView (ExtraZoomMode) <WKFocusedFormControlViewControllerDelegate, WKSelectMenuListViewControllerDelegate, WKTextInputListViewControllerDelegate>
+@interface WKContentView (ExtraZoomMode) <WKFocusedFormControlViewDelegate, WKSelectMenuListViewControllerDelegate, WKTextInputListViewControllerDelegate>
 @end
 
 #endif
@@ -1941,7 +1941,7 @@
     _page->setIsScrollingOrZooming(true);
 
 #if ENABLE(EXTRA_ZOOM_MODE)
-    [_focusedFormControlViewController disengageFocusedFormControlNavigation];
+    [_focusedFormControlView disengageFocusedFormControlNavigation];
 #endif
 }
 
@@ -1961,7 +1961,7 @@
     _page->setIsScrollingOrZooming(false);
 
 #if ENABLE(EXTRA_ZOOM_MODE)
-    [_focusedFormControlViewController engageFocusedFormControlNavigation];
+    [_focusedFormControlView engageFocusedFormControlNavigation];
 #endif
 }
 
@@ -4083,7 +4083,7 @@
         [self becomeFirstResponder];
 
 #if ENABLE(EXTRA_ZOOM_MODE)
-    [self presentFocusedFormControlViewController:NO];
+    [self addFocusedFormControlOverlay];
     if (!_isChangingFocus)
         [self presentViewControllerForCurrentAssistedNode];
 #else
@@ -4110,7 +4110,7 @@
 
 #if ENABLE(EXTRA_ZOOM_MODE)
     if (_isChangingFocus)
-        [_focusedFormControlViewController reloadData:YES];
+        [_focusedFormControlView reloadData:YES];
 #endif
 
     // _inputPeripheral has been initialized in inputView called by reloadInputViews.
@@ -4145,9 +4145,9 @@
     [_webSelectionAssistant resignedFirstResponder];
 
 #if ENABLE(EXTRA_ZOOM_MODE)
-    [self dismissAllInputViewControllers];
+    [self dismissAllInputViewControllers:YES];
     if (!_isChangingFocus)
-        [self dismissFocusedFormControlViewController:[_focusedFormControlViewController isVisible]];
+        [self removeFocusedFormControlOverlay];
 #endif
 
     // The custom fixed position rect behavior is affected by -isAssistingNode, so if that changes we need to recompute rects.
@@ -4176,88 +4176,97 @@
 - (void)reloadContextViewForPresentedListViewController
 {
 #if ENABLE(EXTRA_ZOOM_MODE)
-    [_textInputListViewController reloadContextView];
+    if ([_presentedFullScreenInputViewController isKindOfClass:[WKTextInputListViewController class]])
+        [(WKTextInputListViewController *)_presentedFullScreenInputViewController.get() reloadContextView];
 #endif
 }
 
 #if ENABLE(EXTRA_ZOOM_MODE)
 
-- (void)presentFocusedFormControlViewController:(BOOL)animated
+- (void)addFocusedFormControlOverlay
 {
-    if (_focusedFormControlViewController)
+    if (_focusedFormControlView)
         return;
 
     ++_webView->_activeFocusedStateRetainCount;
 
-    _focusedFormControlViewController = adoptNS([[WKFocusedFormControlViewController alloc] init]);
-    [_focusedFormControlViewController setDelegate:self];
-    [[UIViewController _viewControllerForFullScreenPresentationFromView:self] presentViewController:_focusedFormControlViewController.get() animated:animated completion:nil];
-    [self setInputDelegate:_focusedFormControlViewController.get()];
+    _focusedFormControlView = adoptNS([[WKFocusedFormControlView alloc] initWithFrame:_webView.bounds delegate:self]);
+    [_focusedFormControlView hide:NO];
+    [_webView addSubview:_focusedFormControlView.get()];
+    [self setInputDelegate:_focusedFormControlView.get()];
 }
 
-- (void)dismissFocusedFormControlViewController:(BOOL)animated
+- (void)removeFocusedFormControlOverlay
 {
-    if (!_focusedFormControlViewController)
+    if (!_focusedFormControlView)
         return;
 
     --_webView->_activeFocusedStateRetainCount;
 
-    [_focusedFormControlViewController dismissViewControllerAnimated:animated completion:nil];
-    _focusedFormControlViewController = nil;
+    [_focusedFormControlView removeFromSuperview];
+    _focusedFormControlView = nil;
     [self setInputDelegate:nil];
 }
 
 - (void)presentViewControllerForCurrentAssistedNode
 {
-    [self dismissAllInputViewControllers];
+    [self dismissAllInputViewControllers:NO];
 
     _shouldRestoreFirstResponderStatusAfterLosingFocus = self.isFirstResponder;
+    UIViewController *presentingViewController = [UIViewController _viewControllerForFullScreenPresentationFromView:self];
 
+    ASSERT(!_presentedFullScreenInputViewController);
+
+    BOOL prefersModalPresentation = NO;
+
     switch (_assistedNodeInformation.elementType) {
     case InputType::Select:
-        if (!_selectMenuListViewController) {
-            _selectMenuListViewController = adoptNS([[WKSelectMenuListViewController alloc] initWithDelegate:self]);
-            [_focusedFormControlViewController presentViewController:_selectMenuListViewController.get() animated:YES completion:nil];
-        }
+        _presentedFullScreenInputViewController = adoptNS([[WKSelectMenuListViewController alloc] initWithDelegate:self]);
         break;
     case InputType::Time:
-        if (!_timePickerViewController) {
-            _timePickerViewController = adoptNS([[WKTimePickerViewController alloc] initWithDelegate:self]);
-            [_focusedFormControlViewController presentViewController:_timePickerViewController.get() animated:YES completion:nil];
-        }
+        // Time inputs are special, in that the only UI affordances for dismissal are push buttons rather than status bar chevrons.
+        // As such, modal presentation and dismissal is preferred even if a navigation stack exists.
+        prefersModalPresentation = YES;
+        _presentedFullScreenInputViewController = adoptNS([[WKTimePickerViewController alloc] initWithDelegate:self]);
         break;
     case InputType::Date:
-        if (!_datePickerViewController) {
-            _datePickerViewController = adoptNS([[WKDatePickerViewController alloc] initWithDelegate:self]);
-            [_focusedFormControlViewController presentViewController:_datePickerViewController.get() animated:YES completion:nil];
-        }
+        _presentedFullScreenInputViewController = adoptNS([[WKDatePickerViewController alloc] initWithDelegate:self]);
         break;
     case InputType::None:
-        ASSERT_NOT_REACHED();
         break;
     default:
-        if (!_textInputListViewController) {
-            _textInputListViewController = adoptNS([[WKTextInputListViewController alloc] initWithDelegate:self]);
-            [_focusedFormControlViewController presentViewController:_textInputListViewController.get() animated:YES completion:nil];
-        }
+        _presentedFullScreenInputViewController = adoptNS([[WKTextInputListViewController alloc] initWithDelegate:self]);
         break;
     }
+
+    ASSERT(_presentedFullScreenInputViewController);
+    ASSERT(presentingViewController);
+
+    if (!prefersModalPresentation && [presentingViewController isKindOfClass:[UINavigationController class]])
+        _inputNavigationViewControllerForFullScreenInputs = (UINavigationController *)presentingViewController;
+    else
+        _inputNavigationViewControllerForFullScreenInputs = nil;
+
+    // Present the input view controller on an existing navigation stack, if possible. If there is no navigation stack we can use, fall back to presenting modally.
+    // This is because the HI specification (for certain scenarios) calls for navigation-style view controller presentation, but WKWebView can't make any guarantees
+    // about clients' view controller hierarchies, so we can only try our best to avoid presenting modally. Clients can implicitly opt in to specced behavior by using
+    // UINavigationController to present the web view.
+    if (_inputNavigationViewControllerForFullScreenInputs)
+        [_inputNavigationViewControllerForFullScreenInputs pushViewController:_presentedFullScreenInputViewController.get() animated:YES];
+    else
+        [presentingViewController presentViewController:_presentedFullScreenInputViewController.get() animated:YES completion:nil];
 }
 
-- (void)dismissAllInputViewControllers
+- (void)dismissAllInputViewControllers:(BOOL)animated
 {
-    if (auto controller = WTFMove(_textInputListViewController))
-        [controller dismissViewControllerAnimated:YES completion:nil];
+    auto navigationController = WTFMove(_inputNavigationViewControllerForFullScreenInputs);
+    auto presentedController = WTFMove(_presentedFullScreenInputViewController);
 
-    if (auto controller = WTFMove(_selectMenuListViewController))
-        [controller dismissViewControllerAnimated:YES completion:nil];
+    if ([navigationController viewControllers].lastObject == presentedController.get())
+        [navigationController popViewControllerAnimated:animated];
+    else
+        [presentedController dismissViewControllerAnimated:animated completion:nil];
 
-    if (auto controller = WTFMove(_timePickerViewController))
-        [controller dismissViewControllerAnimated:YES completion:nil];
-
-    if (auto controller = WTFMove(_datePickerViewController))
-        [controller dismissViewControllerAnimated:YES completion:nil];
-
     if (_shouldRestoreFirstResponderStatusAfterLosingFocus) {
         _shouldRestoreFirstResponderStatusAfterLosingFocus = NO;
         if (!self.isFirstResponder)
@@ -4265,18 +4274,18 @@
     }
 }
 
-- (void)focusedFormControlControllerDidSubmit:(WKFocusedFormControlViewController *)controller
+- (void)focusedFormControlViewDidSubmit:(WKFocusedFormControlView *)view
 {
     [self insertText:@"\n"];
     _page->blurAssistedNode();
 }
 
-- (void)focusedFormControlControllerDidCancel:(WKFocusedFormControlViewController *)controller
+- (void)focusedFormControlViewDidCancel:(WKFocusedFormControlView *)view
 {
     _page->blurAssistedNode();
 }
 
-- (void)focusedFormControlControllerDidBeginEditing:(WKFocusedFormControlViewController *)controller
+- (void)focusedFormControlViewDidBeginEditing:(WKFocusedFormControlView *)view
 {
     [self updateCurrentAssistedNodeInformation:[weakSelf = WeakObjCPtr<WKContentView>(self)] (bool didUpdate) {
         if (didUpdate)
@@ -4284,33 +4293,33 @@
     }];
 }
 
-- (CGRect)rectForFocusedFormControlController:(WKFocusedFormControlViewController *)controller inCoordinateSpace:(id <UICoordinateSpace>)coordinateSpace
+- (CGRect)rectForFocusedFormControlView:(WKFocusedFormControlView *)view
 {
-    return [self convertRect:_assistedNodeInformation.elementRect toCoordinateSpace:coordinateSpace];
+    return [self convertRect:_assistedNodeInformation.elementRect toView:view];
 }
 
-- (CGRect)nextRectForFocusedFormControlController:(WKFocusedFormControlViewController *)controller inCoordinateSpace:(id <UICoordinateSpace>)coordinateSpace
+- (CGRect)nextRectForFocusedFormControlView:(WKFocusedFormControlView *)view
 {
     if (!_assistedNodeInformation.hasNextNode)
         return CGRectNull;
 
-    return [self convertRect:_assistedNodeInformation.nextNodeRect toCoordinateSpace:coordinateSpace];
+    return [self convertRect:_assistedNodeInformation.nextNodeRect toView:view];
 }
 
-- (CGRect)previousRectForFocusedFormControlController:(WKFocusedFormControlViewController *)controller inCoordinateSpace:(id <UICoordinateSpace>)coordinateSpace
+- (CGRect)previousRectForFocusedFormControlView:(WKFocusedFormControlView *)view
 {
     if (!_assistedNodeInformation.hasPreviousNode)
         return CGRectNull;
 
-    return [self convertRect:_assistedNodeInformation.previousNodeRect toCoordinateSpace:coordinateSpace];
+    return [self convertRect:_assistedNodeInformation.previousNodeRect toView:view];
 }
 
-- (UIScrollView *)scrollViewForFocusedFormControlController:(WKFocusedFormControlViewController *)controller
+- (UIScrollView *)scrollViewForFocusedFormControlView:(WKFocusedFormControlView *)view
 {
     return self._scroller;
 }
 
-- (NSString *)actionNameForFocusedFormControlController:(WKFocusedFormControlViewController *)controller
+- (NSString *)actionNameForFocusedFormControlView:(WKFocusedFormControlView *)view
 {
     if (_assistedNodeInformation.formAction.isEmpty())
         return nil;
@@ -4327,32 +4336,34 @@
     }
 }
 
-- (void)focusedFormControlControllerDidRequestNextNode:(WKFocusedFormControlViewController *)controller
+- (void)focusedFormControlViewDidRequestNextNode:(WKFocusedFormControlView *)view
 {
     if (_assistedNodeInformation.hasNextNode)
         _page->focusNextAssistedNode(true);
 }
 
-- (void)focusedFormControlControllerDidRequestPreviousNode:(WKFocusedFormControlViewController *)controller
+- (void)focusedFormControlViewDidRequestPreviousNode:(WKFocusedFormControlView *)view
 {
     if (_assistedNodeInformation.hasPreviousNode)
         _page->focusNextAssistedNode(false);
 }
 
-- (BOOL)hasNextNodeForFocusedFormControlController:(WKFocusedFormControlViewController *)controller
+- (BOOL)hasNextNodeForFocusedFormControlView:(WKFocusedFormControlView *)view
 {
     return _assistedNodeInformation.hasNextNode;
 }
 
-- (BOOL)hasPreviousNodeForFocusedFormControlController:(WKFocusedFormControlViewController *)controller
+- (BOOL)hasPreviousNodeForFocusedFormControlView:(WKFocusedFormControlView *)view
 {
     return _assistedNodeInformation.hasPreviousNode;
 }
 
-- (void)focusedFormControllerDidUpdateSuggestions:(WKFocusedFormControlViewController *)controller
+- (void)focusedFormControllerDidUpdateSuggestions:(WKFocusedFormControlView *)view
 {
-    if (!_isBlurringFocusedNode)
-        [_textInputListViewController reloadTextSuggestions];
+    if (_isBlurringFocusedNode || ![_presentedFullScreenInputViewController isKindOfClass:[WKTextInputListViewController class]])
+        return;
+
+    [(WKTextInputListViewController *)_presentedFullScreenInputViewController reloadTextSuggestions];
 }
 
 #pragma mark - WKSelectMenuListViewControllerDelegate
@@ -4417,14 +4428,8 @@
 - (void)_wheelChangedWithEvent:(UIEvent *)event
 {
 #if ENABLE(EXTRA_ZOOM_MODE)
-    if ([_timePickerViewController handleWheelEvent:event])
+    if ([_focusedFormControlView handleWheelEvent:event])
         return;
-
-    if ([_datePickerViewController handleWheelEvent:event])
-        return;
-
-    if ([_focusedFormControlViewController handleWheelEvent:event])
-        return;
 #endif
     [super _wheelChangedWithEvent:event];
 }

Deleted: trunk/Source/WebKit/UIProcess/ios/forms/WKFocusedFormControlViewController.h (230546 => 230547)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFocusedFormControlViewController.h	2018-04-11 20:58:18 UTC (rev 230546)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFocusedFormControlViewController.h	2018-04-11 21:06:48 UTC (rev 230547)
@@ -1,30 +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.
- */
-
-#pragma once
-
-#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/WKFocusedFormControlViewControllerAdditions.h>)
-#import <WebKitAdditions/WKFocusedFormControlViewControllerAdditions.h>
-#endif

Deleted: trunk/Source/WebKit/UIProcess/ios/forms/WKFocusedFormControlViewController.mm (230546 => 230547)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFocusedFormControlViewController.mm	2018-04-11 20:58:18 UTC (rev 230546)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFocusedFormControlViewController.mm	2018-04-11 21:06:48 UTC (rev 230547)
@@ -1,31 +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.
- */
-
-#include "config.h"
-#include "WKFocusedFormControlViewController.h"
-
-#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/WKFocusedFormControlViewControllerAdditions.mm>)
-#import <WebKitAdditions/WKFocusedFormControlViewControllerAdditions.mm>
-#endif

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (230546 => 230547)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2018-04-11 20:58:18 UTC (rev 230546)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2018-04-11 21:06:48 UTC (rev 230547)
@@ -725,8 +725,6 @@
 		2DFC7DBB1BCCC19500C1548C /* WebViewImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DFC7DB91BCCC19500C1548C /* WebViewImpl.h */; };
 		2DFC7DBC1BCCC19500C1548C /* WebViewImpl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DFC7DBA1BCCC19500C1548C /* WebViewImpl.mm */; };
 		2DFF7B6F1DA4CFAF00814614 /* WKBackForwardListItemPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DFF7B6E1DA4CFAF00814614 /* WKBackForwardListItemPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		2E16B6B82017AB9C008996D6 /* WKFocusedFormControlViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E16B6B62017AB9C008996D6 /* WKFocusedFormControlViewController.h */; };
-		2E16B6B92017AB9C008996D6 /* WKFocusedFormControlViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E16B6B72017AB9C008996D6 /* WKFocusedFormControlViewController.mm */; };
 		2E16B6CE2017B7AD008996D6 /* WKFocusedFormControlView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E16B6CC2017B7AB008996D6 /* WKFocusedFormControlView.mm */; };
 		2E16B6CF2017B7AD008996D6 /* WKFocusedFormControlView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E16B6CD2017B7AC008996D6 /* WKFocusedFormControlView.h */; };
 		2E5C770E1FA7D429005932C3 /* APIAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E5C770C1FA7D429005932C3 /* APIAttachment.h */; };
@@ -3100,8 +3098,6 @@
 		2DFC7DB91BCCC19500C1548C /* WebViewImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebViewImpl.h; sourceTree = "<group>"; };
 		2DFC7DBA1BCCC19500C1548C /* WebViewImpl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebViewImpl.mm; sourceTree = "<group>"; };
 		2DFF7B6E1DA4CFAF00814614 /* WKBackForwardListItemPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBackForwardListItemPrivate.h; sourceTree = "<group>"; };
-		2E16B6B62017AB9C008996D6 /* WKFocusedFormControlViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKFocusedFormControlViewController.h; path = ios/forms/WKFocusedFormControlViewController.h; sourceTree = "<group>"; };
-		2E16B6B72017AB9C008996D6 /* WKFocusedFormControlViewController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKFocusedFormControlViewController.mm; path = ios/forms/WKFocusedFormControlViewController.mm; sourceTree = "<group>"; };
 		2E16B6CC2017B7AB008996D6 /* WKFocusedFormControlView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKFocusedFormControlView.mm; path = ios/forms/WKFocusedFormControlView.mm; sourceTree = "<group>"; };
 		2E16B6CD2017B7AC008996D6 /* WKFocusedFormControlView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKFocusedFormControlView.h; path = ios/forms/WKFocusedFormControlView.h; sourceTree = "<group>"; };
 		2E5C770C1FA7D429005932C3 /* APIAttachment.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIAttachment.h; sourceTree = "<group>"; };
@@ -8473,8 +8469,6 @@
 				A58B6F0718FCA733008CBA53 /* WKFileUploadPanel.mm */,
 				2E16B6CD2017B7AC008996D6 /* WKFocusedFormControlView.h */,
 				2E16B6CC2017B7AB008996D6 /* WKFocusedFormControlView.mm */,
-				2E16B6B62017AB9C008996D6 /* WKFocusedFormControlViewController.h */,
-				2E16B6B72017AB9C008996D6 /* WKFocusedFormControlViewController.mm */,
 				F4D5F51B206087A10038BBA8 /* WKFormControlListViewController.h */,
 				F4D5F51C206087A10038BBA8 /* WKFormControlListViewController.mm */,
 				C54256AF18BEC18B00DE4179 /* WKFormInputControl.h */,
@@ -9539,7 +9533,6 @@
 				A58B6F0818FCA733008CBA53 /* WKFileUploadPanel.h in Headers */,
 				37F623B812A57B6200E3FDF6 /* WKFindOptions.h in Headers */,
 				2E16B6CF2017B7AD008996D6 /* WKFocusedFormControlView.h in Headers */,
-				2E16B6B82017AB9C008996D6 /* WKFocusedFormControlViewController.h in Headers */,
 				F4D5F51F206087A10038BBA8 /* WKFormControlListViewController.h in Headers */,
 				C54256B518BEC18C00DE4179 /* WKFormInputControl.h in Headers */,
 				C54256B718BEC18C00DE4179 /* WKFormPeripheral.h in Headers */,
@@ -11266,7 +11259,6 @@
 				BC4075FB124FF0270068F20A /* WKErrorRef.cpp in Sources */,
 				A58B6F0918FCA733008CBA53 /* WKFileUploadPanel.mm in Sources */,
 				2E16B6CE2017B7AD008996D6 /* WKFocusedFormControlView.mm in Sources */,
-				2E16B6B92017AB9C008996D6 /* WKFocusedFormControlViewController.mm in Sources */,
 				F4D5F520206087A10038BBA8 /* WKFormControlListViewController.mm in Sources */,
 				C54256B618BEC18C00DE4179 /* WKFormInputControl.mm in Sources */,
 				C54256B918BEC18C00DE4179 /* WKFormPopover.mm in Sources */,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to