Bug 1243657 spellchecker should check if IME composition works as deleting whole text r=ehsan

This commit is contained in:
Masayuki Nakano 2016-01-30 09:56:03 +09:00
parent 447781660a
commit d9af3563da

View File

@ -134,7 +134,17 @@ mozInlineSpellStatus::InitForEditorChange(
getter_AddRefs(mAnchorRange)); getter_AddRefs(mAnchorRange));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
if (aAction == EditAction::deleteSelection) { nsCOMPtr<nsINode> prevNode = do_QueryInterface(aPreviousNode);
NS_ENSURE_STATE(prevNode);
bool deleted = aAction == EditAction::deleteSelection;
if (aAction == EditAction::insertIMEText) {
// IME may remove the previous node if it cancels composition when
// there is no text around the composition.
deleted = !prevNode->IsInComposedDoc();
}
if (deleted) {
// Deletes are easy, the range is just the current anchor. We set the range // Deletes are easy, the range is just the current anchor. We set the range
// to check to be empty, FinishInitOnEvent will fill in the range to be // to check to be empty, FinishInitOnEvent will fill in the range to be
// the current word. // the current word.
@ -146,9 +156,6 @@ mozInlineSpellStatus::InitForEditorChange(
mOp = eOpChange; mOp = eOpChange;
// range to check // range to check
nsCOMPtr<nsINode> prevNode = do_QueryInterface(aPreviousNode);
NS_ENSURE_STATE(prevNode);
mRange = new nsRange(prevNode); mRange = new nsRange(prevNode);
// ...we need to put the start and end in the correct order // ...we need to put the start and end in the correct order