diff --git a/content/html/content/src/Makefile.in b/content/html/content/src/Makefile.in
index 7a095905d2da..3ddd16436c80 100644
--- a/content/html/content/src/Makefile.in
+++ b/content/html/content/src/Makefile.in
@@ -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)
diff --git a/editor/libeditor/base/Makefile.in b/editor/libeditor/base/Makefile.in
index 77d1f3410880..142c6923f12f 100644
--- a/editor/libeditor/base/Makefile.in
+++ b/editor/libeditor/base/Makefile.in
@@ -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 \
diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp
index 38a66f89e680..3b08ea41e4ac 100644
--- a/editor/libeditor/base/nsEditor.cpp
+++ b/editor/libeditor/base/nsEditor.cpp
@@ -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(aTxnManager);
return NS_OK;
}
diff --git a/editor/libeditor/base/nsEditor.h b/editor/libeditor/base/nsEditor.h
index ffcc766128f2..a13581513d9c 100644
--- a/editor/libeditor/base/nsEditor.h
+++ b/editor/libeditor/base/nsEditor.h
@@ -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 mInlineSpellChecker;
- nsCOMPtr mTxnMgr;
+ nsRefPtr mTxnMgr;
nsCOMPtr mRootElement; // cached root node
nsCOMPtr mIMETextRangeList; // IME special selection ranges
nsCOMPtr mIMETextNode; // current IME text node
diff --git a/editor/libeditor/html/Makefile.in b/editor/libeditor/html/Makefile.in
index 515b3793de64..65a557705045 100644
--- a/editor/libeditor/html/Makefile.in
+++ b/editor/libeditor/html/Makefile.in
@@ -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)
diff --git a/editor/libeditor/text/Makefile.in b/editor/libeditor/text/Makefile.in
index aacb9f36a437..aff992834cd4 100644
--- a/editor/libeditor/text/Makefile.in
+++ b/editor/libeditor/text/Makefile.in
@@ -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)
diff --git a/editor/txmgr/idl/nsITransactionManager.idl b/editor/txmgr/idl/nsITransactionManager.idl
index 66e75617beae..d7e9e8168363 100644
--- a/editor/txmgr/idl/nsITransactionManager.idl
+++ b/editor/txmgr/idl/nsITransactionManager.idl
@@ -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
{
/**
diff --git a/editor/txmgr/src/nsTransactionManager.h b/editor/txmgr/src/nsTransactionManager.h
index 6ad3d641459b..f6739f0b0808 100644
--- a/editor/txmgr/src/nsTransactionManager.h
+++ b/editor/txmgr/src/nsTransactionManager.h
@@ -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.
*
diff --git a/layout/build/Makefile.in b/layout/build/Makefile.in
index e02602dcc918..9daa83aaee69 100644
--- a/layout/build/Makefile.in
+++ b/layout/build/Makefile.in
@@ -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 \
diff --git a/layout/forms/Makefile.in b/layout/forms/Makefile.in
index 4a0b37b94eb8..f396a9de693f 100644
--- a/layout/forms/Makefile.in
+++ b/layout/forms/Makefile.in
@@ -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