haikuwebkit/ManualTests/autocorrection/autocorrection-contraction....

46 lines
1.1 KiB
HTML
Raw Permalink Normal View History

2010-11-19 Jia Pu <jpu@apple.com> Reviewed by Dan Bernstein. Regression: contraction is considered misspelling. https://bugs.webkit.org/show_bug.cgi?id=49423 <rdar://problem/8654206> * platform/mac-leopard/Skipped: * platform/mac-snowleopard/Skipped: * platform/mac-tiger/Skipped: * platform/mac-wk2/Skipped: * platform/mac/editing/spelling/autocorrection-contraction-expected.checksum: Added. * platform/mac/editing/spelling/autocorrection-contraction-expected.png: Added. * platform/mac/editing/spelling/autocorrection-contraction-expected.txt: Added. * platform/mac/editing/spelling/autocorrection-contraction.html: Added. 2010-11-19 Jia Pu <jpu@apple.com> Reviewed by Dan Bernstein. Regression: contraction is considered misspelling. https://bugs.webkit.org/show_bug.cgi?id=49423 <rdar://problem/8654206> Test: platform/mac/editing/spelling/autocorrection-contraction.html manual-tests/autocorrection/autocorrection-contraction.html * editing/Editor.cpp: (WebCore::isAmbiguousBoundaryCharacter): Moved function to the top of the file so that it can be used by all other functions in the file. (WebCore::Editor::markMisspellingsAfterTypingToWord): Renamed markMisspellingsAfterTypingToPosition() to improve readability, and to pass in additional argument. Before we apply pending autocorrection, we check to see if currently typed character makes current word a partial contraction, for instance "wouldn'". If that's the case, we would not apply the pending correction. (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Make sure currently typed word is not a partial contraction, such as "wouldn'", before mark it as misspelled. Also update the location of ambiguous boundary if other replacements have changed the length of the paragraph. * editing/Editor.h: * editing/TypingCommand.cpp: (WebCore::TypingCommand::markMisspellingsAfterTyping): Adopt renamed function. * manual-tests/autocorrection/autocorrection-contraction.html: Added. Canonical link: https://commits.webkit.org/62931@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@72469 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-11-20 07:25:54 +00:00
<html>
<head>
<style>
.editing {
border: 2px solid red;
padding: 12px;
font-size: 24px;
}
</style>
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: Source/WebCore: <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. Canonical link: https://commits.webkit.org/176290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201490 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-28 19:18:48 +00:00
<script src="../../LayoutTests/editing/editing.js"></script>
2010-11-19 Jia Pu <jpu@apple.com> Reviewed by Dan Bernstein. Regression: contraction is considered misspelling. https://bugs.webkit.org/show_bug.cgi?id=49423 <rdar://problem/8654206> * platform/mac-leopard/Skipped: * platform/mac-snowleopard/Skipped: * platform/mac-tiger/Skipped: * platform/mac-wk2/Skipped: * platform/mac/editing/spelling/autocorrection-contraction-expected.checksum: Added. * platform/mac/editing/spelling/autocorrection-contraction-expected.png: Added. * platform/mac/editing/spelling/autocorrection-contraction-expected.txt: Added. * platform/mac/editing/spelling/autocorrection-contraction.html: Added. 2010-11-19 Jia Pu <jpu@apple.com> Reviewed by Dan Bernstein. Regression: contraction is considered misspelling. https://bugs.webkit.org/show_bug.cgi?id=49423 <rdar://problem/8654206> Test: platform/mac/editing/spelling/autocorrection-contraction.html manual-tests/autocorrection/autocorrection-contraction.html * editing/Editor.cpp: (WebCore::isAmbiguousBoundaryCharacter): Moved function to the top of the file so that it can be used by all other functions in the file. (WebCore::Editor::markMisspellingsAfterTypingToWord): Renamed markMisspellingsAfterTypingToPosition() to improve readability, and to pass in additional argument. Before we apply pending autocorrection, we check to see if currently typed character makes current word a partial contraction, for instance "wouldn'". If that's the case, we would not apply the pending correction. (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Make sure currently typed word is not a partial contraction, such as "wouldn'", before mark it as misspelled. Also update the location of ambiguous boundary if other replacements have changed the length of the paragraph. * editing/Editor.h: * editing/TypingCommand.cpp: (WebCore::TypingCommand::markMisspellingsAfterTyping): Adopt renamed function. * manual-tests/autocorrection/autocorrection-contraction.html: Added. Canonical link: https://commits.webkit.org/62931@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@72469 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-11-20 07:25:54 +00:00
<script>
function editingTest() {
typeCharacterCommand('t');
typeCharacterCommand('h');
typeCharacterCommand('i');
typeCharacterCommand('s');
typeCharacterCommand(' ');
typeCharacterCommand('w');
typeCharacterCommand('o');
typeCharacterCommand('u');
typeCharacterCommand('l');
typeCharacterCommand('d');
typeCharacterCommand('n');
}
</script>
2011-03-03 Jia Pu <jpu@apple.com> Reviewed by Darin Adler. On Mac OS X, spelling suggestion panel stops showing up after change set 80121 https://bugs.webkit.org/show_bug.cgi?id=55628 Rebaselined tests affected by changeset 80121. * platform/mac/editing/spelling/autocorrection-contraction-expected.txt: * platform/mac/editing/spelling/autocorrection-delete-expected.txt: * platform/mac/editing/spelling/autocorrection-removing-underline-after-paste-expected.txt: * platform/mac/editing/spelling/autocorrection-removing-underline-expected.txt: * platform/mac/editing/spelling/autocorrection-simple-expected.txt: * platform/mac/editing/spelling/click-autocorrected-word-expected.txt: * platform/mac/editing/spelling/click-autocorrected-word.html: * platform/mac/editing/spelling/delete-autocorrected-word-1-expected.txt: * platform/mac/editing/spelling/delete-into-autocorrected-word-expected.checksum: * platform/mac/editing/spelling/delete-into-autocorrected-word-expected.png: * platform/mac/editing/spelling/delete-into-autocorrected-word-expected.txt: * platform/mac/editing/spelling/delete-into-autocorrected-word.html: * platform/mac/editing/spelling/forward-delete-into-autocorrected-word-expected.checksum: * platform/mac/editing/spelling/forward-delete-into-autocorrected-word-expected.png: * platform/mac/editing/spelling/forward-delete-into-autocorrected-word-expected.txt: * platform/mac/editing/spelling/forward-delete-into-autocorrected-word.html: * platform/mac/editing/spelling/move-cursor-to-autocorrected-word-expected.checksum: * platform/mac/editing/spelling/move-cursor-to-autocorrected-word-expected.png: * platform/mac/editing/spelling/move-cursor-to-autocorrected-word-expected.txt: * platform/mac/editing/spelling/move-cursor-to-autocorrected-word.html: * platform/mac/editing/spelling/move-cursor-to-beginning-of-autocorrected-word-expected.checksum: * platform/mac/editing/spelling/move-cursor-to-beginning-of-autocorrected-word-expected.png: * platform/mac/editing/spelling/move-cursor-to-beginning-of-autocorrected-word-expected.txt: * platform/mac/editing/spelling/move-cursor-to-beginning-of-autocorrected-word.html: * platform/mac/editing/spelling/removing-underline-after-accepting-autocorrection-using-punctuation-expected.txt: 2011-03-03 Jia Pu <jpu@apple.com> Reviewed by Darin Adler. On Mac OS X, spelling suggestion panel stops showing up after change set 80121 https://bugs.webkit.org/show_bug.cgi?id=55628 Removed a call to stopCorrectionPanelTimer() to fix a regression introduced by changeset 80121. * editing/Editor.cpp: (WebCore::Editor::appliedEditing): * manual-tests/autocorrection/autocorrection-contraction.html: Canonical link: https://commits.webkit.org/70121@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@80226 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-03-03 11:13:52 +00:00
<title>Autocorrection with Contraction Test</title>
2010-11-19 Jia Pu <jpu@apple.com> Reviewed by Dan Bernstein. Regression: contraction is considered misspelling. https://bugs.webkit.org/show_bug.cgi?id=49423 <rdar://problem/8654206> * platform/mac-leopard/Skipped: * platform/mac-snowleopard/Skipped: * platform/mac-tiger/Skipped: * platform/mac-wk2/Skipped: * platform/mac/editing/spelling/autocorrection-contraction-expected.checksum: Added. * platform/mac/editing/spelling/autocorrection-contraction-expected.png: Added. * platform/mac/editing/spelling/autocorrection-contraction-expected.txt: Added. * platform/mac/editing/spelling/autocorrection-contraction.html: Added. 2010-11-19 Jia Pu <jpu@apple.com> Reviewed by Dan Bernstein. Regression: contraction is considered misspelling. https://bugs.webkit.org/show_bug.cgi?id=49423 <rdar://problem/8654206> Test: platform/mac/editing/spelling/autocorrection-contraction.html manual-tests/autocorrection/autocorrection-contraction.html * editing/Editor.cpp: (WebCore::isAmbiguousBoundaryCharacter): Moved function to the top of the file so that it can be used by all other functions in the file. (WebCore::Editor::markMisspellingsAfterTypingToWord): Renamed markMisspellingsAfterTypingToPosition() to improve readability, and to pass in additional argument. Before we apply pending autocorrection, we check to see if currently typed character makes current word a partial contraction, for instance "wouldn'". If that's the case, we would not apply the pending correction. (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Make sure currently typed word is not a partial contraction, such as "wouldn'", before mark it as misspelled. Also update the location of ambiguous boundary if other replacements have changed the length of the paragraph. * editing/Editor.h: * editing/TypingCommand.cpp: (WebCore::TypingCommand::markMisspellingsAfterTyping): Adopt renamed function. * manual-tests/autocorrection/autocorrection-contraction.html: Added. Canonical link: https://commits.webkit.org/62931@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@72469 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-11-20 07:25:54 +00:00
</head>
<body>
<div><p>This test verifies that, after typing an apostrophe, if the current word is part of a contraction, previously shown autocorrection will not be applied.</p>
<p>After loading the page, you should see correction panel shows "would" for "wouldn". Then after typing "'t", the correction panel dissappears and the final sentence is "this wouldn't".</p>
<div contenteditable id="root" class="editing">
<span id="test"></span>
</div>
<script>
runEditingTest();
</script>
</body>
</html>