- Revision
- 96568
- Author
- commit-qu...@webkit.org
- Date
- 2011-10-03 20:10:54 -0700 (Mon, 03 Oct 2011)
Log Message
Should call checkTextOfParagraph() indirectly to make unifying spell-checking code path easy.
https://bugs.webkit.org/show_bug.cgi?id=69241
Patch by Shinya Kawanaka <shin...@google.com> on 2011-10-03
Reviewed by Ryosuke Niwa.
WebCore has two different code paths for spell-checking:
1) checkTextOfParagraph() for Snow Leopard or later
2) checkSpellingOfString() for checkGrammarOfString() for other platforms.
At the first step, this patch introduces an indirect wrapper to call
checkTextOfParagraph() in Snow Leopard or later. This is intended to make it easy to
introduce a function for mimicing checkTextOfParagraph() in Chromium platform or
other non-SL or non-Lion platform.
No new tests because this patch does not change a behavior.
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::hasMisspelling): Calling checkTextOfParagraph() indirectly.
* accessibility/mac/WebAccessibilityObjectWrapper.mm:
(AXAttributeStringSetSpelling): ditto.
* editing/Editor.cpp:
(WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): ditto.
* editing/TextCheckingHelper.cpp:
(WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar): ditto.
(WebCore::TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange): ditto.
(WebCore::checkTextOfParagraph): Added.
* editing/TextCheckingHelper.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (96567 => 96568)
--- trunk/Source/WebCore/ChangeLog 2011-10-04 02:55:54 UTC (rev 96567)
+++ trunk/Source/WebCore/ChangeLog 2011-10-04 03:10:54 UTC (rev 96568)
@@ -1,3 +1,33 @@
+2011-10-03 Shinya Kawanaka <shin...@google.com>
+
+ Should call checkTextOfParagraph() indirectly to make unifying spell-checking code path easy.
+ https://bugs.webkit.org/show_bug.cgi?id=69241
+
+ Reviewed by Ryosuke Niwa.
+
+ WebCore has two different code paths for spell-checking:
+ 1) checkTextOfParagraph() for Snow Leopard or later
+ 2) checkSpellingOfString() for checkGrammarOfString() for other platforms.
+
+ At the first step, this patch introduces an indirect wrapper to call
+ checkTextOfParagraph() in Snow Leopard or later. This is intended to make it easy to
+ introduce a function for mimicing checkTextOfParagraph() in Chromium platform or
+ other non-SL or non-Lion platform.
+
+ No new tests because this patch does not change a behavior.
+
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::hasMisspelling): Calling checkTextOfParagraph() indirectly.
+ * accessibility/mac/WebAccessibilityObjectWrapper.mm:
+ (AXAttributeStringSetSpelling): ditto.
+ * editing/Editor.cpp:
+ (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): ditto.
+ * editing/TextCheckingHelper.cpp:
+ (WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar): ditto.
+ (WebCore::TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange): ditto.
+ (WebCore::checkTextOfParagraph): Added.
+ * editing/TextCheckingHelper.h:
+
2011-10-03 Darin Adler <da...@apple.com>
Change cursor to hand over missing plug-in message
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (96567 => 96568)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2011-10-04 02:55:54 UTC (rev 96567)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2011-10-04 03:10:54 UTC (rev 96568)
@@ -291,7 +291,7 @@
#if USE(UNIFIED_TEXT_CHECKING)
Vector<TextCheckingResult> results;
- textChecker->checkTextOfParagraph(chars, charsLength, TextCheckingTypeSpelling, results);
+ checkTextOfParagraph(textChecker, chars, charsLength, TextCheckingTypeSpelling, results);
if (!results.isEmpty())
isMisspelled = true;
#else
Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm (96567 => 96568)
--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm 2011-10-04 02:55:54 UTC (rev 96567)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm 2011-10-04 03:10:54 UTC (rev 96568)
@@ -694,7 +694,7 @@
// checkTextOfParagraph is the only spelling/grammar checker implemented in WK1 and WK2
Vector<TextCheckingResult> results;
- checker->checkTextOfParagraph(chars, charLength, TextCheckingTypeSpelling, results);
+ checkTextOfParagraph(checker, chars, charLength, TextCheckingTypeSpelling, results);
size_t size = results.size();
NSNumber* trueValue = [NSNumber numberWithBool:YES];
Modified: trunk/Source/WebCore/editing/Editor.cpp (96567 => 96568)
--- trunk/Source/WebCore/editing/Editor.cpp 2011-10-04 02:55:54 UTC (rev 96567)
+++ trunk/Source/WebCore/editing/Editor.cpp 2011-10-04 03:10:54 UTC (rev 96568)
@@ -2142,10 +2142,10 @@
Vector<TextCheckingResult> results;
if (shouldMarkGrammar)
- textChecker()->checkTextOfParagraph(grammarParagraph.textCharacters(), grammarParagraph.textLength(),
+ checkTextOfParagraph(textChecker(), grammarParagraph.textCharacters(), grammarParagraph.textLength(),
resolveTextCheckingTypeMask(textCheckingOptions), results);
else
- textChecker()->checkTextOfParagraph(spellingParagraph.textCharacters(), spellingParagraph.textLength(),
+ checkTextOfParagraph(textChecker(), spellingParagraph.textCharacters(), spellingParagraph.textLength(),
resolveTextCheckingTypeMask(textCheckingOptions), results);
Modified: trunk/Source/WebCore/editing/TextCheckingHelper.cpp (96567 => 96568)
--- trunk/Source/WebCore/editing/TextCheckingHelper.cpp 2011-10-04 02:55:54 UTC (rev 96567)
+++ trunk/Source/WebCore/editing/TextCheckingHelper.cpp 2011-10-04 03:10:54 UTC (rev 96568)
@@ -276,7 +276,7 @@
Vector<TextCheckingResult> results;
TextCheckingTypeMask checkingTypes = checkGrammar ? (TextCheckingTypeSpelling | TextCheckingTypeGrammar) : TextCheckingTypeSpelling;
- m_client->textChecker()->checkTextOfParagraph(paragraphString.characters(), paragraphString.length(), checkingTypes, results);
+ checkTextOfParagraph(m_client->textChecker(), paragraphString.characters(), paragraphString.length(), checkingTypes, results);
for (unsigned i = 0; i < results.size(); i++) {
const TextCheckingResult* result = &results[i];
@@ -526,7 +526,7 @@
Vector<TextCheckingResult> results;
TextCheckingTypeMask checkingTypes = checkGrammar ? (TextCheckingTypeSpelling | TextCheckingTypeGrammar) : TextCheckingTypeSpelling;
- m_client->textChecker()->checkTextOfParagraph(paragraph.textCharacters(), paragraph.textLength(), checkingTypes, results);
+ checkTextOfParagraph(m_client->textChecker(), paragraph.textCharacters(), paragraph.textLength(), checkingTypes, results);
for (unsigned i = 0; i < results.size(); i++) {
const TextCheckingResult* result = &results[i];
@@ -590,4 +590,21 @@
findFirstBadGrammar(ignoredGrammarDetail, ignoredOffset, true);
}
+void checkTextOfParagraph(TextCheckerClient* client, const UChar* text, int length,
+ TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results)
+{
+#if USE(UNIFIED_TEXT_CHECKING)
+ client->checkTextOfParagraph(text, length, checkingTypes, results);
+#else
+ // Should implement later to unify unified spell-checking code path and
+ // legacy spell-checking code path.
+ ASSERT_NOT_REACHED();
+ UNUSED_PARAM(client);
+ UNUSED_PARAM(text);
+ UNUSED_PARAM(length);
+ UNUSED_PARAM(checkingTypes);
+ UNUSED_PARAM(results);
+#endif
}
+
+}
Modified: trunk/Source/WebCore/editing/TextCheckingHelper.h (96567 => 96568)
--- trunk/Source/WebCore/editing/TextCheckingHelper.h 2011-10-04 02:55:54 UTC (rev 96567)
+++ trunk/Source/WebCore/editing/TextCheckingHelper.h 2011-10-04 03:10:54 UTC (rev 96568)
@@ -92,6 +92,9 @@
RefPtr<Range> m_range;
};
+void checkTextOfParagraph(TextCheckerClient*, const UChar* text, int length,
+ TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results);
+
} // namespace WebCore
#endif // TextCheckingHelper_h