Title: [271868] trunk/Source/WebKit
Revision
271868
Author
drou...@apple.com
Date
2021-01-25 16:36:31 -0800 (Mon, 25 Jan 2021)

Log Message

[iOS] improve support for sequential scribble interactions that involving different inputs
https://bugs.webkit.org/show_bug.cgi?id=220933
<rdar:/problem/71911346>

Reviewed by Tim Horton.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanUpInteraction]):
(-[WKContentView becomeFirstResponderForWebView]):
(-[WKContentView _zoomToRevealFocusedElement]):
(-[WKContentView _didCommitLoadForMainFrame]):
(-[WKContentView _willBeginTextInteractionInTextInputContext:]):
(-[WKContentView _didFinishTextInteractionInTextInputContext:]):
Rather than have a simple "yes/no" `_textInteractionIsHappening` we should keep a count of
scribble interactions (increment in `willBegin*` and decrement in `didFinish*`) so that we
don't send unnecessary/incorrect IPC to the WebProcess after the first scribble commits if
there's a second scribble in progress for another element.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (271867 => 271868)


--- trunk/Source/WebKit/ChangeLog	2021-01-26 00:33:44 UTC (rev 271867)
+++ trunk/Source/WebKit/ChangeLog	2021-01-26 00:36:31 UTC (rev 271868)
@@ -1,3 +1,24 @@
+2021-01-25  Devin Rousso  <drou...@apple.com>
+
+        [iOS] improve support for sequential scribble interactions that involving different inputs
+        https://bugs.webkit.org/show_bug.cgi?id=220933
+        <rdar:/problem/71911346>
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView cleanUpInteraction]):
+        (-[WKContentView becomeFirstResponderForWebView]):
+        (-[WKContentView _zoomToRevealFocusedElement]):
+        (-[WKContentView _didCommitLoadForMainFrame]):
+        (-[WKContentView _willBeginTextInteractionInTextInputContext:]):
+        (-[WKContentView _didFinishTextInteractionInTextInputContext:]):
+        Rather than have a simple "yes/no" `_textInteractionIsHappening` we should keep a count of
+        scribble interactions (increment in `willBegin*` and decrement in `didFinish*`) so that we
+        don't send unnecessary/incorrect IPC to the WebProcess after the first scribble commits if
+        there's a second scribble in progress for another element.
+
 2021-01-25  Aditya Keerthi  <akeer...@apple.com>
 
         [iOS] Obscured elements should not be focusable using the accessory bar

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (271867 => 271868)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2021-01-26 00:33:44 UTC (rev 271867)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2021-01-26 00:36:31 UTC (rev 271868)
@@ -397,7 +397,6 @@
     BOOL _isExpectingFastSingleTapCommit;
     BOOL _showDebugTapHighlightsForFastClicking;
     BOOL _textInteractionDidChangeFocusedElement;
-    BOOL _textInteractionIsHappening;
     BOOL _treatAsContentEditableUntilNextEditorStateUpdate;
     bool _isWaitingOnPositionInformation;
 
@@ -424,6 +423,7 @@
 
     BOOL _hasSetUpInteractions;
     NSUInteger _ignoreSelectionCommandFadeCount;
+    NSUInteger _activeTextInteractionCount;
     NSInteger _suppressNonEditableSingleTapTextInteractionCount;
     CompletionHandler<void(WebCore::DOMPasteAccessResponse)> _domPasteRequestHandler;
     BlockPtr<void(UIWKAutocorrectionContext *)> _pendingAutocorrectionContextHandler;

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (271867 => 271868)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-01-26 00:33:44 UTC (rev 271867)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-01-26 00:36:31 UTC (rev 271868)
@@ -942,7 +942,7 @@
 #endif
 
     _textInteractionDidChangeFocusedElement = NO;
-    _textInteractionIsHappening = NO;
+    _activeTextInteractionCount = 0;
 
     _treatAsContentEditableUntilNextEditorStateUpdate = NO;
 
@@ -1378,7 +1378,7 @@
 
         _page->activityStateDidChange(WebCore::ActivityState::IsFocused, WebKit::WebPageProxy::ActivityStateChangeDispatchMode::Immediate);
 
-        if ([self canShowNonEmptySelectionView] || (!_suppressSelectionAssistantReasons && _textInteractionIsHappening))
+        if ([self canShowNonEmptySelectionView] || (!_suppressSelectionAssistantReasons && _activeTextInteractionCount))
             [_textInteractionAssistant activateSelection];
 
         [self _scheduleResetInputViewDeferralAfterBecomingFirstResponder];
@@ -2079,7 +2079,7 @@
 
 - (void)_zoomToRevealFocusedElement
 {
-    if (_suppressSelectionAssistantReasons || _textInteractionIsHappening)
+    if (_suppressSelectionAssistantReasons || _activeTextInteractionCount)
         return;
 
     // In case user scaling is force enabled, do not use that scaling when zooming in with an input field.
@@ -4454,7 +4454,7 @@
     [_webView _didCommitLoadForMainFrame];
 
     _textInteractionDidChangeFocusedElement = NO;
-    _textInteractionIsHappening = NO;
+    _activeTextInteractionCount = 0;
     _treatAsContentEditableUntilNextEditorStateUpdate = NO;
     _hasValidPositionInformation = NO;
     _positionInformation = { };
@@ -5387,19 +5387,31 @@
 - (void)_willBeginTextInteractionInTextInputContext:(_WKTextInputContext *)context
 {
     ASSERT(context);
+
+    _page->setCanShowPlaceholder(context._textInputContext, false);
+
+    ++_activeTextInteractionCount;
+    if (_activeTextInteractionCount > 1)
+        return;
+
     _textInteractionDidChangeFocusedElement = NO;
     _page->setShouldRevealCurrentSelectionAfterInsertion(false);
-    _page->setCanShowPlaceholder(context._textInputContext, false);
     _usingGestureForSelection = YES;
-    _textInteractionIsHappening = YES;
 }
 
 - (void)_didFinishTextInteractionInTextInputContext:(_WKTextInputContext *)context
 {
     ASSERT(context);
-    _textInteractionIsHappening = NO;
+
+    _page->setCanShowPlaceholder(context._textInputContext, true);
+
+    ASSERT(_activeTextInteractionCount > 0);
+    --_activeTextInteractionCount;
+    if (_activeTextInteractionCount)
+        return;
+
     _usingGestureForSelection = NO;
-    _page->setCanShowPlaceholder(context._textInputContext, true);
+
     if (_textInteractionDidChangeFocusedElement) {
         // Mark to zoom to reveal the newly focused element on the next editor state update.
         // Then tell the web process to reveal the current selection, which will send us (the
@@ -5407,6 +5419,7 @@
         _page->setWaitingForPostLayoutEditorStateUpdateAfterFocusingElement(true);
         _textInteractionDidChangeFocusedElement = NO;
     }
+
     _page->setShouldRevealCurrentSelectionAfterInsertion(true);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to