зеркало из https://github.com/mozilla/gecko-dev.git
Bug 765595 part 2 - De-COMtaminate nsEditor::mTxnMgr; r=ehsan
This commit is contained in:
Родитель
2f08b098d4
Коммит
538ef8bff3
|
@ -121,6 +121,7 @@ INCLUDES += \
|
|||
-I$(srcdir)/../../../../dom/base \
|
||||
-I$(srcdir)/../../../../editor/libeditor/base \
|
||||
-I$(srcdir)/../../../../editor/libeditor/text \
|
||||
-I$(srcdir)/../../../../editor/txmgr/src \
|
||||
-I$(srcdir) \
|
||||
-I$(topsrcdir)/xpcom/ds \
|
||||
$(NULL)
|
||||
|
|
|
@ -58,6 +58,7 @@ include $(topsrcdir)/config/rules.mk
|
|||
|
||||
INCLUDES += \
|
||||
-I$(topsrcdir)/editor/libeditor/text \
|
||||
-I$(topsrcdir)/editor/txmgr/src \
|
||||
-I$(topsrcdir)/content/base/src \
|
||||
-I$(topsrcdir)/content/events/src \
|
||||
-I$(topsrcdir)/layout/style \
|
||||
|
|
|
@ -165,7 +165,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsEditor)
|
|||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mRootElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mInlineSpellChecker)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTxnMgr)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mTxnMgr, nsITransactionManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mIMETextRangeList)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mIMETextNode)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(mActionListeners)
|
||||
|
@ -709,26 +709,14 @@ nsEditor::DoTransaction(nsITransaction* aTxn)
|
|||
NS_IMETHODIMP
|
||||
nsEditor::EnableUndo(bool aEnable)
|
||||
{
|
||||
nsresult result=NS_OK;
|
||||
|
||||
if (true==aEnable)
|
||||
{
|
||||
if (!mTxnMgr)
|
||||
{
|
||||
mTxnMgr = do_CreateInstance(NS_TRANSACTIONMANAGER_CONTRACTID, &result);
|
||||
if (NS_FAILED(result) || !mTxnMgr) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
}
|
||||
mTxnMgr->SetMaxTransactionCount(-1);
|
||||
}
|
||||
else
|
||||
{ // disable the transaction manager if it is enabled
|
||||
if (mTxnMgr)
|
||||
{
|
||||
mTxnMgr->Clear();
|
||||
mTxnMgr->SetMaxTransactionCount(0);
|
||||
if (aEnable) {
|
||||
if (!mTxnMgr) {
|
||||
mTxnMgr = new nsTransactionManager();
|
||||
}
|
||||
} else if (mTxnMgr) {
|
||||
// disable the transaction manager if it is enabled
|
||||
mTxnMgr->Clear();
|
||||
mTxnMgr->SetMaxTransactionCount(0);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -765,7 +753,8 @@ nsEditor::SetTransactionManager(nsITransactionManager *aTxnManager)
|
|||
{
|
||||
NS_ENSURE_TRUE(aTxnManager, NS_ERROR_FAILURE);
|
||||
|
||||
mTxnMgr = aTxnManager;
|
||||
// nsITransactionManager is builtinclass, so this is safe
|
||||
mTxnMgr = static_cast<nsTransactionManager*>(aTxnManager);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "mozilla/Selection.h"
|
||||
#include "nsIDOMCharacterData.h"
|
||||
#include "nsIPrivateTextRange.h"
|
||||
#include "nsITransactionManager.h"
|
||||
#include "nsTransactionManager.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsIEditActionListener.h"
|
||||
|
@ -821,7 +821,7 @@ protected:
|
|||
|
||||
nsCOMPtr<nsIInlineSpellChecker> mInlineSpellChecker;
|
||||
|
||||
nsCOMPtr<nsITransactionManager> mTxnMgr;
|
||||
nsRefPtr<nsTransactionManager> mTxnMgr;
|
||||
nsCOMPtr<mozilla::dom::Element> mRootElement; // cached root node
|
||||
nsCOMPtr<nsIPrivateTextRangeList> mIMETextRangeList; // IME special selection ranges
|
||||
nsCOMPtr<nsIDOMCharacterData> mIMETextNode; // current IME text node
|
||||
|
|
|
@ -55,5 +55,6 @@ include $(topsrcdir)/config/rules.mk
|
|||
|
||||
INCLUDES += -I$(topsrcdir)/editor/libeditor/base \
|
||||
-I$(topsrcdir)/editor/libeditor/text \
|
||||
-I$(topsrcdir)/editor/txmgr/src \
|
||||
-I$(topsrcdir)/content/base/src \
|
||||
$(NULL)
|
||||
|
|
|
@ -34,5 +34,6 @@ include $(topsrcdir)/config/rules.mk
|
|||
|
||||
INCLUDES += \
|
||||
-I$(topsrcdir)/editor/libeditor/base \
|
||||
-I$(topsrcdir)/editor/txmgr/src \
|
||||
-I$(topsrcdir)/content/base/src \
|
||||
$(NULL)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* This interface is implemented by an object that wants to
|
||||
* manage/track transactions.
|
||||
*/
|
||||
[scriptable, uuid(58e330c2-7b48-11d2-98b9-00805f297d89)]
|
||||
[scriptable, builtinclass, uuid(58e330c2-7b48-11d2-98b9-00805f297d89)]
|
||||
interface nsITransactionManager : nsISupports
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
#include "nsCOMArray.h"
|
||||
#include "nsITransactionListener.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsTransactionStack.h"
|
||||
|
||||
class nsITransaction;
|
||||
class nsITransactionListener;
|
||||
class nsTransactionItem;
|
||||
class nsTransactionStack;
|
||||
|
||||
/** implementation of a transaction manager object.
|
||||
*
|
||||
|
|
|
@ -251,6 +251,7 @@ LOCAL_INCLUDES += -I$(srcdir)/../base \
|
|||
-I$(topsrcdir)/editor/libeditor/base \
|
||||
-I$(topsrcdir)/editor/libeditor/text \
|
||||
-I$(topsrcdir)/editor/libeditor/html \
|
||||
-I$(topsrcdir)/editor/txmgr/src \
|
||||
-I$(topsrcdir)/editor/txtsvc/src \
|
||||
-I$(topsrcdir)/editor/composer/src \
|
||||
-I$(topsrcdir)/js/xpconnect/src \
|
||||
|
|
|
@ -61,6 +61,7 @@ LOCAL_INCLUDES = \
|
|||
-I$(srcdir)/../../content/html/content/src \
|
||||
-I$(srcdir)/../../editor/libeditor/base \
|
||||
-I$(srcdir)/../../editor/libeditor/text \
|
||||
-I$(srcdir)/../../editor/txmgr/src \
|
||||
$(NULL)
|
||||
|
||||
DEFINES += -D_IMPL_NS_LAYOUT
|
||||
|
|
Загрузка…
Ссылка в новой задаче