Title: [259935] trunk/Source/WebKit
- Revision
- 259935
- Author
- [email protected]
- Date
- 2020-04-11 16:21:26 -0700 (Sat, 11 Apr 2020)
Log Message
Add text interaction delegate functions
https://bugs.webkit.org/show_bug.cgi?id=210395
<rdar://problem/61650549>
Reviewed by Wenson Hsieh.
Implement some delegate callbacks that are used to toggle selection reveal,
placeholder text, and selection assistance.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _willBeginTextInteractionInTextInputContext:]): Added.
(-[WKContentView _didFinishTextInteractionInTextInputContext:]): Added.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (259934 => 259935)
--- trunk/Source/WebKit/ChangeLog 2020-04-11 20:17:13 UTC (rev 259934)
+++ trunk/Source/WebKit/ChangeLog 2020-04-11 23:21:26 UTC (rev 259935)
@@ -1,3 +1,19 @@
+2020-04-11 Daniel Bates <[email protected]>
+
+ Add text interaction delegate functions
+ https://bugs.webkit.org/show_bug.cgi?id=210395
+ <rdar://problem/61650549>
+
+ Reviewed by Wenson Hsieh.
+
+ Implement some delegate callbacks that are used to toggle selection reveal,
+ placeholder text, and selection assistance.
+
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _willBeginTextInteractionInTextInputContext:]): Added.
+ (-[WKContentView _didFinishTextInteractionInTextInputContext:]): Added.
+
2020-04-10 Darin Adler <[email protected]>
Move more from live range to SimpleRange: callers of absoluteTextRects
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (259934 => 259935)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2020-04-11 20:17:13 UTC (rev 259934)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2020-04-11 23:21:26 UTC (rev 259935)
@@ -96,10 +96,6 @@
struct WebAutocorrectionContext;
}
-@class _UICursorInteraction;
-@class _UILookupGestureRecognizer;
-@class _UIHighlightView;
-@class UITargetedPreview;
@class WebEvent;
@class WKActionSheetAssistant;
@class WKContextMenuElementInfo;
@@ -110,7 +106,13 @@
@class WKHighlightLongPressGestureRecognizer;
@class WKMouseGestureRecognizer;
@class WKInspectorNodeSearchGestureRecognizer;
+@class _WKTextInputContext;
+@class UITargetedPreview;
+@class _UICursorInteraction;
+@class _UILookupGestureRecognizer;
+@class _UIHighlightView;
+
typedef void (^UIWKAutocorrectionCompletionHandler)(UIWKAutocorrectionRects *rectsForInput);
typedef void (^UIWKAutocorrectionContextHandler)(UIWKAutocorrectionContext *autocorrectionContext);
typedef void (^UIWKDictationContextHandler)(NSString *selectedText, NSString *beforeText, NSString *afterText);
@@ -565,6 +567,11 @@
- (WKDrawingCoordinator *)_drawingCoordinator;
#endif
+#if USE(TEXT_INTERACTION_ADDITIONS)
+- (void)_willBeginTextInteractionInTextInputContext:(_WKTextInputContext *)context;
+- (void)_didFinishTextInteractionInTextInputContext:(_WKTextInputContext *)context;
+#endif
+
- (void)_handleAutocorrectionContext:(const WebKit::WebAutocorrectionContext&)context;
- (void)_didStartProvisionalLoadForMainFrame;
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (259934 => 259935)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-04-11 20:17:13 UTC (rev 259934)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-04-11 23:21:26 UTC (rev 259935)
@@ -5078,6 +5078,32 @@
return CGRectZero;
}
+#if USE(TEXT_INTERACTION_ADDITIONS)
+
+- (void)_willBeginTextInteractionInTextInputContext:(_WKTextInputContext *)context
+{
+ ASSERT(context);
+ _page->setShouldRevealCurrentSelectionAfterInsertion(false);
+ _page->setCanShowPlaceholder(context._textInputContext, false);
+ [self _startSuppressingSelectionAssistantForReason:WebKit::InteractionIsHappening];
+}
+
+- (void)_didFinishTextInteractionInTextInputContext:(_WKTextInputContext *)context
+{
+ ASSERT(context);
+ [self _stopSuppressingSelectionAssistantForReason:WebKit::InteractionIsHappening];
+ _page->setCanShowPlaceholder(context._textInputContext, true);
+ // 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
+ // UI process) an editor state update.
+ // FIXME: Only do this if focus changed since -willBeginTextInteractionInTextInputContext was called.
+ // See <rdar://problem/60997530> for more details.
+ _page->setWaitingForPostLayoutEditorStateUpdateAfterFocusingElement(true);
+ _page->setShouldRevealCurrentSelectionAfterInsertion(true);
+}
+
+#endif
+
#if USE(UIKIT_KEYBOARD_ADDITIONS)
- (void)modifierFlagsDidChangeFrom:(UIKeyModifierFlags)oldFlags to:(UIKeyModifierFlags)newFlags
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes