<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[281468] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/281468">281468</a></dd>
<dt>Author</dt> <dd>wenson_hsieh@apple.com</dd>
<dt>Date</dt> <dd>2021-08-23 13:52:43 -0700 (Mon, 23 Aug 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>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:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformiosTestExpectations">trunk/LayoutTests/platform/ios/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformios14TestExpectations">trunk/LayoutTests/platform/ios-14/TestExpectations</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaDocumentEditingContextmm">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaRequestTextInputContextmm">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsiosUIWKInteractionViewProtocolmm">trunk/Tools/TestWebKitAPI/Tests/ios/UIWKInteractionViewProtocol.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPIcocoaTestWKWebViewh">trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h</a></li>
<li><a href="#trunkToolsTestWebKitAPIcocoaTestWKWebViewmm">trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPIiosUIKitSPIh">trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaeditableresponsivebodyhtml">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/editable-responsive-body.html</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestseditingselectioniosselecttextinexistingselectionexpectedtxt">trunk/LayoutTests/editing/selection/ios/select-text-in-existing-selection-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingselectioniosselecttextinexistingselectionhtml">trunk/LayoutTests/editing/selection/ios/select-text-in-existing-selection.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (281467 => 281468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-08-23 20:38:03 UTC (rev 281467)
+++ trunk/LayoutTests/ChangeLog 2021-08-23 20:52:43 UTC (rev 281468)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2021-08-23  Wenson Hsieh  <wenson_hsieh@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:
+
</ins><span class="cx"> 2021-08-23  Eric Hutchison  <ehutchison@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Set test expectations for fast/events/ios/rotation/basic-rotation.html.
</span></span></pre></div>
<a id="trunkLayoutTestseditingselectioniosselecttextinexistingselectionexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/editing/selection/ios/select-text-in-existing-selection-expected.txt (281467 => 281468)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,11 +0,0 @@
</span><del>-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
-
</del></span></pre></div>
<a id="trunkLayoutTestseditingselectioniosselecttextinexistingselectionhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/editing/selection/ios/select-text-in-existing-selection.html (281467 => 281468)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,43 +0,0 @@
</span><del>-<html>
-<head>
-<script src="../../../resources/js-test.js"></script>
-<script src="../../../resources/ui-helper.js"></script>
-<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>
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiosTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios/TestExpectations (281467 => 281468)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -3380,9 +3380,6 @@
</span><span class="cx"> # rdar://80396502 ([ iOS15 ] http/wpt/mediarecorder/pause-recording.html is a flaky crash)
</span><span class="cx"> http/wpt/mediarecorder/pause-recording.html [ Pass Crash ]
</span><span class="cx"> 
</span><del>-#rdar://80385434 ([ iOS15 ] editing/selection/ios/select-text-in-existing-selection.html [ Failure ])
-editing/selection/ios/select-text-in-existing-selection.html  [ Failure ]
-
</del><span class="cx"> # rdar://80383672 ([ iOS15 ] accessibility/misspelling-range.html is failing)
</span><span class="cx"> accessibility/misspelling-range.html  [ Failure ]
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformios14TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-14/TestExpectations (281467 => 281468)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -42,9 +42,6 @@
</span><span class="cx"> # rdar://80396502 ([ iOS15 ] http/wpt/mediarecorder/pause-recording.html is a flaky crash)
</span><span class="cx"> http/wpt/mediarecorder/pause-recording.html [ Pass ]
</span><span class="cx"> 
</span><del>-#rdar://80385434 ([ iOS15 ] editing/selection/ios/select-text-in-existing-selection.html [ Failure ])
-editing/selection/ios/select-text-in-existing-selection.html  [ Pass ]
-
</del><span class="cx"> # rdar://80383672 ([ iOS15 ] accessibility/misspelling-range.html is failing)
</span><span class="cx"> accessibility/misspelling-range.html  [ Pass ]
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (281467 => 281468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2021-08-23 20:38:03 UTC (rev 281467)
+++ trunk/Tools/ChangeLog       2021-08-23 20:52:43 UTC (rev 281468)
</span><span class="lines">@@ -1,3 +1,49 @@
</span><ins>+2021-08-23  Wenson Hsieh  <wenson_hsieh@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:
+
</ins><span class="cx"> 2021-08-23  Peng Liu  <peng.liu6@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Add a new option '--show-window' to run-webkit-tests
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (281467 => 281468)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1197,6 +1197,7 @@
</span><span class="cx">          F42D634422A1729F00D2FB3A /* AutocorrectionTestsIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = F42D634322A1729F00D2FB3A /* AutocorrectionTestsIOS.mm */; };
</span><span class="cx">          F42DA5161D8CEFE400336F40 /* large-input-field-focus-onload.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */; };
</span><span class="cx">          F434CA1A22E65BCA005DDB26 /* ScrollToRevealSelection.mm in Sources */ = {isa = PBXBuildFile; fileRef = F434CA1922E65BCA005DDB26 /* ScrollToRevealSelection.mm */; };
</span><ins>+               F4352F9F26D403DE00E605E4 /* editable-responsive-body.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4352F9E26D4037000E605E4 /* editable-responsive-body.html */; };
</ins><span class="cx">           F43E3BBF20DADA1E00A4E7ED /* WKScrollViewTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F43E3BBE20DADA1E00A4E7ED /* WKScrollViewTests.mm */; };
</span><span class="cx">          F43E3BC120DADBC500A4E7ED /* fixed-nav-bar.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F43E3BC020DADB8000A4E7ED /* fixed-nav-bar.html */; };
</span><span class="cx">          F442851D2140DF2900CCDA22 /* NSFontPanelTesting.mm in Sources */ = {isa = PBXBuildFile; fileRef = F442851C2140DF2900CCDA22 /* NSFontPanelTesting.mm */; };
</span><span class="lines">@@ -1480,6 +1481,7 @@
</span><span class="cx">                          9984FACE1CFFB090008D198C /* editable-body.html in Copy Resources */,
</span><span class="cx">                          F4D9818F2196B920008230FC /* editable-nested-lists.html in Copy Resources */,
</span><span class="cx">                          CEDA12412437C9FB00C28A9E /* editable-region-composited-and-non-composited-overlap.html in Copy Resources */,
</span><ins>+                               F4352F9F26D403DE00E605E4 /* editable-responsive-body.html in Copy Resources */,
</ins><span class="cx">                           F44D06451F395C26001A0E29 /* editor-state-test-harness.html in Copy Resources */,
</span><span class="cx">                          51C8E1A91F27F49600BF731B /* EmptyGrandfatheredResourceLoadStatistics.plist in Copy Resources */,
</span><span class="cx">                          A14AAB651E78DC5400C1ADC2 /* encrypted.pdf in Copy Resources */,
</span><span class="lines">@@ -3044,6 +3046,7 @@
</span><span class="cx">          F42D634322A1729F00D2FB3A /* AutocorrectionTestsIOS.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AutocorrectionTestsIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">          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; };
</span><span class="cx">          F434CA1922E65BCA005DDB26 /* ScrollToRevealSelection.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollToRevealSelection.mm; sourceTree = "<group>"; };
</span><ins>+               F4352F9E26D4037000E605E4 /* editable-responsive-body.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "editable-responsive-body.html"; sourceTree = "<group>"; };
</ins><span class="cx">           F43E3BBE20DADA1E00A4E7ED /* WKScrollViewTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKScrollViewTests.mm; sourceTree = "<group>"; };
</span><span class="cx">          F43E3BC020DADB8000A4E7ED /* fixed-nav-bar.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "fixed-nav-bar.html"; sourceTree = "<group>"; };
</span><span class="cx">          F442851B2140DF2900CCDA22 /* NSFontPanelTesting.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSFontPanelTesting.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -4032,6 +4035,7 @@
</span><span class="cx">                          A155022B1E050BC500A24C57 /* duplicate-completion-handler-calls.html */,
</span><span class="cx">                          9984FACD1CFFB038008D198C /* editable-body.html */,
</span><span class="cx">                          F4D9818E2196B911008230FC /* editable-nested-lists.html */,
</span><ins>+                               F4352F9E26D4037000E605E4 /* editable-responsive-body.html */,
</ins><span class="cx">                           F44D06441F395C0D001A0E29 /* editor-state-test-harness.html */,
</span><span class="cx">                          51C8E1A81F27F47300BF731B /* EmptyGrandfatheredResourceLoadStatistics.plist */,
</span><span class="cx">                          F4C2AB211DD6D94100E06D5B /* enormous-video-with-sound.html */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaDocumentEditingContextmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm (281467 => 281468)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -139,18 +139,6 @@
</span><span class="cx">     TestWebKitAPI::Util::run(&finished);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (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();
-}
-
</del><span class="cx"> - (UITextPlaceholder *)synchronouslyInsertTextPlaceholderWithSize:(CGSize)size
</span><span class="cx"> {
</span><span class="cx">     __block bool finished = false;
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaRequestTextInputContextmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm (281467 => 281468)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -82,18 +82,6 @@
</span><span class="cx"> 
</span><span class="cx"> @implementation TestWKWebView (SynchronousTextInputContext)
</span><span class="cx"> 
</span><del>-- (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();
-}
-
</del><span class="cx"> - (UIResponder<UITextInput> *)synchronouslyFocusTextInputContext:(_WKTextInputContext *)context placeCaretAt:(CGPoint)point
</span><span class="cx"> {
</span><span class="cx">     __block bool finished = false;
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaeditableresponsivebodyhtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/editable-responsive-body.html (0 => 281468)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+<!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>
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsiosUIWKInteractionViewProtocolmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/ios/UIWKInteractionViewProtocol.mm (281467 => 281468)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -180,6 +180,32 @@
</span><span class="cx">     EXPECT_WK_STREQ("DIV", [webView stringByEvaluatingJavaScript:@"document.querySelector('iframe').contentDocument.activeElement.tagName"]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+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);
+}
+
</ins><span class="cx"> } // namespace TestWebKitAPI
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIcocoaTestWKWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h (281467 => 281468)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS_FAMILY)
</span><span class="cx"> @class _WKActivatedElementInfo;
</span><ins>+@class _WKTextInputContext;
</ins><span class="cx"> @protocol UITextInputInternal;
</span><span class="cx"> @protocol UITextInputMultiDocument;
</span><span class="cx"> @protocol UITextInputPrivate;
</span><span class="lines">@@ -50,6 +51,7 @@
</span><span class="cx"> @interface WKWebView (TestWebKitAPI)
</span><span class="cx"> #if PLATFORM(IOS_FAMILY)
</span><span class="cx"> @property (nonatomic, readonly) UIView <UITextInputPrivate, UITextInputInternal, UITextInputMultiDocument, UIWKInteractionViewProtocol, UITextInputTokenizer> *textInputContentView;
</span><ins>+- (NSArray<_WKTextInputContext *> *)synchronouslyRequestTextInputContextsInRect:(CGRect)rect;
</ins><span class="cx"> #endif
</span><span class="cx"> @property (nonatomic, readonly) NSString *contentsAsString;
</span><span class="cx"> @property (nonatomic, readonly) NSArray<NSString *> *tagsInBody;
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIcocoaTestWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm (281467 => 281468)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #import <WebKit/WebKitPrivate.h>
</span><span class="cx"> #import <WebKit/_WKActivatedElementInfo.h>
</span><span class="cx"> #import <WebKit/_WKProcessPoolConfiguration.h>
</span><ins>+#import <WebKit/_WKTextInputContext.h>
</ins><span class="cx"> #import <objc/runtime.h>
</span><span class="cx"> #import <wtf/BlockPtr.h>
</span><span class="cx"> #import <wtf/RetainPtr.h>
</span><span class="lines">@@ -138,6 +139,18 @@
</span><span class="cx">     return (UIView <UITextInputPrivate, UITextInputMultiDocument> *)[self valueForKey:@"_currentContentView"];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (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();
+}
+
</ins><span class="cx"> #endif // PLATFORM(IOS_FAMILY)
</span><span class="cx"> 
</span><span class="cx"> - (NSString *)contentsAsString
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIiosUIKitSPIh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/ios/UIKitSPI.h (281467 => 281468)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -189,6 +189,10 @@
</span><span class="cx"> - (void)accessoryDone;
</span><span class="cx"> @end
</span><span class="cx"> 
</span><ins>+typedef NS_ENUM(NSInteger, UIWKGestureType) {
+    UIWKGestureLoupe
+};
+
</ins><span class="cx"> @protocol UIWKInteractionViewProtocol
</span><span class="cx"> - (void)pasteWithCompletionHandler:(void (^)(void))completionHandler;
</span><span class="cx"> - (void)requestAutocorrectionRectsForString:(NSString *)input withCompletionHandler:(void (^)(UIWKAutocorrectionRects *rectsForInput))completionHandler;
</span><span class="lines">@@ -199,6 +203,7 @@
</span><span class="cx"> - (void)updateSelectionWithExtentPoint:(CGPoint)point completionHandler:(void (^)(BOOL selectionEndIsMoving))completionHandler;
</span><span class="cx"> - (void)updateSelectionWithExtentPoint:(CGPoint)point withBoundary:(UITextGranularity)granularity completionHandler:(void (^)(BOOL selectionEndIsMoving))completionHandler;
</span><span class="cx"> - (void)selectWordForReplacement;
</span><ins>+- (BOOL)textInteractionGesture:(UIWKGestureType)gesture shouldBeginAtPoint:(CGPoint)point;
</ins><span class="cx"> @property (nonatomic, readonly) NSString *selectedText;
</span><span class="cx"> 
</span><span class="cx"> @optional
</span></span></pre>
</div>
</div>

</body>
</html>