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

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

Issue 181693003: Have Document::markers() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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/SpellCheckRequester.cpp ('k') | Source/core/editing/SplitTextNodeCommand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/SpellChecker.cpp
diff --git a/Source/core/editing/SpellChecker.cpp b/Source/core/editing/SpellChecker.cpp
index f746ce17fa8293f720e5ee735913e5ec0d3b7098..3f8cb4bb921b158d01dda6bf1a8bbd3095634c75 100644
--- a/Source/core/editing/SpellChecker.cpp
+++ b/Source/core/editing/SpellChecker.cpp
@@ -144,7 +144,7 @@ void SpellChecker::didBeginEditing(Element* element)
void SpellChecker::ignoreSpelling()
{
if (RefPtr<Range> selectedRange = m_frame.selection().toNormalizedRange())
- m_frame.document()->markers()->removeMarkers(selectedRange.get(), DocumentMarker::Spelling);
+ m_frame.document()->markers().removeMarkers(selectedRange.get(), DocumentMarker::Spelling);
}
void SpellChecker::advanceToNextMisspelling(bool startBeforeSelection)
@@ -290,7 +290,7 @@ void SpellChecker::advanceToNextMisspelling(bool startBeforeSelection)
m_frame.selection().setSelection(VisibleSelection(badGrammarRange.get(), SEL_DEFAULT_AFFINITY));
m_frame.selection().revealSelection();
- m_frame.document()->markers()->addMarker(badGrammarRange.get(), DocumentMarker::Grammar, grammarDetail.userDescription);
+ m_frame.document()->markers().addMarker(badGrammarRange.get(), DocumentMarker::Grammar, grammarDetail.userDescription);
} else if (!misspelledWord.isEmpty()) {
// We found a misspelling, but not any earlier bad grammar. Select the misspelling, update the spelling panel, and store
// a marker so we draw the red squiggle later.
@@ -300,7 +300,7 @@ void SpellChecker::advanceToNextMisspelling(bool startBeforeSelection)
m_frame.selection().revealSelection();
spellCheckerClient().updateSpellingUIWithMisspelledWord(misspelledWord);
- m_frame.document()->markers()->addMarker(misspellingRange.get(), DocumentMarker::Spelling);
+ m_frame.document()->markers().addMarker(misspellingRange.get(), DocumentMarker::Spelling);
}
}
@@ -319,7 +319,7 @@ void SpellChecker::clearMisspellingsAndBadGrammar(const VisibleSelection &moving
{
RefPtr<Range> selectedRange = movingSelection.toNormalizedRange();
if (selectedRange)
- m_frame.document()->markers()->removeMarkers(selectedRange.get(), DocumentMarker::MisspellingMarkers());
+ m_frame.document()->markers().removeMarkers(selectedRange.get(), DocumentMarker::MisspellingMarkers());
}
void SpellChecker::markMisspellingsAndBadGrammar(const VisibleSelection &movingSelection)
@@ -569,7 +569,7 @@ void SpellChecker::markAndReplaceFor(PassRefPtr<SpellCheckRequest> request, cons
if (shouldMarkSpelling && result->decoration == TextDecorationTypeSpelling && resultLocation >= paragraph.checkingStart() && resultLocation + resultLength <= spellingRangeEndOffset && !resultEndsAtAmbiguousBoundary) {
ASSERT(resultLength > 0 && resultLocation >= 0);
RefPtr<Range> misspellingRange = paragraph.subrange(resultLocation, resultLength);
- misspellingRange->startContainer()->document().markers()->addMarker(misspellingRange.get(), DocumentMarker::Spelling, result->replacement, result->hash);
+ misspellingRange->startContainer()->document().markers().addMarker(misspellingRange.get(), DocumentMarker::Spelling, result->replacement, result->hash);
} else if (shouldMarkGrammar && result->decoration == TextDecorationTypeGrammar && paragraph.checkingRangeCovers(resultLocation, resultLength)) {
ASSERT(resultLength > 0 && resultLocation >= 0);
for (unsigned j = 0; j < result->details.size(); j++) {
@@ -577,13 +577,13 @@ void SpellChecker::markAndReplaceFor(PassRefPtr<SpellCheckRequest> request, cons
ASSERT(detail->length > 0 && detail->location >= 0);
if (paragraph.checkingRangeCovers(resultLocation + detail->location, detail->length)) {
RefPtr<Range> badGrammarRange = paragraph.subrange(resultLocation + detail->location, detail->length);
- badGrammarRange->startContainer()->document().markers()->addMarker(badGrammarRange.get(), DocumentMarker::Grammar, detail->userDescription, result->hash);
+ badGrammarRange->startContainer()->document().markers().addMarker(badGrammarRange.get(), DocumentMarker::Grammar, detail->userDescription, result->hash);
}
}
} else if (result->decoration == TextDecorationTypeInvisibleSpellcheck && resultLocation >= paragraph.checkingStart() && resultLocation + resultLength <= spellingRangeEndOffset) {
ASSERT(resultLength > 0 && resultLocation >= 0);
RefPtr<Range> invisibleSpellcheckRange = paragraph.subrange(resultLocation, resultLength);
- invisibleSpellcheckRange->startContainer()->document().markers()->addMarker(invisibleSpellcheckRange.get(), DocumentMarker::InvisibleSpellcheck, result->replacement, result->hash);
+ invisibleSpellcheckRange->startContainer()->document().markers().addMarker(invisibleSpellcheckRange.get(), DocumentMarker::InvisibleSpellcheck, result->replacement, result->hash);
}
}
@@ -691,7 +691,7 @@ void SpellChecker::updateMarkersForWordsAffectedByEditing(bool doNotRemoveIfSele
ASSERT(document);
RefPtr<Range> wordRange = Range::create(*document, startOfFirstWord.deepEquivalent(), endOfLastWord.deepEquivalent());
- document->markers()->removeMarkers(wordRange.get(), DocumentMarker::MisspellingMarkers(), DocumentMarkerController::RemovePartiallyOverlappingMarker);
+ document->markers().removeMarkers(wordRange.get(), DocumentMarker::MisspellingMarkers(), DocumentMarkerController::RemovePartiallyOverlappingMarker);
}
void SpellChecker::didEndEditingOnTextField(Element* e)
@@ -705,7 +705,7 @@ void SpellChecker::didEndEditingOnTextField(Element* e)
if (isGrammarCheckingEnabled() || unifiedTextCheckerEnabled())
markerTypes.add(DocumentMarker::Grammar);
for (Node* node = innerText; node; node = NodeTraversal::next(*node, innerText)) {
- m_frame.document()->markers()->removeMarkers(node, markerTypes);
+ m_frame.document()->markers().removeMarkers(node, markerTypes);
}
}
@@ -741,19 +741,19 @@ void SpellChecker::respondToChangedSelection(const VisibleSelection& oldSelectio
if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTypeSpelling)) {
if (RefPtr<Range> wordRange = newAdjacentWords.toNormalizedRange())
- m_frame.document()->markers()->removeMarkers(wordRange.get(), DocumentMarker::Spelling);
+ m_frame.document()->markers().removeMarkers(wordRange.get(), DocumentMarker::Spelling);
}
if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTypeGrammar)) {
if (RefPtr<Range> sentenceRange = newSelectedSentence.toNormalizedRange())
- m_frame.document()->markers()->removeMarkers(sentenceRange.get(), DocumentMarker::Grammar);
+ m_frame.document()->markers().removeMarkers(sentenceRange.get(), DocumentMarker::Grammar);
}
}
// When continuous spell checking is off, existing markers disappear after the selection changes.
if (!isContinuousSpellCheckingEnabled)
- m_frame.document()->markers()->removeMarkers(DocumentMarker::Spelling);
+ m_frame.document()->markers().removeMarkers(DocumentMarker::Spelling);
if (!isContinuousGrammarCheckingEnabled)
- m_frame.document()->markers()->removeMarkers(DocumentMarker::Grammar);
+ m_frame.document()->markers().removeMarkers(DocumentMarker::Grammar);
}
void SpellChecker::spellCheckAfterBlur()
@@ -810,7 +810,7 @@ bool SpellChecker::selectionStartHasMarkerFor(DocumentMarker::MarkerType markerT
unsigned startOffset = static_cast<unsigned>(from);
unsigned endOffset = static_cast<unsigned>(from + length);
- Vector<DocumentMarker*> markers = m_frame.document()->markers()->markersFor(node);
+ Vector<DocumentMarker*> markers = m_frame.document()->markers().markersFor(node);
for (size_t i = 0; i < markers.size(); ++i) {
DocumentMarker* marker = markers[i];
if (marker->startOffset() <= startOffset && endOffset <= marker->endOffset() && marker->type() == markerType)
« no previous file with comments | « Source/core/editing/SpellCheckRequester.cpp ('k') | Source/core/editing/SplitTextNodeCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698