Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(605)

Unified Diff: Source/core/editing/TextCheckingHelper.cpp

Issue 15179002: Remove code that is unused after ContextMenu cleanup (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove canHandleRequest code from DRT Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/editing/TextCheckingHelper.h ('k') | Source/core/history/BackForwardController.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/TextCheckingHelper.cpp
diff --git a/Source/core/editing/TextCheckingHelper.cpp b/Source/core/editing/TextCheckingHelper.cpp
index 3f73d045f66d1a25295251c516770ba5c0445d3f..a4595f198f01f697110e9ef518ecf9ae590e0dc5 100644
--- a/Source/core/editing/TextCheckingHelper.cpp
+++ b/Source/core/editing/TextCheckingHelper.cpp
@@ -503,99 +503,6 @@ String TextCheckingHelper::findFirstBadGrammar(GrammarDetail& outGrammarDetail,
return firstBadGrammarPhrase;
}
-
-bool TextCheckingHelper::isUngrammatical(Vector<String>& guessesVector) const
-{
- if (!m_client)
- return false;
-
- if (!m_range || m_range->collapsed(IGNORE_EXCEPTION))
- return false;
-
- // Returns true only if the passed range exactly corresponds to a bad grammar detail range. This is analogous
- // to isSelectionMisspelled. It's not good enough for there to be some bad grammar somewhere in the range,
- // or overlapping the range; the ranges must exactly match.
- guessesVector.clear();
- int grammarPhraseOffset;
-
- GrammarDetail grammarDetail;
- String badGrammarPhrase = const_cast<TextCheckingHelper*>(this)->findFirstBadGrammar(grammarDetail, grammarPhraseOffset, false);
-
- // No bad grammar in these parts at all.
- if (badGrammarPhrase.isEmpty())
- return false;
-
- // Bad grammar, but phrase (e.g. sentence) starts beyond start of range.
- if (grammarPhraseOffset > 0)
- return false;
-
- ASSERT(grammarDetail.location >= 0 && grammarDetail.length > 0);
-
- // Bad grammar, but start of detail (e.g. ungrammatical word) doesn't match start of range
- if (grammarDetail.location + grammarPhraseOffset)
- return false;
-
- // Bad grammar at start of range, but end of bad grammar is before or after end of range
- if (grammarDetail.length != TextIterator::rangeLength(m_range.get()))
- return false;
-
- return true;
-}
-
-Vector<String> TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange(bool checkGrammar, bool& misspelled, bool& ungrammatical) const
-{
- if (!unifiedTextCheckerEnabled())
- return Vector<String>();
-
- Vector<String> guesses;
- misspelled = false;
- ungrammatical = false;
-
- if (!m_client || !m_range || m_range->collapsed(IGNORE_EXCEPTION))
- return guesses;
-
- // Expand the range to encompass entire paragraphs, since text checking needs that much context.
- TextCheckingParagraph paragraph(m_range);
- if (paragraph.isEmpty())
- return guesses;
-
- Vector<TextCheckingResult> results;
- TextCheckingTypeMask checkingTypes = checkGrammar ? (TextCheckingTypeSpelling | TextCheckingTypeGrammar) : TextCheckingTypeSpelling;
- checkTextOfParagraph(m_client->textChecker(), paragraph.textCharacters(), paragraph.textLength(), checkingTypes, results);
-
- for (unsigned i = 0; i < results.size(); i++) {
- const TextCheckingResult* result = &results[i];
- if (result->type == TextCheckingTypeSpelling && paragraph.checkingRangeMatches(result->location, result->length)) {
- String misspelledWord = paragraph.checkingSubstring();
- ASSERT(misspelledWord.length());
- m_client->updateSpellingUIWithMisspelledWord(misspelledWord);
- misspelled = true;
- return guesses;
- }
- }
-
- if (!checkGrammar)
- return guesses;
-
- for (unsigned i = 0; i < results.size(); i++) {
- const TextCheckingResult* result = &results[i];
- if (result->type == TextCheckingTypeGrammar && paragraph.isCheckingRangeCoveredBy(result->location, result->length)) {
- for (unsigned j = 0; j < result->details.size(); j++) {
- const GrammarDetail* detail = &result->details[j];
- ASSERT(detail->length > 0 && detail->location >= 0);
- if (paragraph.checkingRangeMatches(result->location + detail->location, detail->length)) {
- for (unsigned k = 0; k < detail->guesses.size(); k++)
- guesses.append(detail->guesses[k]);
- ungrammatical = true;
- return guesses;
- }
- }
- }
- }
- return guesses;
-}
-
-
void TextCheckingHelper::markAllMisspellings(RefPtr<Range>& firstMisspellingRange)
{
// Use the "markAll" feature of findFirstMisspelling. Ignore the return value and the "out parameter";
« no previous file with comments | « Source/core/editing/TextCheckingHelper.h ('k') | Source/core/history/BackForwardController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698