| Index: Source/core/editing/Editor.cpp
|
| diff --git a/Source/core/editing/Editor.cpp b/Source/core/editing/Editor.cpp
|
| index 556bf22118b5062b2757cdff56c926b01b243d6b..db17a00518cc256351b7c7781f7f5f1348003d93 100644
|
| --- a/Source/core/editing/Editor.cpp
|
| +++ b/Source/core/editing/Editor.cpp
|
| @@ -419,9 +419,9 @@ void Editor::replaceSelectionWithFragment(PassRefPtr<DocumentFragment> fragment,
|
| Node* nodeToCheck = m_frame->selection()->rootEditableElement();
|
| if (!nodeToCheck)
|
| return;
|
| -
|
| RefPtr<Range> rangeToCheck = Range::create(m_frame->document(), firstPositionInNode(nodeToCheck), lastPositionInNode(nodeToCheck));
|
| - m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(resolveTextCheckingTypeMask(TextCheckingTypeSpelling | TextCheckingTypeGrammar), TextCheckingProcessBatch, rangeToCheck, rangeToCheck));
|
| + TextCheckingParagraph textToCheck(rangeToCheck, rangeToCheck);
|
| + chunkAndMarkAllMisspellingsAndBadGrammar(resolveTextCheckingTypeMask(TextCheckingTypeSpelling | TextCheckingTypeGrammar), textToCheck, true);
|
| }
|
|
|
| void Editor::replaceSelectionWithText(const String& text, bool selectReplacement, bool smartReplace)
|
| @@ -1509,6 +1509,13 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask textC
|
|
|
| Range* rangeToCheck = shouldMarkGrammar ? grammarRange : spellingRange;
|
| TextCheckingParagraph fullParagraphToCheck(rangeToCheck);
|
| +
|
| + bool asynchronous = m_frame && m_frame->settings() && m_frame->settings()->asynchronousSpellCheckingEnabled();
|
| + chunkAndMarkAllMisspellingsAndBadGrammar(textCheckingOptions, fullParagraphToCheck, asynchronous);
|
| +}
|
| +
|
| +void Editor::chunkAndMarkAllMisspellingsAndBadGrammar(TextCheckingTypeMask textCheckingOptions, const TextCheckingParagraph& fullParagraphToCheck, bool asynchronous)
|
| +{
|
| if (fullParagraphToCheck.isRangeEmpty() || fullParagraphToCheck.isEmpty())
|
| return;
|
|
|
| @@ -1518,10 +1525,9 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask textC
|
| int end = fullParagraphToCheck.checkingEnd();
|
| start = std::min(start, end);
|
| end = std::max(start, end);
|
| - bool asynchronous = m_frame && m_frame->settings() && m_frame->settings()->asynchronousSpellCheckingEnabled();
|
| const int kNumChunksToCheck = asynchronous ? (end - start + kChunkSize - 1) / (kChunkSize) : 1;
|
| int currentChunkStart = start;
|
| - RefPtr<Range> checkRange = asynchronous ? fullParagraphToCheck.paragraphRange() : rangeToCheck;
|
| + RefPtr<Range> checkRange = asynchronous ? fullParagraphToCheck.paragraphRange() : fullParagraphToCheck.checkingRange();
|
| RefPtr<Range> paragraphRange = fullParagraphToCheck.paragraphRange();
|
| if (kNumChunksToCheck == 1 && asynchronous) {
|
| markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, checkRange.get(), paragraphRange.get(), asynchronous, 0);
|
|
|