Title: [122380] trunk/Source/WebCore
Revision
122380
Author
[email protected]
Date
2012-07-11 15:48:49 -0700 (Wed, 11 Jul 2012)

Log Message

On Mac, autocorrection sometimes fails to take place in Safari.
https://bugs.webkit.org/show_bug.cgi?id=89982

Reviewed by Ryosuke Niwa.

We should check the value of shouldCheckForCorrection, not shouldShowCorrectionPanel, to determine if we should
early return in markAndReplaceFor(). Also, since we don't want autocorrection to happen when we only change selection,
not the content, so we shouldn't set TextCheckingTypeCorrection flag in markMisspellingsAndBadGrammar() as this function
is triggered only by selection change.

* editing/Editor.cpp:
(WebCore::Editor::markAndReplaceFor):
(WebCore::Editor::markMisspellingsAndBadGrammar):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (122379 => 122380)


--- trunk/Source/WebCore/ChangeLog	2012-07-11 22:42:29 UTC (rev 122379)
+++ trunk/Source/WebCore/ChangeLog	2012-07-11 22:48:49 UTC (rev 122380)
@@ -1,3 +1,19 @@
+2012-07-11  Jia Pu  <[email protected]>
+
+        On Mac, autocorrection sometimes fails to take place in Safari.
+        https://bugs.webkit.org/show_bug.cgi?id=89982
+
+        Reviewed by Ryosuke Niwa.
+
+        We should check the value of shouldCheckForCorrection, not shouldShowCorrectionPanel, to determine if we should
+        early return in markAndReplaceFor(). Also, since we don't want autocorrection to happen when we only change selection,
+        not the content, so we shouldn't set TextCheckingTypeCorrection flag in markMisspellingsAndBadGrammar() as this function
+        is triggered only by selection change.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::markAndReplaceFor):
+        (WebCore::Editor::markMisspellingsAndBadGrammar):
+
 2012-07-11  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r122361.

Modified: trunk/Source/WebCore/editing/Editor.cpp (122379 => 122380)


--- trunk/Source/WebCore/editing/Editor.cpp	2012-07-11 22:42:29 UTC (rev 122379)
+++ trunk/Source/WebCore/editing/Editor.cpp	2012-07-11 22:48:49 UTC (rev 122380)
@@ -2085,7 +2085,7 @@
             if (result->type == TextCheckingTypeLink && selectionOffset > resultLocation + resultLength + 1)
                 continue;
 
-            if (!(shouldPerformReplacement || shouldShowCorrectionPanel || shouldMarkLink) || !doReplacement)
+            if (!(shouldPerformReplacement || shouldCheckForCorrection || shouldMarkLink) || !doReplacement)
                 continue;
 
             String replacedString = plainText(rangeToReplace.get());
@@ -2188,7 +2188,9 @@
     if (unifiedTextCheckerEnabled()) {
         if (!isContinuousSpellCheckingEnabled())
             return;
-        TextCheckingTypeMask textCheckingOptions = TextCheckingTypeSpelling | TextCheckingTypeCorrection;
+
+        // markMisspellingsAndBadGrammar() is triggered by selection change, in which case we check spelling and grammar, but don't autocorrect misspellings.
+        TextCheckingTypeMask textCheckingOptions = TextCheckingTypeSpelling;
         if (markGrammar && isGrammarCheckingEnabled())
             textCheckingOptions |= TextCheckingTypeGrammar;
         markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, spellingSelection.toNormalizedRange().get(), grammarSelection.toNormalizedRange().get());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to