Bug 580151 - Part 1: Move the increment up in case the call to nsIEditor::GetSelection fails and we bail out early; r=roc

--HG--
extra : rebase_source : 249cf74c6a1700b230d946793819ff6611ebbb99
This commit is contained in:
Ehsan Akhgari 2010-07-20 09:04:14 -04:00
parent 3541b2238b
commit 25f6280420

View File

@ -221,6 +221,12 @@ nsTextEditRules::BeforeEdit(PRInt32 action, nsIEditor::EDirection aDirection)
nsAutoLockRulesSniffing lockIt(this);
mDidExplicitlySetInterline = PR_FALSE;
if (!mActionNesting)
{
// let rules remember the top level action
mTheAction = action;
}
mActionNesting++;
// get the selection and cache the position before editing
nsCOMPtr<nsISelection> selection;
@ -230,12 +236,6 @@ nsTextEditRules::BeforeEdit(PRInt32 action, nsIEditor::EDirection aDirection)
selection->GetAnchorNode(getter_AddRefs(mCachedSelectionNode));
selection->GetAnchorOffset(&mCachedSelectionOffset);
if (!mActionNesting)
{
// let rules remember the top level action
mTheAction = action;
}
mActionNesting++;
return NS_OK;
}