haikuwebkit/ManualTests/autocorrection/move-to-end-of-word-to-show...

52 lines
1.4 KiB
HTML
Raw Permalink Normal View History

reversion bubble in WebViews https://bugs.webkit.org/show_bug.cgi?id=47630 <rdar://problem/8530960> Patch by Jia Pu <jpu@apple.com> on 2010-11-04 Reviewed by Dan Bernstein. WebCore: Added manual test: manual-tests/autocorrection/continue-typing-to-dismiss-reversion.html manual-tests/autocorrection/delete-to-dismiss-reversion.html manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html manual-tests/autocorrection/type-whitespace-to-dismiss-reversion.html We can only manully test this feature for two reasons: 1. On Mac OS X, the result of spell checking is partly determined by past user usage. We can't realiably generating test cases until we can disable user custom data during spell checking. 2. To exerciese this feature, we need a minimum of 0.3 second delay using WebCore timer. This patch is to add reversion to correction panel. It consists of following major code changes: 1. Collected all autocorrection related member variables in Editor into a CorrectionPanelInfo class to improve readability. 2. Changed signature of Editor::startCorrectionPanelTimer() to allow caller to specify the type of correction panel--regular correction or reversion. 3. Made necessary changes to adopt reversion API in AppKit. 4. Use SUPPORT_CORRECTION_PANEL macro to improve readability. * GNUmakefile.am: Added CorrectionPanelInfo.h. * WebCore.gypi: Ditto. * WebCore.pro: Ditto. * WebCore.vcproj/WebCore.vcproj: Ditto. * WebCore.xcodeproj/project.pbxproj: * editing/CorrectionPanelInfo.h: Added. * editing/Editor.cpp: (WebCore::Editor::respondToChangedSelection): Start correction panel timer for reversion when the new selection is a caret selection at end of a previously corrected word. (WebCore::Editor::appliedEditing): Stop timer at the beginning of the method instead of at the end. (WebCore::Editor::~Editor): Adopted new method dismissCorrectionPanel(). (WebCore::Editor::markMisspellingsAfterTypingToPosition): Adopted new method applyCorrectionPanelInfo(). (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Code change for new m_correctionPanelInfo member variable. (WebCore::Editor::correctionPanelTimerFired): Change to handle reversion panel type. (WebCore::Editor::handleRejectedCorrection): Ditto. (WebCore::Editor::startCorrectionPanelTimer): Changed signature to allow passing in panel type. (WebCore::Editor::stopCorrectionPanelTimer): Adopted macro SUPPORT_CORRECTION_PANEL. (WebCore::Editor::handleCancelOperation): Ditto. (WebCore::Editor::isShowingCorrectionPanel): Ditto. (WebCore::Editor::dismissCorrectionPanel): Update m_correctionPanelInfo when correction panel is dismissed. (WebCore::Editor::applyCorrectionPanelInfo): Factored out code that applies autocorrection. (WebCore::Editor::changeSelectionAfterCommand): Adopt macro SUPPORT_CORRECTION_PANEL. * editing/Editor.h: Adopted CorrectionPanelInfo and add new member methods. * editing/EditorCommand.cpp: Adopted macro SUPPORT_CORRECTION_PANEL (WebCore::createCommandMap): * editing/TypingCommand.cpp: Adopted macro SUPPORT_CORRECTION_PANEL and new signature of startCorrectionPanelTimer(). (WebCore::TypingCommand::markMisspellingsAfterTyping): * loader/EmptyClients.h: (WebCore::EmptyEditorClient::showCorrectionPanel): Adopted new signature of base class method. (WebCore::EmptyEditorClient::dismissCorrectionPanel): Ditto. * manual-tests/autocorrection/continue-typing-to-dismiss-reversion.html: Added. * manual-tests/autocorrection/delete-to-dismiss-reversion.html: Added. * manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html: Added. * manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html: Added. * manual-tests/autocorrection/type-whitespace-to-dismiss-reversion.html: Added. * page/EditorClient.h: Changed signature of showCorrectionPanel() and dismissCorrectionPanel(). * platform/graphics/mac/GraphicsContextMac.mm: Added comment to improve readability. (WebCore::GraphicsContext::drawLineForTextChecking): WebKit/mac: This patch is to add reversion to correction panel. Please see WebCore/ChangeLog for detail. * WebCoreSupport/WebEditorClient.h: Adopted new signature of base class method. * WebCoreSupport/WebEditorClient.mm: Adopted new signature of base class method. And code change to use new reversion API in AppKit. (WebEditorClient::WebEditorClient): (WebEditorClient::~WebEditorClient): (WebEditorClient::respondToChangedSelection): (WebEditorClient::showCorrectionPanel): (WebEditorClient::dismissCorrectionPanel): (WebEditorClient::isShowingCorrectionPanel): WebKit2: This patch is to add reversion to correction panel. Please see WebCore/ChangeLog for detail. * WebProcess/WebCoreSupport/WebEditorClient.h: Adopted new signature of base class method. * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: Ditto. (WebKit::WebEditorClient::showCorrectionPanel): (WebKit::WebEditorClient::dismissCorrectionPanel): Canonical link: https://commits.webkit.org/61872@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@71385 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-11-05 03:48:05 +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>
reversion bubble in WebViews https://bugs.webkit.org/show_bug.cgi?id=47630 <rdar://problem/8530960> Patch by Jia Pu <jpu@apple.com> on 2010-11-04 Reviewed by Dan Bernstein. WebCore: Added manual test: manual-tests/autocorrection/continue-typing-to-dismiss-reversion.html manual-tests/autocorrection/delete-to-dismiss-reversion.html manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html manual-tests/autocorrection/type-whitespace-to-dismiss-reversion.html We can only manully test this feature for two reasons: 1. On Mac OS X, the result of spell checking is partly determined by past user usage. We can't realiably generating test cases until we can disable user custom data during spell checking. 2. To exerciese this feature, we need a minimum of 0.3 second delay using WebCore timer. This patch is to add reversion to correction panel. It consists of following major code changes: 1. Collected all autocorrection related member variables in Editor into a CorrectionPanelInfo class to improve readability. 2. Changed signature of Editor::startCorrectionPanelTimer() to allow caller to specify the type of correction panel--regular correction or reversion. 3. Made necessary changes to adopt reversion API in AppKit. 4. Use SUPPORT_CORRECTION_PANEL macro to improve readability. * GNUmakefile.am: Added CorrectionPanelInfo.h. * WebCore.gypi: Ditto. * WebCore.pro: Ditto. * WebCore.vcproj/WebCore.vcproj: Ditto. * WebCore.xcodeproj/project.pbxproj: * editing/CorrectionPanelInfo.h: Added. * editing/Editor.cpp: (WebCore::Editor::respondToChangedSelection): Start correction panel timer for reversion when the new selection is a caret selection at end of a previously corrected word. (WebCore::Editor::appliedEditing): Stop timer at the beginning of the method instead of at the end. (WebCore::Editor::~Editor): Adopted new method dismissCorrectionPanel(). (WebCore::Editor::markMisspellingsAfterTypingToPosition): Adopted new method applyCorrectionPanelInfo(). (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Code change for new m_correctionPanelInfo member variable. (WebCore::Editor::correctionPanelTimerFired): Change to handle reversion panel type. (WebCore::Editor::handleRejectedCorrection): Ditto. (WebCore::Editor::startCorrectionPanelTimer): Changed signature to allow passing in panel type. (WebCore::Editor::stopCorrectionPanelTimer): Adopted macro SUPPORT_CORRECTION_PANEL. (WebCore::Editor::handleCancelOperation): Ditto. (WebCore::Editor::isShowingCorrectionPanel): Ditto. (WebCore::Editor::dismissCorrectionPanel): Update m_correctionPanelInfo when correction panel is dismissed. (WebCore::Editor::applyCorrectionPanelInfo): Factored out code that applies autocorrection. (WebCore::Editor::changeSelectionAfterCommand): Adopt macro SUPPORT_CORRECTION_PANEL. * editing/Editor.h: Adopted CorrectionPanelInfo and add new member methods. * editing/EditorCommand.cpp: Adopted macro SUPPORT_CORRECTION_PANEL (WebCore::createCommandMap): * editing/TypingCommand.cpp: Adopted macro SUPPORT_CORRECTION_PANEL and new signature of startCorrectionPanelTimer(). (WebCore::TypingCommand::markMisspellingsAfterTyping): * loader/EmptyClients.h: (WebCore::EmptyEditorClient::showCorrectionPanel): Adopted new signature of base class method. (WebCore::EmptyEditorClient::dismissCorrectionPanel): Ditto. * manual-tests/autocorrection/continue-typing-to-dismiss-reversion.html: Added. * manual-tests/autocorrection/delete-to-dismiss-reversion.html: Added. * manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html: Added. * manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html: Added. * manual-tests/autocorrection/type-whitespace-to-dismiss-reversion.html: Added. * page/EditorClient.h: Changed signature of showCorrectionPanel() and dismissCorrectionPanel(). * platform/graphics/mac/GraphicsContextMac.mm: Added comment to improve readability. (WebCore::GraphicsContext::drawLineForTextChecking): WebKit/mac: This patch is to add reversion to correction panel. Please see WebCore/ChangeLog for detail. * WebCoreSupport/WebEditorClient.h: Adopted new signature of base class method. * WebCoreSupport/WebEditorClient.mm: Adopted new signature of base class method. And code change to use new reversion API in AppKit. (WebEditorClient::WebEditorClient): (WebEditorClient::~WebEditorClient): (WebEditorClient::respondToChangedSelection): (WebEditorClient::showCorrectionPanel): (WebEditorClient::dismissCorrectionPanel): (WebEditorClient::isShowingCorrectionPanel): WebKit2: This patch is to add reversion to correction panel. Please see WebCore/ChangeLog for detail. * WebProcess/WebCoreSupport/WebEditorClient.h: Adopted new signature of base class method. * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: Ditto. (WebKit::WebEditorClient::showCorrectionPanel): (WebKit::WebEditorClient::dismissCorrectionPanel): Canonical link: https://commits.webkit.org/61872@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@71385 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-11-05 03:48:05 +00:00
<script>
function editingTest() {
typeCharacterCommand('t');
typeCharacterCommand('h');
typeCharacterCommand('e');
typeCharacterCommand(' ');
typeCharacterCommand('m');
typeCharacterCommand('e');
typeCharacterCommand('s');
typeCharacterCommand('a');
typeCharacterCommand('g');
typeCharacterCommand('e');
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
setTimeout(function () {
typeCharacterCommand(' ');
setTimeout(function () {
execMoveSelectionBackwardByCharacterCommand();
}, 100);
}, 100);
reversion bubble in WebViews https://bugs.webkit.org/show_bug.cgi?id=47630 <rdar://problem/8530960> Patch by Jia Pu <jpu@apple.com> on 2010-11-04 Reviewed by Dan Bernstein. WebCore: Added manual test: manual-tests/autocorrection/continue-typing-to-dismiss-reversion.html manual-tests/autocorrection/delete-to-dismiss-reversion.html manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html manual-tests/autocorrection/type-whitespace-to-dismiss-reversion.html We can only manully test this feature for two reasons: 1. On Mac OS X, the result of spell checking is partly determined by past user usage. We can't realiably generating test cases until we can disable user custom data during spell checking. 2. To exerciese this feature, we need a minimum of 0.3 second delay using WebCore timer. This patch is to add reversion to correction panel. It consists of following major code changes: 1. Collected all autocorrection related member variables in Editor into a CorrectionPanelInfo class to improve readability. 2. Changed signature of Editor::startCorrectionPanelTimer() to allow caller to specify the type of correction panel--regular correction or reversion. 3. Made necessary changes to adopt reversion API in AppKit. 4. Use SUPPORT_CORRECTION_PANEL macro to improve readability. * GNUmakefile.am: Added CorrectionPanelInfo.h. * WebCore.gypi: Ditto. * WebCore.pro: Ditto. * WebCore.vcproj/WebCore.vcproj: Ditto. * WebCore.xcodeproj/project.pbxproj: * editing/CorrectionPanelInfo.h: Added. * editing/Editor.cpp: (WebCore::Editor::respondToChangedSelection): Start correction panel timer for reversion when the new selection is a caret selection at end of a previously corrected word. (WebCore::Editor::appliedEditing): Stop timer at the beginning of the method instead of at the end. (WebCore::Editor::~Editor): Adopted new method dismissCorrectionPanel(). (WebCore::Editor::markMisspellingsAfterTypingToPosition): Adopted new method applyCorrectionPanelInfo(). (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Code change for new m_correctionPanelInfo member variable. (WebCore::Editor::correctionPanelTimerFired): Change to handle reversion panel type. (WebCore::Editor::handleRejectedCorrection): Ditto. (WebCore::Editor::startCorrectionPanelTimer): Changed signature to allow passing in panel type. (WebCore::Editor::stopCorrectionPanelTimer): Adopted macro SUPPORT_CORRECTION_PANEL. (WebCore::Editor::handleCancelOperation): Ditto. (WebCore::Editor::isShowingCorrectionPanel): Ditto. (WebCore::Editor::dismissCorrectionPanel): Update m_correctionPanelInfo when correction panel is dismissed. (WebCore::Editor::applyCorrectionPanelInfo): Factored out code that applies autocorrection. (WebCore::Editor::changeSelectionAfterCommand): Adopt macro SUPPORT_CORRECTION_PANEL. * editing/Editor.h: Adopted CorrectionPanelInfo and add new member methods. * editing/EditorCommand.cpp: Adopted macro SUPPORT_CORRECTION_PANEL (WebCore::createCommandMap): * editing/TypingCommand.cpp: Adopted macro SUPPORT_CORRECTION_PANEL and new signature of startCorrectionPanelTimer(). (WebCore::TypingCommand::markMisspellingsAfterTyping): * loader/EmptyClients.h: (WebCore::EmptyEditorClient::showCorrectionPanel): Adopted new signature of base class method. (WebCore::EmptyEditorClient::dismissCorrectionPanel): Ditto. * manual-tests/autocorrection/continue-typing-to-dismiss-reversion.html: Added. * manual-tests/autocorrection/delete-to-dismiss-reversion.html: Added. * manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html: Added. * manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html: Added. * manual-tests/autocorrection/type-whitespace-to-dismiss-reversion.html: Added. * page/EditorClient.h: Changed signature of showCorrectionPanel() and dismissCorrectionPanel(). * platform/graphics/mac/GraphicsContextMac.mm: Added comment to improve readability. (WebCore::GraphicsContext::drawLineForTextChecking): WebKit/mac: This patch is to add reversion to correction panel. Please see WebCore/ChangeLog for detail. * WebCoreSupport/WebEditorClient.h: Adopted new signature of base class method. * WebCoreSupport/WebEditorClient.mm: Adopted new signature of base class method. And code change to use new reversion API in AppKit. (WebEditorClient::WebEditorClient): (WebEditorClient::~WebEditorClient): (WebEditorClient::respondToChangedSelection): (WebEditorClient::showCorrectionPanel): (WebEditorClient::dismissCorrectionPanel): (WebEditorClient::isShowingCorrectionPanel): WebKit2: This patch is to add reversion to correction panel. Please see WebCore/ChangeLog for detail. * WebProcess/WebCoreSupport/WebEditorClient.h: Adopted new signature of base class method. * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: Ditto. (WebKit::WebEditorClient::showCorrectionPanel): (WebKit::WebEditorClient::dismissCorrectionPanel): Canonical link: https://commits.webkit.org/61872@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@71385 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-11-05 03:48:05 +00:00
}
</script>
<title>Move to End of Word to Show Reversion Panel Test</title>
</head>
<body>
<div><p>This test verifies that reversion panel is shown when user moves carret to previously corrected word</p>
2011-05-12 Jia Pu <jpu@apple.com> Reviewed by Darin Adler. Regression caused by changeset 86281 https://bugs.webkit.org/show_bug.cgi?id=60712 Changed wording in some tests to reflect AppKit UI change. * manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html: * manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html: 2011-05-12 Jia Pu <jpu@apple.com> Reviewed by Darin Adler. Regression caused by changeset 86281 https://bugs.webkit.org/show_bug.cgi?id=60712 <rdar://problem/9427970> Removed the condition variable. [NSSpellChecker dismissCorrectionIndicatorForView:] is blocking. So handleAcceptedReplacement() triggered by dismissInternal() will return before dismissInternal() returns. So we don't need to use the condition to coordinate between these two function. In fact, all callbacks are delivered on main thread. We don't really need any locking here. Since now we don't have distinction between dismiss() and dismissSoon(). dismissSoon() has been removed. * WebCoreSupport/CorrectionPanel.h: * WebCoreSupport/CorrectionPanel.mm: (CorrectionPanel::CorrectionPanel): (CorrectionPanel::show): (CorrectionPanel::dismiss): (CorrectionPanel::dismissInternal): (CorrectionPanel::handleAcceptedReplacement): * WebCoreSupport/WebEditorClient.mm: (WebEditorClient::dismissCorrectionPanelSoon): 2011-05-12 Jia Pu <jpu@apple.com> Reviewed by Darin Adler. Regression caused by changeset 86281 https://bugs.webkit.org/show_bug.cgi?id=60712 <rdar://problem/9427970> Removed the condition variable. [NSSpellChecker dismissCorrectionIndicatorForView:] is blocking. So handleAcceptedReplacement() triggered by dismissInternal() will return before dismissInternal() returns. So we don't need to use the condition to coordinate between these two function. In fact, all callbacks are delivered on main thread. We don't really need any locking here. Since now we don't have distinction between dismiss() and dismissSoon(). dismissSoon() has been removed. * UIProcess/API/mac/PageClientImpl.mm: (WebKit::PageClientImpl::dismissCorrectionPanelSoon): * UIProcess/mac/CorrectionPanel.h: * UIProcess/mac/CorrectionPanel.mm: (WebKit::CorrectionPanel::CorrectionPanel): (WebKit::CorrectionPanel::show): (WebKit::CorrectionPanel::dismiss): (WebKit::CorrectionPanel::dismissInternal): (WebKit::CorrectionPanel::handleAcceptedReplacement): Canonical link: https://commits.webkit.org/76061@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@86406 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-05-13 01:19:03 +00:00
<p>After seeing the reversion panel, press down key followed by return key. You should see the phrase "the mesage". </p>
Reversion should not be marked as misspelled. https://bugs.webkit.org/show_bug.cgi?id=53255 Source/WebCore: Patch by Jia Pu <jpu@apple.com> on 2011-02-03 This patch includes fix for reported bug, and also some housekeeping changes. To implement desired behavior, we need: 1. Add a new marker type, SpellCheckingExemption, since now we distingusish between text that shouldn't be spellchecked and text shouldn't be autocorrected. 2. Make sure that there is no pending correction panel when we enter markAllMisspellingsAndBadGrammarInRanges(). Otherwise the spell checking code in that function may interfere with autocorrection. This is achieved by explicitly applying pending correction when user types space, line break or paragraph break. Housekeeping code changes include: 1. Change manual-tests that were broken by relocated WebCore directory. 2. Use TextIterator in various DocumentMarkerController functions instead of using Node::traverseNextNode() directly. 3. Allow passing multiple marker types into DocumentMarkerController::removeMarkers() and DocumentMarkerController::hasMarkers() to improve clarity and efficiency. 4. Fixes of minor bugs that were exposed previously. * WebCore.exp.in: Change signature of DocumentMarkerController::removeMarkers(). * dom/DocumentMarker.h: Added new marker type SpellCheckingExemption. * dom/DocumentMarkerController.cpp: (WebCore::DocumentMarkerController::removeMarkers): Use TextIterator to scan the range to be consistent with addMarker() function. Allow passing in multiple marker types in one call. Added a boolean argument to specify the behavior when removing markers that partially overlap the specified range. (WebCore::DocumentMarkerController::removeMarkersFromMarkerMapVectorPair): Allow passing in multiple marker types in one call. (WebCore::DocumentMarkerController::hasMarkers): Use TextIterator to scan the range to be consistent with addMarker() function. Allow passing in multiple marker types in one call. * dom/DocumentMarkerController.h: Allow passing in multiple marker types to removeMarkers() and hasMarkers(). Added a boolean argument to removeMarkers() to specify the behavior when removing markers that partially overlap the specified range. * editing/Editor.cpp: (WebCore::markerTypesForAutocorrection): Add SpellCheckingExemption marker when apply correction. (WebCore::markerTypesForReplacement): Ditto. (WebCore::Editor::respondToChangedSelection): Reordered call to dismissCorrectionPanel() and setSelection() to make sure there is no pending correction when entering markAllMisspellingsAndBadGrammarInRanges(). (WebCore::Editor::appliedEditing): Only remove CorrectionIndicator markers when the command is a top level command to improve efficiency. (WebCore::Editor::insertTextWithoutSendingTextEvent): Added code to applying pending correction. (WebCore::Editor::insertLineBreak): Ditto. (WebCore::Editor::insertParagraphSeparator): Ditto. (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Don't mark mispelling if the text carries SpellCheckingExemption marker. (WebCore::Editor::correctionPanelTimerFired): Reset correction panel if the returned suggestion from spellchecker is an empty string. (WebCore::Editor::removeSpellAndCorrectionMarkersFromWordsToBeEdited): Use new DocumentMarkerController::removeMarkers() to replace custom implemenation to improve efficiency and readability. (WebCore::Editor::applyCorrectionPanelInfo): Remove the code that set caret position after applying correction, since it's unnecessary. Also, store pre-correction string together with the marker for reversion panel to use. (WebCore::Editor::applyAutocorrectionBeforeTypingIfAppropriate): Apply pending correction. (WebCore::Editor::changeSelectionAfterCommand): Moved marker removal code to Editor::appliedEditing() where we have access to EditCommand object. * editing/Editor.h: Added new function applyAutocorrectionAfterTypingIfAppropriate(). * manual-tests/autocorrection/autocorrection-cancelled-by-ESC.html: Change manual-tests that were broken by relocated WebCore directory. * manual-tests/autocorrection/autocorrection-cancelled-by-typing-1.html: Ditto. * manual-tests/autocorrection/autocorrection-contraction.html: Ditto. * manual-tests/autocorrection/continue-typing-to-dismiss-reversion.html: Ditto. * manual-tests/autocorrection/delete-to-dismiss-reversion.html: Ditto. * manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html: Ditto. * manual-tests/autocorrection/dismiss-multiple-guesses.html: Ditto. * manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html: Ditto. * manual-tests/autocorrection/select-from-multiple-guesses.html: Ditto. * manual-tests/autocorrection/spell-checking-after-reversion.html: Added. * manual-tests/autocorrection/type-whitespace-to-dismiss-reversion.html: Change manual-tests that were broken by relocated WebCore directory. * rendering/InlineTextBox.cpp: (WebCore::InlineTextBox::paintDocumentMarkers): Code clean-up to be more concise. LayoutTests: Patch by Jia Pu <jpu@apple.com> on 2011-02-03 Rebaselined tests broken by https://bugs.webkit.org/show_bug.cgi?id=51389 * platform/mac/editing/spelling/autocorrection-contraction-expected.png: * platform/mac/editing/spelling/autocorrection-contraction-expected.txt: * platform/mac/editing/spelling/autocorrection-delete-expected.png: * platform/mac/editing/spelling/autocorrection-delete-expected.txt: * platform/mac/editing/spelling/autocorrection-removing-underline-after-paste-expected.png: * platform/mac/editing/spelling/autocorrection-removing-underline-after-paste-expected.txt: * platform/mac/editing/spelling/autocorrection-removing-underline-expected.png: * platform/mac/editing/spelling/autocorrection-removing-underline-expected.txt: * platform/mac/editing/spelling/autocorrection-simple-expected.checksum: * platform/mac/editing/spelling/autocorrection-simple-expected.png: * platform/mac/editing/spelling/autocorrection-simple-expected.txt: * platform/mac/editing/spelling/autocorrection-simple.html: * platform/mac/editing/spelling/delete-autocorrected-word-1-expected.png: * platform/mac/editing/spelling/delete-autocorrected-word-1-expected.txt: Canonical link: https://commits.webkit.org/67652@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@77577 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-02-04 01:40:37 +00:00
<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>
reversion bubble in WebViews https://bugs.webkit.org/show_bug.cgi?id=47630 <rdar://problem/8530960> Patch by Jia Pu <jpu@apple.com> on 2010-11-04 Reviewed by Dan Bernstein. WebCore: Added manual test: manual-tests/autocorrection/continue-typing-to-dismiss-reversion.html manual-tests/autocorrection/delete-to-dismiss-reversion.html manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html manual-tests/autocorrection/type-whitespace-to-dismiss-reversion.html We can only manully test this feature for two reasons: 1. On Mac OS X, the result of spell checking is partly determined by past user usage. We can't realiably generating test cases until we can disable user custom data during spell checking. 2. To exerciese this feature, we need a minimum of 0.3 second delay using WebCore timer. This patch is to add reversion to correction panel. It consists of following major code changes: 1. Collected all autocorrection related member variables in Editor into a CorrectionPanelInfo class to improve readability. 2. Changed signature of Editor::startCorrectionPanelTimer() to allow caller to specify the type of correction panel--regular correction or reversion. 3. Made necessary changes to adopt reversion API in AppKit. 4. Use SUPPORT_CORRECTION_PANEL macro to improve readability. * GNUmakefile.am: Added CorrectionPanelInfo.h. * WebCore.gypi: Ditto. * WebCore.pro: Ditto. * WebCore.vcproj/WebCore.vcproj: Ditto. * WebCore.xcodeproj/project.pbxproj: * editing/CorrectionPanelInfo.h: Added. * editing/Editor.cpp: (WebCore::Editor::respondToChangedSelection): Start correction panel timer for reversion when the new selection is a caret selection at end of a previously corrected word. (WebCore::Editor::appliedEditing): Stop timer at the beginning of the method instead of at the end. (WebCore::Editor::~Editor): Adopted new method dismissCorrectionPanel(). (WebCore::Editor::markMisspellingsAfterTypingToPosition): Adopted new method applyCorrectionPanelInfo(). (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Code change for new m_correctionPanelInfo member variable. (WebCore::Editor::correctionPanelTimerFired): Change to handle reversion panel type. (WebCore::Editor::handleRejectedCorrection): Ditto. (WebCore::Editor::startCorrectionPanelTimer): Changed signature to allow passing in panel type. (WebCore::Editor::stopCorrectionPanelTimer): Adopted macro SUPPORT_CORRECTION_PANEL. (WebCore::Editor::handleCancelOperation): Ditto. (WebCore::Editor::isShowingCorrectionPanel): Ditto. (WebCore::Editor::dismissCorrectionPanel): Update m_correctionPanelInfo when correction panel is dismissed. (WebCore::Editor::applyCorrectionPanelInfo): Factored out code that applies autocorrection. (WebCore::Editor::changeSelectionAfterCommand): Adopt macro SUPPORT_CORRECTION_PANEL. * editing/Editor.h: Adopted CorrectionPanelInfo and add new member methods. * editing/EditorCommand.cpp: Adopted macro SUPPORT_CORRECTION_PANEL (WebCore::createCommandMap): * editing/TypingCommand.cpp: Adopted macro SUPPORT_CORRECTION_PANEL and new signature of startCorrectionPanelTimer(). (WebCore::TypingCommand::markMisspellingsAfterTyping): * loader/EmptyClients.h: (WebCore::EmptyEditorClient::showCorrectionPanel): Adopted new signature of base class method. (WebCore::EmptyEditorClient::dismissCorrectionPanel): Ditto. * manual-tests/autocorrection/continue-typing-to-dismiss-reversion.html: Added. * manual-tests/autocorrection/delete-to-dismiss-reversion.html: Added. * manual-tests/autocorrection/delete-to-end-of-word-to-show-reversion.html: Added. * manual-tests/autocorrection/move-to-end-of-word-to-show-reversion.html: Added. * manual-tests/autocorrection/type-whitespace-to-dismiss-reversion.html: Added. * page/EditorClient.h: Changed signature of showCorrectionPanel() and dismissCorrectionPanel(). * platform/graphics/mac/GraphicsContextMac.mm: Added comment to improve readability. (WebCore::GraphicsContext::drawLineForTextChecking): WebKit/mac: This patch is to add reversion to correction panel. Please see WebCore/ChangeLog for detail. * WebCoreSupport/WebEditorClient.h: Adopted new signature of base class method. * WebCoreSupport/WebEditorClient.mm: Adopted new signature of base class method. And code change to use new reversion API in AppKit. (WebEditorClient::WebEditorClient): (WebEditorClient::~WebEditorClient): (WebEditorClient::respondToChangedSelection): (WebEditorClient::showCorrectionPanel): (WebEditorClient::dismissCorrectionPanel): (WebEditorClient::isShowingCorrectionPanel): WebKit2: This patch is to add reversion to correction panel. Please see WebCore/ChangeLog for detail. * WebProcess/WebCoreSupport/WebEditorClient.h: Adopted new signature of base class method. * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm: Ditto. (WebKit::WebEditorClient::showCorrectionPanel): (WebKit::WebEditorClient::dismissCorrectionPanel): Canonical link: https://commits.webkit.org/61872@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@71385 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-11-05 03:48:05 +00:00
<div contenteditable id="root" class="editing">
<span id="test"></span>
</div>
<script>
runEditingTest();
</script>
</body>
</html>