зеркало из https://github.com/mozilla/gecko-dev.git
Bug 771435 - Fix nsEditor::DoTransaction to use transaction interfaces sanely; r=ehsan
This commit is contained in:
Родитель
aee28e1eec
Коммит
6ef3102fab
|
@ -617,19 +617,7 @@ NS_IMETHODIMP
|
|||
nsEditor::DoTransaction(nsITransaction* aTxn)
|
||||
{
|
||||
if (mPlaceHolderBatch && !mPlaceHolderTxn) {
|
||||
// it's pretty darn amazing how many different types of pointers this
|
||||
// transaction goes through here. I bet this is a record.
|
||||
|
||||
// We start off with an EditTxn since that's what the factory returns.
|
||||
nsRefPtr<EditTxn> editTxn = new PlaceholderTxn();
|
||||
|
||||
// Then we QI to an nsIAbsorbingTransaction to get at placeholder
|
||||
// functionality
|
||||
nsCOMPtr<nsIAbsorbingTransaction> plcTxn;
|
||||
editTxn->QueryInterface(NS_GET_IID(nsIAbsorbingTransaction),
|
||||
getter_AddRefs(plcTxn));
|
||||
// have to use line above instead of "plcTxn = do_QueryInterface(editTxn);"
|
||||
// due to our broken interface model for transactions.
|
||||
nsCOMPtr<nsIAbsorbingTransaction> plcTxn = new PlaceholderTxn();
|
||||
|
||||
// save off weak reference to placeholder txn
|
||||
mPlaceHolderTxn = do_GetWeakReference(plcTxn);
|
||||
|
@ -637,8 +625,7 @@ nsEditor::DoTransaction(nsITransaction* aTxn)
|
|||
// placeholder txn took ownership of this pointer
|
||||
mSelState = nsnull;
|
||||
|
||||
// finally we QI to an nsITransaction since that's what DoTransaction()
|
||||
// expects
|
||||
// QI to an nsITransaction since that's what DoTransaction() expects
|
||||
nsCOMPtr<nsITransaction> theTxn = do_QueryInterface(plcTxn);
|
||||
// we will recurse, but will not hit this case in the nested call
|
||||
DoTransaction(theTxn);
|
||||
|
|
Загрузка…
Ссылка в новой задаче