Title: [149465] trunk/Source/WebCore
Revision
149465
Author
[email protected]
Date
2013-05-01 17:02:29 -0700 (Wed, 01 May 2013)

Log Message

[Mac] Text replacement should use correction indicator
https://bugs.webkit.org/show_bug.cgi?id=115471

Reviewed by Darin Adler.

Support autocorrection panel for text replacements by making AlternativeTextTypeCorrection
handle text replacements as well as automatic spelling correction.

No new tests. Unfortunately this feature is not testable as is. We need to provide some
internals or testRunner methods to make this feature testable in the long term.

* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::timerFired): Trigger both TextCheckingTypeReplacement
and TextCheckingTypeShowCorrectionPanel.

* editing/Editor.cpp:
(WebCore::Editor::markAndReplaceFor): Autocorrection panel maybe used for both
TextCheckingTypeReplacement and TextCheckingTypeShowCorrectionPanel.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149464 => 149465)


--- trunk/Source/WebCore/ChangeLog	2013-05-01 23:46:55 UTC (rev 149464)
+++ trunk/Source/WebCore/ChangeLog	2013-05-02 00:02:29 UTC (rev 149465)
@@ -1,3 +1,24 @@
+2013-05-01  Ryosuke Niwa  <[email protected]>
+
+        [Mac] Text replacement should use correction indicator
+        https://bugs.webkit.org/show_bug.cgi?id=115471
+
+        Reviewed by Darin Adler.
+
+        Support autocorrection panel for text replacements by making AlternativeTextTypeCorrection
+        handle text replacements as well as automatic spelling correction.
+
+        No new tests. Unfortunately this feature is not testable as is. We need to provide some
+        internals or testRunner methods to make this feature testable in the long term.
+
+        * editing/AlternativeTextController.cpp:
+        (WebCore::AlternativeTextController::timerFired): Trigger both TextCheckingTypeReplacement
+        and TextCheckingTypeShowCorrectionPanel.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::markAndReplaceFor): Autocorrection panel maybe used for both
+        TextCheckingTypeReplacement and TextCheckingTypeShowCorrectionPanel.
+
 2013-05-01  Tim Horton  <[email protected]>
 
         Move knowledge of PDF/PostScript MIME types into MIMETypeRegistry

Modified: trunk/Source/WebCore/editing/AlternativeTextController.cpp (149464 => 149465)


--- trunk/Source/WebCore/editing/AlternativeTextController.cpp	2013-05-01 23:46:55 UTC (rev 149464)
+++ trunk/Source/WebCore/editing/AlternativeTextController.cpp	2013-05-02 00:02:29 UTC (rev 149465)
@@ -339,7 +339,7 @@
         VisiblePosition start(selection.start(), selection.affinity());
         VisiblePosition p = startOfWord(start, LeftWordIfOnBoundary);
         VisibleSelection adjacentWords = VisibleSelection(p, start);
-        m_frame->editor()->markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeSpelling | TextCheckingTypeShowCorrectionPanel, adjacentWords.toNormalizedRange().get(), 0);
+        m_frame->editor()->markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeSpelling | TextCheckingTypeReplacement | TextCheckingTypeShowCorrectionPanel, adjacentWords.toNormalizedRange().get(), 0);
     }
         break;
     case AlternativeTextTypeReversion: {

Modified: trunk/Source/WebCore/editing/Editor.cpp (149464 => 149465)


--- trunk/Source/WebCore/editing/Editor.cpp	2013-05-01 23:46:55 UTC (rev 149464)
+++ trunk/Source/WebCore/editing/Editor.cpp	2013-05-02 00:02:29 UTC (rev 149465)
@@ -2246,7 +2246,8 @@
             // In this case the result range just has to touch the spelling range, so we can handle replacing non-word text such as punctuation.
             ASSERT(resultLength > 0 && resultLocation >= 0);
 
-            if (shouldShowCorrectionPanel && (resultEndLocation < spellingRangeEndOffset || resultType != TextCheckingTypeCorrection))
+            if (shouldShowCorrectionPanel && (resultEndLocation < spellingRangeEndOffset
+                || !(resultType & (TextCheckingTypeReplacement | TextCheckingTypeCorrection))))
                 continue;
 
             // Apply replacement if:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to