Title: [264812] trunk
Revision
264812
Author
wenson_hs...@apple.com
Date
2020-07-23 22:31:56 -0700 (Thu, 23 Jul 2020)

Log Message

Tapping QuickType suggestions for a misspelled word does nothing in Mail compose
https://bugs.webkit.org/show_bug.cgi?id=214705
<rdar://problem/58320785>

Reviewed by Tim Horton.

Source/WebKit:

In WebKit2-based editing contexts on iOS (such as Mail compose), tapping on a misspelled word will result in
QuickType suggestions in the input accessory row either showing up blank (i.e. with no suggestions), or will
show suggestions that are contextual to the text selection prior to selecting the misspelled word. Subsequently,
attempting to choose of these suggestions results in no text being inserted. This happens for a couple of
reasons:

1.  UIKit doesn't attempt to re-request the autocorrection context after tapping on a misspelled word. UIKit
    just uses `-selectWordForReplacement` to extend the selection over the misspelled word, which doesn't
    currently fire any of the selection change callbacks on UIInputDelegate. As a result, UIKit will instead
    believe that the selection is collapsed to the start or end of the misspelled word.

2.  Upon attempting to compute text suggestions for QuickType, `-[UIKeyboardImpl replacementsFromSelectedText]`
    uses `-textInRange:` to grab the currently selected text, which (in WKContentView) is currently hard-coded
    to always return `nil`.

We address (1) by bookending `-selectWordForReplacement` with calls to `-beginSelectionChange` and
`-endSelectionChange`, and address (2) by teaching `-textInRange:` to return the current text selection, only in
the case where the given `UITextRange` is equal to the current ranged selection.

Test: SelectionTests.SelectedTextAfterSelectingWordForReplacement

* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::extendSelection):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanUpInteraction]):
(-[WKContentView textInRange:]):

Special-case the scenario where the input text range is exactly the same as `self.selectedTextRange` by
returning the currently selected text that is cached on EditorState. In all other cases, continue to return
`nil`.

(-[WKContentView selectedTextRange]):

Cache the current selected text range on WKContentView, such that repeated calls to selectedTextRange when the
selection has not changed does not require a new WKTextRange to be constructed every time.

(-[WKContentView _selectionChanged]):

Invalidate the cached selected text range whenever the selection has changed.

(-[WKContentView selectWordForReplacement]):

Use the completion callback added below to bookend this method with `-(begin|end)SelectionChange`.

(-[WKContentView _updateChangedSelection:]):

Invalidate the cached selected text range whenever we're about to tell UIKit to repaint the selection.

* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::extendSelection):

Add an optional completion callback to `extendSelection`.

* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::extendSelection):

Tools:

* TestWebKitAPI/Tests/ios/SelectionByWord.mm:

Add a unit test to exercise the changes in behavior when calling UITextInput API.

(-[SelectionChangeListener setSelectionWillChangeHandler:]):
(-[SelectionChangeListener setSelectionDidChangeHandler:]):
(-[SelectionChangeListener selectionWillChangeHandler]):
(-[SelectionChangeListener selectionDidChangeHandler]):
(-[SelectionChangeListener selectionWillChange:]):
(-[SelectionChangeListener selectionDidChange:]):
(-[SelectionChangeListener textWillChange:]):
(-[SelectionChangeListener textDidChange:]):
* TestWebKitAPI/ios/UIKitSPI.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (264811 => 264812)


--- trunk/Source/WebKit/ChangeLog	2020-07-24 05:04:38 UTC (rev 264811)
+++ trunk/Source/WebKit/ChangeLog	2020-07-24 05:31:56 UTC (rev 264812)
@@ -1,3 +1,70 @@
+2020-07-23  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Tapping QuickType suggestions for a misspelled word does nothing in Mail compose
+        https://bugs.webkit.org/show_bug.cgi?id=214705
+        <rdar://problem/58320785>
+
+        Reviewed by Tim Horton.
+
+        In WebKit2-based editing contexts on iOS (such as Mail compose), tapping on a misspelled word will result in
+        QuickType suggestions in the input accessory row either showing up blank (i.e. with no suggestions), or will
+        show suggestions that are contextual to the text selection prior to selecting the misspelled word. Subsequently,
+        attempting to choose of these suggestions results in no text being inserted. This happens for a couple of
+        reasons:
+
+        1.  UIKit doesn't attempt to re-request the autocorrection context after tapping on a misspelled word. UIKit
+            just uses `-selectWordForReplacement` to extend the selection over the misspelled word, which doesn't
+            currently fire any of the selection change callbacks on UIInputDelegate. As a result, UIKit will instead
+            believe that the selection is collapsed to the start or end of the misspelled word.
+
+        2.  Upon attempting to compute text suggestions for QuickType, `-[UIKeyboardImpl replacementsFromSelectedText]`
+            uses `-textInRange:` to grab the currently selected text, which (in WKContentView) is currently hard-coded
+            to always return `nil`.
+
+        We address (1) by bookending `-selectWordForReplacement` with calls to `-beginSelectionChange` and
+        `-endSelectionChange`, and address (2) by teaching `-textInRange:` to return the current text selection, only in
+        the case where the given `UITextRange` is equal to the current ranged selection.
+
+        Test: SelectionTests.SelectedTextAfterSelectingWordForReplacement
+
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::extendSelection):
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView cleanUpInteraction]):
+        (-[WKContentView textInRange:]):
+
+        Special-case the scenario where the input text range is exactly the same as `self.selectedTextRange` by
+        returning the currently selected text that is cached on EditorState. In all other cases, continue to return
+        `nil`.
+
+        (-[WKContentView selectedTextRange]):
+
+        Cache the current selected text range on WKContentView, such that repeated calls to selectedTextRange when the
+        selection has not changed does not require a new WKTextRange to be constructed every time.
+
+        (-[WKContentView _selectionChanged]):
+
+        Invalidate the cached selected text range whenever the selection has changed.
+
+        (-[WKContentView selectWordForReplacement]):
+
+        Use the completion callback added below to bookend this method with `-(begin|end)SelectionChange`.
+
+        (-[WKContentView _updateChangedSelection:]):
+
+        Invalidate the cached selected text range whenever we're about to tell UIKit to repaint the selection.
+
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::extendSelection):
+
+        Add an optional completion callback to `extendSelection`.
+
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::extendSelection):
+
 2020-07-23  Peng Liu  <peng.l...@apple.com>
 
         Safari Related Leaked Assertions after Playing YouTube Video

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (264811 => 264812)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2020-07-24 05:04:38 UTC (rev 264811)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2020-07-24 05:31:56 UTC (rev 264812)
@@ -765,7 +765,7 @@
     void selectWithGesture(const WebCore::IntPoint, GestureType, GestureRecognizerState, bool isInteractingWithFocusedElement, WTF::Function<void(const WebCore::IntPoint&, GestureType, GestureRecognizerState, OptionSet<SelectionFlags>, CallbackBase::Error)>&&);
     void updateSelectionWithTouches(const WebCore::IntPoint, SelectionTouch, bool baseIsStart, Function<void(const WebCore::IntPoint&, SelectionTouch, OptionSet<SelectionFlags>, CallbackBase::Error)>&&);
     void selectWithTwoTouches(const WebCore::IntPoint from, const WebCore::IntPoint to, GestureType, GestureRecognizerState, Function<void(const WebCore::IntPoint&, GestureType, GestureRecognizerState, OptionSet<SelectionFlags>, CallbackBase::Error)>&&);
-    void extendSelection(WebCore::TextGranularity);
+    void extendSelection(WebCore::TextGranularity, CompletionHandler<void()>&& = { });
     void selectWordBackward();
     void moveSelectionByOffset(int32_t offset, CompletionHandler<void()>&&);
     void selectTextWithGranularityAtPoint(const WebCore::IntPoint, WebCore::TextGranularity, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&);

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (264811 => 264812)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2020-07-24 05:04:38 UTC (rev 264811)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2020-07-24 05:31:56 UTC (rev 264812)
@@ -108,6 +108,7 @@
 @class WKHighlightLongPressGestureRecognizer;
 @class WKMouseGestureRecognizer;
 @class WKInspectorNodeSearchGestureRecognizer;
+@class WKTextRange;
 @class _WKTextInputContext;
 
 @class UITargetedPreview;
@@ -322,6 +323,7 @@
     WebKit::TransactionID _layerTreeTransactionIdAtLastInteractionStart;
 
     WebKit::WKSelectionDrawingInfo _lastSelectionDrawingInfo;
+    RetainPtr<WKTextRange> _cachedSelectedTextRange;
 
     Optional<WebKit::InteractionInformationRequest> _lastOutstandingPositionInformationRequest;
 

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (264811 => 264812)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-07-24 05:04:38 UTC (rev 264811)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-07-24 05:31:56 UTC (rev 264812)
@@ -1063,6 +1063,8 @@
     [self _resetPanningPreventionFlags];
     [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
     [self _cancelPendingKeyEventHandler];
+
+    _cachedSelectedTextRange = nil;
 }
 
 - (void)_cancelPendingKeyEventHandler
@@ -4530,6 +4532,13 @@
 
 - (NSString *)textInRange:(UITextRange *)range
 {
+    if (!_page)
+        return nil;
+
+    auto& editorState = _page->editorState();
+    if (self.selectedTextRange == range && !editorState.isMissingPostLayoutData && editorState.selectionIsRange)
+        return editorState.postLayoutData().wordAtSelection;
+
     return nil;
 }
 
@@ -4588,11 +4597,15 @@
     if (!isContentEditable && !isRange)
         return nil;
 
+    if (_cachedSelectedTextRange)
+        return _cachedSelectedTextRange.get();
+
     auto caretStartRect = [self _scaledCaretRectForSelectionStart:_page->editorState().postLayoutData().caretRectAtStart];
     auto caretEndRect = [self _scaledCaretRectForSelectionEnd:_page->editorState().postLayoutData().caretRectAtEnd];
     auto selectionRects = wkTextSelectionRects(_page->editorState().postLayoutData().selectionRects);
     auto selectedTextLength = editorState.postLayoutData().selectedTextLength;
-    return [WKTextRange textRangeWithState:!hasSelection isRange:isRange isEditable:isContentEditable startRect:caretStartRect endRect:caretEndRect selectionRects:selectionRects selectedTextLength:selectedTextLength];
+    _cachedSelectedTextRange = [WKTextRange textRangeWithState:!hasSelection isRange:isRange isEditable:isContentEditable startRect:caretStartRect endRect:caretEndRect selectionRects:selectionRects selectedTextLength:selectedTextLength];
+    return _cachedSelectedTextRange.get();
 }
 
 - (CGRect)caretRectForPosition:(UITextPosition *)position
@@ -6575,6 +6588,7 @@
 {
     [self _updateSelectionAssistantSuppressionState];
 
+    _cachedSelectedTextRange = nil;
     _selectionNeedsUpdate = YES;
     // If we are changing the selection with a gesture there is no need
     // to wait to paint the selection.
@@ -6600,7 +6614,11 @@
 
 - (void)selectWordForReplacement
 {
-    _page->extendSelection(WebCore::TextGranularity::WordGranularity);
+    [self beginSelectionChange];
+    _page->extendSelection(WebCore::TextGranularity::WordGranularity, [weakSelf = WeakObjCPtr<WKContentView>(self)] {
+        if (auto strongSelf = weakSelf.get())
+            [strongSelf endSelectionChange];
+    });
 }
 
 #if ENABLE(PLATFORM_DRIVEN_TEXT_CHECKING)
@@ -6631,6 +6649,7 @@
     if (force || selectionDrawingInfo != _lastSelectionDrawingInfo) {
         LOG_WITH_STREAM(Selection, stream << "_updateChangedSelection " << selectionDrawingInfo);
 
+        _cachedSelectedTextRange = nil;
         _lastSelectionDrawingInfo = selectionDrawingInfo;
 
         // FIXME: We need to figure out what to do if the selection is changed by _javascript_.

Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (264811 => 264812)


--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2020-07-24 05:04:38 UTC (rev 264811)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2020-07-24 05:31:56 UTC (rev 264812)
@@ -752,9 +752,12 @@
     m_process->send(Messages::WebPage::ApplicationDidBecomeActive(), m_webPageID);
 }
 
-void WebPageProxy::extendSelection(WebCore::TextGranularity granularity)
+void WebPageProxy::extendSelection(WebCore::TextGranularity granularity, CompletionHandler<void()>&& completionHandler)
 {
-    m_process->send(Messages::WebPage::ExtendSelection(granularity), m_webPageID);
+    sendWithAsyncReply(Messages::WebPage::ExtendSelection(granularity), [completionHandler = WTFMove(completionHandler)]() mutable {
+        if (completionHandler)
+            completionHandler();
+    });
 }
 
 void WebPageProxy::selectWordBackward()

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (264811 => 264812)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2020-07-24 05:04:38 UTC (rev 264811)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2020-07-24 05:31:56 UTC (rev 264812)
@@ -695,7 +695,7 @@
     void selectWithGesture(const WebCore::IntPoint&, GestureType, GestureRecognizerState, bool isInteractingWithFocusedElement, CallbackID);
     void updateSelectionWithTouches(const WebCore::IntPoint&, SelectionTouch, bool baseIsStart, CallbackID);
     void selectWithTwoTouches(const WebCore::IntPoint& from, const WebCore::IntPoint& to, GestureType, GestureRecognizerState, CallbackID);
-    void extendSelection(WebCore::TextGranularity);
+    void extendSelection(WebCore::TextGranularity, CompletionHandler<void()>&&);
     void selectWordBackward();
     void moveSelectionByOffset(int32_t offset, CompletionHandler<void()>&&);
     void selectTextWithGranularityAtPoint(const WebCore::IntPoint&, WebCore::TextGranularity, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&);

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (264811 => 264812)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2020-07-24 05:04:38 UTC (rev 264811)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2020-07-24 05:31:56 UTC (rev 264812)
@@ -68,7 +68,7 @@
     SelectWithGesture(WebCore::IntPoint point, enum:uint8_t WebKit::GestureType gestureType, enum:uint8_t WebKit::GestureRecognizerState gestureState, bool isInteractingWithFocusedElement, WebKit::CallbackID callbackID)
     UpdateSelectionWithTouches(WebCore::IntPoint point, enum:uint8_t WebKit::SelectionTouch touches, bool baseIsStart, WebKit::CallbackID callbackID)
     SelectWithTwoTouches(WebCore::IntPoint from, WebCore::IntPoint to, enum:uint8_t WebKit::GestureType gestureType, enum:uint8_t WebKit::GestureRecognizerState gestureState, WebKit::CallbackID callbackID)
-    ExtendSelection(enum:uint8_t WebCore::TextGranularity granularity)
+    ExtendSelection(enum:uint8_t WebCore::TextGranularity granularity) -> () Async
     SelectWordBackward()
     MoveSelectionByOffset(int32_t offset) -> () Async
     SelectTextWithGranularityAtPoint(WebCore::IntPoint point, enum:uint8_t WebCore::TextGranularity granularity, bool isInteractingWithFocusedElement) -> () Async

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (264811 => 264812)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-07-24 05:04:38 UTC (rev 264811)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-07-24 05:31:56 UTC (rev 264812)
@@ -133,6 +133,7 @@
 #import <WebCore/WebEvent.h>
 #import <wtf/MathExtras.h>
 #import <wtf/MemoryPressureHandler.h>
+#import <wtf/Scope.h>
 #import <wtf/SetForScope.h>
 #import <wtf/SoftLinking.h>
 #import <wtf/cocoa/Entitlements.h>
@@ -1762,8 +1763,10 @@
     send(Messages::WebPageProxy::GestureCallback(from, gestureType, gestureState, { }, callbackID));
 }
 
-void WebPage::extendSelection(WebCore::TextGranularity granularity)
+void WebPage::extendSelection(WebCore::TextGranularity granularity, CompletionHandler<void()>&& completionHandler)
 {
+    auto callCompletionHandlerOnExit = makeScopeExit(WTFMove(completionHandler));
+
     Frame& frame = m_page->focusController().focusedOrMainFrame();
     // For the moment we handle only TextGranularity::WordGranularity.
     if (granularity != TextGranularity::WordGranularity || !frame.selection().isCaret())

Modified: trunk/Tools/ChangeLog (264811 => 264812)


--- trunk/Tools/ChangeLog	2020-07-24 05:04:38 UTC (rev 264811)
+++ trunk/Tools/ChangeLog	2020-07-24 05:31:56 UTC (rev 264812)
@@ -1,3 +1,25 @@
+2020-07-23  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Tapping QuickType suggestions for a misspelled word does nothing in Mail compose
+        https://bugs.webkit.org/show_bug.cgi?id=214705
+        <rdar://problem/58320785>
+
+        Reviewed by Tim Horton.
+
+        * TestWebKitAPI/Tests/ios/SelectionByWord.mm:
+
+        Add a unit test to exercise the changes in behavior when calling UITextInput API.
+
+        (-[SelectionChangeListener setSelectionWillChangeHandler:]):
+        (-[SelectionChangeListener setSelectionDidChangeHandler:]):
+        (-[SelectionChangeListener selectionWillChangeHandler]):
+        (-[SelectionChangeListener selectionDidChangeHandler]):
+        (-[SelectionChangeListener selectionWillChange:]):
+        (-[SelectionChangeListener selectionDidChange:]):
+        (-[SelectionChangeListener textWillChange:]):
+        (-[SelectionChangeListener textDidChange:]):
+        * TestWebKitAPI/ios/UIKitSPI.h:
+
 2020-07-23  Aakash Jain  <aakash_j...@apple.com>
 
         [ews] Notify bot watchers about pre-existing and flaky test failures found on ews bots

Modified: trunk/Tools/TestWebKitAPI/Tests/ios/SelectionByWord.mm (264811 => 264812)


--- trunk/Tools/TestWebKitAPI/Tests/ios/SelectionByWord.mm	2020-07-24 05:04:38 UTC (rev 264811)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/SelectionByWord.mm	2020-07-24 05:31:56 UTC (rev 264812)
@@ -31,11 +31,8 @@
 #import "TestInputDelegate.h"
 #import "TestWKWebView.h"
 #import "UIKitSPI.h"
+#import <wtf/BlockPtr.h>
 
-@interface WKContentView (Private)
-- (void)selectWordForReplacement;
-@end
-
 TEST(SelectionTests, ByWordAtEndOfDocument)
 {
     auto webView = adoptNS([[TestWKWebView alloc] init]);
@@ -47,7 +44,7 @@
     EXPECT_TRUE([webView stringByEvaluatingJavaScript:@"getSelection().isCollapsed"].boolValue);
 
     // This method triggers the wordRangeFromPosition() code to be tested.
-    [[webView wkContentView] selectWordForReplacement];
+    [[webView textInputContentView] selectWordForReplacement];
 
     EXPECT_FALSE([webView stringByEvaluatingJavaScript:@"getSelection().isCollapsed"].boolValue);
     EXPECT_WK_STREQ([webView stringByEvaluatingJavaScript:@"getSelection().anchorNode.nodeValue"], "Paragraph Three");
@@ -58,4 +55,83 @@
     EXPECT_WK_STREQ([webView stringByEvaluatingJavaScript:@"getSelection().toString()"], "Three");
 }
 
+@interface SelectionChangeListener : NSObject <UITextInputDelegate>
+@property (nonatomic) dispatch_block_t selectionWillChangeHandler;
+@property (nonatomic) dispatch_block_t selectionDidChangeHandler;
+@end
+
+@implementation SelectionChangeListener {
+    BlockPtr<void()> _selectionWillChangeHandler;
+    BlockPtr<void()> _selectionDidChangeHandler;
+}
+
+- (void)setSelectionWillChangeHandler:(dispatch_block_t)handler
+{
+    _selectionWillChangeHandler = makeBlockPtr(handler);
+}
+
+- (void)setSelectionDidChangeHandler:(dispatch_block_t)handler
+{
+    _selectionDidChangeHandler = makeBlockPtr(handler);
+}
+
+- (dispatch_block_t)selectionWillChangeHandler
+{
+    return _selectionWillChangeHandler.get();
+}
+
+- (dispatch_block_t)selectionDidChangeHandler
+{
+    return _selectionDidChangeHandler.get();
+}
+
+- (void)selectionWillChange:(id <UITextInput>)textInput
+{
+    if (_selectionWillChangeHandler)
+        _selectionWillChangeHandler();
+}
+
+- (void)selectionDidChange:(id <UITextInput>)textInput
+{
+    if (_selectionDidChangeHandler)
+        _selectionDidChangeHandler();
+}
+
+- (void)textWillChange:(id <UITextInput>)textInput
+{
+}
+
+- (void)textDidChange:(id <UITextInput>)textInput
+{
+}
+
+@end
+
+TEST(SelectionTests, SelectedTextAfterSelectingWordForReplacement)
+{
+    auto listener = adoptNS([[SelectionChangeListener alloc] init]);
+    auto webView = adoptNS([[TestWKWebView alloc] init]);
+    [webView synchronouslyLoadHTMLString:@"<body contenteditable><p>Hello</p></body><script>document.body.focus()</script>"];
+
+    auto contentView = [webView textInputContentView];
+    [contentView setInputDelegate:listener.get()];
+
+    __block bool selectionWillChange = false;
+    [listener setSelectionWillChangeHandler:^{
+        selectionWillChange = true;
+    }];
+
+    __block bool selectionDidChange = false;
+    [listener setSelectionDidChangeHandler:^{
+        selectionDidChange = true;
+    }];
+
+    [contentView selectWordForReplacement];
+    [webView waitForNextPresentationUpdate];
+
+    TestWebKitAPI::Util::run(&selectionWillChange);
+    TestWebKitAPI::Util::run(&selectionDidChange);
+    EXPECT_WK_STREQ("Hello", [contentView textInRange:contentView.selectedTextRange]);
+}
+
 #endif // PLATFORM(IOS_FAMILY)

Modified: trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h (264811 => 264812)


--- trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h	2020-07-24 05:04:38 UTC (rev 264811)
+++ trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h	2020-07-24 05:31:56 UTC (rev 264812)
@@ -180,6 +180,7 @@
 - (void)selectTextWithGranularity:(UITextGranularity)granularity atPoint:(CGPoint)point completionHandler:(void (^)(void))completionHandler;
 - (void)updateSelectionWithExtentPoint:(CGPoint)point completionHandler:(void (^)(BOOL selectionEndIsMoving))completionHandler;
 - (void)updateSelectionWithExtentPoint:(CGPoint)point withBoundary:(UITextGranularity)granularity completionHandler:(void (^)(BOOL selectionEndIsMoving))completionHandler;
+- (void)selectWordForReplacement;
 @property (nonatomic, readonly) NSString *selectedText;
 
 @optional
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to