Title: [281468] trunk
Revision
281468
Author
wenson_hs...@apple.com
Date
2021-08-23 13:52:43 -0700 (Mon, 23 Aug 2021)

Log Message

editing/selection/ios/select-text-in-existing-selection.html fails on iOS 15
https://bugs.webkit.org/show_bug.cgi?id=229411
rdar://80385434

Reviewed by Tim Horton.

Tools:

After the changes in rdar://70851909, UIKit's text selection interaction (which encompasses the loupe text
interaction gesture) is no longer allowed to transition to `Began` state when long pressing inside an existing
text selection. This causes us to no longer enter floating caret mode (via loupe gesture) and change the
selection when triggering a long press in selected text, which causes this layout test to fail.

This layout test was originally intended to test a fix for text selection via trackpad on iPadOS failing to
begin when clicking and dragging inside text that has already been selected. At that time, I intentionally wrote
this test in a way that didn't involve the trackpad at all, and instead simply exercised the codechange in
`-[WKContentView textInteractionGesture:shouldBeginAtPoint:]` by synthesizing touches.

Since UIKit no longer supports this behavior, we can rewrite this test to be more robust by calling and checking
the value of `-textInteractionGesture:shouldBeginAtPoint:` in an API test. This patch deletes the existing
layout test, and replaces it with an API test that directly exercises the SPI on `UIWKInteractionViewProtocol`.

Note that the original bug that was fixed by the change that came along with this failing test remains fixed,
because trackpad-based text selection on iPadOS uses `UITextLoupeCursorBehavior` rather than
`UITextLoupeTouchBehavior`, which (unlike the former) contains logic to explicitly avoid starting the loupe
text interaction when long pressing inside of selected text.

Test: UIWKInteractionViewProtocol.TextInteractionCanBeginInExistingSelection

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm:
(-[TestWKWebView synchronouslyRequestTextInputContextsInRect:]): Deleted.
* TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm:
(-[TestWKWebView synchronouslyRequestTextInputContextsInRect:]): Deleted.

Drive-by fix: also fix a build warning by pulling duplicate implementations of this testing helper method into
a common location in `WKWebView (TestWebKitAPI)`, inside of `TestWKWebView.h`.

* TestWebKitAPI/Tests/WebKitCocoa/editable-responsive-body.html: Added.
* TestWebKitAPI/Tests/ios/UIWKInteractionViewProtocol.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/cocoa/TestWKWebView.h:
* TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[WKWebView synchronouslyRequestTextInputContextsInRect:]):
* TestWebKitAPI/ios/UIKitSPI.h:

LayoutTests:

Remove this failing layout test, along with its test expectations. See API test in Tools/ChangeLog for more
details.

* editing/selection/ios/select-text-in-existing-selection-expected.txt: Removed.
* editing/selection/ios/select-text-in-existing-selection.html: Removed.
* platform/ios-14/TestExpectations:
* platform/ios/TestExpectations:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (281467 => 281468)


--- trunk/LayoutTests/ChangeLog	2021-08-23 20:38:03 UTC (rev 281467)
+++ trunk/LayoutTests/ChangeLog	2021-08-23 20:52:43 UTC (rev 281468)
@@ -1,3 +1,19 @@
+2021-08-23  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        editing/selection/ios/select-text-in-existing-selection.html fails on iOS 15
+        https://bugs.webkit.org/show_bug.cgi?id=229411
+        rdar://80385434
+
+        Reviewed by Tim Horton.
+
+        Remove this failing layout test, along with its test expectations. See API test in Tools/ChangeLog for more
+        details.
+
+        * editing/selection/ios/select-text-in-existing-selection-expected.txt: Removed.
+        * editing/selection/ios/select-text-in-existing-selection.html: Removed.
+        * platform/ios-14/TestExpectations:
+        * platform/ios/TestExpectations:
+
 2021-08-23  Eric Hutchison  <ehutchi...@apple.com>
 
         Set test expectations for fast/events/ios/rotation/basic-rotation.html.

Deleted: trunk/LayoutTests/editing/selection/ios/select-text-in-existing-selection-expected.txt (281467 => 281468)


--- trunk/LayoutTests/editing/selection/ios/select-text-in-existing-selection-expected.txt	2021-08-23 20:38:03 UTC (rev 281467)
+++ trunk/LayoutTests/editing/selection/ios/select-text-in-existing-selection-expected.txt	2021-08-23 20:52:43 UTC (rev 281468)
@@ -1,11 +0,0 @@
-The quick brown fox jumped over the lazy dog.
-This test verifies that the selection can be modified via long press inside an existing selection. To manually test, select all the text in the editable area and long press on a word to change the selection.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS getSelection().getRangeAt(0).commonAncestorContainer is target.childNodes[0]
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/editing/selection/ios/select-text-in-existing-selection.html (281467 => 281468)


--- trunk/LayoutTests/editing/selection/ios/select-text-in-existing-selection.html	2021-08-23 20:38:03 UTC (rev 281467)
+++ trunk/LayoutTests/editing/selection/ios/select-text-in-existing-selection.html	2021-08-23 20:52:43 UTC (rev 281468)
@@ -1,43 +0,0 @@
-<html>
-<head>
-<script src=""
-<script src=""
-<meta name=viewport content="width=device-width, initial-scale=1">
-<style>
-body, html {
-    width: 100%;
-    height: 100%;
-    margin: 0;
-}
-
-div[contenteditable] {
-    width: 300px;
-    height: 400px;
-    border: 1px solid black;
-    font-size: 64px;
-}
-</style>
-</head>
-<body>
-<div contenteditable>The quick brown fox <span id="target">jumped</span> over the lazy dog.</div>
-<p id="description"></p>
-<p id="console"></p>
-<script>
-jsTestIsAsync = true;
-let editor = document.querySelector("div[contenteditable]");
-let target = document.getElementById("target");
-
-description("This test verifies that the selection can be modified via long press inside an existing selection. To manually test, select all the text in the editable area and long press on a word to change the selection.");
-document.addEventListener("dragstart", event => event.preventDefault());
-
-addEventListener("load", async () => {
-    await UIHelper.activateElementAndWaitForInputSession(editor);
-    document.execCommand("SelectAll");
-    await UIHelper.waitForSelectionToAppear();
-    await UIHelper.longPressElement(target);
-    shouldBe("getSelection().getRangeAt(0).commonAncestorContainer", "target.childNodes[0]");
-    finishJSTest();
-});
-</script>
-</body>
-</html>
\ No newline at end of file

Modified: trunk/LayoutTests/platform/ios/TestExpectations (281467 => 281468)


--- trunk/LayoutTests/platform/ios/TestExpectations	2021-08-23 20:38:03 UTC (rev 281467)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2021-08-23 20:52:43 UTC (rev 281468)
@@ -3380,9 +3380,6 @@
 # rdar://80396502 ([ iOS15 ] http/wpt/mediarecorder/pause-recording.html is a flaky crash)
 http/wpt/mediarecorder/pause-recording.html [ Pass Crash ]
 
-#rdar://80385434 ([ iOS15 ] editing/selection/ios/select-text-in-existing-selection.html [ Failure ])
-editing/selection/ios/select-text-in-existing-selection.html  [ Failure ]
-
 # rdar://80383672 ([ iOS15 ] accessibility/misspelling-range.html is failing)
 accessibility/misspelling-range.html  [ Failure ]
 

Modified: trunk/LayoutTests/platform/ios-14/TestExpectations (281467 => 281468)


--- trunk/LayoutTests/platform/ios-14/TestExpectations	2021-08-23 20:38:03 UTC (rev 281467)
+++ trunk/LayoutTests/platform/ios-14/TestExpectations	2021-08-23 20:52:43 UTC (rev 281468)
@@ -42,9 +42,6 @@
 # rdar://80396502 ([ iOS15 ] http/wpt/mediarecorder/pause-recording.html is a flaky crash)
 http/wpt/mediarecorder/pause-recording.html [ Pass ]
 
-#rdar://80385434 ([ iOS15 ] editing/selection/ios/select-text-in-existing-selection.html [ Failure ])
-editing/selection/ios/select-text-in-existing-selection.html  [ Pass ]
-
 # rdar://80383672 ([ iOS15 ] accessibility/misspelling-range.html is failing)
 accessibility/misspelling-range.html  [ Pass ]
 

Modified: trunk/Tools/ChangeLog (281467 => 281468)


--- trunk/Tools/ChangeLog	2021-08-23 20:38:03 UTC (rev 281467)
+++ trunk/Tools/ChangeLog	2021-08-23 20:52:43 UTC (rev 281468)
@@ -1,3 +1,49 @@
+2021-08-23  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        editing/selection/ios/select-text-in-existing-selection.html fails on iOS 15
+        https://bugs.webkit.org/show_bug.cgi?id=229411
+        rdar://80385434
+
+        Reviewed by Tim Horton.
+
+        After the changes in rdar://70851909, UIKit's text selection interaction (which encompasses the loupe text
+        interaction gesture) is no longer allowed to transition to `Began` state when long pressing inside an existing
+        text selection. This causes us to no longer enter floating caret mode (via loupe gesture) and change the
+        selection when triggering a long press in selected text, which causes this layout test to fail.
+
+        This layout test was originally intended to test a fix for text selection via trackpad on iPadOS failing to
+        begin when clicking and dragging inside text that has already been selected. At that time, I intentionally wrote
+        this test in a way that didn't involve the trackpad at all, and instead simply exercised the codechange in
+        `-[WKContentView textInteractionGesture:shouldBeginAtPoint:]` by synthesizing touches.
+
+        Since UIKit no longer supports this behavior, we can rewrite this test to be more robust by calling and checking
+        the value of `-textInteractionGesture:shouldBeginAtPoint:` in an API test. This patch deletes the existing
+        layout test, and replaces it with an API test that directly exercises the SPI on `UIWKInteractionViewProtocol`.
+
+        Note that the original bug that was fixed by the change that came along with this failing test remains fixed,
+        because trackpad-based text selection on iPadOS uses `UITextLoupeCursorBehavior` rather than
+        `UITextLoupeTouchBehavior`, which (unlike the former) contains logic to explicitly avoid starting the loupe
+        text interaction when long pressing inside of selected text.
+
+        Test: UIWKInteractionViewProtocol.TextInteractionCanBeginInExistingSelection
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm:
+        (-[TestWKWebView synchronouslyRequestTextInputContextsInRect:]): Deleted.
+        * TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm:
+        (-[TestWKWebView synchronouslyRequestTextInputContextsInRect:]): Deleted.
+
+        Drive-by fix: also fix a build warning by pulling duplicate implementations of this testing helper method into
+        a common location in `WKWebView (TestWebKitAPI)`, inside of `TestWKWebView.h`.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/editable-responsive-body.html: Added.
+        * TestWebKitAPI/Tests/ios/UIWKInteractionViewProtocol.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/cocoa/TestWKWebView.h:
+        * TestWebKitAPI/cocoa/TestWKWebView.mm:
+        (-[WKWebView synchronouslyRequestTextInputContextsInRect:]):
+        * TestWebKitAPI/ios/UIKitSPI.h:
+
 2021-08-23  Peng Liu  <peng.l...@apple.com>
 
         Add a new option '--show-window' to run-webkit-tests

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (281467 => 281468)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2021-08-23 20:38:03 UTC (rev 281467)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2021-08-23 20:52:43 UTC (rev 281468)
@@ -1197,6 +1197,7 @@
 		F42D634422A1729F00D2FB3A /* AutocorrectionTestsIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = F42D634322A1729F00D2FB3A /* AutocorrectionTestsIOS.mm */; };
 		F42DA5161D8CEFE400336F40 /* large-input-field-focus-onload.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */; };
 		F434CA1A22E65BCA005DDB26 /* ScrollToRevealSelection.mm in Sources */ = {isa = PBXBuildFile; fileRef = F434CA1922E65BCA005DDB26 /* ScrollToRevealSelection.mm */; };
+		F4352F9F26D403DE00E605E4 /* editable-responsive-body.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4352F9E26D4037000E605E4 /* editable-responsive-body.html */; };
 		F43E3BBF20DADA1E00A4E7ED /* WKScrollViewTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F43E3BBE20DADA1E00A4E7ED /* WKScrollViewTests.mm */; };
 		F43E3BC120DADBC500A4E7ED /* fixed-nav-bar.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F43E3BC020DADB8000A4E7ED /* fixed-nav-bar.html */; };
 		F442851D2140DF2900CCDA22 /* NSFontPanelTesting.mm in Sources */ = {isa = PBXBuildFile; fileRef = F442851C2140DF2900CCDA22 /* NSFontPanelTesting.mm */; };
@@ -1480,6 +1481,7 @@
 				9984FACE1CFFB090008D198C /* editable-body.html in Copy Resources */,
 				F4D9818F2196B920008230FC /* editable-nested-lists.html in Copy Resources */,
 				CEDA12412437C9FB00C28A9E /* editable-region-composited-and-non-composited-overlap.html in Copy Resources */,
+				F4352F9F26D403DE00E605E4 /* editable-responsive-body.html in Copy Resources */,
 				F44D06451F395C26001A0E29 /* editor-state-test-harness.html in Copy Resources */,
 				51C8E1A91F27F49600BF731B /* EmptyGrandfatheredResourceLoadStatistics.plist in Copy Resources */,
 				A14AAB651E78DC5400C1ADC2 /* encrypted.pdf in Copy Resources */,
@@ -3044,6 +3046,7 @@
 		F42D634322A1729F00D2FB3A /* AutocorrectionTestsIOS.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AutocorrectionTestsIOS.mm; sourceTree = "<group>"; };
 		F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = "large-input-field-focus-onload.html"; path = "Tests/WebKitCocoa/large-input-field-focus-onload.html"; sourceTree = SOURCE_ROOT; };
 		F434CA1922E65BCA005DDB26 /* ScrollToRevealSelection.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollToRevealSelection.mm; sourceTree = "<group>"; };
+		F4352F9E26D4037000E605E4 /* editable-responsive-body.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "editable-responsive-body.html"; sourceTree = "<group>"; };
 		F43E3BBE20DADA1E00A4E7ED /* WKScrollViewTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKScrollViewTests.mm; sourceTree = "<group>"; };
 		F43E3BC020DADB8000A4E7ED /* fixed-nav-bar.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "fixed-nav-bar.html"; sourceTree = "<group>"; };
 		F442851B2140DF2900CCDA22 /* NSFontPanelTesting.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSFontPanelTesting.h; sourceTree = "<group>"; };
@@ -4032,6 +4035,7 @@
 				A155022B1E050BC500A24C57 /* duplicate-completion-handler-calls.html */,
 				9984FACD1CFFB038008D198C /* editable-body.html */,
 				F4D9818E2196B911008230FC /* editable-nested-lists.html */,
+				F4352F9E26D4037000E605E4 /* editable-responsive-body.html */,
 				F44D06441F395C0D001A0E29 /* editor-state-test-harness.html */,
 				51C8E1A81F27F47300BF731B /* EmptyGrandfatheredResourceLoadStatistics.plist */,
 				F4C2AB211DD6D94100E06D5B /* enormous-video-with-sound.html */,

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm (281467 => 281468)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm	2021-08-23 20:38:03 UTC (rev 281467)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm	2021-08-23 20:52:43 UTC (rev 281468)
@@ -139,18 +139,6 @@
     TestWebKitAPI::Util::run(&finished);
 }
 
-- (NSArray<_WKTextInputContext *> *)synchronouslyRequestTextInputContextsInRect:(CGRect)rect
-{
-    __block bool finished = false;
-    __block RetainPtr<NSArray<_WKTextInputContext *>> result;
-    [self _requestTextInputContextsInRect:rect completionHandler:^(NSArray<_WKTextInputContext *> *contexts) {
-        result = contexts;
-        finished = true;
-    }];
-    TestWebKitAPI::Util::run(&finished);
-    return result.autorelease();
-}
-
 - (UITextPlaceholder *)synchronouslyInsertTextPlaceholderWithSize:(CGSize)size
 {
     __block bool finished = false;

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm (281467 => 281468)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm	2021-08-23 20:38:03 UTC (rev 281467)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm	2021-08-23 20:52:43 UTC (rev 281468)
@@ -82,18 +82,6 @@
 
 @implementation TestWKWebView (SynchronousTextInputContext)
 
-- (NSArray<_WKTextInputContext *> *)synchronouslyRequestTextInputContextsInRect:(CGRect)rect
-{
-    __block bool finished = false;
-    __block RetainPtr<NSArray<_WKTextInputContext *>> result;
-    [self _requestTextInputContextsInRect:rect completionHandler:^(NSArray<_WKTextInputContext *> *contexts) {
-        result = contexts;
-        finished = true;
-    }];
-    TestWebKitAPI::Util::run(&finished);
-    return result.autorelease();
-}
-
 - (UIResponder<UITextInput> *)synchronouslyFocusTextInputContext:(_WKTextInputContext *)context placeCaretAt:(CGPoint)point
 {
     __block bool finished = false;

Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/editable-responsive-body.html (0 => 281468)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/editable-responsive-body.html	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/editable-responsive-body.html	2021-08-23 20:52:43 UTC (rev 281468)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <head>
+        <style>
+            body {
+                margin: 0;
+                font-size: 24px;
+            }
+        </style>
+    </head>
+    <body contenteditable>
+        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean laoreet nisi felis, eu scelerisque dolor imperdiet in. Sed at porttitor purus, in placerat justo. Mauris at augue ac purus viverra molestie. Fusce ultrices ante at pellentesque lobortis. Sed pellentesque, ipsum eu semper mollis, arcu lectus dignissim enim, in maximus tortor ligula id ipsum. Nulla dignissim diam a mi tempor porta. Etiam tempor ac augue non dapibus. Donec euismod vel turpis in ultrices. Ut accumsan ultrices arcu vitae venenatis. In urna velit, accumsan sit amet arcu vel, vestibulum pulvinar leo. Aliquam vulputate euismod ultrices. Sed congue vestibulum libero quis ornare.
+        <script>
+            document.body.focus();
+        </script>
+    </body>
+</html>

Modified: trunk/Tools/TestWebKitAPI/Tests/ios/UIWKInteractionViewProtocol.mm (281467 => 281468)


--- trunk/Tools/TestWebKitAPI/Tests/ios/UIWKInteractionViewProtocol.mm	2021-08-23 20:38:03 UTC (rev 281467)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/UIWKInteractionViewProtocol.mm	2021-08-23 20:52:43 UTC (rev 281468)
@@ -180,6 +180,32 @@
     EXPECT_WK_STREQ("DIV", [webView stringByEvaluatingJavaScript:@"document.querySelector('iframe').contentDocument.activeElement.tagName"]);
 }
 
+TEST(UIWKInteractionViewProtocol, TextInteractionCanBeginInExistingSelection)
+{
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)]);
+    auto inputDelegate = adoptNS([TestInputDelegate new]);
+    [webView _setInputDelegate:inputDelegate.get()];
+
+    bool didStartInputSession = false;
+    [inputDelegate setFocusStartsInputSessionPolicyHandler:[&] (WKWebView *, id <_WKFocusedElementInfo>) {
+        didStartInputSession = true;
+        return _WKFocusStartsInputSessionPolicyAllow;
+    }];
+
+    [webView synchronouslyLoadTestPageNamed:@"editable-responsive-body"];
+    TestWebKitAPI::Util::run(&didStartInputSession);
+
+    auto contentView = [webView textInputContentView];
+    BOOL allowsTextInteractionOutsideOfSelection = [contentView textInteractionGesture:UIWKGestureLoupe shouldBeginAtPoint:CGPointMake(50, 50)];
+    EXPECT_TRUE(allowsTextInteractionOutsideOfSelection);
+
+    [webView selectAll:nil];
+    [webView waitForNextPresentationUpdate];
+
+    BOOL allowsTextInteractionInsideSelection = [contentView textInteractionGesture:UIWKGestureLoupe shouldBeginAtPoint:CGPointMake(50, 50)];
+    EXPECT_TRUE(allowsTextInteractionInsideSelection);
+}
+
 } // namespace TestWebKitAPI
 
 #endif

Modified: trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h (281467 => 281468)


--- trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h	2021-08-23 20:38:03 UTC (rev 281467)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h	2021-08-23 20:52:43 UTC (rev 281468)
@@ -30,6 +30,7 @@
 
 #if PLATFORM(IOS_FAMILY)
 @class _WKActivatedElementInfo;
+@class _WKTextInputContext;
 @protocol UITextInputInternal;
 @protocol UITextInputMultiDocument;
 @protocol UITextInputPrivate;
@@ -50,6 +51,7 @@
 @interface WKWebView (TestWebKitAPI)
 #if PLATFORM(IOS_FAMILY)
 @property (nonatomic, readonly) UIView <UITextInputPrivate, UITextInputInternal, UITextInputMultiDocument, UIWKInteractionViewProtocol, UITextInputTokenizer> *textInputContentView;
+- (NSArray<_WKTextInputContext *> *)synchronouslyRequestTextInputContextsInRect:(CGRect)rect;
 #endif
 @property (nonatomic, readonly) NSString *contentsAsString;
 @property (nonatomic, readonly) NSArray<NSString *> *tagsInBody;

Modified: trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm (281467 => 281468)


--- trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm	2021-08-23 20:38:03 UTC (rev 281467)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm	2021-08-23 20:52:43 UTC (rev 281468)
@@ -36,6 +36,7 @@
 #import <WebKit/WebKitPrivate.h>
 #import <WebKit/_WKActivatedElementInfo.h>
 #import <WebKit/_WKProcessPoolConfiguration.h>
+#import <WebKit/_WKTextInputContext.h>
 #import <objc/runtime.h>
 #import <wtf/BlockPtr.h>
 #import <wtf/RetainPtr.h>
@@ -138,6 +139,18 @@
     return (UIView <UITextInputPrivate, UITextInputMultiDocument> *)[self valueForKey:@"_currentContentView"];
 }
 
+- (NSArray<_WKTextInputContext *> *)synchronouslyRequestTextInputContextsInRect:(CGRect)rect
+{
+    __block bool finished = false;
+    __block RetainPtr<NSArray<_WKTextInputContext *>> result;
+    [self _requestTextInputContextsInRect:rect completionHandler:^(NSArray<_WKTextInputContext *> *contexts) {
+        result = contexts;
+        finished = true;
+    }];
+    TestWebKitAPI::Util::run(&finished);
+    return result.autorelease();
+}
+
 #endif // PLATFORM(IOS_FAMILY)
 
 - (NSString *)contentsAsString

Modified: trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h (281467 => 281468)


--- trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h	2021-08-23 20:38:03 UTC (rev 281467)
+++ trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h	2021-08-23 20:52:43 UTC (rev 281468)
@@ -189,6 +189,10 @@
 - (void)accessoryDone;
 @end
 
+typedef NS_ENUM(NSInteger, UIWKGestureType) {
+    UIWKGestureLoupe
+};
+
 @protocol UIWKInteractionViewProtocol
 - (void)pasteWithCompletionHandler:(void (^)(void))completionHandler;
 - (void)requestAutocorrectionRectsForString:(NSString *)input withCompletionHandler:(void (^)(UIWKAutocorrectionRects *rectsForInput))completionHandler;
@@ -199,6 +203,7 @@
 - (void)updateSelectionWithExtentPoint:(CGPoint)point completionHandler:(void (^)(BOOL selectionEndIsMoving))completionHandler;
 - (void)updateSelectionWithExtentPoint:(CGPoint)point withBoundary:(UITextGranularity)granularity completionHandler:(void (^)(BOOL selectionEndIsMoving))completionHandler;
 - (void)selectWordForReplacement;
+- (BOOL)textInteractionGesture:(UIWKGestureType)gesture shouldBeginAtPoint:(CGPoint)point;
 @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