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

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

Issue 1369713002: Avoid creating duplicate Range objects when handling misspellings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
index 5913a2a0e977499d88af5819e257d577bd64c6fd..a7fc286648cfc8cad3b14e1732f8211fbc6b9e22 100644
--- a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
+++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
@@ -517,13 +517,13 @@ void SpellChecker::chunkAndMarkAllMisspellingsAndBadGrammar(TextCheckingTypeMask
const int kNumChunksToCheck = asynchronous ? (end - start + kChunkSize - 1) / (kChunkSize) : 1;
int currentChunkStart = start;
if (kNumChunksToCheck == 1 && asynchronous) {
- EphemeralRange checkRange = fullParagraphToCheck.checkingRange();
+ const EphemeralRange checkRange = fullParagraphToCheck.checkingRange();
yosin_UTC9 2015/09/26 04:56:00 nit: better in another patch. Sorry, I forgot to a
sof 2015/09/26 06:59:44 A minor tidyup in any case, but reverted it from t
markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, checkRange, checkRange, asynchronous, 0);
return;
}
for (int iter = 0; iter < kNumChunksToCheck; ++iter) {
- EphemeralRange checkRange = expandRangeToSentenceBoundary(fullParagraphToCheck.subrange(currentChunkStart, kChunkSize));
+ const EphemeralRange checkRange = expandRangeToSentenceBoundary(fullParagraphToCheck.subrange(currentChunkStart, kChunkSize));
yosin_UTC9 2015/09/26 04:55:59 nit: better in another patch. Sorry, I forgot to a
sof 2015/09/26 06:59:43 Same.
int checkingLength = 0;
markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, checkRange, checkRange, asynchronous, iter, &checkingLength);
@@ -537,7 +537,9 @@ void SpellChecker::markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask
if (checkingLength)
*checkingLength = sentenceToCheck.checkingLength();
- RefPtrWillBeRawPtr<SpellCheckRequest> request = SpellCheckRequest::create(resolveTextCheckingTypeMask(textCheckingOptions), TextCheckingProcessBatch, createRange(checkRange), createRange(paragraphRange), requestNumber);
+ RefPtrWillBeRawPtr<Range> checkRangeObject = createRange(checkRange);
+ RefPtrWillBeRawPtr<Range> paragraphRangeObject = (checkRange == paragraphRange) ? checkRangeObject.get() : createRange(paragraphRange).get();
+ RefPtrWillBeRawPtr<SpellCheckRequest> request = SpellCheckRequest::create(resolveTextCheckingTypeMask(textCheckingOptions), TextCheckingProcessBatch, checkRangeObject, paragraphRangeObject, requestNumber);
yosin_UTC9 2015/09/26 04:55:59 Could you do this in |SpellCheckRequest::create()|
sof 2015/09/26 06:59:44 That's well worthwhile, pushed the Range conversio
if (!request)
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698