Bug 743819 - Only re-spellcheck new nodes on insertions, not everything; r=ehsan

This commit is contained in:
Aryeh Gregor 2012-04-25 08:56:32 +03:00
parent 4d832b0653
commit 3f9b2b76b7
2 changed files with 13 additions and 6 deletions

View File

@ -9250,7 +9250,4 @@ nsHTMLEditRules::DocumentModifiedWorker()
// Try to recreate the bogus node if needed.
CreateBogusNodeIfNeeded(selection);
// Reset the spell checker
mEditor->SyncRealTimeSpell();
}

View File

@ -3506,14 +3506,14 @@ NS_IMETHODIMP nsHTMLEditor::InsertTextImpl(const nsAString& aStringToInsert,
void
nsHTMLEditor::ContentAppended(nsIDocument *aDocument, nsIContent* aContainer,
nsIContent* aFirstNewContent,
PRInt32 /* unused */)
PRInt32 aIndexInContainer)
{
ContentInserted(aDocument, aContainer, aFirstNewContent, 0);
ContentInserted(aDocument, aContainer, aFirstNewContent, aIndexInContainer);
}
void
nsHTMLEditor::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer,
nsIContent* aChild, PRInt32 /* unused */)
nsIContent* aChild, PRInt32 aIndexInContainer)
{
if (!aChild) {
return;
@ -3531,6 +3531,16 @@ nsHTMLEditor::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer,
return;
}
mRules->DocumentModified();
// Update spellcheck for only the newly-inserted node (bug 743819)
if (mInlineSpellChecker) {
nsRefPtr<nsRange> range = new nsRange();
nsresult res = range->Set(aContainer, aIndexInContainer,
aContainer, aIndexInContainer + 1);
if (NS_SUCCEEDED(res)) {
mInlineSpellChecker->SpellCheckRange(range);
}
}
}
}