Diff
Modified: trunk/ChangeLog (201489 => 201490)
--- trunk/ChangeLog 2016-05-28 18:27:53 UTC (rev 201489)
+++ trunk/ChangeLog 2016-05-28 19:18:48 UTC (rev 201490)
@@ -1,3 +1,44 @@
+2016-05-28 Ryosuke Niwa <[email protected]>
+
+ Autocorrection makes it hard to type "doesn't" 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:
+
2016-05-25 Konstantin Tokarev <[email protected]>
[cmake] Deduplicate make-js-file-arrays usage and make it work on Windows.
Added: trunk/ManualTests/autocorrection/autocorrection-at-mark.html (0 => 201490)
--- 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)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This tests words won't be corrected immediately when "@" is typed.<br>
+To test, "jcomet@". "jcomet" should not be autocorrected to "commet@".</p>
+<div contenteditable><br></div>
+<script>
+document.querySelector('div').focus();
+document.execCommand('insertText', false, 'Hello, ');
+</script>
+</body>
+</html>
Modified: trunk/ManualTests/autocorrection/autocorrection-cancelled-by-ESC.html (201489 => 201490)
--- 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)
@@ -8,7 +8,7 @@
font-size: 24px;
}
</style>
-<script src="" language="_javascript_" type="text/_javascript_" ></script>
+<script src=""
<script>
function editingTest() {
Modified: trunk/ManualTests/autocorrection/autocorrection-cancelled-by-typing-1.html (201489 => 201490)
--- 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)
@@ -8,7 +8,7 @@
font-size: 24px;
}
</style>
-<script src="" language="_javascript_" type="text/_javascript_" ></script>
+<script src=""
<script>
function editingTest() {
Modified: trunk/ManualTests/autocorrection/autocorrection-contraction.html (201489 => 201490)
--- 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)
@@ -8,7 +8,7 @@
font-size: 24px;
}
</style>
-<script src="" language="_javascript_" type="text/_javascript_" ></script>
+<script src=""
<script>
function editingTest() {
Modified: trunk/ManualTests/autocorrection/autocorrection-in-iframe.html (201489 => 201490)
--- 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)
@@ -10,7 +10,7 @@
<br>
<br>
<div style="-webkit-transform: translate(100px, 100px) rotate(20deg)">
- <iframe src=""
+ <iframe src=""
</div>
</body>
</html>
Modified: trunk/ManualTests/autocorrection/close-window-when-correction-is-shown.html (201489 => 201490)
--- 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)
@@ -8,7 +8,7 @@
font-size: 24px;
}
</style>
-<script src="" language="_javascript_" type="text/_javascript_" ></script>
+<script src=""
<script>
function editingTest() {
Modified: trunk/ManualTests/autocorrection/continue-typing-to-dismiss-reversion.html (201489 => 201490)
--- 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)
@@ -8,7 +8,7 @@
font-size: 24px;
}
</style>
-<script src="" language="_javascript_" type="text/_javascript_" ></script>
+<script src=""
<script>
function editingTest() {
Modified: trunk/ManualTests/autocorrection/delete-to-dismiss-reversion.html (201489 => 201490)
--- 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)
@@ -8,7 +8,7 @@
font-size: 24px;
}
</style>
-<script src="" language="_javascript_" type="text/_javascript_" ></script>
+<script src=""
<script>
function editingTest() {
Modified: trunk/ManualTests/autocorrection/delete-to-end-of-word-to-show-reversion.html (201489 => 201490)
--- 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)
@@ -8,7 +8,7 @@
font-size: 24px;
}
</style>
-<script src="" language="_javascript_" type="text/_javascript_" ></script>
+<script src=""
<script>
function editingTest() {
@@ -22,8 +22,12 @@
typeCharacterCommand('a');
typeCharacterCommand('g');
typeCharacterCommand('e');
- typeCharacterCommand(' ');
- execDeleteCommand();
+ setTimeout(function () {
+ typeCharacterCommand(' ');
+ setTimeout(function () {
+ execDeleteCommand();
+ }, 100);
+ }, 100);
}
</script>
Modified: trunk/ManualTests/autocorrection/dismiss-multiple-guesses.html (201489 => 201490)
--- 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)
@@ -8,7 +8,7 @@
font-size: 24px;
}
</style>
-<script src="" language="_javascript_" type="text/_javascript_" ></script>
+<script src=""
<script>
function editingTest() {
Deleted: trunk/ManualTests/autocorrection/document-for-iframe-test.html (201489 => 201490)
--- 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)
@@ -1,36 +0,0 @@
-<html>
-<head>
-<style>
-.editing {
- border: 2px solid red;
- padding: 12px;
- font-size: 24px;
-}
-</style>
-
-<script src="" language="_javascript_" type="text/_javascript_" ></script>
-
-<script>
-function editingTest() {
- typeCharacterCommand('t');
- typeCharacterCommand('h');
- typeCharacterCommand('e');
- typeCharacterCommand(' ');
- typeCharacterCommand('m');
- typeCharacterCommand('a');
- typeCharacterCommand('n');
- typeCharacterCommand('a');
- typeCharacterCommand('g');
-}
-</script>
-
-<div contenteditable id="root" class="editing">
-<span id="test"></span>
-</div>
-
-<script>
-runEditingTest();
-</script>
-
-</body>
-</html>
Modified: trunk/ManualTests/autocorrection/move-to-end-of-word-to-show-reversion.html (201489 => 201490)
--- 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)
@@ -8,7 +8,7 @@
font-size: 24px;
}
</style>
-<script src="" language="_javascript_" type="text/_javascript_" ></script>
+<script src=""
<script>
function editingTest() {
@@ -22,8 +22,12 @@
typeCharacterCommand('a');
typeCharacterCommand('g');
typeCharacterCommand('e');
- typeCharacterCommand(' ');
- execMoveSelectionBackwardByCharacterCommand();
+ setTimeout(function () {
+ typeCharacterCommand(' ');
+ setTimeout(function () {
+ execMoveSelectionBackwardByCharacterCommand();
+ }, 100);
+ }, 100);
}
</script>
Modified: trunk/ManualTests/autocorrection/remove-misspelling-marker-after-appending-letter.html (201489 => 201490)
--- 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)
@@ -8,7 +8,7 @@
font-size: 24px;
}
</style>
-<script src="" language="_javascript_" type="text/_javascript_" ></script>
+<script src=""
<script>
@@ -16,14 +16,13 @@
textarea = document.getElementById('test');
textarea.focus();
document.execCommand("InsertText", false, "this brougt");
- typeCharacterCommand(' ');
- document.execCommand("Delete");
- document.execCommand("Delete");
- typeCharacterCommand(' ');
-
- // Now the word "brough" should carry misspelling marker.
-
- document.execCommand("Delete");
+ setTimeout(function () {
+ typeCharacterCommand(' ');
+ setTimeout(function () {
+ document.execCommand("Delete");
+ document.execCommand("Delete");
+ }, 100);
+ }, 100);
}
</script>
@@ -31,8 +30,8 @@
<title>Removing misspelling marker after appending letter test.</title>
</head>
<body>
-<div>The test verified that misspelling marker is removed after appending new letter to misspelled word. You should see the phrase "this brought" without red underline.</div>
-<p style="color:green">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.</p>
+<div>The test verified that misspelling marker is removed after accepting a correction. You should see the phrase "this brough" without red underline.</div>
+<p style="color:green">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.</p>
<textarea id="test" cols="80" rows="10"></textarea>
</div>
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)
--- 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)
@@ -0,0 +1,49 @@
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ padding: 12px;
+ font-size: 24px;
+}
+</style>
+<script src=""
+
+<script>
+
+function editingTest() {
+ textarea = document.getElementById('test');
+ textarea.focus();
+
+ document.execCommand("InsertText", false, "this brougt");
+ setTimeout(function () {
+ typeCharacterCommand(' ');
+ setTimeout(function () {
+ document.execCommand("Delete");
+ document.execCommand("Delete");
+ setTimeout(function () {
+ typeCharacterCommand(" ");
+ document.execCommand("Delete");
+ }, 100);
+ }, 100);
+ }, 100);
+}
+
+</script>
+
+<title>Removing misspelling marker after appending letter test.</title>
+</head>
+<body>
+<div>The test verified that misspelling marker is removed after appending new letter to misspelled word. You should see the phrase "this brought" without red underline.</div>
+<p style="color:green">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.</p>
+<textarea id="test" cols="80" rows="10"></textarea>
+</div>
+
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
Copied: trunk/ManualTests/autocorrection/resources/document-for-iframe-test.html (from rev 201489, trunk/ManualTests/autocorrection/document-for-iframe-test.html) (0 => 201490)
--- 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)
@@ -0,0 +1,36 @@
+<html>
+<head>
+<style>
+.editing {
+ border: 2px solid red;
+ padding: 12px;
+ font-size: 24px;
+}
+</style>
+
+<script src=""
+
+<script>
+function editingTest() {
+ typeCharacterCommand('t');
+ typeCharacterCommand('h');
+ typeCharacterCommand('e');
+ typeCharacterCommand(' ');
+ typeCharacterCommand('m');
+ typeCharacterCommand('a');
+ typeCharacterCommand('n');
+ typeCharacterCommand('a');
+ typeCharacterCommand('g');
+}
+</script>
+
+<div contenteditable id="root" class="editing">
+<span id="test"></span>
+</div>
+
+<script>
+runEditingTest();
+</script>
+
+</body>
+</html>
Modified: trunk/ManualTests/autocorrection/select-from-multiple-guesses.html (201489 => 201490)
--- 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)
@@ -8,7 +8,7 @@
font-size: 24px;
}
</style>
-<script src="" language="_javascript_" type="text/_javascript_" ></script>
+<script src=""
<script>
function editingTest() {
@@ -34,7 +34,7 @@
</head>
<body>
<div><p>This test verifies that multiple guesses on mispelled word is working correctly</p>
-<p>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.</p>
+<p>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.</p>
<p style="color:green">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.</p>
<div contenteditable id="root" class="editing">
<span id="test"></span>
Modified: trunk/ManualTests/autocorrection/spell-checking-after-reversion.html (201489 => 201490)
--- 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)
@@ -8,7 +8,7 @@
font-size: 24px;
}
</style>
-<script src="" language="_javascript_" type="text/_javascript_" ></script>
+<script src=""
<script>
function editingTest() {
Modified: trunk/ManualTests/autocorrection/type-whitespace-to-dismiss-reversion.html (201489 => 201490)
--- 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)
@@ -8,7 +8,7 @@
font-size: 24px;
}
</style>
-<script src="" language="_javascript_" type="text/_javascript_" ></script>
+<script src=""
<script>
function editingTest() {
@@ -22,8 +22,12 @@
typeCharacterCommand('a');
typeCharacterCommand('g');
typeCharacterCommand('e');
- typeCharacterCommand(' ');
- execMoveSelectionBackwardByCharacterCommand();
+ setTimeout(function () {
+ typeCharacterCommand(' ');
+ setTimeout(function () {
+ execMoveSelectionBackwardByCharacterCommand();
+ }, 100);
+ }, 100);
}
</script>
Added: trunk/ManualTests/autocorrection/undo-autocorrection-2.html (0 => 201490)
--- 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)
@@ -0,0 +1,37 @@
+<html>
+<head>
+
+<style>
+.editing {
+ border: 2px solid red;
+ padding: 12px;
+ font-size: 24px;
+}
+</style>
+
+<title>Undo Autocorrection Test</title>
+</head>
+<body>
+<div><p>This test verifies the behavior of undoing autocorrection.</p>
+
+<p>Type "the ". Set font to bold, then type "me". Set font to regular, then type "sage". After seeing the correction panel, type whitespace to accept the correction (automated). Undo the autocorrection. You should see the second word being reverted to "message" with "me" in bold font.</p>
+<p style="color:green">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.</p>
+<div contenteditable id="root2" class="editing">
+<span id="test"></span>
+</div>
+<script>
+
+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);
+
+</script>
+
+</body>
+</html>
Modified: trunk/ManualTests/autocorrection/undo-autocorrection.html (201489 => 201490)
--- 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)
@@ -13,12 +13,9 @@
</head>
<body>
<div><p>This test verifies the behavior of undoing autocorrection.</p>
-<p><b>Test 1:</b> Type "the mesage". After seeing the correction panel, type whitespace to accept the correction, then select undo. You should see the second word being reverted to "message".</p>
-<p><b>Test 2:</b> Type "the ". Set font to bold, then type "me". Set font to regular, then type "sage". After seeing the correction panel, type whitespace to accept the correction, then select undo. You should see the second word being reverted to "message" with "me" in bold font.</p>
-<p style="color:green">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.</p>
-<div contenteditable id="root" class="editing">
+<p>Type "the mesage". After seeing the correction panel, type whitespace to accept the correction, then select undo. You should see the second word being reverted to "message".</p>
+<div contenteditable id="root1" class="editing">
<span id="test"></span>
</div>
-
</body>
</html>
Modified: trunk/Source/WebCore/ChangeLog (201489 => 201490)
--- 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)
@@ -1,3 +1,37 @@
+2016-05-28 Ryosuke Niwa <[email protected]>
+
+ Autocorrection makes it hard to type "doesn't" and to type @ in email addresses
+ https://bugs.webkit.org/show_bug.cgi?id=158177
+ <rdar://problem/20490862>
+ <rdar://problem/24707954>
+
+ Reviewed by Darin Adler.
+
+ When the user had typed "doesn'", some unified spellchecker may try to autocorrect it to "doesn't" or "does"
+ 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 "ambiguous boundary character" 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 "doesn'" and our autocorrection result is
+ "doesn't", resultEndLocation (the end of "doesn't") is larger than selectionOffset (the end of "doesn'").
+ When the correction is "does", resultEndLocation (the end of "does") 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.
+
2016-05-28 Konstantin Tokarev <[email protected]>
FileSystem: use OS(WINDOWS) instead of PLATFORM(WIN).
Modified: trunk/Source/WebCore/editing/AlternativeTextController.cpp (201489 => 201490)
--- 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)
@@ -340,13 +340,13 @@
}
break;
case AlternativeTextTypeReversion: {
- if (!m_alternativeTextInfo.rangeWithAlternative)
+ auto* details = static_cast<const AutocorrectionAlternativeDetails*>(m_alternativeTextInfo.details.get());
+ if (!m_alternativeTextInfo.rangeWithAlternative || !details || details->replacementString().isEmpty())
break;
m_alternativeTextInfo.isActive = true;
m_alternativeTextInfo.originalText = plainText(m_alternativeTextInfo.rangeWithAlternative.get());
FloatRect boundingBox = rootViewRectForRange(m_alternativeTextInfo.rangeWithAlternative.get());
if (!boundingBox.isEmpty()) {
- const AutocorrectionAlternativeDetails* details = static_cast<const AutocorrectionAlternativeDetails*>(m_alternativeTextInfo.details.get());
if (AlternativeTextClient* client = alternativeTextClient())
client->showCorrectionAlternative(m_alternativeTextInfo.type, boundingBox, m_alternativeTextInfo.originalText, details->replacementString(), Vector<String>());
}
Modified: trunk/Source/WebCore/editing/Editor.cpp (201489 => 201490)
--- 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)
@@ -2524,7 +2524,7 @@
const int resultLength = results[i].length;
const int resultEndLocation = resultLocation + resultLength;
const String& replacement = results[i].replacement;
- const bool resultEndsAtAmbiguousBoundary = useAmbiguousBoundaryOffset && resultEndLocation == selectionOffset - 1;
+ const bool resultEndsAtAmbiguousBoundary = useAmbiguousBoundaryOffset && selectionOffset - 1 <= resultEndLocation;
// Only mark misspelling if:
// 1. Current text checking isn't done for autocorrection, in which case shouldMarkSpelling is false.
Modified: trunk/Source/WebCore/editing/htmlediting.cpp (201489 => 201490)
--- 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)
@@ -389,6 +389,14 @@
return 0;
}
+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 <rdar://problem/6853027> is fixed and text checking can do this for us.
+ return character == '\'' || character == '@' || character == rightSingleQuotationMark || character == hebrewPunctuationGershayim;
+}
+
String stringWithRebalancedWhitespace(const String& string, bool startIsStartOfParagraph, bool endIsEndOfParagraph)
{
StringBuilder rebalancedString;
Modified: trunk/Source/WebCore/editing/htmlediting.h (201489 => 201490)
--- 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)
@@ -215,13 +215,7 @@
return c == ' ' || c == '\n';
}
-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;
-}
+bool isAmbiguousBoundaryCharacter(UChar);
inline bool editingIgnoresContent(const Node& node)
{