Commit 9ca1914b authored by xiaochengh's avatar xiaochengh Committed by Commit bot

Correct usage of text iterator in idle time spellchecker

Idle time spell checker used to assume that TextIterator::advance()
is no-op when the iterator is already at end, which is incorrect.

This patch fixes the issue by adding |atEnd()| checks.

Note: When at end, TextIterator::advance() should be no-op but is not.
See crbug.com/699747

BUG=679616
TEST=compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents.html

Review-Url: https://codereview.chromium.org/2734393003
Cr-Commit-Position: refs/heads/master@{#455654}
parent 1d11ee28
......@@ -73,11 +73,13 @@ EphemeralRange calculateHotModeCheckingRange(const Element& editable,
.build();
BackwardsCharacterIterator backwardIterator(fullRange.startPosition(),
position, behavior);
backwardIterator.advance(kHotModeChunkSize / 2);
if (!backwardIterator.atEnd())
backwardIterator.advance(kHotModeChunkSize / 2);
const Position& chunkStart = backwardIterator.endPosition();
CharacterIterator forwardIterator(position, fullRange.endPosition(),
behavior);
forwardIterator.advance(kHotModeChunkSize / 2);
if (!forwardIterator.atEnd())
forwardIterator.advance(kHotModeChunkSize / 2);
const Position& chunkEnd = forwardIterator.endPosition();
return expandRangeToSentenceBoundary(EphemeralRange(chunkStart, chunkEnd));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment