<!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>[201490] 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/201490">201490</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-05-28 12:18:48 -0700 (Sat, 28 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Autocorrection makes it hard to type &quot;doesn't&quot; and to type @ in email addresses
https://bugs.webkit.org/show_bug.cgi?id=158177
.:

Reviewed by Darin Adler.

Fixed manual tests for autocorrection panels and added a manual test for . Most of changes are fixing up the path to LayoutTests/editing/editing.js.

Also wrap many steps to type in a space or delete a character inside setTimeout since autocorrection happens on a timer
and the fact WebKit2 communicates with NSSpellChecker via IPC makes the behavior even more indeterministic.

* ManualTests/autocorrection/autocorrection-at-mark.html: Added.
* ManualTests/autocorrection/autocorrection-cancelled-by-ESC.html:
* ManualTests/autocorrection/autocorrection-cancelled-by-typing-1.html:
* ManualTests/autocorrection/autocorrection-contraction-2.html: Added.
* ManualTests/autocorrection/autocorrection-contraction.html:
* ManualTests/autocorrection/autocorrection-in-iframe.html:
* ManualTests/autocorrection/close-window-when-correction-is-shown.html:
* ManualTests/autocorrection/continue-typing-to-dismiss-reversion.html:
* ManualTests/autocorrection/delete-to-dismiss-reversion.html:
* ManualTests/autocorrection/delete-to-end-of-word-to-show-reversion.html:
* ManualTests/autocorrection/dismiss-multiple-guesses.html:
* ManualTests/autocorrection/document-for-iframe-test.html: Removed.
* ManualTests/autocorrection/move-to-end-of-word-to-show-reversion.html: Type a space and move care in setTimeout as
the reversion panel wouldn't show up otherwise.
* ManualTests/autocorrection/remove-misspelling-marker-after-appending-letter.html: Delay the typing of a space as well as
deleting letters since autocorrection panel wouldn't show up in time otherwise, and deleting character immediately would
reject the autocorrection instead of accepting it. Also removed the steps to add back the spellchecking marker and extracted
it as a separate test.
* ManualTests/autocorrection/removing-misspelling-marker-after-appending-letter-2.html: Copied. This test continues the full
scenario in the previous test by typing a space and deleting the character, thereby bringing up spellchecking marker.
* ManualTests/autocorrection/resources: Added.
* ManualTests/autocorrection/resources/document-for-iframe-test.html: Moved from ManualTests/autocorrection/.
* ManualTests/autocorrection/select-from-multiple-guesses.html: Added a missing instruction.
* ManualTests/autocorrection/spell-checking-after-reversion.html:
* ManualTests/autocorrection/type-whitespace-to-dismiss-reversion.html: Delay the typing of a space and moving the selection
since the reversion panel wouldn't show up otherwise.
* ManualTests/autocorrection/undo-autocorrection-2.html: Copied. Automated most of steps in the second test case.
* ManualTests/autocorrection/undo-autocorrection.html:

Source/WebCore:

&lt;rdar://problem/20490862&gt;
&lt;rdar://problem/24707954&gt;

Reviewed by Darin Adler.

When the user had typed &quot;doesn'&quot;, some unified spellchecker may try to autocorrect it to &quot;doesn't&quot; or &quot;does&quot;
but we should ignore this for a moment until the next character is typed by the user. The code to deal with
this situation which checks the existence of an &quot;ambiguous boundary character&quot; was not robust when the
replacement text was longer than the corrected text.

Fixed this bug by fixing the logic to detect this case. Also added '@' as an ambiguous boundary character
since autocorrecting letters that appear right before '@' would not be useful in many cases.

Tests: ManualTests/autocorrection/autocorrection-at-mark.html
       ManualTests/autocorrection/autocorrection-contraction-2.html

* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::timerFired): Fixed a bug that we can show an empty reversion panel.
* editing/Editor.cpp:
(WebCore::Editor::markAndReplaceFor): When the user had typed &quot;doesn'&quot; and our autocorrection result is
&quot;doesn't&quot;, resultEndLocation (the end of &quot;doesn't&quot;) is larger than selectionOffset (the end of &quot;doesn'&quot;).
When the correction is &quot;does&quot;, resultEndLocation (the end of &quot;does&quot;) is one less than selectionOffset.
Updated the condition to deal with both of these conditions as well as cases where the correction result
contains more than one letter after '.
* editing/htmlediting.cpp:
(WebCore::isAmbiguousBoundaryCharacter): Moved from the header file since this is not a hot function and
doesn't need to be inlined everywhere. Added '@' as an ambiguous boundary character.
* editing/htmlediting.h:
(WebCore::isAmbiguousBoundaryCharacter): Moved to the cpp file.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkChangeLog">trunk/ChangeLog</a></li>
<li><a href="#trunkManualTestsautocorrectionautocorrectioncancelledbyESChtml">trunk/ManualTests/autocorrection/autocorrection-cancelled-by-ESC.html</a></li>
<li><a href="#trunkManualTestsautocorrectionautocorrectioncancelledbytyping1html">trunk/ManualTests/autocorrection/autocorrection-cancelled-by-typing-1.html</a></li>
<li><a href="#trunkManualTestsautocorrectionautocorrectioncontractionhtml">trunk/ManualTests/autocorrection/autocorrection-contraction.html</a></li>
<li><a href="#trunkManualTestsautocorrectionautocorrectioniniframehtml">trunk/ManualTests/autocorrection/autocorrection-in-iframe.html</a></li>
<li><a href="#trunkManualTestsautocorrectionclosewindowwhencorrectionisshownhtml">trunk/ManualTests/autocorrection/close-window-when-correction-is-shown.html</a></li>
<li><a href="#trunkManualTestsautocorrectioncontinuetypingtodismissreversionhtml">trunk/ManualTests/autocorrection/continue-typing-to-dismiss-reversion.html</a></li>
<li><a href="#trunkManualTestsautocorrectiondeletetodismissreversionhtml">trunk/ManualTests/autocorrection/delete-to-dismiss-reversion.html</a></li>
<li><a href="#trunkManualTestsautocorrectiondeletetoendofwordtoshowreversionhtml">trunk/ManualTests/autocorrection/delete-to-end-of-word-to-show-reversion.html</a></li>
<li><a href="#trunkManualTestsautocorrectiondismissmultipleguesseshtml">trunk/ManualTests/autocorrection/dismiss-multiple-guesses.html</a></li>
<li><a href="#trunkManualTestsautocorrectionmovetoendofwordtoshowreversionhtml">trunk/ManualTests/autocorrection/move-to-end-of-word-to-show-reversion.html</a></li>
<li><a href="#trunkManualTestsautocorrectionremovemisspellingmarkerafterappendingletterhtml">trunk/ManualTests/autocorrection/remove-misspelling-marker-after-appending-letter.html</a></li>
<li><a href="#trunkManualTestsautocorrectionselectfrommultipleguesseshtml">trunk/ManualTests/autocorrection/select-from-multiple-guesses.html</a></li>
<li><a href="#trunkManualTestsautocorrectionspellcheckingafterreversionhtml">trunk/ManualTests/autocorrection/spell-checking-after-reversion.html</a></li>
<li><a href="#trunkManualTestsautocorrectiontypewhitespacetodismissreversionhtml">trunk/ManualTests/autocorrection/type-whitespace-to-dismiss-reversion.html</a></li>
<li><a href="#trunkManualTestsautocorrectionundoautocorrectionhtml">trunk/ManualTests/autocorrection/undo-autocorrection.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreeditingAlternativeTextControllercpp">trunk/Source/WebCore/editing/AlternativeTextController.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorcpp">trunk/Source/WebCore/editing/Editor.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditinghtmleditingcpp">trunk/Source/WebCore/editing/htmlediting.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditinghtmleditingh">trunk/Source/WebCore/editing/htmlediting.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkManualTestsautocorrectionautocorrectionatmarkhtml">trunk/ManualTests/autocorrection/autocorrection-at-mark.html</a></li>
<li><a href="#trunkManualTestsautocorrectionremovingmisspellingmarkerafterappendingletter2html">trunk/ManualTests/autocorrection/removing-misspelling-marker-after-appending-letter-2.html</a></li>
<li>trunk/ManualTests/autocorrection/resources/</li>
<li><a href="#trunkManualTestsautocorrectionresourcesdocumentforiframetesthtml">trunk/ManualTests/autocorrection/resources/document-for-iframe-test.html</a></li>
<li><a href="#trunkManualTestsautocorrectionundoautocorrection2html">trunk/ManualTests/autocorrection/undo-autocorrection-2.html</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkManualTestsautocorrectiondocumentforiframetesthtml">trunk/ManualTests/autocorrection/document-for-iframe-test.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/ChangeLog (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ChangeLog        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ChangeLog        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2016-05-28  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        Autocorrection makes it hard to type &quot;doesn't&quot; and to type @ in email addresses
+        https://bugs.webkit.org/show_bug.cgi?id=158177
+
+        Reviewed by Darin Adler.
+
+        Fixed manual tests for autocorrection panels and added a manual test for . Most of changes are fixing up the path to LayoutTests/editing/editing.js.
+
+        Also wrap many steps to type in a space or delete a character inside setTimeout since autocorrection happens on a timer
+        and the fact WebKit2 communicates with NSSpellChecker via IPC makes the behavior even more indeterministic.
+
+        * ManualTests/autocorrection/autocorrection-at-mark.html: Added.
+        * ManualTests/autocorrection/autocorrection-cancelled-by-ESC.html:
+        * ManualTests/autocorrection/autocorrection-cancelled-by-typing-1.html:
+        * ManualTests/autocorrection/autocorrection-contraction-2.html: Added.
+        * ManualTests/autocorrection/autocorrection-contraction.html:
+        * ManualTests/autocorrection/autocorrection-in-iframe.html:
+        * ManualTests/autocorrection/close-window-when-correction-is-shown.html:
+        * ManualTests/autocorrection/continue-typing-to-dismiss-reversion.html:
+        * ManualTests/autocorrection/delete-to-dismiss-reversion.html:
+        * ManualTests/autocorrection/delete-to-end-of-word-to-show-reversion.html:
+        * ManualTests/autocorrection/dismiss-multiple-guesses.html:
+        * ManualTests/autocorrection/document-for-iframe-test.html: Removed.
+        * ManualTests/autocorrection/move-to-end-of-word-to-show-reversion.html: Type a space and move care in setTimeout as
+        the reversion panel wouldn't show up otherwise.
+        * ManualTests/autocorrection/remove-misspelling-marker-after-appending-letter.html: Delay the typing of a space as well as
+        deleting letters since autocorrection panel wouldn't show up in time otherwise, and deleting character immediately would
+        reject the autocorrection instead of accepting it. Also removed the steps to add back the spellchecking marker and extracted
+        it as a separate test.
+        * ManualTests/autocorrection/removing-misspelling-marker-after-appending-letter-2.html: Copied. This test continues the full
+        scenario in the previous test by typing a space and deleting the character, thereby bringing up spellchecking marker.
+        * ManualTests/autocorrection/resources: Added.
+        * ManualTests/autocorrection/resources/document-for-iframe-test.html: Moved from ManualTests/autocorrection/.
+        * ManualTests/autocorrection/select-from-multiple-guesses.html: Added a missing instruction.
+        * ManualTests/autocorrection/spell-checking-after-reversion.html:
+        * ManualTests/autocorrection/type-whitespace-to-dismiss-reversion.html: Delay the typing of a space and moving the selection
+        since the reversion panel wouldn't show up otherwise.
+        * ManualTests/autocorrection/undo-autocorrection-2.html: Copied. Automated most of steps in the second test case.
+        * ManualTests/autocorrection/undo-autocorrection.html:
+
</ins><span class="cx"> 2016-05-25  Konstantin Tokarev  &lt;annulen@yandex.ru&gt;
</span><span class="cx"> 
</span><span class="cx">         [cmake] Deduplicate make-js-file-arrays usage and make it work on Windows.
</span></span></pre></div>
<a id="trunkManualTestsautocorrectionautocorrectionatmarkhtml"></a>
<div class="addfile"><h4>Added: trunk/ManualTests/autocorrection/autocorrection-at-mark.html (0 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/autocorrection-at-mark.html                                (rev 0)
+++ trunk/ManualTests/autocorrection/autocorrection-at-mark.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;p&gt;This tests words won't be corrected immediately when &quot;@&quot; is typed.&lt;br&gt;
+To test, &quot;jcomet@&quot;. &quot;jcomet&quot; should not be autocorrected to &quot;commet@&quot;.&lt;/p&gt;
+&lt;div contenteditable&gt;&lt;br&gt;&lt;/div&gt;
+&lt;script&gt;
+document.querySelector('div').focus();
+document.execCommand('insertText', false, 'Hello, ');
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkManualTestsautocorrectionautocorrectioncancelledbyESChtml"></a>
<div class="modfile"><h4>Modified: trunk/ManualTests/autocorrection/autocorrection-cancelled-by-ESC.html (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/autocorrection-cancelled-by-ESC.html        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ManualTests/autocorrection/autocorrection-cancelled-by-ESC.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -8,7 +8,7 @@
</span><span class="cx">     font-size: 24px;
</span><span class="cx"> }
</span><span class="cx"> &lt;/style&gt;
</span><del>-&lt;script src=../../../../LayoutTests/editing/editing.js language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot; &gt;&lt;/script&gt;
</del><ins>+&lt;script src=&quot;../../LayoutTests/editing/editing.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> function editingTest() {
</span></span></pre></div>
<a id="trunkManualTestsautocorrectionautocorrectioncancelledbytyping1html"></a>
<div class="modfile"><h4>Modified: trunk/ManualTests/autocorrection/autocorrection-cancelled-by-typing-1.html (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/autocorrection-cancelled-by-typing-1.html        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ManualTests/autocorrection/autocorrection-cancelled-by-typing-1.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -8,7 +8,7 @@
</span><span class="cx">     font-size: 24px;
</span><span class="cx"> }
</span><span class="cx"> &lt;/style&gt;
</span><del>-&lt;script src=../../../../LayoutTests/editing/editing.js language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot; &gt;&lt;/script&gt;
</del><ins>+&lt;script src=&quot;../../LayoutTests/editing/editing.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> function editingTest() {
</span></span></pre></div>
<a id="trunkManualTestsautocorrectionautocorrectioncontractionhtml"></a>
<div class="modfile"><h4>Modified: trunk/ManualTests/autocorrection/autocorrection-contraction.html (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/autocorrection-contraction.html        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ManualTests/autocorrection/autocorrection-contraction.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -8,7 +8,7 @@
</span><span class="cx">     font-size: 24px;
</span><span class="cx"> }
</span><span class="cx"> &lt;/style&gt;
</span><del>-&lt;script src=../../../../LayoutTests/editing/editing.js language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot; &gt;&lt;/script&gt;
</del><ins>+&lt;script src=&quot;../../LayoutTests/editing/editing.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> function editingTest() {
</span></span></pre></div>
<a id="trunkManualTestsautocorrectionautocorrectioniniframehtml"></a>
<div class="modfile"><h4>Modified: trunk/ManualTests/autocorrection/autocorrection-in-iframe.html (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/autocorrection-in-iframe.html        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ManualTests/autocorrection/autocorrection-in-iframe.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -10,7 +10,7 @@
</span><span class="cx"> &lt;br&gt;
</span><span class="cx"> &lt;br&gt;
</span><span class="cx"> &lt;div style=&quot;-webkit-transform: translate(100px, 100px) rotate(20deg)&quot;&gt;
</span><del>-  &lt;iframe src=&quot;document-for-iframe-test.html&quot;&gt;&lt;/iframe&gt;
</del><ins>+  &lt;iframe src=&quot;resources/document-for-iframe-test.html&quot;&gt;&lt;/iframe&gt;
</ins><span class="cx"> &lt;/div&gt;
</span><span class="cx"> &lt;/body&gt;
</span><span class="cx"> &lt;/html&gt;
</span></span></pre></div>
<a id="trunkManualTestsautocorrectionclosewindowwhencorrectionisshownhtml"></a>
<div class="modfile"><h4>Modified: trunk/ManualTests/autocorrection/close-window-when-correction-is-shown.html (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/close-window-when-correction-is-shown.html        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ManualTests/autocorrection/close-window-when-correction-is-shown.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -8,7 +8,7 @@
</span><span class="cx">     font-size: 24px;
</span><span class="cx"> }
</span><span class="cx"> &lt;/style&gt;
</span><del>-&lt;script src=../../../../LayoutTests/editing/editing.js language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot; &gt;&lt;/script&gt;
</del><ins>+&lt;script src=&quot;../../LayoutTests/editing/editing.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> function editingTest() {
</span></span></pre></div>
<a id="trunkManualTestsautocorrectioncontinuetypingtodismissreversionhtml"></a>
<div class="modfile"><h4>Modified: trunk/ManualTests/autocorrection/continue-typing-to-dismiss-reversion.html (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/continue-typing-to-dismiss-reversion.html        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ManualTests/autocorrection/continue-typing-to-dismiss-reversion.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -8,7 +8,7 @@
</span><span class="cx">     font-size: 24px;
</span><span class="cx"> }
</span><span class="cx"> &lt;/style&gt;
</span><del>-&lt;script src=../../../../LayoutTests/editing/editing.js language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot; &gt;&lt;/script&gt;
</del><ins>+&lt;script src=&quot;../../LayoutTests/editing/editing.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> function editingTest() {
</span></span></pre></div>
<a id="trunkManualTestsautocorrectiondeletetodismissreversionhtml"></a>
<div class="modfile"><h4>Modified: trunk/ManualTests/autocorrection/delete-to-dismiss-reversion.html (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/delete-to-dismiss-reversion.html        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ManualTests/autocorrection/delete-to-dismiss-reversion.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -8,7 +8,7 @@
</span><span class="cx">     font-size: 24px;
</span><span class="cx"> }
</span><span class="cx"> &lt;/style&gt;
</span><del>-&lt;script src=../../../../LayoutTests/editing/editing.js language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot; &gt;&lt;/script&gt;
</del><ins>+&lt;script src=&quot;../../LayoutTests/editing/editing.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> function editingTest() {
</span></span></pre></div>
<a id="trunkManualTestsautocorrectiondeletetoendofwordtoshowreversionhtml"></a>
<div class="modfile"><h4>Modified: trunk/ManualTests/autocorrection/delete-to-end-of-word-to-show-reversion.html (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/delete-to-end-of-word-to-show-reversion.html        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ManualTests/autocorrection/delete-to-end-of-word-to-show-reversion.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -8,7 +8,7 @@
</span><span class="cx">     font-size: 24px;
</span><span class="cx"> }
</span><span class="cx"> &lt;/style&gt;
</span><del>-&lt;script src=../../../../LayoutTests/editing/editing.js language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot; &gt;&lt;/script&gt;
</del><ins>+&lt;script src=&quot;../../LayoutTests/editing/editing.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> function editingTest() {
</span><span class="lines">@@ -22,8 +22,12 @@
</span><span class="cx">     typeCharacterCommand('a');
</span><span class="cx">     typeCharacterCommand('g');
</span><span class="cx">     typeCharacterCommand('e');
</span><del>-    typeCharacterCommand(' ');
-    execDeleteCommand();
</del><ins>+    setTimeout(function () {
+        typeCharacterCommand(' ');
+        setTimeout(function () {
+            execDeleteCommand();
+        }, 100);
+    }, 100);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> &lt;/script&gt;
</span></span></pre></div>
<a id="trunkManualTestsautocorrectiondismissmultipleguesseshtml"></a>
<div class="modfile"><h4>Modified: trunk/ManualTests/autocorrection/dismiss-multiple-guesses.html (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/dismiss-multiple-guesses.html        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ManualTests/autocorrection/dismiss-multiple-guesses.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -8,7 +8,7 @@
</span><span class="cx">     font-size: 24px;
</span><span class="cx"> }
</span><span class="cx"> &lt;/style&gt;
</span><del>-&lt;script src=../../../../LayoutTests/editing/editing.js language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot; &gt;&lt;/script&gt;
</del><ins>+&lt;script src=&quot;../../LayoutTests/editing/editing.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> function editingTest() {
</span></span></pre></div>
<a id="trunkManualTestsautocorrectiondocumentforiframetesthtml"></a>
<div class="delfile"><h4>Deleted: trunk/ManualTests/autocorrection/document-for-iframe-test.html (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/document-for-iframe-test.html        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ManualTests/autocorrection/document-for-iframe-test.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -1,36 +0,0 @@
</span><del>-&lt;html&gt;
-&lt;head&gt;
-&lt;style&gt;
-.editing {
-    border: 2px solid red;
-    padding: 12px;
-    font-size: 24px;
-}
-&lt;/style&gt;
-
-&lt;script src=../../../../LayoutTests/editing/editing.js language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot; &gt;&lt;/script&gt;
-
-&lt;script&gt;
-function editingTest() {
-    typeCharacterCommand('t');
-    typeCharacterCommand('h');
-    typeCharacterCommand('e');
-    typeCharacterCommand(' ');
-    typeCharacterCommand('m');
-    typeCharacterCommand('a');
-    typeCharacterCommand('n');
-    typeCharacterCommand('a');
-    typeCharacterCommand('g');
-}
-&lt;/script&gt;
-
-&lt;div contenteditable id=&quot;root&quot; class=&quot;editing&quot;&gt;
-&lt;span id=&quot;test&quot;&gt;&lt;/span&gt;
-&lt;/div&gt;
-
-&lt;script&gt;
-runEditingTest();
-&lt;/script&gt;
-
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkManualTestsautocorrectionmovetoendofwordtoshowreversionhtml"></a>
<div class="modfile"><h4>Modified: trunk/ManualTests/autocorrection/move-to-end-of-word-to-show-reversion.html (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/move-to-end-of-word-to-show-reversion.html        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ManualTests/autocorrection/move-to-end-of-word-to-show-reversion.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -8,7 +8,7 @@
</span><span class="cx">     font-size: 24px;
</span><span class="cx"> }
</span><span class="cx"> &lt;/style&gt;
</span><del>-&lt;script src=../../../../LayoutTests/editing/editing.js language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot; &gt;&lt;/script&gt;
</del><ins>+&lt;script src=&quot;../../LayoutTests/editing/editing.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> function editingTest() {
</span><span class="lines">@@ -22,8 +22,12 @@
</span><span class="cx">     typeCharacterCommand('a');
</span><span class="cx">     typeCharacterCommand('g');
</span><span class="cx">     typeCharacterCommand('e');
</span><del>-    typeCharacterCommand(' ');
-    execMoveSelectionBackwardByCharacterCommand();
</del><ins>+    setTimeout(function () {
+        typeCharacterCommand(' ');
+            setTimeout(function () {
+                execMoveSelectionBackwardByCharacterCommand();
+            }, 100);
+    }, 100);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> &lt;/script&gt;
</span></span></pre></div>
<a id="trunkManualTestsautocorrectionremovemisspellingmarkerafterappendingletterhtml"></a>
<div class="modfile"><h4>Modified: trunk/ManualTests/autocorrection/remove-misspelling-marker-after-appending-letter.html (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/remove-misspelling-marker-after-appending-letter.html        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ManualTests/autocorrection/remove-misspelling-marker-after-appending-letter.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -8,7 +8,7 @@
</span><span class="cx">     font-size: 24px; 
</span><span class="cx"> }
</span><span class="cx"> &lt;/style&gt;
</span><del>-&lt;script src=../../../../LayoutTests/editing/editing.js language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot; &gt;&lt;/script&gt;
</del><ins>+&lt;script src=&quot;../../LayoutTests/editing/editing.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -16,14 +16,13 @@
</span><span class="cx">     textarea = document.getElementById('test');
</span><span class="cx">     textarea.focus();
</span><span class="cx">     document.execCommand(&quot;InsertText&quot;, false, &quot;this brougt&quot;);
</span><del>-    typeCharacterCommand(' ');
-    document.execCommand(&quot;Delete&quot;);
-    document.execCommand(&quot;Delete&quot;);
-    typeCharacterCommand(' ');
-    
-    // Now the word &quot;brough&quot; should carry misspelling marker.
-    
-    document.execCommand(&quot;Delete&quot;);
</del><ins>+    setTimeout(function () {
+        typeCharacterCommand(' ');
+        setTimeout(function () {
+            document.execCommand(&quot;Delete&quot;);
+            document.execCommand(&quot;Delete&quot;);
+        }, 100);
+    }, 100);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> &lt;/script&gt;
</span><span class="lines">@@ -31,8 +30,8 @@
</span><span class="cx"> &lt;title&gt;Removing misspelling marker after appending letter test.&lt;/title&gt; 
</span><span class="cx"> &lt;/head&gt; 
</span><span class="cx"> &lt;body&gt;
</span><del>-&lt;div&gt;The test verified that misspelling marker is removed after appending new letter to misspelled word. You should see the phrase &quot;this brought&quot; without red underline.&lt;/div&gt;
-&lt;p  style=&quot;color:green&quot;&gt;Note, this test can fail due to user specific spell checking data. If the user has previously dismissed 'brought' as the correct spelling of 'brougth' several times, the spell checker will not provide 'notational' as a suggestion anymore. To fix this, remove all files in ~/Library/Spelling.&lt;/p&gt;
</del><ins>+&lt;div&gt;The test verified that misspelling marker is removed after accepting a correction. You should see the phrase &quot;this brough&quot; without red underline.&lt;/div&gt;
+&lt;p  style=&quot;color:green&quot;&gt;Note, this test can fail due to user specific spell checking data. If the user has previously dismissed 'brought' as the correct spelling of 'brougt' several times, the spell checker will not provide 'notational' as a suggestion anymore. To fix this, remove all files in ~/Library/Spelling.&lt;/p&gt;
</ins><span class="cx"> &lt;textarea id=&quot;test&quot; cols=&quot;80&quot; rows=&quot;10&quot;&gt;&lt;/textarea&gt;
</span><span class="cx"> &lt;/div&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkManualTestsautocorrectionremovingmisspellingmarkerafterappendingletter2htmlfromrev201489trunkManualTestsautocorrectionremovemisspellingmarkerafterappendingletterhtml"></a>
<div class="copfile"><h4>Copied: trunk/ManualTests/autocorrection/removing-misspelling-marker-after-appending-letter-2.html (from rev 201489, trunk/ManualTests/autocorrection/remove-misspelling-marker-after-appending-letter.html) (0 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/removing-misspelling-marker-after-appending-letter-2.html                                (rev 0)
+++ trunk/ManualTests/autocorrection/removing-misspelling-marker-after-appending-letter-2.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+&lt;html&gt; 
+&lt;head&gt;
+
+&lt;style&gt;
+.editing { 
+    border: 2px solid red; 
+    padding: 12px; 
+    font-size: 24px; 
+}
+&lt;/style&gt;
+&lt;script src=&quot;../../LayoutTests/editing/editing.js&quot;&gt;&lt;/script&gt;
+
+&lt;script&gt;
+
+function editingTest() {
+    textarea = document.getElementById('test');
+    textarea.focus();
+
+    document.execCommand(&quot;InsertText&quot;, false, &quot;this brougt&quot;);
+    setTimeout(function () {
+        typeCharacterCommand(' ');
+        setTimeout(function () {
+            document.execCommand(&quot;Delete&quot;);
+            document.execCommand(&quot;Delete&quot;);
+            setTimeout(function () {
+                typeCharacterCommand(&quot; &quot;);
+                document.execCommand(&quot;Delete&quot;);
+            }, 100);
+        }, 100);
+    }, 100);
+}
+
+&lt;/script&gt;
+
+&lt;title&gt;Removing misspelling marker after appending letter test.&lt;/title&gt; 
+&lt;/head&gt; 
+&lt;body&gt;
+&lt;div&gt;The test verified that misspelling marker is removed after appending new letter to misspelled word. You should see the phrase &quot;this brought&quot; without red underline.&lt;/div&gt;
+&lt;p  style=&quot;color:green&quot;&gt;Note, this test can fail due to user specific spell checking data. If the user has previously dismissed 'brought' as the correct spelling of 'brougth' several times, the spell checker will not provide 'notational' as a suggestion anymore. To fix this, remove all files in ~/Library/Spelling.&lt;/p&gt;
+&lt;textarea id=&quot;test&quot; cols=&quot;80&quot; rows=&quot;10&quot;&gt;&lt;/textarea&gt;
+&lt;/div&gt;
+
+
+&lt;script&gt;
+runEditingTest();
+&lt;/script&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkManualTestsautocorrectionresourcesdocumentforiframetesthtmlfromrev201489trunkManualTestsautocorrectiondocumentforiframetesthtml"></a>
<div class="copfile"><h4>Copied: trunk/ManualTests/autocorrection/resources/document-for-iframe-test.html (from rev 201489, trunk/ManualTests/autocorrection/document-for-iframe-test.html) (0 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/resources/document-for-iframe-test.html                                (rev 0)
+++ trunk/ManualTests/autocorrection/resources/document-for-iframe-test.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.editing {
+    border: 2px solid red;
+    padding: 12px;
+    font-size: 24px;
+}
+&lt;/style&gt;
+
+&lt;script src=&quot;../../../LayoutTests/editing/editing.js&quot;&gt;&lt;/script&gt;
+
+&lt;script&gt;
+function editingTest() {
+    typeCharacterCommand('t');
+    typeCharacterCommand('h');
+    typeCharacterCommand('e');
+    typeCharacterCommand(' ');
+    typeCharacterCommand('m');
+    typeCharacterCommand('a');
+    typeCharacterCommand('n');
+    typeCharacterCommand('a');
+    typeCharacterCommand('g');
+}
+&lt;/script&gt;
+
+&lt;div contenteditable id=&quot;root&quot; class=&quot;editing&quot;&gt;
+&lt;span id=&quot;test&quot;&gt;&lt;/span&gt;
+&lt;/div&gt;
+
+&lt;script&gt;
+runEditingTest();
+&lt;/script&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkManualTestsautocorrectionselectfrommultipleguesseshtml"></a>
<div class="modfile"><h4>Modified: trunk/ManualTests/autocorrection/select-from-multiple-guesses.html (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/select-from-multiple-guesses.html        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ManualTests/autocorrection/select-from-multiple-guesses.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -8,7 +8,7 @@
</span><span class="cx">     font-size: 24px;
</span><span class="cx"> }
</span><span class="cx"> &lt;/style&gt;
</span><del>-&lt;script src=../../../../LayoutTests/editing/editing.js language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot; &gt;&lt;/script&gt;
</del><ins>+&lt;script src=&quot;../../LayoutTests/editing/editing.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> function editingTest() {
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> &lt;/head&gt;
</span><span class="cx"> &lt;body&gt;
</span><span class="cx"> &lt;div&gt;&lt;p&gt;This test verifies that multiple guesses on mispelled word is working correctly&lt;/p&gt;
</span><del>-&lt;p&gt;After seeing the panel with multiple candidates, use left and/or right arrow key to select the desired candidate, and then use return key to confirm. You can also use this test to test that pressing ESC key will dismiss the panel.&lt;/p&gt;
</del><ins>+&lt;p&gt;After seeing the panel with multiple candidates, use down arrow key to select the first candidate, and then use left and/or right arrow key to select the desired candidate, and then use return key to confirm. You can also use this test to test that pressing ESC key will dismiss the panel.&lt;/p&gt;
</ins><span class="cx"> &lt;p  style=&quot;color:green&quot;&gt;Note, this test can fail due to user specific spell checking data. To fix this, remove all files in ~/Library/Spelling, then kill AppleSpell.service process.&lt;/p&gt;
</span><span class="cx"> &lt;div contenteditable id=&quot;root&quot; class=&quot;editing&quot;&gt;
</span><span class="cx"> &lt;span id=&quot;test&quot;&gt;&lt;/span&gt;
</span></span></pre></div>
<a id="trunkManualTestsautocorrectionspellcheckingafterreversionhtml"></a>
<div class="modfile"><h4>Modified: trunk/ManualTests/autocorrection/spell-checking-after-reversion.html (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/spell-checking-after-reversion.html        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ManualTests/autocorrection/spell-checking-after-reversion.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -8,7 +8,7 @@
</span><span class="cx">     font-size: 24px;
</span><span class="cx"> }
</span><span class="cx"> &lt;/style&gt;
</span><del>-&lt;script src=../../../../LayoutTests/editing/editing.js language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot; &gt;&lt;/script&gt;
</del><ins>+&lt;script src=&quot;../../LayoutTests/editing/editing.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> function editingTest() {
</span></span></pre></div>
<a id="trunkManualTestsautocorrectiontypewhitespacetodismissreversionhtml"></a>
<div class="modfile"><h4>Modified: trunk/ManualTests/autocorrection/type-whitespace-to-dismiss-reversion.html (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/type-whitespace-to-dismiss-reversion.html        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ManualTests/autocorrection/type-whitespace-to-dismiss-reversion.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -8,7 +8,7 @@
</span><span class="cx">     font-size: 24px;
</span><span class="cx"> }
</span><span class="cx"> &lt;/style&gt;
</span><del>-&lt;script src=../../../../LayoutTests/editing/editing.js language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot; &gt;&lt;/script&gt;
</del><ins>+&lt;script src=&quot;../../LayoutTests/editing/editing.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> function editingTest() {
</span><span class="lines">@@ -22,8 +22,12 @@
</span><span class="cx">     typeCharacterCommand('a');
</span><span class="cx">     typeCharacterCommand('g');
</span><span class="cx">     typeCharacterCommand('e');
</span><del>-    typeCharacterCommand(' ');
-    execMoveSelectionBackwardByCharacterCommand();
</del><ins>+    setTimeout(function () {
+        typeCharacterCommand(' ');
+        setTimeout(function () {
+            execMoveSelectionBackwardByCharacterCommand();
+        }, 100);
+    }, 100);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> &lt;/script&gt;
</span></span></pre></div>
<a id="trunkManualTestsautocorrectionundoautocorrection2html"></a>
<div class="addfile"><h4>Added: trunk/ManualTests/autocorrection/undo-autocorrection-2.html (0 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/undo-autocorrection-2.html                                (rev 0)
+++ trunk/ManualTests/autocorrection/undo-autocorrection-2.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+
+&lt;style&gt;
+.editing {
+    border: 2px solid red;
+    padding: 12px;
+    font-size: 24px;
+}
+&lt;/style&gt;
+
+&lt;title&gt;Undo Autocorrection Test&lt;/title&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div&gt;&lt;p&gt;This test verifies the behavior of undoing autocorrection.&lt;/p&gt;
+
+&lt;p&gt;Type &quot;the &quot;. Set font to bold, then type &quot;me&quot;. Set font to regular, then type &quot;sage&quot;. After seeing the correction panel, type whitespace to accept the correction (automated). Undo the autocorrection. You should see the second word being reverted to &quot;message&quot; with &quot;me&quot; in bold font.&lt;/p&gt;
+&lt;p  style=&quot;color:green&quot;&gt;Note, this test can fail due to user specific spell checking data. If the user has previously frequently revert 'message' to 'mesage'. To fix this, remove all files in ~/Library/Spelling, then kill AppleSpell.service process.&lt;/p&gt;
+&lt;div contenteditable id=&quot;root2&quot; class=&quot;editing&quot;&gt;
+&lt;span id=&quot;test&quot;&gt;&lt;/span&gt;
+&lt;/div&gt;
+&lt;script&gt;
+
+document.getElementById('root2').focus();
+document.execCommand('insertText', false, 'the ');
+document.execCommand('bold', false, null);
+document.execCommand('insertText', false, 'me');
+document.execCommand('bold', false, null);
+document.execCommand('insertText', false, 'sage');
+setTimeout(function () {
+    document.execCommand('insertText', false, ' ');
+}, 500);
+
+&lt;/script&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkManualTestsautocorrectionundoautocorrectionhtml"></a>
<div class="modfile"><h4>Modified: trunk/ManualTests/autocorrection/undo-autocorrection.html (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/autocorrection/undo-autocorrection.html        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ManualTests/autocorrection/undo-autocorrection.html        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -13,12 +13,9 @@
</span><span class="cx"> &lt;/head&gt;
</span><span class="cx"> &lt;body&gt;
</span><span class="cx"> &lt;div&gt;&lt;p&gt;This test verifies the behavior of undoing autocorrection.&lt;/p&gt;
</span><del>-&lt;p&gt;&lt;b&gt;Test 1:&lt;/b&gt; Type &quot;the mesage&quot;. After seeing the correction panel, type whitespace to accept the correction, then select undo. You should see the second word being reverted to &quot;message&quot;.&lt;/p&gt;
-&lt;p&gt;&lt;b&gt;Test 2:&lt;/b&gt; Type &quot;the &quot;. Set font to bold, then type &quot;me&quot;. Set font to regular, then type &quot;sage&quot;. After seeing the correction panel, type whitespace to accept the correction, then select undo. You should see the second word being reverted to &quot;message&quot; with &quot;me&quot; in bold font.&lt;/p&gt;
-&lt;p  style=&quot;color:green&quot;&gt;Note, this test can fail due to user specific spell checking data. If the user has previously frequently revert 'message' to 'mesage'. To fix this, remove all files in ~/Library/Spelling, then kill AppleSpell.service process.&lt;/p&gt;
-&lt;div contenteditable id=&quot;root&quot; class=&quot;editing&quot;&gt;
</del><ins>+&lt;p&gt;Type &quot;the mesage&quot;. After seeing the correction panel, type whitespace to accept the correction, then select undo. You should see the second word being reverted to &quot;message&quot;.&lt;/p&gt;
+&lt;div contenteditable id=&quot;root1&quot; class=&quot;editing&quot;&gt;
</ins><span class="cx"> &lt;span id=&quot;test&quot;&gt;&lt;/span&gt;
</span><span class="cx"> &lt;/div&gt;
</span><del>-
</del><span class="cx"> &lt;/body&gt;
</span><span class="cx"> &lt;/html&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/Source/WebCore/ChangeLog        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2016-05-28  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        Autocorrection makes it hard to type &quot;doesn't&quot; and to type @ in email addresses
+        https://bugs.webkit.org/show_bug.cgi?id=158177
+        &lt;rdar://problem/20490862&gt;
+        &lt;rdar://problem/24707954&gt;
+
+        Reviewed by Darin Adler.
+
+        When the user had typed &quot;doesn'&quot;, some unified spellchecker may try to autocorrect it to &quot;doesn't&quot; or &quot;does&quot;
+        but we should ignore this for a moment until the next character is typed by the user. The code to deal with
+        this situation which checks the existence of an &quot;ambiguous boundary character&quot; was not robust when the
+        replacement text was longer than the corrected text.
+
+        Fixed this bug by fixing the logic to detect this case. Also added '@' as an ambiguous boundary character
+        since autocorrecting letters that appear right before '@' would not be useful in many cases.
+
+        Tests: ManualTests/autocorrection/autocorrection-at-mark.html
+               ManualTests/autocorrection/autocorrection-contraction-2.html
+
+        * editing/AlternativeTextController.cpp:
+        (WebCore::AlternativeTextController::timerFired): Fixed a bug that we can show an empty reversion panel.
+        * editing/Editor.cpp:
+        (WebCore::Editor::markAndReplaceFor): When the user had typed &quot;doesn'&quot; and our autocorrection result is
+        &quot;doesn't&quot;, resultEndLocation (the end of &quot;doesn't&quot;) is larger than selectionOffset (the end of &quot;doesn'&quot;).
+        When the correction is &quot;does&quot;, resultEndLocation (the end of &quot;does&quot;) is one less than selectionOffset.
+        Updated the condition to deal with both of these conditions as well as cases where the correction result
+        contains more than one letter after '.
+        * editing/htmlediting.cpp:
+        (WebCore::isAmbiguousBoundaryCharacter): Moved from the header file since this is not a hot function and
+        doesn't need to be inlined everywhere. Added '@' as an ambiguous boundary character.
+        * editing/htmlediting.h:
+        (WebCore::isAmbiguousBoundaryCharacter): Moved to the cpp file.
+
</ins><span class="cx"> 2016-05-28  Konstantin Tokarev  &lt;annulen@yandex.ru&gt;
</span><span class="cx"> 
</span><span class="cx">         FileSystem: use OS(WINDOWS) instead of PLATFORM(WIN).
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingAlternativeTextControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/AlternativeTextController.cpp (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/AlternativeTextController.cpp        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/Source/WebCore/editing/AlternativeTextController.cpp        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -340,13 +340,13 @@
</span><span class="cx">     }
</span><span class="cx">         break;
</span><span class="cx">     case AlternativeTextTypeReversion: {
</span><del>-        if (!m_alternativeTextInfo.rangeWithAlternative)
</del><ins>+        auto* details = static_cast&lt;const AutocorrectionAlternativeDetails*&gt;(m_alternativeTextInfo.details.get());
+        if (!m_alternativeTextInfo.rangeWithAlternative || !details || details-&gt;replacementString().isEmpty())
</ins><span class="cx">             break;
</span><span class="cx">         m_alternativeTextInfo.isActive = true;
</span><span class="cx">         m_alternativeTextInfo.originalText = plainText(m_alternativeTextInfo.rangeWithAlternative.get());
</span><span class="cx">         FloatRect boundingBox = rootViewRectForRange(m_alternativeTextInfo.rangeWithAlternative.get());
</span><span class="cx">         if (!boundingBox.isEmpty()) {
</span><del>-            const AutocorrectionAlternativeDetails* details = static_cast&lt;const AutocorrectionAlternativeDetails*&gt;(m_alternativeTextInfo.details.get());
</del><span class="cx">             if (AlternativeTextClient* client = alternativeTextClient())
</span><span class="cx">                 client-&gt;showCorrectionAlternative(m_alternativeTextInfo.type, boundingBox, m_alternativeTextInfo.originalText, details-&gt;replacementString(), Vector&lt;String&gt;());
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.cpp (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.cpp        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/Source/WebCore/editing/Editor.cpp        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -2524,7 +2524,7 @@
</span><span class="cx">         const int resultLength = results[i].length;
</span><span class="cx">         const int resultEndLocation = resultLocation + resultLength;
</span><span class="cx">         const String&amp; replacement = results[i].replacement;
</span><del>-        const bool resultEndsAtAmbiguousBoundary = useAmbiguousBoundaryOffset &amp;&amp; resultEndLocation == selectionOffset - 1;
</del><ins>+        const bool resultEndsAtAmbiguousBoundary = useAmbiguousBoundaryOffset &amp;&amp; selectionOffset - 1 &lt;= resultEndLocation;
</ins><span class="cx"> 
</span><span class="cx">         // Only mark misspelling if:
</span><span class="cx">         // 1. Current text checking isn't done for autocorrection, in which case shouldMarkSpelling is false.
</span></span></pre></div>
<a id="trunkSourceWebCoreeditinghtmleditingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/htmlediting.cpp (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/htmlediting.cpp        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/Source/WebCore/editing/htmlediting.cpp        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -389,6 +389,14 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool isAmbiguousBoundaryCharacter(UChar character)
+{
+    // These are characters that can behave as word boundaries, but can appear within words.
+    // If they are just typed, i.e. if they are immediately followed by a caret, we want to delay text checking until the next character has been typed.
+    // FIXME: this is required until &lt;rdar://problem/6853027&gt; is fixed and text checking can do this for us.
+    return character == '\'' || character == '@' || character == rightSingleQuotationMark || character == hebrewPunctuationGershayim;
+}
+
</ins><span class="cx"> String stringWithRebalancedWhitespace(const String&amp; string, bool startIsStartOfParagraph, bool endIsEndOfParagraph)
</span><span class="cx"> {
</span><span class="cx">     StringBuilder rebalancedString;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditinghtmleditingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/htmlediting.h (201489 => 201490)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/htmlediting.h        2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/Source/WebCore/editing/htmlediting.h        2016-05-28 19:18:48 UTC (rev 201490)
</span><span class="lines">@@ -215,13 +215,7 @@
</span><span class="cx">     return c == ' ' || c == '\n';
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool isAmbiguousBoundaryCharacter(UChar character)
-{
-    // These are characters that can behave as word boundaries, but can appear within words.
-    // If they are just typed, i.e. if they are immediately followed by a caret, we want to delay text checking until the next character has been typed.
-    // FIXME: this is required until 6853027 is fixed and text checking can do this for us.
-    return character == '\'' || character == rightSingleQuotationMark || character == hebrewPunctuationGershayim;
-}
</del><ins>+bool isAmbiguousBoundaryCharacter(UChar);
</ins><span class="cx"> 
</span><span class="cx"> inline bool editingIgnoresContent(const Node&amp; node)
</span><span class="cx"> {
</span></span></pre>
</div>
</div>

</body>
</html>