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

Unified Diff: Source/core/editing/spellcheck/SpellChecker.cpp

Issue 1313863002: Make SpellChecker::markAllMisspellingsAndBadGrammarInRanges() to take EphemeralRange (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-25T15:52:55 Created 5 years, 4 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/spellcheck/SpellChecker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/spellcheck/SpellChecker.cpp
diff --git a/Source/core/editing/spellcheck/SpellChecker.cpp b/Source/core/editing/spellcheck/SpellChecker.cpp
index 3b6dca0141cd6976d44c033a72fb94d20571a95b..91a56817ec2eaf07347d3d3186bf68edc7c2152d 100644
--- a/Source/core/editing/spellcheck/SpellChecker.cpp
+++ b/Source/core/editing/spellcheck/SpellChecker.cpp
@@ -363,8 +363,8 @@ void SpellChecker::markMisspellingsAfterLineBreak(const VisibleSelection& wordSe
endOfParagraph(wordSelection.visibleEnd()));
markAllMisspellingsAndBadGrammarInRanges(
- textCheckingOptions, wordSelection.toNormalizedRange().get(),
- wholeParagraph.toNormalizedRange().get());
+ textCheckingOptions, wordSelection.toNormalizedEphemeralRange(),
+ wholeParagraph.toNormalizedEphemeralRange());
} else {
RefPtrWillBeRawPtr<Range> misspellingRange = nullptr;
markMisspellings(wordSelection, misspellingRange);
@@ -390,9 +390,9 @@ void SpellChecker::markMisspellingsAfterTypingToWord(const VisiblePosition &word
VisibleSelection adjacentWords = VisibleSelection(startOfWord(wordStart, LeftWordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary));
if (textCheckingOptions & TextCheckingTypeGrammar) {
VisibleSelection selectedSentence = VisibleSelection(startOfSentence(wordStart), endOfSentence(wordStart));
- markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, adjacentWords.toNormalizedRange().get(), selectedSentence.toNormalizedRange().get());
+ markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, adjacentWords.toNormalizedEphemeralRange(), selectedSentence.toNormalizedEphemeralRange());
} else {
- markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, adjacentWords.toNormalizedRange().get(), adjacentWords.toNormalizedRange().get());
+ markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, adjacentWords.toNormalizedEphemeralRange(), adjacentWords.toNormalizedEphemeralRange());
}
return;
}
@@ -468,25 +468,25 @@ void SpellChecker::markBadGrammar(const VisibleSelection& selection)
markMisspellingsOrBadGrammar(selection, false, firstMisspellingRange);
}
-void SpellChecker::markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask textCheckingOptions, Range* spellingRange, Range* grammarRange)
+void SpellChecker::markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask textCheckingOptions, const EphemeralRange& spellingRange, const EphemeralRange& grammarRange)
{
ASSERT(unifiedTextCheckerEnabled());
bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar;
// This function is called with selections already expanded to word boundaries.
- if (!spellingRange || (shouldMarkGrammar && !grammarRange))
+ if (spellingRange.isNull() || (shouldMarkGrammar && grammarRange.isNull()))
return;
// If we're not in an editable node, bail.
- Node* editableNode = spellingRange->startContainer();
+ Node* editableNode = spellingRange.startPosition().computeContainerNode();
if (!editableNode || !editableNode->hasEditableStyle())
return;
if (!isSpellCheckingEnabledFor(editableNode))
return;
- Range* rangeToCheck = shouldMarkGrammar ? grammarRange : spellingRange;
+ RefPtrWillBeRawPtr<Range> rangeToCheck = createRange(shouldMarkGrammar ? grammarRange : spellingRange);
TextCheckingParagraph fullParagraphToCheck(rangeToCheck);
bool asynchronous = frame().settings() && frame().settings()->asynchronousSpellCheckingEnabled();
@@ -643,7 +643,7 @@ void SpellChecker::markMisspellingsAndBadGrammar(const VisibleSelection& spellin
TextCheckingTypeMask textCheckingOptions = TextCheckingTypeSpelling;
if (markGrammar && isGrammarCheckingEnabled())
textCheckingOptions |= TextCheckingTypeGrammar;
- markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, spellingSelection.toNormalizedRange().get(), grammarSelection.toNormalizedRange().get());
+ markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, spellingSelection.toNormalizedEphemeralRange(), grammarSelection.toNormalizedEphemeralRange());
return;
}
« no previous file with comments | « Source/core/editing/spellcheck/SpellChecker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698