+2013-05-01 Ryosuke Niwa <rniwa@webkit.org>
+
+ [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 <timothy_horton@apple.com>
Move knowledge of PDF/PostScript MIME types into MIMETypeRegistry
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: {
// 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: