mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-20 18:08:19 +00:00
Bug 1480055 - part 3: Create non-virtual method to set EditorBase::mAllowsTransactionsToChangeSelection r=m_kato
There is no non-virtual method to modify EditorBase::mAllowsTransactionsToChangeSelection. Therefore, AutoTransactionsConserveSelection calls virtual method, nsIEditor::SetShouldTxnSetSelection() twice (from both constructor and destructor). So, we should save this unnecessary cost. MozReview-Commit-ID: B7TYGnGtuLB --HG-- extra : rebase_source : 26ce77fb63a1967cca88b002cd65e1105477a63d
This commit is contained in:
parent
a9559a1d82
commit
4292293e8c
@ -985,7 +985,7 @@ EditorBase::EndPlaceholderTransaction()
|
||||
NS_IMETHODIMP
|
||||
EditorBase::SetShouldTxnSetSelection(bool aShould)
|
||||
{
|
||||
mAllowsTransactionsToChangeSelection = aShould;
|
||||
MakeThisAllowTransactionsToChangeSelection(aShould);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1556,6 +1556,16 @@ protected: // May be called by friends.
|
||||
return mAllowsTransactionsToChangeSelection;
|
||||
}
|
||||
|
||||
/**
|
||||
* MakeThisAllowTransactionsToChangeSelection() with true makes this editor
|
||||
* allow transactions to change Selection. Otherwise, i.e., with false,
|
||||
* makes this editor not allow transactions to change Selection.
|
||||
*/
|
||||
inline void MakeThisAllowTransactionsToChangeSelection(bool aAllow)
|
||||
{
|
||||
mAllowsTransactionsToChangeSelection = aAllow;
|
||||
}
|
||||
|
||||
nsresult HandleInlineSpellCheck(EditSubAction aEditSubAction,
|
||||
Selection& aSelection,
|
||||
nsINode* previousSelectedNode,
|
||||
|
@ -581,14 +581,14 @@ public:
|
||||
if (mEditorBase) {
|
||||
mAllowedTransactionsToChangeSelection =
|
||||
mEditorBase->AllowsTransactionsToChangeSelection();
|
||||
mEditorBase->SetShouldTxnSetSelection(false);
|
||||
mEditorBase->MakeThisAllowTransactionsToChangeSelection(false);
|
||||
}
|
||||
}
|
||||
|
||||
~AutoTransactionsConserveSelection()
|
||||
{
|
||||
if (mEditorBase) {
|
||||
mEditorBase->SetShouldTxnSetSelection(
|
||||
mEditorBase->MakeThisAllowTransactionsToChangeSelection(
|
||||
mAllowedTransactionsToChangeSelection);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user