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 4847455e2c
commit e754f176cf
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);
}
}
}
}