Remove nsTransactionFactory and most transaction CIDs. (Bug 489851) r+sr=peterv
authorL. David Baron <dbaron@dbaron.org>
Fri, 24 Apr 2009 15:45:34 -0700
changeset 27825 cec9d9f355e803ff8122af4f8618f1f71cd27a41
parent 27824 30936df0271e7f7701e08716dea1a858963fda29
child 27826 49f4101fb09b15849e3f46e87b5fb0312f036710
push id6729
push userdbaron@mozilla.com
push dateFri, 24 Apr 2009 22:45:54 +0000
treeherderautoland@cec9d9f355e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs489851
milestone1.9.2a1pre
Remove nsTransactionFactory and most transaction CIDs. (Bug 489851) r+sr=peterv
editor/libeditor/base/ChangeAttributeTxn.h
editor/libeditor/base/ChangeCSSInlineStyleTxn.h
editor/libeditor/base/CreateElementTxn.h
editor/libeditor/base/DeleteElementTxn.h
editor/libeditor/base/DeleteRangeTxn.cpp
editor/libeditor/base/DeleteRangeTxn.h
editor/libeditor/base/DeleteTextTxn.h
editor/libeditor/base/EditAggregateTxn.cpp
editor/libeditor/base/EditAggregateTxn.h
editor/libeditor/base/EditTxn.h
editor/libeditor/base/IMETextTxn.h
editor/libeditor/base/InsertElementTxn.h
editor/libeditor/base/InsertTextTxn.h
editor/libeditor/base/JoinElementTxn.h
editor/libeditor/base/Makefile.in
editor/libeditor/base/PlaceholderTxn.h
editor/libeditor/base/SetDocTitleTxn.h
editor/libeditor/base/SplitElementTxn.h
editor/libeditor/base/TransactionFactory.cpp
editor/libeditor/base/TransactionFactory.h
editor/libeditor/base/nsEditor.cpp
editor/libeditor/base/nsStyleSheetTxns.h
editor/libeditor/html/nsHTMLCSSUtils.cpp
editor/libeditor/html/nsHTMLEditor.cpp
--- a/editor/libeditor/base/ChangeAttributeTxn.h
+++ b/editor/libeditor/base/ChangeAttributeTxn.h
@@ -38,48 +38,38 @@
 #ifndef ChangeAttributeTxn_h__
 #define ChangeAttributeTxn_h__
 
 #include "EditTxn.h"
 #include "nsCOMPtr.h"
 #include "nsIDOMElement.h"
 #include "nsIEditor.h"
 
-#define CHANGE_ATTRIBUTE_TXN_CID \
-{/* 97818860-ac48-11d2-86d8-000064657374 */ \
-0x97818860, 0xac48, 0x11d2, \
-{0x86, 0xd8, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74} }
-
 /**
  * A transaction that changes an attribute of a content node. 
  * This transaction covers add, remove, and change attribute.
  */
 class ChangeAttributeTxn : public EditTxn
 {
 public:
-
-  static const nsIID& GetCID() { static const nsIID iid = CHANGE_ATTRIBUTE_TXN_CID; return iid; }
-
   /** Initialize the transaction.
     * @param aEditor the object providing core editing operations
     * @param aNode   the node whose attribute will be changed
     * @param aAttribute the name of the attribute to change
     * @param aValue     the new value for aAttribute, if aRemoveAttribute is false
     * @param aRemoveAttribute if PR_TRUE, remove aAttribute from aNode
     */
   NS_IMETHOD Init(nsIEditor      *aEditor,
                   nsIDOMElement  *aNode,
                   const nsAString& aAttribute,
                   const nsAString& aValue,
                   PRBool aRemoveAttribute);
 
-private:
   ChangeAttributeTxn();
 
-public:
 
   NS_DECL_EDITTXN
 
   NS_IMETHOD RedoTransaction();
 
 protected:
 
   /** the editor that created this transaction */
@@ -97,13 +87,11 @@ protected:
   /** the value to set the attribute to for undo */
   nsString mUndoValue;
 
   /** PR_TRUE if the mAttribute was set on mElement at the time of execution */
   PRBool   mAttributeWasSet;
 
   /** PR_TRUE if the operation is to remove mAttribute from mElement */
   PRBool   mRemoveAttribute;
-
-  friend class TransactionFactory;
 };
 
 #endif
--- a/editor/libeditor/base/ChangeCSSInlineStyleTxn.h
+++ b/editor/libeditor/base/ChangeCSSInlineStyleTxn.h
@@ -39,31 +39,23 @@
 #ifndef ChangeCSSInlineStyleTxn_h__
 #define ChangeCSSInlineStyleTxn_h__
 
 #include "EditTxn.h"
 #include "nsCOMPtr.h"
 #include "nsIDOMElement.h"
 #include "nsIEditor.h"
 
-#define CHANGE_CSSINLINESTYLE_TXN_CID \
-{/* a2185c9e-1dd1-11b2-88d6-d89704bf7a5a */ \
-0xa2185c9e, 0x1dd1, 0x11b2, \
-{0x88, 0xd6, 0xd8, 0x97, 0x04, 0xbf, 0x7a, 0x5a} }
-
 /**
  * A transaction that changes the value of a CSS inline style of a content node. 
  * This transaction covers add, remove, and change a property's value.
  */
 class ChangeCSSInlineStyleTxn : public EditTxn
 {
 public:
-
-  static const nsIID& GetCID() { static const nsIID iid = CHANGE_CSSINLINESTYLE_TXN_CID; return iid; }
-
   /** Initialize the transaction.
     * @param aEditor         [IN] the object providing core editing operations
     * @param aNode           [IN] the node whose style attribute will be changed
     * @param aProperty       [IN] the name of the property to change
     * @param aValue          [IN] the new value for aProperty, if aRemoveProperty is false
     * @param aRemoveProperty [IN] if PR_TRUE, remove aProperty from style attribute
     */
   NS_IMETHOD Init(nsIEditor      * aEditor,
@@ -83,19 +75,19 @@ public:
 
   /** adds the value aNewValue to the list of white-space separated values aValues
     *
     * @param aValues         [IN/OUT] a list of wite-space separated values
     * @param aNewValue       [IN] a value this code adds to aValues if it is not already in
     */
   NS_IMETHOD AddValueToMultivalueProperty(nsAString & aValues, const nsAString  & aNewValue);
 
-private:
   ChangeCSSInlineStyleTxn();
 
+private:
   /** returns true if the property accepts more than one value
     *
     * @return                true if the property accepts more than one value
     * @param aCSSProperty    [IN] the CSS property
     */
   PRBool AcceptsMoreThanOneValue(nsIAtom * aCSSProperty);
 
   /** remove a value from a list of white-space separated values
@@ -136,13 +128,11 @@ protected:
   nsString mRedoValue;
   /** true if the style attribute was present and not empty before DoTransaction */
   PRBool   mUndoAttributeWasSet;
   /** true if the style attribute is present and not empty after DoTransaction */
   PRBool   mRedoAttributeWasSet;
 
   /** PR_TRUE if the operation is to remove mProperty from mElement */
   PRBool   mRemoveProperty;
-
-  friend class TransactionFactory;
 };
 
 #endif
--- a/editor/libeditor/base/CreateElementTxn.h
+++ b/editor/libeditor/base/CreateElementTxn.h
@@ -38,48 +38,38 @@
 #ifndef CreateElementTxn_h__
 #define CreateElementTxn_h__
 
 #include "EditTxn.h"
 #include "nsEditor.h"
 #include "nsIDOMNode.h"
 #include "nsCOMPtr.h"
 
-#define CREATE_ELEMENT_TXN_CID \
-{/* 7a6393c0-ac48-11d2-86d8-000064657374 */ \
-0x7a6393c0, 0xac48, 0x11d2, \
-{0x86, 0xd8, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74} }
-
 /**
  * A transaction that creates a new node in the content tree.
  */
 class CreateElementTxn : public EditTxn
 {
 public:
-
-  static const nsIID& GetCID() { static const nsIID iid = CREATE_ELEMENT_TXN_CID; return iid; }
-
   enum { eAppend=-1 };
 
   /** Initialize the transaction.
     * @param aEditor the provider of basic editing functionality
     * @param aTag    the tag (P, HR, TABLE, etc.) for the new element
     * @param aParent the node into which the new element will be inserted
     * @param aOffsetInParent the location in aParent to insert the new element
     *                        if eAppend, the new element is appended as the last child
     */
   NS_IMETHOD Init(nsEditor *aEditor,
                   const nsAString& aTag,
                   nsIDOMNode *aParent,
                   PRUint32 aOffsetInParent);
 
-private:
   CreateElementTxn();
 
-public:
   NS_DECL_EDITTXN
 
   NS_IMETHOD RedoTransaction();
 
   NS_IMETHOD GetNewNode(nsIDOMNode **aNewNode);
 
 protected:
   
@@ -95,14 +85,11 @@ protected:
   /** the index in mParent for the new node */
   PRUint32 mOffsetInParent;
 
   /** the new node to insert */
   nsCOMPtr<nsIDOMNode> mNewNode;  
 
   /** the node we will insert mNewNode before.  We compute this ourselves. */
   nsCOMPtr<nsIDOMNode> mRefNode;
-
-  friend class TransactionFactory;
-
 };
 
 #endif
--- a/editor/libeditor/base/DeleteElementTxn.h
+++ b/editor/libeditor/base/DeleteElementTxn.h
@@ -39,41 +39,31 @@
 #define DeleteElementTxn_h__
 
 #include "EditTxn.h"
 
 #include "nsIDOMNode.h"
 #include "nsIEditor.h"
 #include "nsCOMPtr.h"
 
-#define DELETE_ELEMENT_TXN_CID \
-{/* 6fd77770-ac49-11d2-86d8-000064657374 */ \
-0x6fd77770, 0xac49, 0x11d2, \
-{0x86, 0xd8, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74} }
-
 class nsRangeUpdater;
 
 /**
  * A transaction that deletes a single element
  */
 class DeleteElementTxn : public EditTxn
 {
 public:
-
-  static const nsIID& GetCID() { static const nsIID iid = DELETE_ELEMENT_TXN_CID; return iid; }
- 
   /** initialize the transaction.
     * @param aElement the node to delete
     */
   NS_IMETHOD Init(nsIEditor *aEditor, nsIDOMNode *aElement, nsRangeUpdater *aRangeUpdater);
 
-private:
   DeleteElementTxn();
 
-public:
   NS_DECL_EDITTXN
 
   NS_IMETHOD RedoTransaction();
 
 protected:
   
   /** the element to delete */
   nsCOMPtr<nsIDOMNode> mElement;
@@ -84,14 +74,11 @@ protected:
   /** next sibling to remember for undo/redo purposes */
   nsCOMPtr<nsIDOMNode> mRefNode;
 
   /** the editor for this transaction */
   nsIEditor* mEditor;
 
   /** range updater object */
   nsRangeUpdater *mRangeUpdater;
-  
-  friend class TransactionFactory;
-
 };
 
 #endif
--- a/editor/libeditor/base/DeleteRangeTxn.cpp
+++ b/editor/libeditor/base/DeleteRangeTxn.cpp
@@ -38,17 +38,16 @@
 
 #include "DeleteRangeTxn.h"
 #include "nsIDOMRange.h"
 #include "nsIDOMCharacterData.h"
 #include "nsIDOMNodeList.h"
 #include "nsISelection.h"
 #include "DeleteTextTxn.h"
 #include "DeleteElementTxn.h"
-#include "TransactionFactory.h"
 #include "nsIContentIterator.h"
 #include "nsIContent.h"
 #include "nsComponentManagerUtils.h"
 
 #ifdef NS_DEBUG
 static PRBool gNoisy = PR_FALSE;
 #endif
 
@@ -232,30 +231,28 @@ DeleteRangeTxn::CreateTxnsToDeleteBetwee
                                           PRUint32    aStartOffset, 
                                           PRUint32    aEndOffset)
 {
   nsresult result;
   // see what kind of node we have
   nsCOMPtr<nsIDOMCharacterData> textNode = do_QueryInterface(aStartParent);
   if (textNode)
   { // if the node is a text node, then delete text content
-    DeleteTextTxn *txn;
-    result = TransactionFactory::GetNewTransaction(DeleteTextTxn::GetCID(), (EditTxn **)&txn);
-    if (NS_FAILED(result)) return result;
-    if (!txn) return NS_ERROR_NULL_POINTER;
+    nsRefPtr<DeleteTextTxn> txn = new DeleteTextTxn();
+    if (!txn)
+      return NS_ERROR_OUT_OF_MEMORY;
 
     PRInt32 numToDel;
     if (aStartOffset==aEndOffset)
       numToDel = 1;
     else
       numToDel = aEndOffset-aStartOffset;
     result = txn->Init(mEditor, textNode, aStartOffset, numToDel, mRangeUpdater);
     if (NS_SUCCEEDED(result))
       AppendChild(txn);
-    NS_RELEASE(txn);
   }
   else
   {
     nsCOMPtr<nsIDOMNodeList> children;
     result = aStartParent->GetChildNodes(getter_AddRefs(children));
     if (NS_FAILED(result)) return result;
     if (!children) return NS_ERROR_NULL_POINTER;
 
@@ -267,25 +264,23 @@ DeleteRangeTxn::CreateTxnsToDeleteBetwee
     PRUint32 i;
     for (i=aStartOffset; i<aEndOffset; i++)
     {
       nsCOMPtr<nsIDOMNode> child;
       result = children->Item(i, getter_AddRefs(child));
       if (NS_FAILED(result)) return result;
       if (!child) return NS_ERROR_NULL_POINTER;
 
-      DeleteElementTxn *txn;
-      result = TransactionFactory::GetNewTransaction(DeleteElementTxn::GetCID(), (EditTxn **)&txn);
-      if (NS_FAILED(result)) return result;
-      if (!txn) return NS_ERROR_NULL_POINTER;
+      nsRefPtr<DeleteElementTxn> txn = new DeleteElementTxn();
+      if (!txn)
+        return NS_ERROR_OUT_OF_MEMORY;
 
       result = txn->Init(mEditor, child, mRangeUpdater);
       if (NS_SUCCEEDED(result))
         AppendChild(txn);
-      NS_RELEASE(txn);
     }
   }
   return result;
 }
 
 NS_IMETHODIMP DeleteRangeTxn::CreateTxnsToDeleteContent(nsIDOMNode *aParent, 
                                                         PRUint32    aOffset, 
                                                         nsIEditor::EDirection aAction)
@@ -305,25 +300,23 @@ NS_IMETHODIMP DeleteRangeTxn::CreateTxns
     else
     {
       start=0;
       numToDelete=aOffset;
     }
     
     if (numToDelete)
     {
-      DeleteTextTxn *txn;
-      result = TransactionFactory::GetNewTransaction(DeleteTextTxn::GetCID(), (EditTxn **)&txn);
-      if (NS_FAILED(result)) return result;
-      if (!txn) return NS_ERROR_NULL_POINTER;
+      nsRefPtr<DeleteTextTxn> txn = new DeleteTextTxn();
+      if (!txn)
+        return NS_ERROR_OUT_OF_MEMORY;
 
       result = txn->Init(mEditor, textNode, start, numToDelete, mRangeUpdater);
       if (NS_SUCCEEDED(result))
         AppendChild(txn);
-      NS_RELEASE(txn);
     }
   }
 
   return result;
 }
 
 NS_IMETHODIMP DeleteRangeTxn::CreateTxnsToDeleteNodesBetween()
 {
@@ -334,22 +327,20 @@ NS_IMETHODIMP DeleteRangeTxn::CreateTxns
   if (NS_FAILED(result)) return result;
 
   while (!iter->IsDone() && NS_SUCCEEDED(result))
   {
     nsCOMPtr<nsIDOMNode> node = do_QueryInterface(iter->GetCurrentNode());
     if (!node)
       return NS_ERROR_NULL_POINTER;
 
-    DeleteElementTxn *txn;
-    result = TransactionFactory::GetNewTransaction(DeleteElementTxn::GetCID(), (EditTxn **)&txn);
-    if (NS_FAILED(result)) return result;
-    if (!txn) return NS_ERROR_NULL_POINTER;
+    nsRefPtr<DeleteElementTxn> txn = new DeleteElementTxn();
+    if (!txn)
+      return NS_ERROR_OUT_OF_MEMORY;
 
     result = txn->Init(mEditor, node, mRangeUpdater);
     if (NS_SUCCEEDED(result))
       AppendChild(txn);
-    NS_RELEASE(txn);
     iter->Next();
   }
   return result;
 }
 
--- a/editor/libeditor/base/DeleteRangeTxn.h
+++ b/editor/libeditor/base/DeleteRangeTxn.h
@@ -39,46 +39,36 @@
 #define DeleteRangeTxn_h__
 
 #include "EditAggregateTxn.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMRange.h"
 #include "nsIEditor.h"
 #include "nsCOMPtr.h"
 
-#define DELETE_RANGE_TXN_CID \
-{/* 5ec6b260-ac49-11d2-86d8-000064657374 */ \
-0x5ec6b260, 0xac49, 0x11d2, \
-{0x86, 0xd8, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74} }
-
 class nsIDOMRange;
 class nsIEditor;
 class nsRangeUpdater;
 
 /**
  * A transaction that deletes an entire range in the content tree
  */
 class DeleteRangeTxn : public EditAggregateTxn
 {
 public:
-
-  static const nsIID& GetCID() { static const nsIID iid = DELETE_RANGE_TXN_CID; return iid; }
-
   /** initialize the transaction.
     * @param aEditor the object providing basic editing operations
     * @param aRange  the range to delete
     */
   NS_IMETHOD Init(nsIEditor *aEditor, 
                   nsIDOMRange *aRange,
                   nsRangeUpdater *aRangeUpdater);
 
-private:
   DeleteRangeTxn();
 
-public:
   NS_DECL_EDITTXN
 
   NS_IMETHOD RedoTransaction();
 
 protected:
 
   NS_IMETHOD CreateTxnsToDeleteBetween(nsIDOMNode *aStartParent, 
                                              PRUint32    aStartOffset, 
@@ -110,14 +100,11 @@ protected:
   /** p2 offset */
   PRInt32 mEndOffset;
 
   /** the editor for this transaction */
   nsIEditor* mEditor;
 
   /** range updater object */
   nsRangeUpdater *mRangeUpdater;
-  
-  friend class TransactionFactory;
-
 };
 
 #endif
--- a/editor/libeditor/base/DeleteTextTxn.h
+++ b/editor/libeditor/base/DeleteTextTxn.h
@@ -38,48 +38,38 @@
 #ifndef DeleteTextTxn_h__
 #define DeleteTextTxn_h__
 
 #include "EditTxn.h"
 #include "nsIEditor.h"
 #include "nsIDOMCharacterData.h"
 #include "nsCOMPtr.h"
 
-#define DELETE_TEXT_TXN_CID \
-{/* 4d3a2720-ac49-11d2-86d8-000064657374 */ \
-0x4d3a2720, 0xac49, 0x11d2, \
-{0x86, 0xd8, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74} }
-
 class nsRangeUpdater;
 
 /**
  * A transaction that removes text from a content node. 
  */
 class DeleteTextTxn : public EditTxn
 {
 public:
-
-  static const nsIID& GetCID() { static const nsIID iid = DELETE_TEXT_TXN_CID; return iid; }
-
   /** initialize the transaction.
     * @param aEditor  the provider of basic editing operations
     * @param aElement the content node to remove text from
     * @param aOffset  the location in aElement to begin the deletion
     * @param aNumCharsToDelete  the number of characters to delete.  Not the number of bytes!
     */
   NS_IMETHOD Init(nsIEditor *aEditor,
                   nsIDOMCharacterData *aElement,
                   PRUint32 aOffset,
                   PRUint32 aNumCharsToDelete,
                   nsRangeUpdater *aRangeUpdater);
 
-private:
   DeleteTextTxn();
 
-public:
   NS_DECL_EDITTXN
 
   PRUint32 GetOffset() { return mOffset; }
 
   PRUint32 GetNumCharsToDelete() { return mNumCharsToDelete; }
 
 protected:
 
@@ -95,14 +85,11 @@ protected:
   /** the number of characters to delete */
   PRUint32 mNumCharsToDelete;
 
   /** the text that was deleted */
   nsString mDeletedText;
 
   /** range updater object */
   nsRangeUpdater *mRangeUpdater;
-  
-  friend class TransactionFactory;
-
 };
 
 #endif
--- a/editor/libeditor/base/EditAggregateTxn.cpp
+++ b/editor/libeditor/base/EditAggregateTxn.cpp
@@ -179,16 +179,11 @@ NS_IMETHODIMP EditAggregateTxn::GetName(
   }
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP EditAggregateTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
 {
   if (!aInstancePtr) return NS_ERROR_NULL_POINTER;
  
-  if (aIID.Equals(EditAggregateTxn::GetCID())) {
-    *aInstancePtr = static_cast<EditAggregateTxn*>(this);
-    NS_ADDREF_THIS();
-    return NS_OK;
-  }
   return EditTxn::QueryInterface(aIID, aInstancePtr);
 }
 
--- a/editor/libeditor/base/EditAggregateTxn.h
+++ b/editor/libeditor/base/EditAggregateTxn.h
@@ -39,33 +39,25 @@
 #define EditAggregateTxn_h__
 
 #include "EditTxn.h"
 #include "nsIAtom.h"
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
 #include "nsAutoPtr.h"
 
-#define EDIT_AGGREGATE_TXN_CID \
-{/* 345921a0-ac49-11d2-86d8-000064657374 */ \
-0x345921a0, 0xac49, 0x11d2, \
-{0x86, 0xd8, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74} }
-
-
 /**
  * base class for all document editing transactions that require aggregation.
  * provides a list of child transactions.
  */
 class EditAggregateTxn : public EditTxn
 {
 public:
   NS_IMETHOD QueryInterface(REFNSIID aIID, void **aInstancePtr);
 
-  static const nsIID& GetCID() { static const nsIID cid = EDIT_AGGREGATE_TXN_CID; return cid; }
-
   EditAggregateTxn();
 
   NS_DECL_EDITTXN
 
   NS_IMETHOD RedoTransaction();
   NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
 
   /** append a transaction to this aggregate */
--- a/editor/libeditor/base/EditTxn.h
+++ b/editor/libeditor/base/EditTxn.h
@@ -37,31 +37,23 @@
 
 #ifndef EditTxn_h__
 #define EditTxn_h__
 
 #include "nsITransaction.h"
 #include "nsString.h"
 #include "nsPIEditorTransaction.h"
 
-#define EDIT_TXN_CID \
-{/* c5ea31b0-ac48-11d2-86d8-000064657374 */ \
-0xc5ea31b0, 0xac48, 0x11d2, \
-{0x86, 0xd8, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74} }
-
 /**
  * Base class for all document editing transactions.
  */
 class EditTxn : public nsITransaction,
                 public nsPIEditorTransaction
 {
 public:
-
-  static const nsIID& GetCID() { static const nsIID iid = EDIT_TXN_CID; return iid; }
-
   NS_DECL_ISUPPORTS
 
   virtual ~EditTxn();
 
   NS_IMETHOD RedoTransaction(void);
   NS_IMETHOD GetIsTransient(PRBool *aIsTransient);
   NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
 };
--- a/editor/libeditor/base/IMETextTxn.h
+++ b/editor/libeditor/base/IMETextTxn.h
@@ -72,21 +72,18 @@ public:
     */
   NS_IMETHOD Init(nsIDOMCharacterData *aElement,
                   PRUint32 aOffset,
                   PRUint32 aReplaceLength,
                   nsIPrivateTextRangeList* aTextRangeList,
                   const nsAString& aString,
                   nsWeakPtr aSelCon);
 
-private:
-	
-	IMETextTxn();
+  IMETextTxn();
 
-public:
   NS_DECL_EDITTXN
 
   NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
 
   NS_IMETHOD MarkFixed(void);
 
 // nsISupports declarations
 
@@ -113,13 +110,11 @@ protected:
 
   /** the range list **/
   nsCOMPtr<nsIPrivateTextRangeList>	mRangeList;
 
   /** the selection controller, which we'll need to get the selection */
   nsWeakPtr mSelConWeak;  // use a weak reference
 
   PRBool	mFixed;
-
-  friend class TransactionFactory;
 };
 
 #endif
--- a/editor/libeditor/base/InsertElementTxn.h
+++ b/editor/libeditor/base/InsertElementTxn.h
@@ -38,57 +38,44 @@
 #ifndef InsertElementTxn_h__
 #define InsertElementTxn_h__
 
 #include "EditTxn.h"
 #include "nsIEditor.h"
 #include "nsIDOMNode.h"
 #include "nsCOMPtr.h"
 
-#define INSERT_ELEMENT_TXN_CID \
-{/* b5762440-cbb0-11d2-86db-000064657374 */ \
-0xb5762440, 0xcbb0, 0x11d2, \
-{0x86, 0xdb, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74} }
-
 /**
  * A transaction that inserts a single element
  */
 class InsertElementTxn : public EditTxn
 {
 public:
-
-  static const nsIID& GetCID() { static const nsIID iid = INSERT_ELEMENT_TXN_CID; return iid; }
-
   /** initialize the transaction.
     * @param aNode   the node to insert
     * @param aParent the node to insert into
     * @param aOffset the offset in aParent to insert aNode
     */
   NS_IMETHOD Init(nsIDOMNode *aNode,
                   nsIDOMNode *aParent,
                   PRInt32     aOffset,
                   nsIEditor  *aEditor);
 
-private:
   InsertElementTxn();
 
-public:
   NS_DECL_EDITTXN
 
 protected:
   
   /** the element to insert */
   nsCOMPtr<nsIDOMNode> mNode;
 
   /** the node into which the new node will be inserted */
   nsCOMPtr<nsIDOMNode> mParent;
 
   /** the editor for this transaction */
   nsIEditor*           mEditor;
 
   /** the index in mParent for the new node */
   PRInt32 mOffset;
-
-  friend class TransactionFactory;
-
 };
 
 #endif
--- a/editor/libeditor/base/InsertTextTxn.h
+++ b/editor/libeditor/base/InsertTextTxn.h
@@ -63,21 +63,18 @@ public:
     * @param aString  the new text to insert
     * @param aPresShell used to get and set the selection
     */
   NS_IMETHOD Init(nsIDOMCharacterData *aElement,
                   PRUint32 aOffset,
                   const nsAString& aString,
                   nsIEditor *aEditor);
 
-private:
-	
-	InsertTextTxn();
+  InsertTextTxn();
 
-public:
 	
   NS_DECL_EDITTXN
 
   NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
 
 // nsISupports declarations
 
   // override QueryInterface to handle InsertTextTxn request
@@ -97,13 +94,11 @@ protected:
   /** the offset into mElement where the insertion is to take place */
   PRUint32 mOffset;
 
   /** the text to insert into mElement at mOffset */
   nsString mStringToInsert;
 
   /** the editor, which we'll need to get the selection */
   nsIEditor *mEditor;   
-
-  friend class TransactionFactory;
 };
 
 #endif
--- a/editor/libeditor/base/JoinElementTxn.h
+++ b/editor/libeditor/base/JoinElementTxn.h
@@ -38,48 +38,39 @@
 #ifndef JoinElementTxn_h__
 #define JoinElementTxn_h__
 
 #include "EditTxn.h"
 #include "nsIDOMNode.h"
 #include "nsCOMPtr.h"
 #include "nsIEditor.h"
 
-#define JOIN_ELEMENT_TXN_CID \
-{/* 9bc5f9f0-ac48-11d2-86d8-000064657374 */ \
-0x9bc5f9f0, 0xac48, 0x11d2, \
-{0x86, 0xd8, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74} }
-
 class nsEditor;
 
 /**
  * A transaction that joins two elements E1 (left node) and E2 (right node)
  * into a single node E.  
  * The children of E are the children of E1 followed by the children of E2.
  * After DoTransaction() and RedoTransaction(), E1 is removed from the content
  * tree and E2 remains.
  */
 class JoinElementTxn : public EditTxn
 {
 public:
-
-  static const nsIID& GetCID() { static const nsIID iid = JOIN_ELEMENT_TXN_CID; return iid; }
-
   /** initialize the transaction
     * @param aEditor    the provider of core editing operations
     * @param aLeftNode  the first of two nodes to join
     * @param aRightNode the second of two nodes to join
     */
   NS_IMETHOD Init(nsEditor   *aEditor,
                   nsIDOMNode *aLeftNode,
                   nsIDOMNode *aRightNode);
-protected:
+
   JoinElementTxn();
 
-public:
   NS_DECL_EDITTXN
 
 protected:
   
   /** the elements to operate upon.  
     * After the merge, mRightNode remains and mLeftNode is removed from the content tree.
     */
   nsCOMPtr<nsIDOMNode> mLeftNode;
@@ -89,14 +80,11 @@ protected:
     * mOffset is the index of the first child in the right node. 
     * -1 means the left node had no children.
     */
   PRUint32  mOffset;
 
   /** the parent node containing mLeftNode and mRightNode */
   nsCOMPtr<nsIDOMNode> mParent;
   nsEditor*  mEditor;
-
-  friend class TransactionFactory;
-
 };
 
 #endif
--- a/editor/libeditor/base/Makefile.in
+++ b/editor/libeditor/base/Makefile.in
@@ -95,17 +95,16 @@ CPPSRCS		+=                          \
 		EditAggregateTxn.cpp        \
 		IMETextTxn.cpp              \
 		InsertElementTxn.cpp        \
 		InsertTextTxn.cpp           \
 		JoinElementTxn.cpp          \
 		SetDocTitleTxn.cpp          \
 		SplitElementTxn.cpp         \
 		nsStyleSheetTxns.cpp        \
-		TransactionFactory.cpp      \
 		$(NULL)
 
 # don't want the shared lib; force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 include $(topsrcdir)/config/rules.mk
 
 INCLUDES	+= \
--- a/editor/libeditor/base/PlaceholderTxn.h
+++ b/editor/libeditor/base/PlaceholderTxn.h
@@ -42,45 +42,35 @@
 #include "nsEditorUtils.h"
 #include "nsIAbsorbingTransaction.h"
 #include "nsIDOMNode.h"
 #include "nsCOMPtr.h"
 #include "nsWeakPtr.h"
 #include "nsWeakReference.h"
 #include "nsAutoPtr.h"
 
-#define PLACEHOLDER_TXN_CID \
-{/* {0CE9FB00-D9D1-11d2-86DE-000064657374} */ \
-0x0CE9FB00, 0xD9D1, 0x11d2, \
-{0x86, 0xde, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74} }
-
 class nsHTMLEditor;
 class IMETextTxn;
 
 /**
  * An aggregate transaction that knows how to absorb all subsequent
  * transactions with the same name.  This transaction does not "Do" anything.
  * But it absorbs other transactions via merge, and can undo/redo the
  * transactions it has absorbed.
  */
  
 class PlaceholderTxn : public EditAggregateTxn, 
                        public nsIAbsorbingTransaction, 
                        public nsSupportsWeakReference
 {
 public:
-
-  static const nsIID& GetCID() { static const nsIID iid = PLACEHOLDER_TXN_CID; return iid; }
-
   NS_DECL_ISUPPORTS_INHERITED  
   
-private:
   PlaceholderTxn();
 
-public:
 // ------------ EditAggregateTxn -----------------------
 
   NS_DECL_EDITTXN
 
   NS_IMETHOD RedoTransaction();
   NS_IMETHOD Merge(nsITransaction *aTransaction, PRBool *aDidMerge);
 
 // ------------ nsIAbsorbingTransaction -----------------------
@@ -93,18 +83,16 @@ public:
 
   NS_IMETHOD EndPlaceHolderBatch();
 
   NS_IMETHOD ForwardEndBatchTo(nsIAbsorbingTransaction *aForwardingAddress);
 
   NS_IMETHOD Commit();
 
   NS_IMETHOD RememberEndingSelection();
-  
-  friend class TransactionFactory;
 
 protected:
 
   /** the presentation shell, which we'll need to get the selection */
   PRBool      mAbsorb;          // do we auto absorb any and all transaction?
   nsWeakPtr   mForwarding;
   IMETextTxn *mIMETextTxn;      // first IME txn in this placeholder - used for IME merging
                                 // non-owning for now - can't nsCOMPtr it due to broken transaction interfaces
--- a/editor/libeditor/base/SetDocTitleTxn.h
+++ b/editor/libeditor/base/SetDocTitleTxn.h
@@ -39,40 +39,32 @@
 #define SetDocTitleTxn_h__
 
 #include "EditTxn.h"
 #include "nsIEditor.h"
 #include "nsIHTMLEditor.h"
 #include "nsITransaction.h"
 #include "nsCOMPtr.h"
 
-#define SET_DOC_TITLE_TXN_CID \
-{ /*7FC508B5-ED8F-11d4-AF02-0050040AE132 */ \
-0x7fc508b5, 0xed8f, 0x11d4, \
-{ 0xaf, 0x2, 0x0, 0x50, 0x4, 0xa, 0xe1, 0x32 } }
-
 /**
  * A transaction that changes the document's title,
  *  which is a text node under the <title> tag in a page's <head> section
  * provides default concrete behavior for all nsITransaction methods.
  */
 class SetDocTitleTxn : public EditTxn
 {
 public:
-
-  static const nsIID& GetCID() { static const nsIID iid = SET_DOC_TITLE_TXN_CID; return iid; }
-
   /** Initialize the transaction.
     * @param aEditor the object providing core editing operations
     * @param aValue  the new value for document title
     */
   NS_IMETHOD Init(nsIHTMLEditor  *aEditor,
                   const nsAString *aValue);
+  SetDocTitleTxn();
 private:
-  SetDocTitleTxn();
   nsresult SetDomTitle(const nsAString& aTitle);
 
 public:
   NS_DECL_EDITTXN
 
   NS_IMETHOD RedoTransaction();
   NS_IMETHOD GetIsTransient(PRBool *aIsTransient);
 
@@ -84,13 +76,11 @@ protected:
   /** The new title string */
   nsString    mValue;
 
   /** The previous title string to use for undo */
   nsString    mUndoValue;
 
   /** Set true if we dont' really change the title during Do() */
   PRPackedBool mIsTransient;
-
-  friend class TransactionFactory;
 };
 
 #endif
--- a/editor/libeditor/base/SplitElementTxn.h
+++ b/editor/libeditor/base/SplitElementTxn.h
@@ -38,47 +38,38 @@
 #ifndef SplitElementTxn_h__
 #define SplitElementTxn_h__
 
 #include "EditTxn.h"
 #include "nsIDOMNode.h"
 #include "nsCOMPtr.h"
 #include "nsIEditor.h"
 
-#define SPLIT_ELEMENT_TXN_CID \
-{/* 690c6290-ac48-11d2-86d8-000064657374 */ \
-0x690c6290, 0xac48, 0x11d2, \
-{0x86, 0xd8, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74} }
-
 class nsEditor;
 
 /**
  * A transaction that splits an element E into two identical nodes, E1 and E2
  * with the children of E divided between E1 and E2.
  */
 class SplitElementTxn : public EditTxn
 {
 public:
-
-  static const nsIID& GetCID() { static const nsIID iid = SPLIT_ELEMENT_TXN_CID; return iid; }
-
   /** initialize the transaction.
     * @param aEditor  the provider of core editing operations
     * @param aNode    the node to split
     * @param aOffset  the location within aNode to do the split.
     *                 aOffset may refer to children of aNode, or content of aNode.
     *                 The left node will have child|content 0..aOffset-1.
     */
   NS_IMETHOD Init (nsEditor   *aEditor,
                    nsIDOMNode *aNode,
                    PRInt32     aOffset);
-protected:
+
   SplitElementTxn();
 
-public:
   NS_DECL_EDITTXN
 
   NS_IMETHOD RedoTransaction(void);
 
   NS_IMETHOD GetNewNode(nsIDOMNode **aNewNode);
 
 protected:
   
@@ -92,14 +83,11 @@ protected:
   PRInt32  mOffset;
 
   /** the element we create when splitting mElement */
   nsCOMPtr<nsIDOMNode> mNewLeftNode;
 
   /** the parent shared by mExistingRightNode and mNewLeftNode */
   nsCOMPtr<nsIDOMNode> mParent;
   nsEditor*  mEditor;
-
-  friend class TransactionFactory;
-
 };
 
 #endif
deleted file mode 100644
--- a/editor/libeditor/base/TransactionFactory.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Daniel Glazman <glazman@netscape.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "TransactionFactory.h"
-// transactions this factory knows how to build
-#include "EditAggregateTxn.h"
-#include "PlaceholderTxn.h"
-#include "InsertTextTxn.h"
-#include "DeleteTextTxn.h"
-#include "CreateElementTxn.h"
-#include "InsertElementTxn.h"
-#include "DeleteElementTxn.h"
-#include "DeleteRangeTxn.h"
-#include "ChangeAttributeTxn.h"
-#include "SplitElementTxn.h"
-#include "JoinElementTxn.h"
-#include "nsStyleSheetTxns.h"
-#include "IMETextTxn.h"
-
-#ifndef MOZILLA_PLAINTEXT_EDITOR_ONLY
-#include "SetDocTitleTxn.h"
-#include "ChangeCSSInlineStyleTxn.h"
-#endif // MOZILLA_PLAINTEXT_EDITOR_ONLY
-
-TransactionFactory::TransactionFactory()
-{
-}
-
-TransactionFactory::~TransactionFactory()
-{
-}
-
-nsresult
-TransactionFactory::GetNewTransaction(REFNSIID aTxnType, EditTxn **aResult)
-{
-  nsresult result = NS_OK;
-  *aResult = nsnull;
-  if (aTxnType.Equals(InsertTextTxn::GetCID()))
-    *aResult = new InsertTextTxn();
-  else if (aTxnType.Equals(DeleteTextTxn::GetCID()))
-    *aResult = new DeleteTextTxn();
-  else if (aTxnType.Equals(CreateElementTxn::GetCID()))
-    *aResult = new CreateElementTxn();
-  else if (aTxnType.Equals(InsertElementTxn::GetCID()))
-    *aResult = new InsertElementTxn();
-  else if (aTxnType.Equals(DeleteElementTxn::GetCID()))
-    *aResult = new DeleteElementTxn();
-  else if (aTxnType.Equals(DeleteRangeTxn::GetCID()))
-    *aResult = new DeleteRangeTxn();
-  else if (aTxnType.Equals(ChangeAttributeTxn::GetCID()))
-    *aResult = new ChangeAttributeTxn();
-#ifndef MOZILLA_PLAINTEXT_EDITOR_ONLY
-  else if (aTxnType.Equals(ChangeCSSInlineStyleTxn::GetCID()))
-    *aResult = new ChangeCSSInlineStyleTxn();
-#endif // MOZILLA_PLAINTEXT_EDITOR_ONLY
-  else if (aTxnType.Equals(SplitElementTxn::GetCID()))
-    *aResult = new SplitElementTxn();
-  else if (aTxnType.Equals(JoinElementTxn::GetCID()))
-    *aResult = new JoinElementTxn();
-  else if (aTxnType.Equals(EditAggregateTxn::GetCID()))
-    *aResult = new EditAggregateTxn();
-  else if (aTxnType.Equals(IMETextTxn::GetCID()))
-    *aResult = new IMETextTxn();
-  else if (aTxnType.Equals(AddStyleSheetTxn::GetCID()))
-    *aResult = new AddStyleSheetTxn();
-  else if (aTxnType.Equals(RemoveStyleSheetTxn::GetCID()))
-    *aResult = new RemoveStyleSheetTxn();
-#ifndef MOZILLA_PLAINTEXT_EDITOR_ONLY
-  else if (aTxnType.Equals(SetDocTitleTxn::GetCID()))
-    *aResult = new SetDocTitleTxn();
-#endif // MOZILLA_PLAINTEXT_EDITOR_ONLY
-  else if (aTxnType.Equals(PlaceholderTxn::GetCID()))
-    *aResult = new PlaceholderTxn();
-  else
-    result = NS_ERROR_NO_INTERFACE;
-  
-  if (NS_SUCCEEDED(result) && !*aResult)
-    result = NS_ERROR_OUT_OF_MEMORY;
-
-  if (NS_SUCCEEDED(result))
-    NS_ADDREF(*aResult);
-
-  return result;
-}
-
deleted file mode 100644
--- a/editor/libeditor/base/TransactionFactory.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef TransactionFactory_h__
-#define TransactionFactory_h__
-
-#include "nsISupports.h"
-
-class EditTxn;
-
-/**
- * This class instantiates and optionally recycles edit transactions
- * A recycler would be a separate static object, since this class does not get instantiated
- */
-class TransactionFactory
-{
-protected:
-  TransactionFactory();
-  virtual ~TransactionFactory();
-
-public:
-  /** return a transaction object of aTxnType, refcounted 
-    * @return NS_ERROR_NO_INTERFACE if aTxnType is unknown, 
-    *         NS_ERROR_OUT_OF_MEMORY if the allocations fails.
-    */
-  static nsresult GetNewTransaction(REFNSIID aTxnType, EditTxn **aResult);
-
-};
-
-#endif
--- a/editor/libeditor/base/nsEditor.cpp
+++ b/editor/libeditor/base/nsEditor.cpp
@@ -85,17 +85,16 @@
 #include "nsIFrame.h"  // Needed by IME code
 
 #include "nsICSSStyleSheet.h"
 
 #include "nsIContent.h"
 #include "nsServiceManagerUtils.h"
 
 // transactions the editor knows how to build
-#include "TransactionFactory.h"
 #include "EditAggregateTxn.h"
 #include "PlaceholderTxn.h"
 #include "ChangeAttributeTxn.h"
 #include "CreateElementTxn.h"
 #include "InsertElementTxn.h"
 #include "DeleteElementTxn.h"
 #include "InsertTextTxn.h"
 #include "DeleteTextTxn.h"
@@ -617,21 +616,18 @@ nsEditor::DoTransaction(nsITransaction *
   nsresult result = NS_OK;
   
   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;
-    result = TransactionFactory::GetNewTransaction(PlaceholderTxn::GetCID(),
-                                                   getter_AddRefs(editTxn));
-    if (NS_FAILED(result)) { return result; }
-    if (!editTxn) { return NS_ERROR_NULL_POINTER; }
+    nsRefPtr<EditTxn> editTxn = new PlaceholderTxn();
+    if (!editTxn) { return NS_ERROR_OUT_OF_MEMORY; }
 
     // 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.
 
     // save off weak reference to placeholder txn
@@ -2783,19 +2779,19 @@ nsEditor::NotifyDocumentListeners(TDocum
 NS_IMETHODIMP nsEditor::CreateTxnForInsertText(const nsAString & aStringToInsert,
                                                nsIDOMCharacterData *aTextNode,
                                                PRInt32 aOffset,
                                                InsertTextTxn ** aTxn)
 {
   if (!aTextNode || !aTxn) return NS_ERROR_NULL_POINTER;
   nsresult result;
 
-  result = TransactionFactory::GetNewTransaction(InsertTextTxn::GetCID(), (EditTxn **)aTxn);
-  if (NS_FAILED(result)) return result;
+  *aTxn = new InsertTextTxn();
   if (!*aTxn) return NS_ERROR_OUT_OF_MEMORY;
+  NS_ADDREF(*aTxn);
   result = (*aTxn)->Init(aTextNode, aOffset, aStringToInsert, this);
   return result;
 }
 
 
 NS_IMETHODIMP nsEditor::DeleteText(nsIDOMCharacterData *aElement,
                               PRUint32             aOffset,
                               PRUint32             aLength)
@@ -2824,52 +2820,54 @@ NS_IMETHODIMP nsEditor::DeleteText(nsIDO
 NS_IMETHODIMP nsEditor::CreateTxnForDeleteText(nsIDOMCharacterData *aElement,
                                                PRUint32             aOffset,
                                                PRUint32             aLength,
                                                DeleteTextTxn      **aTxn)
 {
   if (!aElement)
     return NS_ERROR_NULL_POINTER;
 
-  nsresult result = TransactionFactory::GetNewTransaction(DeleteTextTxn::GetCID(), (EditTxn **)aTxn);
-  if (NS_SUCCEEDED(result))  {
-    result = (*aTxn)->Init(this, aElement, aOffset, aLength, &mRangeUpdater);
-  }
-  return result;
+  *aTxn = new DeleteTextTxn();
+  if (!*aTxn)
+    return NS_ERROR_OUT_OF_MEMORY;
+  NS_ADDREF(*aTxn);
+  return (*aTxn)->Init(this, aElement, aOffset, aLength, &mRangeUpdater);
 }
 
 
 
 
 NS_IMETHODIMP nsEditor::CreateTxnForSplitNode(nsIDOMNode *aNode,
                                          PRUint32    aOffset,
                                          SplitElementTxn **aTxn)
 {
   if (!aNode)
     return NS_ERROR_NULL_POINTER;
 
-  nsresult result = TransactionFactory::GetNewTransaction(SplitElementTxn::GetCID(), (EditTxn **)aTxn);
-  if (NS_FAILED(result))
-    return result;
+  *aTxn = new SplitElementTxn();
+  if (!*aTxn)
+    return NS_ERROR_OUT_OF_MEMORY;
+  NS_ADDREF(*aTxn);
 
   return (*aTxn)->Init(this, aNode, aOffset);
 }
 
 NS_IMETHODIMP nsEditor::CreateTxnForJoinNode(nsIDOMNode  *aLeftNode,
                                              nsIDOMNode  *aRightNode,
                                              JoinElementTxn **aTxn)
 {
   if (!aLeftNode || !aRightNode)
     return NS_ERROR_NULL_POINTER;
 
-  nsresult result = TransactionFactory::GetNewTransaction(JoinElementTxn::GetCID(), (EditTxn **)aTxn);
-  if (NS_SUCCEEDED(result))  {
-    result = (*aTxn)->Init(this, aLeftNode, aRightNode);
-  }
-  return result;
+  *aTxn = new JoinElementTxn();
+  if (!*aTxn)
+    return NS_ERROR_OUT_OF_MEMORY;
+  NS_ADDREF(*aTxn);
+
+  return (*aTxn)->Init(this, aLeftNode, aRightNode);
 }
 
 
 // END nsEditor core implementation
 
 #ifdef XP_MAC
 #pragma mark -
 #pragma mark  nsEditor public static helper methods 
@@ -4636,138 +4634,127 @@ nsEditor::DoAfterRedoTransaction()
 }
 
 NS_IMETHODIMP 
 nsEditor::CreateTxnForSetAttribute(nsIDOMElement *aElement, 
                                    const nsAString& aAttribute, 
                                    const nsAString& aValue,
                                    ChangeAttributeTxn ** aTxn)
 {
-  nsresult result = NS_ERROR_NULL_POINTER;
-  if (nsnull != aElement)
-  {
-    result = TransactionFactory::GetNewTransaction(ChangeAttributeTxn::GetCID(), (EditTxn **)aTxn);
-    if (NS_SUCCEEDED(result))  {
-      result = (*aTxn)->Init(this, aElement, aAttribute, aValue, PR_FALSE);
-    }
-  }
-  return result;
+  if (!aElement)
+    return NS_ERROR_NULL_POINTER;
+
+  *aTxn = new ChangeAttributeTxn();
+  if (!*aTxn)
+    return NS_ERROR_OUT_OF_MEMORY;
+  NS_ADDREF(*aTxn);
+  return (*aTxn)->Init(this, aElement, aAttribute, aValue, PR_FALSE);
 }
 
 
 NS_IMETHODIMP 
 nsEditor::CreateTxnForRemoveAttribute(nsIDOMElement *aElement, 
                                       const nsAString& aAttribute,
                                       ChangeAttributeTxn ** aTxn)
 {
-  nsresult result = NS_ERROR_NULL_POINTER;
-  if (nsnull != aElement)
-  {
-    result = TransactionFactory::GetNewTransaction(ChangeAttributeTxn::GetCID(), (EditTxn **)aTxn);
-    if (NS_SUCCEEDED(result))  
-    {
-      nsAutoString value;
-      result = (*aTxn)->Init(this, aElement, aAttribute, value, PR_TRUE);
-    }
-  }
-  return result;
+  if (!aElement)
+    return NS_ERROR_NULL_POINTER;
+
+  *aTxn = new ChangeAttributeTxn();
+  if (!*aTxn)
+    return NS_ERROR_OUT_OF_MEMORY;
+  NS_ADDREF(*aTxn);
+
+  return (*aTxn)->Init(this, aElement, aAttribute, EmptyString(), PR_TRUE);
 }
 
 
 NS_IMETHODIMP nsEditor::CreateTxnForCreateElement(const nsAString& aTag,
                                                   nsIDOMNode     *aParent,
                                                   PRInt32         aPosition,
                                                   CreateElementTxn ** aTxn)
 {
-  nsresult result = NS_ERROR_NULL_POINTER;
-  if (nsnull != aParent)
-  {
-    result = TransactionFactory::GetNewTransaction(CreateElementTxn::GetCID(), (EditTxn **)aTxn);
-    if (NS_SUCCEEDED(result))  {
-      result = (*aTxn)->Init(this, aTag, aParent, aPosition);
-    }
-  }
-  return result;
+  if (!aParent)
+    return NS_ERROR_NULL_POINTER;
+
+  *aTxn = new CreateElementTxn();
+  if (!*aTxn)
+    return NS_ERROR_OUT_OF_MEMORY;
+  NS_ADDREF(*aTxn);
+
+  return (*aTxn)->Init(this, aTag, aParent, aPosition);
 }
 
 
 NS_IMETHODIMP nsEditor::CreateTxnForInsertElement(nsIDOMNode * aNode,
                                                   nsIDOMNode * aParent,
                                                   PRInt32      aPosition,
                                                   InsertElementTxn ** aTxn)
 {
-  nsresult result = NS_ERROR_NULL_POINTER;
-  if (aNode && aParent && aTxn)
-  {
-    result = TransactionFactory::GetNewTransaction(InsertElementTxn::GetCID(), (EditTxn **)aTxn);
-    if (NS_SUCCEEDED(result)) {
-      result = (*aTxn)->Init(aNode, aParent, aPosition, this);
-    }
-  }
-  return result;
+  if (!aNode || !aParent)
+    return NS_ERROR_NULL_POINTER;
+
+  *aTxn = new InsertElementTxn();
+  if (!*aTxn)
+    return NS_ERROR_OUT_OF_MEMORY;
+  NS_ADDREF(*aTxn);
+
+  return (*aTxn)->Init(aNode, aParent, aPosition, this);
 }
 
 NS_IMETHODIMP nsEditor::CreateTxnForDeleteElement(nsIDOMNode * aElement,
                                              DeleteElementTxn ** aTxn)
 {
-  nsresult result = NS_ERROR_NULL_POINTER;
-  if (nsnull != aElement)
-  {
-    result = TransactionFactory::GetNewTransaction(DeleteElementTxn::GetCID(), (EditTxn **)aTxn);
-    if (NS_SUCCEEDED(result)) {
-      result = (*aTxn)->Init(this, aElement, &mRangeUpdater);
-    }
-  }
-  return result;
+  if (!aElement)
+    return NS_ERROR_NULL_POINTER;
+
+  *aTxn = new DeleteElementTxn();
+  if (!*aTxn)
+    return NS_ERROR_OUT_OF_MEMORY;
+  NS_ADDREF(*aTxn);
+
+  return (*aTxn)->Init(this, aElement, &mRangeUpdater);
 }
 
 NS_IMETHODIMP 
 nsEditor::CreateTxnForIMEText(const nsAString& aStringToInsert,
                               IMETextTxn ** aTxn)
 {
   NS_ASSERTION(aTxn, "illegal value- null ptr- aTxn");
-  if(!aTxn) return NS_ERROR_NULL_POINTER;
      
-  nsresult  result;
-
-  result = TransactionFactory::GetNewTransaction(IMETextTxn::GetCID(), (EditTxn **)aTxn);
-  if (nsnull!=*aTxn) {
-    result = (*aTxn)->Init(mIMETextNode,mIMETextOffset,mIMEBufferLength,mIMETextRangeList,aStringToInsert,mSelConWeak);
-  }
-  else {
-    result = NS_ERROR_OUT_OF_MEMORY;
-  }
-  return result;
+  *aTxn = new IMETextTxn();
+  if (!*aTxn)
+    return NS_ERROR_OUT_OF_MEMORY;
+  NS_ADDREF(*aTxn);
+
+  return (*aTxn)->Init(mIMETextNode, mIMETextOffset, mIMEBufferLength,
+                       mIMETextRangeList, aStringToInsert, mSelConWeak);
 }
 
 
 NS_IMETHODIMP 
 nsEditor::CreateTxnForAddStyleSheet(nsICSSStyleSheet* aSheet, AddStyleSheetTxn* *aTxn)
 {
-  nsresult rv = TransactionFactory::GetNewTransaction(AddStyleSheetTxn::GetCID(), (EditTxn **)aTxn);
-  if (NS_FAILED(rv))
-    return rv;
-    
+  *aTxn = new AddStyleSheetTxn();
   if (! *aTxn)
     return NS_ERROR_OUT_OF_MEMORY;
+  NS_ADDREF(*aTxn);
 
   return (*aTxn)->Init(this, aSheet);
 }
 
 
 
 NS_IMETHODIMP 
 nsEditor::CreateTxnForRemoveStyleSheet(nsICSSStyleSheet* aSheet, RemoveStyleSheetTxn* *aTxn)
 {
-  nsresult rv = TransactionFactory::GetNewTransaction(RemoveStyleSheetTxn::GetCID(), (EditTxn **)aTxn);
-  if (NS_FAILED(rv))
-    return rv;
-    
+  *aTxn = new RemoveStyleSheetTxn();
   if (! *aTxn)
     return NS_ERROR_OUT_OF_MEMORY;
+  NS_ADDREF(*aTxn);
 
   return (*aTxn)->Init(this, aSheet);
 }
 
 
 NS_IMETHODIMP
 nsEditor::CreateTxnForDeleteSelection(nsIEditor::EDirection aAction,
                                       EditAggregateTxn ** aTxn,
@@ -4788,43 +4775,39 @@ nsEditor::CreateTxnForDeleteSelection(ns
   {
     // Check whether the selection is collapsed and we should do nothing:
     PRBool isCollapsed;
     result = (selection->GetIsCollapsed(&isCollapsed));
     if (NS_SUCCEEDED(result) && isCollapsed && aAction == eNone)
       return NS_OK;
 
     // allocate the out-param transaction
-    result = TransactionFactory::GetNewTransaction(EditAggregateTxn::GetCID(), (EditTxn **)aTxn);
-    if (NS_FAILED(result)) {
-      return result;
+    *aTxn = new EditAggregateTxn();
+    if (!*aTxn) {
+      return NS_ERROR_OUT_OF_MEMORY;
     }
+    NS_ADDREF(*aTxn);
 
     nsCOMPtr<nsISelectionPrivate>selPrivate(do_QueryInterface(selection));
     nsCOMPtr<nsIEnumerator> enumerator;
     result = selPrivate->GetEnumerator(getter_AddRefs(enumerator));
     if (NS_SUCCEEDED(result) && enumerator)
     {
       for (enumerator->First(); NS_OK!=enumerator->IsDone(); enumerator->Next())
       {
         nsCOMPtr<nsISupports> currentItem;
         result = enumerator->CurrentItem(getter_AddRefs(currentItem));
         if ((NS_SUCCEEDED(result)) && (currentItem))
         {
           nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
           range->GetCollapsed(&isCollapsed);
           if (!isCollapsed)
           {
-            nsRefPtr<EditTxn> editTxn;
-            result =
-              TransactionFactory::GetNewTransaction(DeleteRangeTxn::GetCID(),
-                                                    getter_AddRefs(editTxn));
-            nsRefPtr<DeleteRangeTxn> txn =
-              static_cast<DeleteRangeTxn*>(editTxn.get());
-            if (NS_SUCCEEDED(result) && txn)
+            nsRefPtr<DeleteRangeTxn> txn = new DeleteRangeTxn();
+            if (txn)
             {
               txn->Init(this, range, &mRangeUpdater);
               (*aTxn)->AppendChild(txn);
             }
             else
               result = NS_ERROR_OUT_OF_MEMORY;
           }
           // Same with range as with selection; if it is collapsed and action
--- a/editor/libeditor/base/nsStyleSheetTxns.h
+++ b/editor/libeditor/base/nsStyleSheetTxns.h
@@ -38,73 +38,50 @@
 #ifndef nsStylesheetTxns_h__
 #define nsStylesheetTxns_h__
 
 #include "EditTxn.h"
 #include "nsCOMPtr.h"
 #include "nsIEditor.h"
 #include "nsICSSStyleSheet.h"
 
-#define ADD_STYLESHEET_TXN_CID \
-{/* d05e2980-2fbe-11d3-9ce4-e8393835307c */ \
-0xd05e2980, 0x2fbe, 0x11d3, { 0x9c, 0xe4, 0xe8, 0x39, 0x38, 0x35, 0x30, 0x7c } }
-
-#define REMOVE_STYLESHEET_TXN_CID \
-{/* d05e2981-2fbe-11d3-9ce4-e8393835307c */ \
-0xd05e2981, 0x2fbe, 0x11d3, { 0x9c, 0xe4, 0xe8, 0x39, 0x38, 0x35, 0x30, 0x7c } }
-
-
 class AddStyleSheetTxn : public EditTxn
 {
-  friend class TransactionFactory;
-
 public:
-
-  static const nsIID& GetCID() { static const nsIID iid = ADD_STYLESHEET_TXN_CID; return iid; }
-
   /** Initialize the transaction.
     * @param aEditor the object providing core editing operations
     * @param aSheet   the stylesheet to add
     */
   NS_IMETHOD Init(nsIEditor         *aEditor,
                   nsICSSStyleSheet  *aSheet);
 
-private:
   AddStyleSheetTxn();
 
-public:
   NS_DECL_EDITTXN
 
 protected:
 
   nsIEditor*  mEditor;									// the editor that created this transaction
   nsCOMPtr<nsICSSStyleSheet>	mSheet;		// the style sheet to add
   
 };
 
 
 class RemoveStyleSheetTxn : public EditTxn
 {
-  friend class TransactionFactory;
-
 public:
-
-  static const nsIID& GetCID() { static const nsIID iid = REMOVE_STYLESHEET_TXN_CID; return iid; }
-
   /** Initialize the transaction.
     * @param aEditor the object providing core editing operations
     * @param aSheet   the stylesheet to remove
     */
   NS_IMETHOD Init(nsIEditor         *aEditor,
                   nsICSSStyleSheet  *aSheet);
 	
-private:
   RemoveStyleSheetTxn();
 
-public:
   NS_DECL_EDITTXN
 
 protected:
 
   nsIEditor*  mEditor;									// the editor that created this transaction
   nsCOMPtr<nsICSSStyleSheet>	mSheet;		// the style sheet to remove
   
 };
--- a/editor/libeditor/html/nsHTMLCSSUtils.cpp
+++ b/editor/libeditor/html/nsHTMLCSSUtils.cpp
@@ -40,17 +40,16 @@
 #include "nsCOMPtr.h"
 #include "nsHTMLEditUtils.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "nsIServiceManager.h"
 #include "nsEditProperty.h"
 #include "ChangeCSSInlineStyleTxn.h"
 #include "nsIDOMElement.h"
-#include "TransactionFactory.h"
 #include "nsIDOMElementCSSInlineStyle.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentView.h"
 #include "nsIContent.h"
 #include "nsIAtom.h"
 #include "nsTextEditUtils.h"
 #include "nsReadableUtils.h"
 #include "nsUnicharUtils.h"
@@ -515,25 +514,24 @@ nsHTMLCSSUtils::RemoveCSSProperty(nsIDOM
 
 nsresult 
 nsHTMLCSSUtils::CreateCSSPropertyTxn(nsIDOMElement *aElement, 
                                      nsIAtom * aAttribute,
                                      const nsAString& aValue,
                                      ChangeCSSInlineStyleTxn ** aTxn,
                                      PRBool aRemoveProperty)
 {
-  nsresult result = NS_ERROR_NULL_POINTER;
-  if (aElement)
-  {
-    result = TransactionFactory::GetNewTransaction(ChangeCSSInlineStyleTxn::GetCID(), (EditTxn **)aTxn);
-    if (NS_SUCCEEDED(result))  {
-      result = (*aTxn)->Init(mHTMLEditor, aElement, aAttribute, aValue, aRemoveProperty);
-    }
-  }
-  return result;
+  if (!aElement)
+    return NS_ERROR_NULL_POINTER;
+
+  *aTxn = new ChangeCSSInlineStyleTxn();
+  if (!*aTxn)
+    return NS_ERROR_OUT_OF_MEMORY;
+  NS_ADDREF(*aTxn);
+  return (*aTxn)->Init(mHTMLEditor, aElement, aAttribute, aValue, aRemoveProperty);
 }
 
 nsresult
 nsHTMLCSSUtils::GetSpecifiedProperty(nsIDOMNode *aNode, nsIAtom *aProperty,
                                      nsAString & aValue)
 {
   return GetCSSInlinePropertyBase(aNode, aProperty, aValue, nsnull, SPECIFIED_STYLE_TYPE);
 }
--- a/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/editor/libeditor/html/nsHTMLEditor.cpp
@@ -67,18 +67,16 @@
 #include "nsISelectionPrivate.h"
 #include "nsIDOMHTMLAnchorElement.h"
 #include "nsISelectionController.h"
 #include "nsIDOMHTMLHtmlElement.h"
 #include "nsGUIEvent.h"
 #include "nsIDOMEventGroup.h"
 #include "nsILinkHandler.h"
 
-#include "TransactionFactory.h"
-
 #include "nsICSSLoader.h"
 #include "nsICSSStyleSheet.h"
 #include "nsIDOMStyleSheet.h"
 #include "nsIDocumentObserver.h"
 #include "nsIDocumentStateListener.h"
 
 #include "nsIEnumerator.h"
 #include "nsIContent.h"
@@ -696,31 +694,27 @@ nsHTMLEditor::IsBlockNode(nsIDOMNode *aN
   NodeIsBlockStatic(aNode, &isBlock);
   return isBlock;
 }
 
 // Non-static version for the nsIEditor interface and JavaScript
 NS_IMETHODIMP 
 nsHTMLEditor::SetDocumentTitle(const nsAString &aTitle)
 {
-  nsRefPtr<EditTxn> txn;
-  nsresult result = TransactionFactory::GetNewTransaction(SetDocTitleTxn::GetCID(), getter_AddRefs(txn));
-  if (NS_SUCCEEDED(result))  
-  {
-    result = static_cast<SetDocTitleTxn*>(txn.get())->Init(this, &aTitle);
-
-    if (NS_SUCCEEDED(result)) 
-    {
-      //Don't let Rules System change the selection
-      nsAutoTxnsConserveSelection dontChangeSelection(this);
-
-      result = nsEditor::DoTransaction(txn);  
-    }
-  }
-  return result;
+  nsRefPtr<SetDocTitleTxn> txn = new SetDocTitleTxn();
+  if (!txn)
+    return NS_ERROR_OUT_OF_MEMORY;
+
+  nsresult result = txn->Init(this, &aTitle);
+  if (NS_FAILED(result))
+    return result;
+
+  //Don't let Rules System change the selection
+  nsAutoTxnsConserveSelection dontChangeSelection(this);
+  return nsEditor::DoTransaction(txn);  
 }
 
 /* ------------ Block methods moved from nsEditor -------------- */
 ///////////////////////////////////////////////////////////////////////////
 // GetBlockNodeParent: returns enclosing block level ancestor, if any
 //
 nsCOMPtr<nsIDOMNode>
 nsHTMLEditor::GetBlockNodeParent(nsIDOMNode *aNode)