2011-02-22 Jia Pu <jpu@apple.com>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Feb 2011 07:06:49 +0000 (07:06 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Feb 2011 07:06:49 +0000 (07:06 +0000)
        Reviewed by Dan Bernstein.

        On Mac OS X, English contractions are marked misspelled with certain user preference setting.
        https://bugs.webkit.org/show_bug.cgi?id=54975

        manual test: manual-tests/autocorrection/spellcheck-on-contraction-when-autocorrection-is-off.html

        Without this patch, we check for contraction only when autocorrection or other type of auto-
        substituation is on. And we failed to check for contraction if only spellchecking is turned on.
        This patch implements the desired behavior, checking for contraction when either correction/substitution,
        or spellchecking, is on.

        * editing/Editor.cpp:
        (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
        * manual-tests/autocorrection/spellcheck-on-contraction-when-autocorrection-is-off.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@79411 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/editing/Editor.cpp
Source/WebCore/manual-tests/autocorrection/spellcheck-on-contraction-when-autocorrection-is-off.html [new file with mode: 0644]

index 4d69216..b67739f 100644 (file)
@@ -1,3 +1,21 @@
+2011-02-22  Jia Pu  <jpu@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        On Mac OS X, English contractions are marked misspelled with certain user preference setting.
+        https://bugs.webkit.org/show_bug.cgi?id=54975
+
+        manual test: manual-tests/autocorrection/spellcheck-on-contraction-when-autocorrection-is-off.html
+
+        Without this patch, we check for contraction only when autocorrection or other type of auto-
+        substituation is on. And we failed to check for contraction if only spellchecking is turned on.
+        This patch implements the desired behavior, checking for contraction when either correction/substitution,
+        or spellchecking, is on.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
+        * manual-tests/autocorrection/spellcheck-on-contraction-when-autocorrection-is-off.html: Added.
+
 2011-02-22  Charlie Reis  <creis@chromium.org>
 
         Reviewed by Darin Fisher.
index 0931f74..ac203f1 100644 (file)
@@ -2274,7 +2274,7 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingOptions textCh
     if (shouldMarkGrammar ? (spellingParagraph.isRangeEmpty() && grammarParagraph.isEmpty()) : spellingParagraph.isEmpty())
         return;
 
-    if (shouldPerformReplacement) {
+    if (shouldPerformReplacement || shouldMarkSpelling) {
         if (m_frame->selection()->selectionType() == VisibleSelection::CaretSelection) {
             // Attempt to save the caret position so we can restore it later if needed
             Position caretPosition = m_frame->selection()->end();
diff --git a/Source/WebCore/manual-tests/autocorrection/spellcheck-on-contraction-when-autocorrection-is-off.html b/Source/WebCore/manual-tests/autocorrection/spellcheck-on-contraction-when-autocorrection-is-off.html
new file mode 100644 (file)
index 0000000..5e84078
--- /dev/null
@@ -0,0 +1,24 @@
+<html>
+<head>
+
+<style>
+.editing {
+    border: 2px solid red;
+    padding: 12px;
+    font-size: 24px;
+}
+</style>
+
+<title>Undo Autocorrection Test</title>
+</head>
+<body>
+<p>This test verifies that common contraction is not marked as misspelled when autocorrection is off.</p>
+<p><b>Step 1:</b> Bring up contextual manual, and uncheck "Spelling and Grammar -> Correct Spelling Automatically" and "Substitutions -> Text Replacement".</p>
+<p><b>Step 2:</b> Type "this wasn't", and verify that "wasn't" isn't marked as mispelled.</p>
+<p><b>Step 3:</b> Restore the settings in contextual manual, otherwise it may affect the result of other autocorrection related tests.</p>
+<div contenteditable id="root" class="editing">
+<span id="test"></span>
+</div>
+
+</body>
+</html>