Title: [279764] trunk/Source/WebKit
Revision
279764
Author
[email protected]
Date
2021-07-08 17:04:48 -0700 (Thu, 08 Jul 2021)

Log Message

[watchOS] Tapping "Done" in Scribble when focusing an editable element should dismiss Quickboard
https://bugs.webkit.org/show_bug.cgi?id=227817
rdar://79931134

Reviewed by Tim Horton and Devin Rousso.

After using PUICQuickboardMessageViewController's PUICTextInput-based mode for presenting Scribble UI, we fail
to dismiss PUICQuickboardMessageViewController underneath `-dismissAllInputViewControllers:`, since Quickboard
is not the top-most view controller (instead, it ends up being PUICQuickboardRemoteViewController). As a result,
the call to `-dismissViewControllerAnimated:completion:` on the fullscreen input view controller ends up being
dropped on the floor.

Prior to adopting PUICQuickboardMessageViewController and remote text input on watchOS, this worked because the
delegate method `-quickboard:textEntered:` would only be invoked after the front-most view controller was done
dismissing, such that calling `-dismissViewControllerAnimated:completion:` on the fullscreen input view
controller would (correctly) dismiss it.

We can address this by checking whether the fullscreen input view controller itself has a presented view
controller in `-dismissAllInputViewControllers:`, and dismissing that first if necessary.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dismissAllInputViewControllers:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (279763 => 279764)


--- trunk/Source/WebKit/ChangeLog	2021-07-08 23:46:39 UTC (rev 279763)
+++ trunk/Source/WebKit/ChangeLog	2021-07-09 00:04:48 UTC (rev 279764)
@@ -1,3 +1,28 @@
+2021-07-08  Wenson Hsieh  <[email protected]>
+
+        [watchOS] Tapping "Done" in Scribble when focusing an editable element should dismiss Quickboard
+        https://bugs.webkit.org/show_bug.cgi?id=227817
+        rdar://79931134
+
+        Reviewed by Tim Horton and Devin Rousso.
+
+        After using PUICQuickboardMessageViewController's PUICTextInput-based mode for presenting Scribble UI, we fail
+        to dismiss PUICQuickboardMessageViewController underneath `-dismissAllInputViewControllers:`, since Quickboard
+        is not the top-most view controller (instead, it ends up being PUICQuickboardRemoteViewController). As a result,
+        the call to `-dismissViewControllerAnimated:completion:` on the fullscreen input view controller ends up being
+        dropped on the floor.
+
+        Prior to adopting PUICQuickboardMessageViewController and remote text input on watchOS, this worked because the
+        delegate method `-quickboard:textEntered:` would only be invoked after the front-most view controller was done
+        dismissing, such that calling `-dismissViewControllerAnimated:completion:` on the fullscreen input view
+        controller would (correctly) dismiss it.
+
+        We can address this by checking whether the fullscreen input view controller itself has a presented view
+        controller in `-dismissAllInputViewControllers:`, and dismissing that first if necessary.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView dismissAllInputViewControllers:]):
+
 2021-07-08  Brent Fulgham  <[email protected]>
 
         [Cocoa] Expose SPI to opt out of Extensible SSO authentication

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (279763 => 279764)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-07-08 23:46:39 UTC (rev 279763)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-07-09 00:04:48 UTC (rev 279764)
@@ -6916,17 +6916,24 @@
     }
 
     if (auto controller = std::exchange(_presentedFullScreenInputViewController, nil)) {
-        if ([navigationController viewControllers].lastObject == controller.get())
-            [navigationController popViewControllerAnimated:animated];
-        else
-            [controller dismissViewControllerAnimated:animated completion:nil];
-
-        [[controller transitionCoordinator] animateAlongsideTransition:nil completion:[weakWebView = WeakObjCPtr<WKWebView>(_webView), controller] (id <UIViewControllerTransitionCoordinatorContext>) {
+        auto dispatchDidDismiss = makeBlockPtr([weakWebView = WeakObjCPtr<WKWebView>(_webView), controller] {
             auto strongWebView = weakWebView.get();
             id <WKUIDelegatePrivate> uiDelegate = static_cast<id <WKUIDelegatePrivate>>([strongWebView UIDelegate]);
             if ([uiDelegate respondsToSelector:@selector(_webView:didDismissFocusedElementViewController:)])
                 [uiDelegate _webView:strongWebView.get() didDismissFocusedElementViewController:controller.get()];
-        }];
+        });
+
+        if ([navigationController viewControllers].lastObject == controller.get()) {
+            [navigationController popViewControllerAnimated:animated];
+            [[controller transitionCoordinator] animateAlongsideTransition:nil completion:[dispatchDidDismiss = WTFMove(dispatchDidDismiss)] (id <UIViewControllerTransitionCoordinatorContext>) {
+                dispatchDidDismiss();
+            }];
+        } else if (auto presentedViewController = retainPtr([controller presentedViewController])) {
+            [presentedViewController dismissViewControllerAnimated:animated completion:[controller, animated, dispatchDidDismiss = WTFMove(dispatchDidDismiss)] {
+                [controller dismissViewControllerAnimated:animated completion:dispatchDidDismiss.get()];
+            }];
+        } else
+            [controller dismissViewControllerAnimated:animated completion:dispatchDidDismiss.get()];
     }
 
 #if HAVE(QUICKBOARD_CONTROLLER)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to