<!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>[248974] 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/248974">248974</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2019-08-21 16:05:26 -0700 (Wed, 21 Aug 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Mail] Tapping top of message scrolls back to copied text instead of top of the message
https://bugs.webkit.org/show_bug.cgi?id=200999
<rdar://problem/54564878>

Reviewed by Wenson Hsieh.

Source/WebCore:

Test: editing/selection/ios/change-selection-by-tapping-with-existing-selection.html

* page/EditorClient.h:
(WebCore::EditorClient::shouldAllowSingleClickToChangeSelection const):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEventSingleClick):
Instead of encoding platform behaviors in EventHandler, defer to EditorClient.

Source/WebKit:

In the case where you have a WebCore selection but are not first responder,
when you tap the WKWebView to become first responder, EventHandler would
bail from setting the selection, assuming UIKit was going to do it. This
behavior was introduced in <a href="http://trac.webkit.org/projects/webkit/changeset/233311">r233311</a>.

However, since we are not first responder, UIKit does not change the
selection, since it considers the view to not be editable.

Fix this by letting WebCore set the selection in this case, as it used to.

* WebProcess/WebCoreSupport/WebEditorClient.h:
* WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
(WebKit::WebEditorClient::shouldAllowSingleClickToChangeSelection const):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::isShowingInputViewForFocusedElement const):
Copy the logic from EventHandler, with the added caveat (which fixes the
aforementioned behavior) that we will allow EventHandler to change the
selection if we don't have a focused node in the UIKit sense, because
we know that the platform text interaction code will *not* change the
selection if that is the case, so it's up to us.

Source/WebKitLegacy/mac:

* WebCoreSupport/WebEditorClient.h:
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::shouldAllowSingleClickToChangeSelection const):
Copy the existing behavior from EventHandler.
We do not fix the bug in WebKitLegacy for a multitude of reasons, primarily
because we do not know of any user impact.

LayoutTests:

* editing/selection/ios/change-selection-by-tapping-with-existing-selection-expected.txt: Added.
* editing/selection/ios/change-selection-by-tapping-with-existing-selection.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageEditorClienth">trunk/Source/WebCore/page/EditorClient.h</a></li>
<li><a href="#trunkSourceWebCorepageEventHandlercpp">trunk/Source/WebCore/page/EventHandler.cpp</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebCoreSupportWebEditorClienth">trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebCoreSupportiosWebEditorClientIOSmm">trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageWebPageh">trunk/Source/WebKit/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKitLegacymacChangeLog">trunk/Source/WebKitLegacy/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitLegacymacWebCoreSupportWebEditorClienth">trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h</a></li>
<li><a href="#trunkSourceWebKitLegacymacWebCoreSupportWebEditorClientmm">trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestseditingselectionioschangeselectionbytappingwithexistingselectionexpectedtxt">trunk/LayoutTests/editing/selection/ios/change-selection-by-tapping-with-existing-selection-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingselectionioschangeselectionbytappingwithexistingselectionhtml">trunk/LayoutTests/editing/selection/ios/change-selection-by-tapping-with-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 (248973 => 248974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2019-08-21 23:01:41 UTC (rev 248973)
+++ trunk/LayoutTests/ChangeLog 2019-08-21 23:05:26 UTC (rev 248974)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2019-08-21  Tim Horton  <timothy_horton@apple.com>
+
+        [Mail] Tapping top of message scrolls back to copied text instead of top of the message
+        https://bugs.webkit.org/show_bug.cgi?id=200999
+        <rdar://problem/54564878>
+
+        Reviewed by Wenson Hsieh.
+
+        * editing/selection/ios/change-selection-by-tapping-with-existing-selection-expected.txt: Added.
+        * editing/selection/ios/change-selection-by-tapping-with-existing-selection.html: Added.
+
</ins><span class="cx"> 2019-08-21  Alex Christensen  <achristensen@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         Disabling text autosizing should prevent text autosizing
</span></span></pre></div>
<a id="trunkLayoutTestseditingselectionioschangeselectionbytappingwithexistingselectionexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/selection/ios/change-selection-by-tapping-with-existing-selection-expected.txt (0 => 248974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/selection/ios/change-selection-by-tapping-with-existing-selection-expected.txt                         (rev 0)
+++ trunk/LayoutTests/editing/selection/ios/change-selection-by-tapping-with-existing-selection-expected.txt    2019-08-21 23:05:26 UTC (rev 248974)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+Here's to the crazy ones, the misfits, the rebels, the trouble makers, the round pegs in the square holes, the ones who see things differently. There not fond of rules, and they have no respect for the status quo, you can quote then, disagree with them, glorify or vilify them, about the only thing you can't do is ignore them. Because they change things. They push the human race forward. And while some may see them as the crazy ones, we see genius. Because the people who are crazy enough to think they can change the world are the ones who do.
+
+Verifies that tapping to change selection works when we already have a selection in the same editable root but do not currently have a focused node in the UIKit sense.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+Selection before tap: (target#0, target#2)
+Selection after tap: (editor#0, editor#0)
</ins></span></pre></div>
<a id="trunkLayoutTestseditingselectionioschangeselectionbytappingwithexistingselectionhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/selection/ios/change-selection-by-tapping-with-existing-selection.html (0 => 248974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/selection/ios/change-selection-by-tapping-with-existing-selection.html                         (rev 0)
+++ trunk/LayoutTests/editing/selection/ios/change-selection-by-tapping-with-existing-selection.html    2019-08-21 23:05:26 UTC (rev 248974)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<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, user-scalable=no">
+<style>
+body, html {
+    width: 100%;
+    height: 100%;
+    margin: 0;
+}
+
+#editor {
+    width: 300px;
+    height: 320px;
+    font-size: 18px;
+}
+</style>
+<script>
+jsTestIsAsync = true;
+
+function selectionToString() {
+    const selection = getSelection();
+    if (!selection.rangeCount)
+        return "(no selection)";
+
+    const range = selection.getRangeAt(0);
+    return `(${range.startContainer.parentElement.id}#${range.startOffset}, ${range.endContainer.parentElement.id}#${range.endOffset})`;
+}
+
+function tapAndWaitForSelectionChange(x, y) {
+    return new Promise(resolve => {
+        const editor = document.getElementById("editor");
+        let doneCount = 0;
+        const checkDone = () => {
+            if (++doneCount != 2)
+                return;
+
+            document.removeEventListener("selectionchange", checkDone);
+            resolve();
+        }
+        document.addEventListener("selectionchange", checkDone);
+        UIHelper.activateAt(x, y).then(checkDone);
+    });
+}
+
+addEventListener("load", async () => {
+    description("Verifies that tapping to change selection works when we already have a selection in the same editable root but do not currently have a focused node in the UIKit sense.");
+
+    var target = document.getElementById("target");
+    window.getSelection().setBaseAndExtent(target, 0, target, 2);
+
+    document.querySelector("#selection-before").textContent = selectionToString();
+    await tapAndWaitForSelectionChange(5, 5);
+    document.querySelector("#selection-after").textContent = selectionToString();
+
+    finishJSTest();
+});
+</script>
+</head>
+<body>
+<p contenteditable id="editor">Here's to the crazy ones, the misfits, the rebels, the trouble makers, the round pegs in the square holes, the ones who see things differently. There not fond of rules, and they have no respect for the status quo, you can quote then, disagree with them, glorify or vilify them, about the only thing you can't do is ignore them.  Because they change things. They push the human race forward. And while some may see them as the crazy ones, we see genius. Because the people who are crazy enough to think they can change the world are the ones who <span id='target'>do</span>.</p>
+    <p id="description"></p>
+    <p id="console"></p>
+    <div>Selection before tap: <span id="selection-before"></span></div>
+    <div>Selection after tap: <span id="selection-after"></span></div>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (248973 => 248974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2019-08-21 23:01:41 UTC (rev 248973)
+++ trunk/Source/WebCore/ChangeLog      2019-08-21 23:05:26 UTC (rev 248974)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2019-08-21  Tim Horton  <timothy_horton@apple.com>
+
+        [Mail] Tapping top of message scrolls back to copied text instead of top of the message
+        https://bugs.webkit.org/show_bug.cgi?id=200999
+        <rdar://problem/54564878>
+
+        Reviewed by Wenson Hsieh.
+
+        Test: editing/selection/ios/change-selection-by-tapping-with-existing-selection.html
+
+        * page/EditorClient.h:
+        (WebCore::EditorClient::shouldAllowSingleClickToChangeSelection const):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleMousePressEventSingleClick):
+        Instead of encoding platform behaviors in EventHandler, defer to EditorClient.
+
</ins><span class="cx"> 2019-08-21  Chris Dumez  <cdumez@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Crash under StringImpl::endsWith() in SQLiteIDBBackingStore::fullDatabaseDirectoryWithUpgrade()
</span></span></pre></div>
<a id="trunkSourceWebCorepageEditorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EditorClient.h (248973 => 248974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EditorClient.h 2019-08-21 23:01:41 UTC (rev 248973)
+++ trunk/Source/WebCore/page/EditorClient.h    2019-08-21 23:05:26 UTC (rev 248974)
</span><span class="lines">@@ -186,6 +186,8 @@
</span><span class="cx">     virtual bool performTwoStepDrop(DocumentFragment&, Range& destination, bool isMove) = 0;
</span><span class="cx"> 
</span><span class="cx">     virtual bool canShowFontPanel() const = 0;
</span><ins>+
+    virtual bool shouldAllowSingleClickToChangeSelection(Node&, const VisibleSelection&) const { return true; }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepageEventHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EventHandler.cpp (248973 => 248974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EventHandler.cpp       2019-08-21 23:01:41 UTC (rev 248973)
+++ trunk/Source/WebCore/page/EventHandler.cpp  2019-08-21 23:05:26 UTC (rev 248974)
</span><span class="lines">@@ -698,12 +698,8 @@
</span><span class="cx">     VisibleSelection newSelection = m_frame.selection().selection();
</span><span class="cx">     TextGranularity granularity = CharacterGranularity;
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS_FAMILY)
-    // The text selection assistant will handle selection in the case where we are already editing the node
-    auto* editableRoot = newSelection.rootEditableElement();
-    if (editableRoot && editableRoot == targetNode->rootEditableElement())
</del><ins>+    if (!m_frame.editor().client()->shouldAllowSingleClickToChangeSelection(*targetNode, newSelection))
</ins><span class="cx">         return true;
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx">     if (extendSelection && newSelection.isCaretOrRange()) {
</span><span class="cx">         VisibleSelection selectionInUserSelectAll = expandSelectionToRespectSelectOnMouseDown(*targetNode, VisibleSelection(pos));
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (248973 => 248974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2019-08-21 23:01:41 UTC (rev 248973)
+++ trunk/Source/WebKit/ChangeLog       2019-08-21 23:05:26 UTC (rev 248974)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2019-08-21  Tim Horton  <timothy_horton@apple.com>
+
+        [Mail] Tapping top of message scrolls back to copied text instead of top of the message
+        https://bugs.webkit.org/show_bug.cgi?id=200999
+        <rdar://problem/54564878>
+
+        Reviewed by Wenson Hsieh.
+
+        In the case where you have a WebCore selection but are not first responder,
+        when you tap the WKWebView to become first responder, EventHandler would
+        bail from setting the selection, assuming UIKit was going to do it. This
+        behavior was introduced in r233311.
+
+        However, since we are not first responder, UIKit does not change the
+        selection, since it considers the view to not be editable.
+
+        Fix this by letting WebCore set the selection in this case, as it used to.
+
+        * WebProcess/WebCoreSupport/WebEditorClient.h:
+        * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
+        (WebKit::WebEditorClient::shouldAllowSingleClickToChangeSelection const):
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::isShowingInputViewForFocusedElement const):
+        Copy the logic from EventHandler, with the added caveat (which fixes the
+        aforementioned behavior) that we will allow EventHandler to change the
+        selection if we don't have a focused node in the UIKit sense, because
+        we know that the platform text interaction code will *not* change the
+        selection if that is the case, so it's up to us.
+
</ins><span class="cx"> 2019-08-21  Chris Dumez  <cdumez@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Crash under NetworkCache::Data::mapToFile()
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebCoreSupportWebEditorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h (248973 => 248974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h  2019-08-21 23:01:41 UTC (rev 248973)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h     2019-08-21 23:05:26 UTC (rev 248974)
</span><span class="lines">@@ -181,6 +181,7 @@
</span><span class="cx">     RefPtr<WebCore::DocumentFragment> documentFragmentFromDelegate(int index) final;
</span><span class="cx">     bool performsTwoStepPaste(WebCore::DocumentFragment*) final;
</span><span class="cx">     void updateStringForFind(const String&) final;
</span><ins>+    bool shouldAllowSingleClickToChangeSelection(WebCore::Node&, const WebCore::VisibleSelection&) const final;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     bool performTwoStepDrop(WebCore::DocumentFragment&, WebCore::Range&, bool isMove) final;
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebCoreSupportiosWebEditorClientIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm (248973 => 248974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm  2019-08-21 23:01:41 UTC (rev 248973)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm     2019-08-21 23:05:26 UTC (rev 248974)
</span><span class="lines">@@ -102,6 +102,13 @@
</span><span class="cx">     m_page->didChangeOverflowScrollPosition();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool WebEditorClient::shouldAllowSingleClickToChangeSelection(WebCore::Node& targetNode, const WebCore::VisibleSelection& newSelection) const
+{
+    // The text selection assistant will handle selection in the case where we are already editing the node
+    auto* editableRoot = newSelection.rootEditableElement();
+    return !editableRoot || editableRoot != targetNode.rootEditableElement() || !m_page->isShowingInputViewForFocusedElement();
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(IOS_FAMILY)
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (248973 => 248974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-08-21 23:01:41 UTC (rev 248973)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h    2019-08-21 23:05:26 UTC (rev 248974)
</span><span class="lines">@@ -678,6 +678,7 @@
</span><span class="cx">     void setFocusedElementValueAsNumber(double);
</span><span class="cx">     void setFocusedElementSelectedIndex(uint32_t index, bool allowMultipleSelection);
</span><span class="cx">     void setIsShowingInputViewForFocusedElement(bool);
</span><ins>+    bool isShowingInputViewForFocusedElement() const { return m_isShowingInputViewForFocusedElement; }
</ins><span class="cx">     void updateSelectionAppearance();
</span><span class="cx">     void getSelectionContext(CallbackID);
</span><span class="cx">     void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, OptionSet<WebKit::WebEvent::Modifier>, uint64_t requestID);
</span></span></pre></div>
<a id="trunkSourceWebKitLegacymacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (248973 => 248974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/mac/ChangeLog  2019-08-21 23:01:41 UTC (rev 248973)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog     2019-08-21 23:05:26 UTC (rev 248974)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2019-08-21  Tim Horton  <timothy_horton@apple.com>
+
+        [Mail] Tapping top of message scrolls back to copied text instead of top of the message
+        https://bugs.webkit.org/show_bug.cgi?id=200999
+        <rdar://problem/54564878>
+
+        Reviewed by Wenson Hsieh.
+
+        * WebCoreSupport/WebEditorClient.h:
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::shouldAllowSingleClickToChangeSelection const):
+        Copy the existing behavior from EventHandler.
+        We do not fix the bug in WebKitLegacy for a multitude of reasons, primarily
+        because we do not know of any user impact.
+
</ins><span class="cx"> 2019-08-21  Ryosuke Niwa  <rniwa@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         Put keygen element behind a runtime flag and disable it by default
</span></span></pre></div>
<a id="trunkSourceWebKitLegacymacWebCoreSupportWebEditorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h (248973 => 248974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h   2019-08-21 23:01:41 UTC (rev 248973)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h      2019-08-21 23:05:26 UTC (rev 248974)
</span><span class="lines">@@ -176,6 +176,10 @@
</span><span class="cx"> 
</span><span class="cx">     void registerUndoOrRedoStep(WebCore::UndoStep&, bool isRedo);
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS_FAMILY)
+    bool shouldAllowSingleClickToChangeSelection(WebCore::Node& targetNode, const WebCore::VisibleSelection& newSelection) const;
+#endif
+
</ins><span class="cx">     bool canShowFontPanel() const final
</span><span class="cx">     {
</span><span class="cx"> #if PLATFORM(MAC)
</span></span></pre></div>
<a id="trunkSourceWebKitLegacymacWebCoreSupportWebEditorClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm (248973 => 248974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm  2019-08-21 23:01:41 UTC (rev 248973)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm     2019-08-21 23:05:26 UTC (rev 248974)
</span><span class="lines">@@ -1258,3 +1258,12 @@
</span><span class="cx">         }];
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><ins>+
+#if PLATFORM(IOS_FAMILY)
+bool WebEditorClient::shouldAllowSingleClickToChangeSelection(WebCore::Node& targetNode, const WebCore::VisibleSelection& newSelection) const
+{
+    // The text selection assistant will handle selection in the case where we are already editing the node
+    auto* editableRoot = newSelection.rootEditableElement();
+    return !editableRoot || editableRoot != targetNode.rootEditableElement();
+}
+#endif
</ins></span></pre>
</div>
</div>

</body>
</html>