Bug 751547 - Unify action enums in editor/; r=ehsan
authorAryeh Gregor <ayg@aryeh.name>
Sat, 05 May 2012 21:52:29 +0300
changeset 93300 94ce5f33a9ea3ec93325e484f3c12d1b882554b9
parent 93299 7a7c6d1e67e00fd1e712cdcdfcb939c01c3ba9a4
child 93301 e6228decd18e78eed00a03f8a7a1115dd5d7d4a7
child 93303 1907bf7e6d7c2f89e484534e5db7312d224f9814
push id22622
push userryanvm@gmail.com
push dateSun, 06 May 2012 03:08:51 +0000
treeherdermozilla-central@94ce5f33a9ea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs751547
milestone15.0a1
first release with
nightly linux32
94ce5f33a9ea / 15.0a1 / 20120506030520 / files
nightly linux64
94ce5f33a9ea / 15.0a1 / 20120506030520 / files
nightly mac
94ce5f33a9ea / 15.0a1 / 20120506030520 / files
nightly win32
94ce5f33a9ea / 15.0a1 / 20120506030520 / files
nightly win64
94ce5f33a9ea / 15.0a1 / 20120506030520 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 751547 - Unify action enums in editor/; r=ehsan
editor/libeditor/base/nsEditRules.h
editor/libeditor/base/nsEditor.cpp
editor/libeditor/base/nsEditor.h
editor/libeditor/base/nsEditorUtils.h
editor/libeditor/html/nsHTMLAbsPosition.cpp
editor/libeditor/html/nsHTMLDataTransfer.cpp
editor/libeditor/html/nsHTMLEditRules.cpp
editor/libeditor/html/nsHTMLEditRules.h
editor/libeditor/html/nsHTMLEditor.cpp
editor/libeditor/html/nsHTMLEditor.h
editor/libeditor/html/nsHTMLEditorStyle.cpp
editor/libeditor/text/nsPlaintextEditor.cpp
editor/libeditor/text/nsPlaintextEditor.h
editor/libeditor/text/nsTextEditRules.cpp
editor/libeditor/text/nsTextEditRules.h
--- a/editor/libeditor/base/nsEditRules.h
+++ b/editor/libeditor/base/nsEditRules.h
@@ -49,38 +49,40 @@ class nsISelection;
 /***************************************************************************
  * base for an object to encapsulate any additional info needed to be passed
  * to rules system by the editor
  */
 class nsRulesInfo
 {
   public:
   
-  nsRulesInfo(int aAction) : action(aAction) {}
+  nsRulesInfo(nsEditor::OperationID aAction) : action(aAction) {}
   virtual ~nsRulesInfo() {}
   
-  int action;
+  nsEditor::OperationID action;
 };
 
 /***************************************************************************
  * Interface of editing rules.
  *  
  */
 class nsIEditRules : public nsISupports
 {
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEDITRULES_IID)
   
 //Interfaces for addref and release and queryinterface
 //NOTE: Use   NS_DECL_ISUPPORTS_INHERITED in any class inherited from nsIEditRules
 
   NS_IMETHOD Init(nsPlaintextEditor *aEditor)=0;
   NS_IMETHOD DetachEditor()=0;
-  NS_IMETHOD BeforeEdit(PRInt32 action, nsIEditor::EDirection aDirection)=0;
-  NS_IMETHOD AfterEdit(PRInt32 action, nsIEditor::EDirection aDirection)=0;
+  NS_IMETHOD BeforeEdit(nsEditor::OperationID action,
+                        nsIEditor::EDirection aDirection) = 0;
+  NS_IMETHOD AfterEdit(nsEditor::OperationID action,
+                       nsIEditor::EDirection aDirection) = 0;
   NS_IMETHOD WillDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, bool *aCancel, bool *aHandled)=0;
   NS_IMETHOD DidDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult)=0;
   NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty)=0;
   NS_IMETHOD DocumentModified()=0;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIEditRules, NS_IEDITRULES_IID)
 
--- a/editor/libeditor/base/nsEditor.cpp
+++ b/editor/libeditor/base/nsEditor.cpp
@@ -149,17 +149,17 @@ extern nsIParserService *sParserService;
 nsEditor::nsEditor()
 :  mPlaceHolderName(nsnull)
 ,  mSelState(nsnull)
 ,  mPhonetic(nsnull)
 ,  mModCount(0)
 ,  mFlags(0)
 ,  mUpdateCount(0)
 ,  mPlaceHolderBatch(0)
-,  mAction(nsnull)
+,  mAction(kOpNone)
 ,  mHandlingActionCount(0)
 ,  mIMETextOffset(0)
 ,  mIMEBufferLength(0)
 ,  mDirection(eNone)
 ,  mDocDirtyState(-1)
 ,  mSpellcheckCheckboxState(eTriUnset)
 ,  mInIMEMode(false)
 ,  mIsIMEComposing(false)
@@ -2152,30 +2152,30 @@ nsEditor::GetRootElement(nsIDOMElement *
   rootElement.forget(aRootElement);
   return NS_OK;
 }
 
 
 /** All editor operations which alter the doc should be prefaced
  *  with a call to StartOperation, naming the action and direction */
 NS_IMETHODIMP
-nsEditor::StartOperation(PRInt32 opID, nsIEditor::EDirection aDirection)
+nsEditor::StartOperation(OperationID opID, nsIEditor::EDirection aDirection)
 {
   mAction = opID;
   mDirection = aDirection;
   return NS_OK;
 }
 
 
 /** All editor operations which alter the doc should be followed
  *  with a call to EndOperation */
 NS_IMETHODIMP
 nsEditor::EndOperation()
 {
-  mAction = nsnull;
+  mAction = kOpNone;
   mDirection = eNone;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsEditor::CloneAttribute(const nsAString & aAttribute,
                          nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode)
 {
@@ -5124,17 +5124,17 @@ nsEditor::HandleKeyPressEvent(nsIDOMKeyE
       DeleteSelection(nsIEditor::eNext);
       aKeyEvent->PreventDefault(); // consumed
       return NS_OK; 
   }
   return NS_OK;
 }
 
 nsresult
-nsEditor::HandleInlineSpellCheck(PRInt32 action,
+nsEditor::HandleInlineSpellCheck(OperationID action,
                                    nsISelection *aSelection,
                                    nsIDOMNode *previousSelectedNode,
                                    PRInt32 previousSelectedOffset,
                                    nsIDOMNode *aStartNode,
                                    PRInt32 aStartOffset,
                                    nsIDOMNode *aEndNode,
                                    PRInt32 aEndOffset)
 {
--- a/editor/libeditor/base/nsEditor.h
+++ b/editor/libeditor/base/nsEditor.h
@@ -124,22 +124,44 @@ public:
     kOpNone = 0,
     kOpUndo,
     kOpRedo,
     kOpInsertNode,
     kOpCreateNode,
     kOpDeleteNode,
     kOpSplitNode,
     kOpJoinNode,
-    kOpDeleteSelection,
+    kOpDeleteText = 1003,
+
     // text commands
-    kOpInsertBreak    = 1000,
-    kOpInsertText     = 1001,
-    kOpInsertIMEText  = 1002,
-    kOpDeleteText     = 1003
+    kOpInsertText         = 2000,
+    kOpInsertIMEText      = 2001,
+    kOpDeleteSelection    = 2002,
+    kOpSetTextProperty    = 2003,
+    kOpRemoveTextProperty = 2004,
+    kOpOutputText         = 2005,
+
+    // html only action
+    kOpInsertBreak         = 3000,
+    kOpMakeList            = 3001,
+    kOpIndent              = 3002,
+    kOpOutdent             = 3003,
+    kOpAlign               = 3004,
+    kOpMakeBasicBlock      = 3005,
+    kOpRemoveList          = 3006,
+    kOpMakeDefListItem     = 3007,
+    kOpInsertElement       = 3008,
+    kOpInsertQuotation     = 3009,
+    kOpHTMLPaste           = 3012,
+    kOpLoadHTML            = 3013,
+    kOpResetTextProperties = 3014,
+    kOpSetAbsolutePosition = 3015,
+    kOpRemoveAbsolutePosition = 3016,
+    kOpDecreaseZIndex      = 3017,
+    kOpIncreaseZIndex      = 3018
   };
 
   /** The default constructor. This should suffice. the setting of the interfaces is done
    *  after the construction of the editor class.
    */
   nsEditor();
   /** The default destructor. This should suffice. Should this be pure virtual 
    *  for someone to derive from the nsEditor later? I don't believe so.
@@ -379,17 +401,18 @@ protected:
     // regardless of DOM. Also, check to see if spell check should be skipped or not.
     return !IsPasswordEditor() && !IsReadonly() && !IsDisabled() && !ShouldSkipSpellCheck();
   }
 
 public:
 
   /** All editor operations which alter the doc should be prefaced
    *  with a call to StartOperation, naming the action and direction */
-  NS_IMETHOD StartOperation(PRInt32 opID, nsIEditor::EDirection aDirection);
+  NS_IMETHOD StartOperation(OperationID opID,
+                            nsIEditor::EDirection aDirection);
 
   /** All editor operations which alter the doc should be followed
    *  with a call to EndOperation */
   NS_IMETHOD EndOperation();
 
   /** routines for managing the preservation of selection across 
    *  various editor actions */
   bool     ArePreservingSelection();
@@ -630,17 +653,17 @@ public:
 
   nsresult BeginUpdateViewBatch(void);
   virtual nsresult EndUpdateViewBatch(void);
 
   bool GetShouldTxnSetSelection();
 
   virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent);
 
-  nsresult HandleInlineSpellCheck(PRInt32 action,
+  nsresult HandleInlineSpellCheck(OperationID action,
                                     nsISelection *aSelection,
                                     nsIDOMNode *previousSelectedNode,
                                     PRInt32 previousSelectedOffset,
                                     nsIDOMNode *aStartNode,
                                     PRInt32 aStartOffset,
                                     nsIDOMNode *aEndNode,
                                     PRInt32 aEndOffset);
 
@@ -841,17 +864,17 @@ protected:
   nsRangeUpdater    mRangeUpdater;       // utility class object for maintaining preserved ranges
 
   PRUint32          mModCount;     // number of modifications (for undo/redo stack)
   PRUint32          mFlags;        // behavior flags. See nsIPlaintextEditor.idl for the flags we use.
 
   PRInt32           mUpdateCount;
 
   PRInt32           mPlaceHolderBatch;   // nesting count for batching
-  PRInt32           mAction;             // the current editor action
+  OperationID       mAction;             // the current editor action
   PRUint32          mHandlingActionCount;
 
   PRUint32          mIMETextOffset;    // offset in text node where IME comp string begins
   PRUint32          mIMEBufferLength;  // current length of IME comp string
 
   EDirection        mDirection;          // the current direction of editor action
   PRInt8            mDocDirtyState;      // -1 = not initialized
   PRUint8           mSpellcheckCheckboxState; // a Tristate value
--- a/editor/libeditor/base/nsEditorUtils.h
+++ b/editor/libeditor/base/nsEditorUtils.h
@@ -101,17 +101,18 @@ class NS_STACK_CLASS nsAutoSelectionRese
 
 /***************************************************************************
  * stack based helper class for StartOperation()/EndOperation() sandwich
  */
 class NS_STACK_CLASS nsAutoRules
 {
   public:
   
-  nsAutoRules(nsEditor *ed, PRInt32 action, nsIEditor::EDirection aDirection) : 
+  nsAutoRules(nsEditor *ed, nsEditor::OperationID action,
+              nsIEditor::EDirection aDirection) :
          mEd(ed), mDoNothing(false)
   { 
     if (mEd && !mEd->mAction) // mAction will already be set if this is nested call
     {
       mEd->StartOperation(action, aDirection);
     }
     else mDoNothing = true; // nested calls will end up here
   }
--- a/editor/libeditor/html/nsHTMLAbsPosition.cpp
+++ b/editor/libeditor/html/nsHTMLAbsPosition.cpp
@@ -79,19 +79,18 @@ nsHTMLEditor::AbsolutePositionSelection(
   
   // the line below does not match the code; should it be removed?
   // Find out if the selection is collapsed:
   nsCOMPtr<nsISelection> selection;
   nsresult res = GetSelection(getter_AddRefs(selection));
   NS_ENSURE_SUCCESS(res, res);
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
-  nsTextRulesInfo ruleInfo(aEnabled ?
-                           nsTextEditRules::kSetAbsolutePosition :
-                           nsTextEditRules::kRemoveAbsolutePosition);
+  nsTextRulesInfo ruleInfo(aEnabled ? kOpSetAbsolutePosition :
+                                      kOpRemoveAbsolutePosition);
   bool cancel, handled;
   res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   if (NS_FAILED(res) || cancel)
     return res;
   
   return mRules->DidDoAction(selection, &ruleInfo, res);
 }
 
@@ -194,18 +193,18 @@ nsHTMLEditor::RelativeChangeZIndex(PRInt
                                  nsIEditor::eNext);
   
   // brade: can we get rid of this comment?
   // Find out if the selection is collapsed:
   nsCOMPtr<nsISelection> selection;
   nsresult res = GetSelection(getter_AddRefs(selection));
   NS_ENSURE_SUCCESS(res, res);
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
-  nsTextRulesInfo ruleInfo((aChange < 0) ? nsTextEditRules::kDecreaseZIndex:
-                                           nsTextEditRules::kIncreaseZIndex);
+  nsTextRulesInfo ruleInfo(aChange < 0 ? kOpDecreaseZIndex :
+                                         kOpIncreaseZIndex);
   bool cancel, handled;
   res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   if (cancel || NS_FAILED(res))
     return res;
   
   return mRules->DidDoAction(selection, &ruleInfo, res);
 }
 
--- a/editor/libeditor/html/nsHTMLDataTransfer.cpp
+++ b/editor/libeditor/html/nsHTMLDataTransfer.cpp
@@ -184,17 +184,17 @@ NS_IMETHODIMP nsHTMLEditor::LoadHTML(con
   nsAutoEditBatch beginBatching(this);
   nsAutoRules beginRulesSniffing(this, kOpLoadHTML, nsIEditor::eNext);
 
   // Get selection
   nsCOMPtr<nsISelection>selection;
   nsresult rv = GetSelection(getter_AddRefs(selection));
   NS_ENSURE_SUCCESS(rv, rv);
 
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kLoadHTML);
+  nsTextRulesInfo ruleInfo(kOpLoadHTML);
   bool cancel, handled;
   rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(rv, rv);
   if (cancel) {
     return NS_OK; // rules canceled the operation
   }
 
   if (!handled)
@@ -415,17 +415,17 @@ nsHTMLEditor::DoInsertHTMLWithContext(co
       rv = DeleteTableCell(1);
       NS_ENSURE_SUCCESS(rv, rv);
     }
     // collapse selection to beginning of deleted table content
     selection->CollapseToStart();
   }
 
   // give rules a chance to handle or cancel
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kInsertElement);
+  nsTextRulesInfo ruleInfo(kOpInsertElement);
   bool cancel, handled;
   rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(rv, rv);
   if (cancel) {
     return NS_OK; // rules canceled the operation
   }
 
   if (!handled)
@@ -1759,17 +1759,17 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsCited
 
   // get selection
   nsCOMPtr<nsISelection> selection;
   nsresult rv = GetSelection(getter_AddRefs(selection));
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   // give rules a chance to handle or cancel
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kInsertElement);
+  nsTextRulesInfo ruleInfo(kOpInsertElement);
   bool cancel, handled;
   rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(rv, rv);
   if (cancel || handled) {
     return NS_OK; // rules canceled the operation
   }
 
   nsCOMPtr<nsIDOMNode> newNode;
@@ -1961,17 +1961,17 @@ nsHTMLEditor::InsertAsPlaintextQuotation
   nsresult rv = GetSelection(getter_AddRefs(selection));
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   nsAutoEditBatch beginBatching(this);
   nsAutoRules beginRulesSniffing(this, kOpInsertQuotation, nsIEditor::eNext);
 
   // give rules a chance to handle or cancel
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kInsertElement);
+  nsTextRulesInfo ruleInfo(kOpInsertElement);
   bool cancel, handled;
   rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(rv, rv);
   if (cancel || handled) {
     return NS_OK; // rules canceled the operation
   }
 
   // Wrap the inserted quote in a <span> so it won't be wrapped:
@@ -2055,17 +2055,17 @@ nsHTMLEditor::InsertAsCitedQuotation(con
   nsresult rv = GetSelection(getter_AddRefs(selection));
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   nsAutoEditBatch beginBatching(this);
   nsAutoRules beginRulesSniffing(this, kOpInsertQuotation, nsIEditor::eNext);
 
   // give rules a chance to handle or cancel
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kInsertElement);
+  nsTextRulesInfo ruleInfo(kOpInsertElement);
   bool cancel, handled;
   rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(rv, rv);
   if (cancel || handled) {
     return NS_OK; // rules canceled the operation
   }
 
   rv = DeleteSelectionAndCreateNode(NS_LITERAL_STRING("blockquote"), getter_AddRefs(newNode));
--- a/editor/libeditor/html/nsHTMLEditRules.cpp
+++ b/editor/libeditor/html/nsHTMLEditRules.cpp
@@ -277,17 +277,18 @@ nsHTMLEditRules::Init(nsPlaintextEditor 
 NS_IMETHODIMP
 nsHTMLEditRules::DetachEditor()
 {
   mHTMLEditor = nsnull;
   return nsTextEditRules::DetachEditor();
 }
 
 NS_IMETHODIMP
-nsHTMLEditRules::BeforeEdit(PRInt32 action, nsIEditor::EDirection aDirection)
+nsHTMLEditRules::BeforeEdit(nsEditor::OperationID action,
+                            nsIEditor::EDirection aDirection)
 {
   if (mLockRulesSniffing) return NS_OK;
   
   nsAutoLockRulesSniffing lockIt((nsTextEditRules*)this);
   mDidExplicitlySetInterline = false;
 
   if (!mActionNesting++)
   {
@@ -361,17 +362,18 @@ nsHTMLEditRules::BeforeEdit(PRInt32 acti
     // let rules remember the top level action
     mTheAction = action;
   }
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
-nsHTMLEditRules::AfterEdit(PRInt32 action, nsIEditor::EDirection aDirection)
+nsHTMLEditRules::AfterEdit(nsEditor::OperationID action,
+                           nsIEditor::EDirection aDirection)
 {
   if (mLockRulesSniffing) return NS_OK;
 
   nsAutoLockRulesSniffing lockIt(this);
 
   NS_PRECONDITION(mActionNesting>0, "bad action nesting!");
   nsresult res = NS_OK;
   if (!--mActionNesting)
@@ -395,17 +397,18 @@ nsHTMLEditRules::AfterEdit(PRInt32 actio
     }
   }
 
   return res;
 }
 
 
 nsresult
-nsHTMLEditRules::AfterEditInner(PRInt32 action, nsIEditor::EDirection aDirection)
+nsHTMLEditRules::AfterEditInner(nsEditor::OperationID action,
+                                nsIEditor::EDirection aDirection)
 {
   ConfirmSelectionInBody();
   if (action == nsEditor::kOpIgnore) return NS_OK;
   
   nsCOMPtr<nsISelection>selection;
   nsresult res = mHTMLEditor->GetSelection(getter_AddRefs(selection));
   NS_ENSURE_SUCCESS(res, res);
   
@@ -547,20 +550,19 @@ nsHTMLEditRules::WillDoAction(nsISelecti
   *aCancel = false;
   *aHandled = false;
     
   // my kingdom for dynamic cast
   nsTextRulesInfo *info = static_cast<nsTextRulesInfo*>(aInfo);
 
   // Deal with actions for which we don't need to check whether the selection is
   // editable.
-  if (info->action == kOutputText ||
-      info->action == kUndo ||
-      info->action == kRedo)
-  {
+  if (info->action == nsEditor::kOpOutputText ||
+      info->action == nsEditor::kOpUndo ||
+      info->action == nsEditor::kOpRedo) {
     return nsTextEditRules::WillDoAction(aSelection, aInfo, aCancel, aHandled);
   }
 
   nsCOMPtr<nsIDOMRange> domRange;
   nsresult rv = aSelection->GetRangeAt(0, getter_AddRefs(domRange));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIDOMNode> selStartNode;
@@ -595,85 +597,86 @@ nsHTMLEditRules::WillDoAction(nsISelecti
       *aCancel = true;
 
       return NS_OK;
     }
   }
 
   switch (info->action)
   {
-    case kInsertText:
-    case kInsertTextIME:
+    case nsEditor::kOpInsertText:
+    case nsEditor::kOpInsertIMEText:
       return WillInsertText(info->action,
                             aSelection, 
                             aCancel, 
                             aHandled,
                             info->inString,
                             info->outString,
                             info->maxLength);
-    case kLoadHTML:
+    case nsEditor::kOpLoadHTML:
       return WillLoadHTML(aSelection, aCancel);
-    case kInsertBreak:
+    case nsEditor::kOpInsertBreak:
       return WillInsertBreak(aSelection, aCancel, aHandled);
-    case kDeleteSelection:
+    case nsEditor::kOpDeleteSelection:
       return WillDeleteSelection(aSelection, info->collapsedAction, aCancel, aHandled);
-    case kMakeList:
+    case nsEditor::kOpMakeList:
       return WillMakeList(aSelection, info->blockType, info->entireList, info->bulletType, aCancel, aHandled);
-    case kIndent:
+    case nsEditor::kOpIndent:
       return WillIndent(aSelection, aCancel, aHandled);
-    case kOutdent:
+    case nsEditor::kOpOutdent:
       return WillOutdent(aSelection, aCancel, aHandled);
-    case kSetAbsolutePosition:
+    case nsEditor::kOpSetAbsolutePosition:
       return WillAbsolutePosition(aSelection, aCancel, aHandled);
-    case kRemoveAbsolutePosition:
+    case nsEditor::kOpRemoveAbsolutePosition:
       return WillRemoveAbsolutePosition(aSelection, aCancel, aHandled);
-    case kAlign:
+    case nsEditor::kOpAlign:
       return WillAlign(aSelection, info->alignType, aCancel, aHandled);
-    case kMakeBasicBlock:
+    case nsEditor::kOpMakeBasicBlock:
       return WillMakeBasicBlock(aSelection, info->blockType, aCancel, aHandled);
-    case kRemoveList:
+    case nsEditor::kOpRemoveList:
       return WillRemoveList(aSelection, info->bOrdered, aCancel, aHandled);
-    case kMakeDefListItem:
+    case nsEditor::kOpMakeDefListItem:
       return WillMakeDefListItem(aSelection, info->blockType, info->entireList, aCancel, aHandled);
-    case kInsertElement:
+    case nsEditor::kOpInsertElement:
       return WillInsert(aSelection, aCancel);
-    case kDecreaseZIndex:
+    case nsEditor::kOpDecreaseZIndex:
       return WillRelativeChangeZIndex(aSelection, -1, aCancel, aHandled);
-    case kIncreaseZIndex:
+    case nsEditor::kOpIncreaseZIndex:
       return WillRelativeChangeZIndex(aSelection, 1, aCancel, aHandled);
-  }
-  return nsTextEditRules::WillDoAction(aSelection, aInfo, aCancel, aHandled);
+    default:
+      return nsTextEditRules::WillDoAction(aSelection, aInfo, aCancel, aHandled);
+  }
 }
   
   
 NS_IMETHODIMP 
 nsHTMLEditRules::DidDoAction(nsISelection *aSelection,
                              nsRulesInfo *aInfo, nsresult aResult)
 {
   nsTextRulesInfo *info = static_cast<nsTextRulesInfo*>(aInfo);
   switch (info->action)
   {
-    case kInsertBreak:
+    case nsEditor::kOpInsertBreak:
       return DidInsertBreak(aSelection, aResult);
-    case kDeleteSelection:
+    case nsEditor::kOpDeleteSelection:
       return DidDeleteSelection(aSelection, info->collapsedAction, aResult);
-    case kMakeBasicBlock:
-    case kIndent:
-    case kOutdent:
-    case kAlign:
+    case nsEditor::kOpMakeBasicBlock:
+    case nsEditor::kOpIndent:
+    case nsEditor::kOpOutdent:
+    case nsEditor::kOpAlign:
       return DidMakeBasicBlock(aSelection, aInfo, aResult);
-    case kSetAbsolutePosition: {
+    case nsEditor::kOpSetAbsolutePosition: {
       nsresult rv = DidMakeBasicBlock(aSelection, aInfo, aResult);
       NS_ENSURE_SUCCESS(rv, rv);
       return DidAbsolutePosition();
-      }
-  }
-  
-  // default: pass thru to nsTextEditRules
-  return nsTextEditRules::DidDoAction(aSelection, aInfo, aResult);
+    }
+    default:
+      // pass thru to nsTextEditRules
+      return nsTextEditRules::DidDoAction(aSelection, aInfo, aResult);
+  }
 }
   
 nsresult
 nsHTMLEditRules::GetListState(bool *aMixed, bool *aOL, bool *aUL, bool *aDL)
 {
   NS_ENSURE_TRUE(aMixed && aOL && aUL && aDL, NS_ERROR_NULL_POINTER);
   *aMixed = false;
   *aOL = false;
@@ -828,22 +831,23 @@ nsHTMLEditRules::GetAlignment(bool *aMix
            offset == rootOffset)
   {
     // if we have selected the body, let's look at the first editable node
     mHTMLEditor->GetNextNode(parent, offset, true, address_of(nodeToExamine));
   }
   else
   {
     nsCOMArray<nsIDOMRange> arrayOfRanges;
-    res = GetPromotedRanges(selection, arrayOfRanges, kAlign);
+    res = GetPromotedRanges(selection, arrayOfRanges, nsEditor::kOpAlign);
     NS_ENSURE_SUCCESS(res, res);
 
     // use these ranges to construct a list of nodes to act on.
     nsCOMArray<nsIDOMNode> arrayOfNodes;
-    res = GetNodesForOperation(arrayOfRanges, arrayOfNodes, kAlign, true);
+    res = GetNodesForOperation(arrayOfRanges, arrayOfNodes,
+                               nsEditor::kOpAlign, true);
     NS_ENSURE_SUCCESS(res, res);                                 
     nodeToExamine = arrayOfNodes.SafeObjectAt(0);
   }
 
   NS_ENSURE_TRUE(nodeToExamine, NS_ERROR_NULL_POINTER);
 
   NS_NAMED_LITERAL_STRING(typeAttrName, "align");
   nsIAtom  *dummyProperty = nsnull;
@@ -952,17 +956,18 @@ nsHTMLEditRules::GetIndentState(bool *aC
   nsCOMPtr<nsISelection>selection;
   nsresult res = mHTMLEditor->GetSelection(getter_AddRefs(selection));
   NS_ENSURE_SUCCESS(res, res);
   nsCOMPtr<nsISelectionPrivate> selPriv(do_QueryInterface(selection));
   NS_ENSURE_TRUE(selPriv, NS_ERROR_FAILURE);
 
   // contruct a list of nodes to act on.
   nsCOMArray<nsIDOMNode> arrayOfNodes;
-  res = GetNodesFromSelection(selection, kIndent, arrayOfNodes, true);
+  res = GetNodesFromSelection(selection, nsEditor::kOpIndent,
+                              arrayOfNodes, true);
   NS_ENSURE_SUCCESS(res, res);
 
   // examine nodes in selection for blockquotes or list elements;
   // these we can outdent.  Note that we return true for canOutdent
   // if *any* of the selection is outdentable, rather than all of it.
   PRInt32 listCount = arrayOfNodes.Count();
   PRInt32 i;
   bool useCSS = mHTMLEditor->IsCSSEnabled();
@@ -1270,30 +1275,27 @@ nsHTMLEditRules::WillInsert(nsISelection
 nsresult
 nsHTMLEditRules::DidInsert(nsISelection *aSelection, nsresult aResult)
 {
   return nsTextEditRules::DidInsert(aSelection, aResult);
 }
 #endif
 
 nsresult
-nsHTMLEditRules::WillInsertText(PRInt32          aAction,
+nsHTMLEditRules::WillInsertText(nsEditor::OperationID aAction,
                                 nsISelection *aSelection, 
                                 bool            *aCancel,
                                 bool            *aHandled,
                                 const nsAString *inString,
                                 nsAString       *outString,
                                 PRInt32          aMaxLength)
 {  
   if (!aSelection || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
 
-
-
-  if (inString->IsEmpty() && (aAction != kInsertTextIME))
-  {
+  if (inString->IsEmpty() && aAction != nsEditor::kOpInsertIMEText) {
     // HACK: this is a fix for bug 19395
     // I can't outlaw all empty insertions
     // because IME transaction depend on them
     // There is more work to do to make the 
     // world safe for IME.
     *aCancel = true;
     *aHandled = false;
     return NS_OK;
@@ -1331,18 +1333,17 @@ nsHTMLEditRules::WillInsertText(PRInt32 
       !mHTMLEditor->CanContainTag(selNode, nsGkAtoms::textTagName)) {
     return NS_ERROR_FAILURE;
   }
 
   // we need to get the doc
   nsCOMPtr<nsIDOMDocument> doc = mHTMLEditor->GetDOMDocument();
   NS_ENSURE_TRUE(doc, NS_ERROR_NOT_INITIALIZED);
     
-  if (aAction == kInsertTextIME) 
-  { 
+  if (aAction == nsEditor::kOpInsertIMEText) {
     // Right now the nsWSRunObject code bails on empty strings, but IME needs 
     // the InsertTextImpl() call to still happen since empty strings are meaningful there.
     if (inString->IsEmpty())
     {
       res = mHTMLEditor->InsertTextImpl(*inString, address_of(selNode), &selOffset, doc);
     }
     else
     {
@@ -2776,17 +2777,18 @@ nsHTMLEditRules::JoinBlocks(nsCOMPtr<nsI
 *         PRInt32 aRightOffset           offset in aRightBlock to move content from
 */
 nsresult
 nsHTMLEditRules::MoveBlock(nsIDOMNode *aLeftBlock, nsIDOMNode *aRightBlock, PRInt32 aLeftOffset, PRInt32 aRightOffset)
 {
   nsCOMArray<nsIDOMNode> arrayOfNodes;
   nsCOMPtr<nsISupports> isupports;
   // GetNodesFromPoint is the workhorse that figures out what we wnat to move.
-  nsresult res = GetNodesFromPoint(DOMPoint(aRightBlock,aRightOffset), kMakeList, arrayOfNodes, true);
+  nsresult res = GetNodesFromPoint(DOMPoint(aRightBlock,aRightOffset),
+                                   nsEditor::kOpMakeList, arrayOfNodes, true);
   NS_ENSURE_SUCCESS(res, res);
   PRInt32 listCount = arrayOfNodes.Count();
   PRInt32 i;
   for (i=0; i<listCount; i++)
   {
     // get the node to act on
     nsIDOMNode* curNode = arrayOfNodes[i];
     if (IsBlockNode(curNode))
@@ -3272,17 +3274,17 @@ nsHTMLEditRules::WillRemoveList(nsISelec
   *aCancel = false;
   *aHandled = true;
   
   nsresult res = NormalizeSelection(aSelection);
   NS_ENSURE_SUCCESS(res, res);
   nsAutoSelectionReset selectionResetter(aSelection, mHTMLEditor);
   
   nsCOMArray<nsIDOMRange> arrayOfRanges;
-  res = GetPromotedRanges(aSelection, arrayOfRanges, kMakeList);
+  res = GetPromotedRanges(aSelection, arrayOfRanges, nsEditor::kOpMakeList);
   NS_ENSURE_SUCCESS(res, res);
   
   // use these ranges to contruct a list of nodes to act on.
   nsCOMArray<nsIDOMNode> arrayOfNodes;
   res = GetListActionNodes(arrayOfNodes, false);
   NS_ENSURE_SUCCESS(res, res);                                 
                                      
   // Remove all non-editable nodes.  Leave them be.
@@ -3361,17 +3363,18 @@ nsHTMLEditRules::WillMakeBasicBlock(nsIS
   NS_ENSURE_SUCCESS(res, res);
   nsAutoSelectionReset selectionResetter(aSelection, mHTMLEditor);
   nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
   *aHandled = true;
   nsString tString(*aBlockType);
 
   // contruct a list of nodes to act on.
   nsCOMArray<nsIDOMNode> arrayOfNodes;
-  res = GetNodesFromSelection(aSelection, kMakeBasicBlock, arrayOfNodes);
+  res = GetNodesFromSelection(aSelection, nsEditor::kOpMakeBasicBlock,
+                              arrayOfNodes);
   NS_ENSURE_SUCCESS(res, res);
 
   // Remove all non-editable nodes.  Leave them be.
   PRInt32 listCount = arrayOfNodes.Count();
   PRInt32 i;
   for (i=listCount-1; i>=0; i--)
   {
     if (!mHTMLEditor->IsEditable(arrayOfNodes[i]))
@@ -3558,17 +3561,17 @@ nsHTMLEditRules::WillCSSIndent(nsISelect
     arrayOfNodes.AppendObject(liNode);
   }
   else
   {
     // convert the selection ranges into "promoted" selection ranges:
     // this basically just expands the range to include the immediate
     // block parent, and then further expands to include any ancestors
     // whose children are all in the range
-    res = GetNodesFromSelection(aSelection, kIndent, arrayOfNodes);
+    res = GetNodesFromSelection(aSelection, nsEditor::kOpIndent, arrayOfNodes);
     NS_ENSURE_SUCCESS(res, res);
   }
   
   NS_NAMED_LITERAL_STRING(quoteType, "blockquote");
   // if nothing visible in list, make an empty block
   if (ListIsEmptyLine(arrayOfNodes))
   {
     nsCOMPtr<nsIDOMNode> parent, theBlock;
@@ -3741,22 +3744,22 @@ nsHTMLEditRules::WillHTMLIndent(nsISelec
   nsAutoSelectionReset selectionResetter(aSelection, mHTMLEditor);
   
   // convert the selection ranges into "promoted" selection ranges:
   // this basically just expands the range to include the immediate
   // block parent, and then further expands to include any ancestors
   // whose children are all in the range
   
   nsCOMArray<nsIDOMRange> arrayOfRanges;
-  res = GetPromotedRanges(aSelection, arrayOfRanges, kIndent);
+  res = GetPromotedRanges(aSelection, arrayOfRanges, nsEditor::kOpIndent);
   NS_ENSURE_SUCCESS(res, res);
   
   // use these ranges to contruct a list of nodes to act on.
   nsCOMArray<nsIDOMNode> arrayOfNodes;
-  res = GetNodesForOperation(arrayOfRanges, arrayOfNodes, kIndent);
+  res = GetNodesForOperation(arrayOfRanges, arrayOfNodes, nsEditor::kOpIndent);
   NS_ENSURE_SUCCESS(res, res);                                 
                                      
   NS_NAMED_LITERAL_STRING(quoteType, "blockquote");
 
   // if nothing visible in list, make an empty block
   if (ListIsEmptyLine(arrayOfNodes))
   {
     nsCOMPtr<nsIDOMNode> parent, theBlock;
@@ -3971,17 +3974,18 @@ nsHTMLEditRules::WillOutdent(nsISelectio
   {
     nsAutoSelectionReset selectionResetter(aSelection, mHTMLEditor);
     
     // convert the selection ranges into "promoted" selection ranges:
     // this basically just expands the range to include the immediate
     // block parent, and then further expands to include any ancestors
     // whose children are all in the range
     nsCOMArray<nsIDOMNode> arrayOfNodes;
-    res = GetNodesFromSelection(aSelection, kOutdent, arrayOfNodes);
+    res = GetNodesFromSelection(aSelection, nsEditor::kOpOutdent,
+                                arrayOfNodes);
     NS_ENSURE_SUCCESS(res, res);
 
     // Ok, now go through all the nodes and remove a level of blockquoting, 
     // or whatever is appropriate.  Wohoo!
 
     nsCOMPtr<nsIDOMNode> curBlockQuote, firstBQChild, lastBQChild;
     bool curBlockQuoteIsIndentedWithCSS = false;
     PRInt32 listCount = arrayOfNodes.Count();
@@ -4594,17 +4598,17 @@ nsHTMLEditRules::WillAlign(nsISelection 
   nsAutoSelectionReset selectionResetter(aSelection, mHTMLEditor);
 
   // convert the selection ranges into "promoted" selection ranges:
   // this basically just expands the range to include the immediate
   // block parent, and then further expands to include any ancestors
   // whose children are all in the range
   *aHandled = true;
   nsCOMArray<nsIDOMNode> arrayOfNodes;
-  res = GetNodesFromSelection(aSelection, kAlign, arrayOfNodes);
+  res = GetNodesFromSelection(aSelection, nsEditor::kOpAlign, arrayOfNodes);
   NS_ENSURE_SUCCESS(res, res);
 
   // if we don't have any nodes, or we have only a single br, then we are
   // creating an empty alignment div.  We have to do some different things for these.
   bool emptyDiv = false;
   PRInt32 listCount = arrayOfNodes.Count();
   if (!listCount) emptyDiv = true;
   if (listCount == 1)
@@ -5470,18 +5474,21 @@ nsHTMLEditRules::NormalizeSelection(nsIS
   return NS_OK;
 }
 
 
 ///////////////////////////////////////////////////////////////////////////
 // GetPromotedPoint: figure out where a start or end point for a block
 //                   operation really is
 nsresult
-nsHTMLEditRules::GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode *aNode, PRInt32 aOffset, 
-                                  PRInt32 actionID, nsCOMPtr<nsIDOMNode> *outNode, PRInt32 *outOffset)
+nsHTMLEditRules::GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode *aNode,
+                                  PRInt32 aOffset,
+                                  nsEditor::OperationID actionID,
+                                  nsCOMPtr<nsIDOMNode> *outNode,
+                                  PRInt32 *outOffset)
 {
   nsresult res = NS_OK;
   nsCOMPtr<nsIDOMNode> nearNode, node = aNode;
   nsCOMPtr<nsIDOMNode> parent = aNode;
   PRInt32 pOffset, offset = aOffset;
   
   // default values
   *outNode = node;
@@ -5667,17 +5674,17 @@ nsHTMLEditRules::GetPromotedPoint(RulesE
 
 ///////////////////////////////////////////////////////////////////////////
 // GetPromotedRanges: run all the selection range endpoint through 
 //                    GetPromotedPoint()
 //                       
 nsresult 
 nsHTMLEditRules::GetPromotedRanges(nsISelection *inSelection, 
                                    nsCOMArray<nsIDOMRange> &outArrayOfRanges, 
-                                   PRInt32 inOperationType)
+                                   nsEditor::OperationID inOperationType)
 {
   NS_ENSURE_TRUE(inSelection, NS_ERROR_NULL_POINTER);
 
   PRInt32 rangeCount;
   nsresult res = inSelection->GetRangeCount(&rangeCount);
   NS_ENSURE_SUCCESS(res, res);
   
   PRInt32 i;
@@ -5708,17 +5715,17 @@ nsHTMLEditRules::GetPromotedRanges(nsISe
 
 
 ///////////////////////////////////////////////////////////////////////////
 // PromoteRange: expand a range to include any parents for which all
 //               editable children are already in range. 
 //                       
 nsresult 
 nsHTMLEditRules::PromoteRange(nsIDOMRange *inRange, 
-                              PRInt32 inOperationType)
+                              nsEditor::OperationID inOperationType)
 {
   NS_ENSURE_TRUE(inRange, NS_ERROR_NULL_POINTER);
   nsresult res;
   nsCOMPtr<nsIDOMNode> startNode, endNode;
   PRInt32 startOffset, endOffset;
   
   res = inRange->GetStartContainer(getter_AddRefs(startNode));
   NS_ENSURE_SUCCESS(res, res);
@@ -5808,17 +5815,17 @@ private:
 
 ///////////////////////////////////////////////////////////////////////////
 // GetNodesForOperation: run through the ranges in the array and construct 
 //                       a new array of nodes to be acted on.
 //                       
 nsresult 
 nsHTMLEditRules::GetNodesForOperation(nsCOMArray<nsIDOMRange>& inArrayOfRanges, 
                                       nsCOMArray<nsIDOMNode>& outArrayOfNodes, 
-                                      PRInt32 inOperationType,
+                                      nsEditor::OperationID inOperationType,
                                       bool aDontTouchContent)
 {
   PRInt32 rangeCount = inArrayOfRanges.Count();
   
   PRInt32 i;
   nsCOMPtr<nsIDOMRange> opRange;
 
   nsresult res = NS_OK;
@@ -5891,53 +5898,51 @@ nsHTMLEditRules::GetNodesForOperation(ns
       NS_ENSURE_SUCCESS(res, res);
       if (!outArrayOfNodes.AppendObjects(nodes))
         return NS_ERROR_OUT_OF_MEMORY;
     }
   }    
 
   // certain operations should not act on li's and td's, but rather inside 
   // them.  alter the list as needed
-  if (inOperationType == kMakeBasicBlock)
-  {
+  if (inOperationType == nsEditor::kOpMakeBasicBlock) {
     PRInt32 listCount = outArrayOfNodes.Count();
     for (i=listCount-1; i>=0; i--)
     {
       nsCOMPtr<nsIDOMNode> node = outArrayOfNodes[i];
       if (nsHTMLEditUtils::IsListItem(node))
       {
         PRInt32 j=i;
         outArrayOfNodes.RemoveObjectAt(i);
         res = GetInnerContent(node, outArrayOfNodes, &j);
         NS_ENSURE_SUCCESS(res, res);
       }
     }
   }
   // indent/outdent already do something special for list items, but
   // we still need to make sure we don't act on table elements
-  else if ( (inOperationType == kOutdent)  ||
-            (inOperationType == kIndent)   ||
-            (inOperationType == kSetAbsolutePosition))
-  {
+  else if (inOperationType == nsEditor::kOpOutdent ||
+           inOperationType == nsEditor::kOpIndent ||
+           inOperationType == nsEditor::kOpSetAbsolutePosition) {
     PRInt32 listCount = outArrayOfNodes.Count();
     for (i=listCount-1; i>=0; i--)
     {
       nsCOMPtr<nsIDOMNode> node = outArrayOfNodes[i];
       if (nsHTMLEditUtils::IsTableElementButNotTable(node))
       {
         PRInt32 j=i;
         outArrayOfNodes.RemoveObjectAt(i);
         res = GetInnerContent(node, outArrayOfNodes, &j);
         NS_ENSURE_SUCCESS(res, res);
       }
     }
   }
   // outdent should look inside of divs.
-  if (inOperationType == kOutdent && !mHTMLEditor->IsCSSEnabled()) 
-  {
+  if (inOperationType == nsEditor::kOpOutdent &&
+      !mHTMLEditor->IsCSSEnabled()) {
     PRInt32 listCount = outArrayOfNodes.Count();
     for (i=listCount-1; i>=0; i--)
     {
       nsCOMPtr<nsIDOMNode> node = outArrayOfNodes[i];
       if (nsHTMLEditUtils::IsDiv(node))
       {
         PRInt32 j=i;
         outArrayOfNodes.RemoveObjectAt(i);
@@ -5945,23 +5950,22 @@ nsHTMLEditRules::GetNodesForOperation(ns
         NS_ENSURE_SUCCESS(res, res);
       }
     }
   }
 
 
   // post process the list to break up inline containers that contain br's.
   // but only for operations that might care, like making lists or para's...
-  if ( (inOperationType == kMakeBasicBlock)   ||
-       (inOperationType == kMakeList)         ||
-       (inOperationType == kAlign)            ||
-       (inOperationType == kSetAbsolutePosition) ||
-       (inOperationType == kIndent)           ||
-       (inOperationType == kOutdent) )
-  {
+  if (inOperationType == nsEditor::kOpMakeBasicBlock ||
+      inOperationType == nsEditor::kOpMakeList ||
+      inOperationType == nsEditor::kOpAlign ||
+      inOperationType == nsEditor::kOpSetAbsolutePosition ||
+      inOperationType == nsEditor::kOpIndent ||
+      inOperationType == nsEditor::kOpOutdent) {
     PRInt32 listCount = outArrayOfNodes.Count();
     for (i=listCount-1; i>=0; i--)
     {
       nsCOMPtr<nsIDOMNode> node = outArrayOfNodes[i];
       if (!aDontTouchContent && IsInlineNode(node) 
            && mHTMLEditor->IsContainer(node) && !mHTMLEditor->IsTextNode(node))
       {
         nsCOMArray<nsIDOMNode> arrayOfInlines;
@@ -6063,17 +6067,18 @@ nsHTMLEditRules::GetListActionNodes(nsCO
     if (outArrayOfNodes.Count()) return NS_OK;
   }
 
   {
     // We don't like other people messing with our selection!
     nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
 
     // contruct a list of nodes to act on.
-    res = GetNodesFromSelection(selection, kMakeList, outArrayOfNodes, aDontTouchContent);
+    res = GetNodesFromSelection(selection, nsEditor::kOpMakeList,
+                                outArrayOfNodes, aDontTouchContent);
     NS_ENSURE_SUCCESS(res, res);
   }
                
   // pre process our list of nodes...                      
   PRInt32 listCount = outArrayOfNodes.Count();
   PRInt32 i;
   for (i=listCount-1; i>=0; i--)
   {
@@ -6186,17 +6191,18 @@ nsresult
 nsHTMLEditRules::GetParagraphFormatNodes(nsCOMArray<nsIDOMNode>& outArrayOfNodes,
                                          bool aDontTouchContent)
 {  
   nsCOMPtr<nsISelection>selection;
   nsresult res = mHTMLEditor->GetSelection(getter_AddRefs(selection));
   NS_ENSURE_SUCCESS(res, res);
 
   // contruct a list of nodes to act on.
-  res = GetNodesFromSelection(selection, kMakeBasicBlock, outArrayOfNodes, aDontTouchContent);
+  res = GetNodesFromSelection(selection, nsEditor::kOpMakeBasicBlock,
+                              outArrayOfNodes, aDontTouchContent);
   NS_ENSURE_SUCCESS(res, res);
 
   // pre process our list of nodes...                      
   PRInt32 listCount = outArrayOfNodes.Count();
   PRInt32 i;
   for (i=listCount-1; i>=0; i--)
   {
     nsCOMPtr<nsIDOMNode> testNode = outArrayOfNodes[i];
@@ -6359,17 +6365,17 @@ nsHTMLEditRules::GetHighestInlineParent(
 
 
 ///////////////////////////////////////////////////////////////////////////
 // GetNodesFromPoint: given a particular operation, construct a list  
 //                     of nodes from a point that will be operated on. 
 //                       
 nsresult 
 nsHTMLEditRules::GetNodesFromPoint(DOMPoint point,
-                                   PRInt32 operation,
+                                   nsEditor::OperationID operation,
                                    nsCOMArray<nsIDOMNode> &arrayOfNodes,
                                    bool dontTouchContent)
 {
   nsresult res;
 
   // get our point
   nsCOMPtr<nsIDOMNode> node;
   PRInt32 offset;
@@ -6400,17 +6406,17 @@ nsHTMLEditRules::GetNodesFromPoint(DOMPo
 
 
 ///////////////////////////////////////////////////////////////////////////
 // GetNodesFromSelection: given a particular operation, construct a list  
 //                     of nodes from the selection that will be operated on. 
 //                       
 nsresult 
 nsHTMLEditRules::GetNodesFromSelection(nsISelection *selection,
-                                       PRInt32 operation,
+                                       nsEditor::OperationID operation,
                                        nsCOMArray<nsIDOMNode>& arrayOfNodes,
                                        bool dontTouchContent)
 {
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
   nsresult res;
   
   // promote selection ranges
   nsCOMArray<nsIDOMRange> arrayOfRanges;
@@ -8926,22 +8932,24 @@ nsHTMLEditRules::WillAbsolutePosition(ns
   nsAutoSelectionReset selectionResetter(aSelection, mHTMLEditor);
   
   // convert the selection ranges into "promoted" selection ranges:
   // this basically just expands the range to include the immediate
   // block parent, and then further expands to include any ancestors
   // whose children are all in the range
   
   nsCOMArray<nsIDOMRange> arrayOfRanges;
-  res = GetPromotedRanges(aSelection, arrayOfRanges, kSetAbsolutePosition);
+  res = GetPromotedRanges(aSelection, arrayOfRanges,
+                          nsEditor::kOpSetAbsolutePosition);
   NS_ENSURE_SUCCESS(res, res);
   
   // use these ranges to contruct a list of nodes to act on.
   nsCOMArray<nsIDOMNode> arrayOfNodes;
-  res = GetNodesForOperation(arrayOfRanges, arrayOfNodes, kSetAbsolutePosition);
+  res = GetNodesForOperation(arrayOfRanges, arrayOfNodes,
+                             nsEditor::kOpSetAbsolutePosition);
   NS_ENSURE_SUCCESS(res, res);                                 
                                      
   NS_NAMED_LITERAL_STRING(divType, "div");
 
 
   // if nothing visible in list, make an empty block
   if (ListIsEmptyLine(arrayOfNodes))
   {
--- a/editor/libeditor/html/nsHTMLEditRules.h
+++ b/editor/libeditor/html/nsHTMLEditRules.h
@@ -85,18 +85,20 @@ public:
   
             nsHTMLEditRules();
   virtual   ~nsHTMLEditRules();
 
 
   // nsIEditRules methods
   NS_IMETHOD Init(nsPlaintextEditor *aEditor);
   NS_IMETHOD DetachEditor();
-  NS_IMETHOD BeforeEdit(PRInt32 action, nsIEditor::EDirection aDirection);
-  NS_IMETHOD AfterEdit(PRInt32 action, nsIEditor::EDirection aDirection);
+  NS_IMETHOD BeforeEdit(nsEditor::OperationID action,
+                        nsIEditor::EDirection aDirection);
+  NS_IMETHOD AfterEdit(nsEditor::OperationID action,
+                       nsIEditor::EDirection aDirection);
   NS_IMETHOD WillDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, bool *aCancel, bool *aHandled);
   NS_IMETHOD DidDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult);
   NS_IMETHOD DocumentModified();
 
   nsresult GetListState(bool *aMixed, bool *aOL, bool *aUL, bool *aDL);
   nsresult GetListItemState(bool *aMixed, bool *aLI, bool *aDT, bool *aDD);
   nsresult GetIndentState(bool *aCanIndent, bool *aCanOutdent);
   nsresult GetAlignment(bool *aMixed, nsIHTMLEditor::EAlignment *aAlign);
@@ -136,17 +138,17 @@ protected:
     kBlockEnd
   };
 
   // nsHTMLEditRules implementation methods
   nsresult WillInsert(nsISelection *aSelection, bool *aCancel);
 #ifdef XXX_DEAD_CODE
   nsresult DidInsert(nsISelection *aSelection, nsresult aResult);
 #endif
-  nsresult WillInsertText(  PRInt32          aAction,
+  nsresult WillInsertText(  nsEditor::OperationID aAction,
                             nsISelection *aSelection, 
                             bool            *aCancel,
                             bool            *aHandled,
                             const nsAString *inString,
                             nsAString       *outString,
                             PRInt32          aMaxLength);
   nsresult WillLoadHTML(nsISelection *aSelection, bool *aCancel);
   nsresult WillInsertBreak(nsISelection *aSelection, bool *aCancel, bool *aHandled);
@@ -191,17 +193,18 @@ protected:
   nsresult ReturnInHeader(nsISelection *aSelection, nsIDOMNode *aHeader, nsIDOMNode *aTextNode, PRInt32 aOffset);
   nsresult ReturnInParagraph(nsISelection *aSelection, nsIDOMNode *aHeader, nsIDOMNode *aTextNode, PRInt32 aOffset, bool *aCancel, bool *aHandled);
   nsresult SplitParagraph(nsIDOMNode *aPara,
                           nsIDOMNode *aBRNode, 
                           nsISelection *aSelection,
                           nsCOMPtr<nsIDOMNode> *aSelNode, 
                           PRInt32 *aOffset);
   nsresult ReturnInListItem(nsISelection *aSelection, nsIDOMNode *aHeader, nsIDOMNode *aTextNode, PRInt32 aOffset);
-  nsresult AfterEditInner(PRInt32 action, nsIEditor::EDirection aDirection);
+  nsresult AfterEditInner(nsEditor::OperationID action,
+                          nsIEditor::EDirection aDirection);
   nsresult RemovePartOfBlock(nsIDOMNode *aBlock, 
                              nsIDOMNode *aStartChild, 
                              nsIDOMNode *aEndChild,
                              nsCOMPtr<nsIDOMNode> *aLeftNode = 0,
                              nsCOMPtr<nsIDOMNode> *aRightNode = 0);
   nsresult SplitBlock(nsIDOMNode *aBlock, 
                       nsIDOMNode *aStartChild, 
                       nsIDOMNode *aEndChild,
@@ -229,34 +232,36 @@ protected:
   nsresult ExpandSelectionForDeletion(nsISelection *aSelection);
   bool IsFirstNode(nsIDOMNode *aNode);
   bool IsLastNode(nsIDOMNode *aNode);
 #ifdef XXX_DEAD_CODE
   bool AtStartOfBlock(nsIDOMNode *aNode, PRInt32 aOffset, nsIDOMNode *aBlock);
   bool AtEndOfBlock(nsIDOMNode *aNode, PRInt32 aOffset, nsIDOMNode *aBlock);
 #endif
   nsresult NormalizeSelection(nsISelection *inSelection);
-  nsresult GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode *aNode, PRInt32 aOffset, 
-                            PRInt32 actionID, nsCOMPtr<nsIDOMNode> *outNode, PRInt32 *outOffset);
+  nsresult GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode *aNode,
+                            PRInt32 aOffset, nsEditor::OperationID actionID,
+                            nsCOMPtr<nsIDOMNode> *outNode, PRInt32 *outOffset);
   nsresult GetPromotedRanges(nsISelection *inSelection, 
                              nsCOMArray<nsIDOMRange> &outArrayOfRanges, 
-                             PRInt32 inOperationType);
-  nsresult PromoteRange(nsIDOMRange *inRange, PRInt32 inOperationType);
+                             nsEditor::OperationID inOperationType);
+  nsresult PromoteRange(nsIDOMRange *inRange,
+                        nsEditor::OperationID inOperationType);
   nsresult GetNodesForOperation(nsCOMArray<nsIDOMRange>& inArrayOfRanges, 
                                 nsCOMArray<nsIDOMNode>& outArrayOfNodes, 
-                                PRInt32 inOperationType,
+                                nsEditor::OperationID inOperationType,
                                 bool aDontTouchContent=false);
   nsresult GetChildNodesForOperation(nsIDOMNode *inNode, 
                                      nsCOMArray<nsIDOMNode>& outArrayOfNodes);
   nsresult GetNodesFromPoint(DOMPoint point,
-                             PRInt32 operation,
+                             nsEditor::OperationID operation,
                              nsCOMArray<nsIDOMNode>& arrayOfNodes,
                              bool dontTouchContent);
   nsresult GetNodesFromSelection(nsISelection *selection,
-                                 PRInt32 operation,
+                                 nsEditor::OperationID operation,
                                  nsCOMArray<nsIDOMNode>& arrayOfNodes,
                                  bool aDontTouchContent=false);
   nsresult GetListActionNodes(nsCOMArray<nsIDOMNode> &outArrayOfNodes, bool aEntireList, bool aDontTouchContent=false);
   nsresult GetDefinitionListItemTypes(nsIDOMNode *aNode, bool &aDT, bool &aDD);
   nsresult GetParagraphFormatNodes(nsCOMArray<nsIDOMNode>& outArrayOfNodes, bool aDontTouchContent=false);
   nsresult LookInsideDivBQandList(nsCOMArray<nsIDOMNode>& aNodeArray);
   nsresult BustUpInlinesAtRangeEndpoints(nsRangeStore &inRange);
   nsresult BustUpInlinesAtBRs(nsIDOMNode *inNode, 
--- a/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/editor/libeditor/html/nsHTMLEditor.cpp
@@ -1737,17 +1737,17 @@ nsHTMLEditor::InsertElementAtSelection(n
 
   nsCOMPtr<nsISelection>selection;
   res = GetSelection(getter_AddRefs(selection));
   if (NS_FAILED(res) || !selection)
     return NS_ERROR_FAILURE;
 
   // hand off to the rules system, see if it has anything to say about this
   bool cancel, handled;
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kInsertElement);
+  nsTextRulesInfo ruleInfo(kOpInsertElement);
   ruleInfo.insertElement = aElement;
   res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   if (cancel || (NS_FAILED(res))) return res;
 
   if (!handled)
   {
     if (aDeleteSelection)
     {
@@ -2217,17 +2217,17 @@ nsHTMLEditor::MakeOrChangeList(const nsA
   nsAutoEditBatch beginBatching(this);
   nsAutoRules beginRulesSniffing(this, kOpMakeList, nsIEditor::eNext);
   
   // pre-process
   res = GetSelection(getter_AddRefs(selection));
   NS_ENSURE_SUCCESS(res, res);
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kMakeList);
+  nsTextRulesInfo ruleInfo(kOpMakeList);
   ruleInfo.blockType = &aListType;
   ruleInfo.entireList = entireList;
   ruleInfo.bulletType = &aBulletType;
   res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   if (cancel || (NS_FAILED(res))) return res;
 
   if (!handled)
   {
@@ -2298,17 +2298,17 @@ nsHTMLEditor::RemoveList(const nsAString
   nsAutoEditBatch beginBatching(this);
   nsAutoRules beginRulesSniffing(this, kOpRemoveList, nsIEditor::eNext);
   
   // pre-process
   res = GetSelection(getter_AddRefs(selection));
   NS_ENSURE_SUCCESS(res, res);
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kRemoveList);
+  nsTextRulesInfo ruleInfo(kOpRemoveList);
   if (aListType.LowerCaseEqualsLiteral("ol"))
     ruleInfo.bOrdered = true;
   else  ruleInfo.bOrdered = false;
   res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   if (cancel || (NS_FAILED(res))) return res;
 
   // no default behavior for this yet.  what would it mean?
 
@@ -2330,17 +2330,17 @@ nsHTMLEditor::MakeDefinitionItem(const n
 
   nsAutoEditBatch beginBatching(this);
   nsAutoRules beginRulesSniffing(this, kOpMakeDefListItem, nsIEditor::eNext);
   
   // pre-process
   res = GetSelection(getter_AddRefs(selection));
   NS_ENSURE_SUCCESS(res, res);
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kMakeDefListItem);
+  nsTextRulesInfo ruleInfo(kOpMakeDefListItem);
   ruleInfo.blockType = &aItemType;
   res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   if (cancel || (NS_FAILED(res))) return res;
 
   if (!handled)
   {
     // todo: no default for now.  we count on rules to handle it.
   }
@@ -2363,17 +2363,17 @@ nsHTMLEditor::InsertBasicBlock(const nsA
 
   nsAutoEditBatch beginBatching(this);
   nsAutoRules beginRulesSniffing(this, kOpMakeBasicBlock, nsIEditor::eNext);
   
   // pre-process
   res = GetSelection(getter_AddRefs(selection));
   NS_ENSURE_SUCCESS(res, res);
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kMakeBasicBlock);
+  nsTextRulesInfo ruleInfo(kOpMakeBasicBlock);
   ruleInfo.blockType = &aBlockType;
   res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   if (cancel || (NS_FAILED(res))) return res;
 
   if (!handled)
   {
     // Find out if the selection is collapsed:
     bool isCollapsed;
@@ -2429,33 +2429,31 @@ nsHTMLEditor::Indent(const nsAString& aI
 {
   nsresult res;
   if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
 
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
   bool cancel, handled;
-  PRInt32 theAction = nsTextEditRules::kIndent;
-  PRInt32 opID = kOpIndent;
+  OperationID opID = kOpIndent;
   if (aIndent.LowerCaseEqualsLiteral("outdent"))
   {
-    theAction = nsTextEditRules::kOutdent;
     opID = kOpOutdent;
   }
   nsAutoEditBatch beginBatching(this);
   nsAutoRules beginRulesSniffing(this, opID, nsIEditor::eNext);
   
   // pre-process
   nsCOMPtr<nsISelection> selection;
   res = GetSelection(getter_AddRefs(selection));
   NS_ENSURE_SUCCESS(res, res);
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
-  nsTextRulesInfo ruleInfo(theAction);
+  nsTextRulesInfo ruleInfo(opID);
   res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   if (cancel || (NS_FAILED(res))) return res;
   
   if (!handled)
   {
     // Do default - insert a blockquote node if selection collapsed
     nsCOMPtr<nsIDOMNode> node;
     PRInt32 offset;
@@ -2525,17 +2523,17 @@ nsHTMLEditor::Align(const nsAString& aAl
   nsCOMPtr<nsIDOMNode> node;
   bool cancel, handled;
   
   // Find out if the selection is collapsed:
   nsCOMPtr<nsISelection> selection;
   nsresult res = GetSelection(getter_AddRefs(selection));
   NS_ENSURE_SUCCESS(res, res);
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kAlign);
+  nsTextRulesInfo ruleInfo(kOpAlign);
   ruleInfo.alignType = &aAlignType;
   res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   if (cancel || NS_FAILED(res))
     return res;
   
   res = mRules->DidDoAction(selection, &ruleInfo, res);
   return res;
 }
@@ -3745,17 +3743,18 @@ nsHTMLEditor::StyleSheetLoaded(nsCSSStyl
 
   return NS_OK;
 }
 
 
 /** All editor operations which alter the doc should be prefaced
  *  with a call to StartOperation, naming the action and direction */
 NS_IMETHODIMP
-nsHTMLEditor::StartOperation(PRInt32 opID, nsIEditor::EDirection aDirection)
+nsHTMLEditor::StartOperation(OperationID opID,
+                             nsIEditor::EDirection aDirection)
 {
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
   nsEditor::StartOperation(opID, aDirection);  // will set mAction, mDirection
   if (mRules) return mRules->BeforeEdit(mAction, mDirection);
   return NS_OK;
 }
@@ -4934,17 +4933,17 @@ nsHTMLEditor::SetCSSBackgroundColor(cons
   selection->GetIsCollapsed(&isCollapsed);
 
   nsAutoEditBatch batchIt(this);
   nsAutoRules beginRulesSniffing(this, kOpInsertElement, nsIEditor::eNext);
   nsAutoSelectionReset selectionResetter(selection, this);
   nsAutoTxnsConserveSelection dontSpazMySelection(this);
   
   bool cancel, handled;
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kSetTextProperty);
+  nsTextRulesInfo ruleInfo(kOpSetTextProperty);
   res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(res, res);
   if (!cancel && !handled)
   {
     // get selection range enumerator
     nsCOMPtr<nsIEnumerator> enumerator;
     res = selPriv->GetEnumerator(getter_AddRefs(enumerator));
     NS_ENSURE_SUCCESS(res, res);
--- a/editor/libeditor/html/nsHTMLEditor.h
+++ b/editor/libeditor/html/nsHTMLEditor.h
@@ -104,39 +104,16 @@ class nsHTMLEditor : public nsPlaintextE
                      public nsIEditorStyleSheets,
                      public nsICSSLoaderObserver,
                      public nsStubMutationObserver
 {
   typedef enum {eNoOp, eReplaceParent=1, eInsertParent=2} BlockTransformationType;
 
 public:
 
-  enum OperationID
-  {
-    kOpInsertBreak         = 3000,
-    kOpMakeList            = 3001,
-    kOpIndent              = 3002,
-    kOpOutdent             = 3003,
-    kOpAlign               = 3004,
-    kOpMakeBasicBlock      = 3005,
-    kOpRemoveList          = 3006,
-    kOpMakeDefListItem     = 3007,
-    kOpInsertElement       = 3008,
-    kOpInsertQuotation     = 3009,
-    kOpSetTextProperty     = 3010,
-    kOpRemoveTextProperty  = 3011,
-    kOpHTMLPaste           = 3012,
-    kOpLoadHTML            = 3013,
-    kOpResetTextProperties = 3014,
-    kOpSetAbsolutePosition = 3015,
-    kOpRemoveAbsolutePosition = 3016,
-    kOpDecreaseZIndex      = 3017,
-    kOpIncreaseZIndex      = 3018
-  };
-
   enum ResizingRequestID
   {
     kX      = 0,
     kY      = 1,
     kWidth  = 2,
     kHeight = 3
   };
 
@@ -312,17 +289,18 @@ public:
 
   NS_IMETHOD PasteTransferable(nsITransferable *aTransferable);
   NS_IMETHOD CanPasteTransferable(nsITransferable *aTransferable, bool *aCanPaste);
 
   NS_IMETHOD DebugUnitTests(PRInt32 *outNumTests, PRInt32 *outNumTestsFailed);
 
   /** All editor operations which alter the doc should be prefaced
    *  with a call to StartOperation, naming the action and direction */
-  NS_IMETHOD StartOperation(PRInt32 opID, nsIEditor::EDirection aDirection);
+  NS_IMETHOD StartOperation(OperationID opID,
+                            nsIEditor::EDirection aDirection);
 
   /** All editor operations which alter the doc should be followed
    *  with a call to EndOperation */
   NS_IMETHOD EndOperation();
 
   /** returns true if aParentTag can contain a child of type aChildTag */
   virtual bool TagCanContainTag(nsIAtom* aParentTag, nsIAtom* aChildTag);
   
--- a/editor/libeditor/html/nsHTMLEditorStyle.cpp
+++ b/editor/libeditor/html/nsHTMLEditorStyle.cpp
@@ -138,17 +138,17 @@ nsHTMLEditor::SetInlineProperty(nsIAtom 
   }
 
   nsAutoEditBatch batchIt(this);
   nsAutoRules beginRulesSniffing(this, kOpInsertElement, nsIEditor::eNext);
   nsAutoSelectionReset selectionResetter(selection, this);
   nsAutoTxnsConserveSelection dontSpazMySelection(this);
 
   bool cancel, handled;
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kSetTextProperty);
+  nsTextRulesInfo ruleInfo(kOpSetTextProperty);
   res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(res, res);
   if (!cancel && !handled) {
     // get selection range enumerator
     nsCOMPtr<nsIEnumerator> enumerator;
     res = selPriv->GetEnumerator(getter_AddRefs(enumerator));
     NS_ENSURE_SUCCESS(res, res);
     NS_ENSURE_TRUE(enumerator, NS_ERROR_FAILURE);
@@ -1280,17 +1280,17 @@ nsresult nsHTMLEditor::RemoveInlinePrope
   }
 
   nsAutoEditBatch batchIt(this);
   nsAutoRules beginRulesSniffing(this, kOpRemoveTextProperty, nsIEditor::eNext);
   nsAutoSelectionReset selectionResetter(selection, this);
   nsAutoTxnsConserveSelection dontSpazMySelection(this);
   
   bool cancel, handled;
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kRemoveTextProperty);
+  nsTextRulesInfo ruleInfo(kOpRemoveTextProperty);
   res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(res, res);
   if (!cancel && !handled)
   {
     // get selection range enumerator
     nsCOMPtr<nsIEnumerator> enumerator;
     res = selPriv->GetEnumerator(getter_AddRefs(enumerator));
     NS_ENSURE_SUCCESS(res, res);
--- a/editor/libeditor/text/nsPlaintextEditor.cpp
+++ b/editor/libeditor/text/nsPlaintextEditor.cpp
@@ -778,17 +778,17 @@ NS_IMETHODIMP nsPlaintextEditor::DeleteS
       NS_ENSURE_SUCCESS(result, result);
     }
     else
     { 
       aAction = eNone;
     }
   }
 
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kDeleteSelection);
+  nsTextRulesInfo ruleInfo(kOpDeleteSelection);
   ruleInfo.collapsedAction = aAction;
   bool cancel, handled;
   result = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(result, result);
   if (!cancel && !handled)
   {
     result = DeleteSelectionImpl(aAction);
   }
@@ -803,36 +803,34 @@ NS_IMETHODIMP nsPlaintextEditor::DeleteS
 
 NS_IMETHODIMP nsPlaintextEditor::InsertText(const nsAString &aStringToInsert)
 {
   if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
 
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
-  PRInt32 theAction = nsTextEditRules::kInsertText;
-  PRInt32 opID = kOpInsertText;
+  OperationID opID = kOpInsertText;
   if (mInIMEMode) 
   {
-    theAction = nsTextEditRules::kInsertTextIME;
     opID = kOpInsertIMEText;
   }
   nsAutoPlaceHolderBatch batch(this, nsnull); 
   nsAutoRules beginRulesSniffing(this, opID, nsIEditor::eNext);
 
   // pre-process
   nsCOMPtr<nsISelection> selection;
   nsresult result = GetSelection(getter_AddRefs(selection));
   NS_ENSURE_SUCCESS(result, result);
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
   nsAutoString resultString;
   // XXX can we trust instring to outlive ruleInfo,
   // XXX and ruleInfo not to refer to instring in its dtor?
   //nsAutoString instring(aStringToInsert);
-  nsTextRulesInfo ruleInfo(theAction);
+  nsTextRulesInfo ruleInfo(opID);
   ruleInfo.inString = &aStringToInsert;
   ruleInfo.outString = &resultString;
   ruleInfo.maxLength = mMaxTextLength;
 
   bool cancel, handled;
   result = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(result, result);
   if (!cancel && !handled)
@@ -865,17 +863,17 @@ NS_IMETHODIMP nsPlaintextEditor::InsertL
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   // Batching the selection and moving nodes out from under the caret causes
   // caret turds. Ask the shell to invalidate the caret now to avoid the turds.
   nsCOMPtr<nsIPresShell> shell = GetPresShell();
   NS_ENSURE_TRUE(shell, NS_ERROR_NOT_INITIALIZED);
   shell->MaybeInvalidateCaretPosition();
 
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kInsertBreak);
+  nsTextRulesInfo ruleInfo(kOpInsertBreak);
   ruleInfo.maxLength = mMaxTextLength;
   bool cancel, handled;
   res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(res, res);
   if (!cancel && !handled)
   {
     // get the (collapsed) selection location
     nsCOMPtr<nsIDOMNode> selNode;
@@ -1204,17 +1202,17 @@ nsPlaintextEditor::Undo(PRUint32 aCount)
   HandlingTrustedAction trusted(this);
 
   nsAutoUpdateViewBatch beginViewBatching(this);
 
   ForceCompositionEnd();
 
   nsAutoRules beginRulesSniffing(this, kOpUndo, nsIEditor::eNone);
 
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kUndo);
+  nsTextRulesInfo ruleInfo(kOpUndo);
   nsCOMPtr<nsISelection> selection;
   GetSelection(getter_AddRefs(selection));
   bool cancel, handled;
   nsresult result = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   
   if (!cancel && NS_SUCCEEDED(result))
   {
     result = nsEditor::Undo(aCount);
@@ -1234,17 +1232,17 @@ nsPlaintextEditor::Redo(PRUint32 aCount)
   HandlingTrustedAction trusted(this);
 
   nsAutoUpdateViewBatch beginViewBatching(this);
 
   ForceCompositionEnd();
 
   nsAutoRules beginRulesSniffing(this, kOpRedo, nsIEditor::eNone);
 
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kRedo);
+  nsTextRulesInfo ruleInfo(kOpRedo);
   nsCOMPtr<nsISelection> selection;
   GetSelection(getter_AddRefs(selection));
   bool cancel, handled;
   nsresult result = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   
   if (!cancel && NS_SUCCEEDED(result))
   {
     result = nsEditor::Redo(aCount);
@@ -1380,17 +1378,17 @@ NS_IMETHODIMP
 nsPlaintextEditor::OutputToString(const nsAString& aFormatType,
                                   PRUint32 aFlags,
                                   nsAString& aOutputString)
 {
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
   nsString resultString;
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kOutputText);
+  nsTextRulesInfo ruleInfo(kOpOutputText);
   ruleInfo.outString = &resultString;
   // XXX Struct should store a nsAReadable*
   nsAutoString str(aFormatType);
   ruleInfo.outputFormat = &str;
   bool cancel, handled;
   nsresult rv = mRules->WillDoAction(nsnull, &ruleInfo, &cancel, &handled);
   if (cancel || NS_FAILED(rv)) { return rv; }
   if (handled)
@@ -1521,17 +1519,17 @@ nsPlaintextEditor::InsertAsQuotation(con
   rv = GetSelection(getter_AddRefs(selection));
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   nsAutoEditBatch beginBatching(this);
   nsAutoRules beginRulesSniffing(this, kOpInsertText, nsIEditor::eNext);
 
   // give rules a chance to handle or cancel
-  nsTextRulesInfo ruleInfo(nsTextEditRules::kInsertElement);
+  nsTextRulesInfo ruleInfo(kOpInsertElement);
   bool cancel, handled;
   rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(rv, rv);
   if (cancel) return NS_OK; // rules canceled the operation
   if (!handled)
   {
     rv = InsertText(quotedStuff);
 
@@ -1647,17 +1645,18 @@ nsPlaintextEditor::GetEmbeddedObjects(ns
   *aNodeList = 0;
   return NS_OK;
 }
 
 
 /** All editor operations which alter the doc should be prefaced
  *  with a call to StartOperation, naming the action and direction */
 NS_IMETHODIMP
-nsPlaintextEditor::StartOperation(PRInt32 opID, nsIEditor::EDirection aDirection)
+nsPlaintextEditor::StartOperation(OperationID opID,
+                                  nsIEditor::EDirection aDirection)
 {
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
   nsEditor::StartOperation(opID, aDirection);  // will set mAction, mDirection
   if (mRules) return mRules->BeforeEdit(mAction, mDirection);
   return NS_OK;
 }
--- a/editor/libeditor/text/nsPlaintextEditor.h
+++ b/editor/libeditor/text/nsPlaintextEditor.h
@@ -125,17 +125,18 @@ public:
   NS_IMETHOD OutputToStream(nsIOutputStream* aOutputStream,
                             const nsAString& aFormatType,
                             const nsACString& aCharsetOverride,
                             PRUint32 aFlags);
 
 
   /** All editor operations which alter the doc should be prefaced
    *  with a call to StartOperation, naming the action and direction */
-  NS_IMETHOD StartOperation(PRInt32 opID, nsIEditor::EDirection aDirection);
+  NS_IMETHOD StartOperation(OperationID opID,
+                            nsIEditor::EDirection aDirection);
 
   /** All editor operations which alter the doc should be followed
    *  with a call to EndOperation */
   NS_IMETHOD EndOperation();
 
   /** make the given selection span the entire document */
   NS_IMETHOD SelectEntireDocument(nsISelection *aSelection);
 
--- a/editor/libeditor/text/nsTextEditRules.cpp
+++ b/editor/libeditor/text/nsTextEditRules.cpp
@@ -86,17 +86,17 @@ using namespace mozilla;
 nsTextEditRules::nsTextEditRules()
 : mEditor(nsnull)
 , mPasswordText()
 , mPasswordIMEText()
 , mPasswordIMEIndex(0)
 , mActionNesting(0)
 , mLockRulesSniffing(false)
 , mDidExplicitlySetInterline(false)
-, mTheAction(0)
+, mTheAction(nsEditor::kOpNone)
 , mLastStart(0)
 , mLastLength(0)
 {
 }
 
 nsTextEditRules::~nsTextEditRules()
 {
    // do NOT delete mEditor here.  We do not hold a ref count to mEditor.  mEditor owns our lifespan.
@@ -168,17 +168,18 @@ nsTextEditRules::DetachEditor()
   if (mTimer)
     mTimer->Cancel();
 
   mEditor = nsnull;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsTextEditRules::BeforeEdit(PRInt32 action, nsIEditor::EDirection aDirection)
+nsTextEditRules::BeforeEdit(nsEditor::OperationID action,
+                            nsIEditor::EDirection aDirection)
 {
   if (mLockRulesSniffing) return NS_OK;
   
   nsAutoLockRulesSniffing lockIt(this);
   mDidExplicitlySetInterline = false;
   if (!mActionNesting)
   {
     // let rules remember the top level action
@@ -194,17 +195,18 @@ nsTextEditRules::BeforeEdit(PRInt32 acti
   selection->GetAnchorNode(getter_AddRefs(mCachedSelectionNode));
   selection->GetAnchorOffset(&mCachedSelectionOffset);
 
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
-nsTextEditRules::AfterEdit(PRInt32 action, nsIEditor::EDirection aDirection)
+nsTextEditRules::AfterEdit(nsEditor::OperationID action,
+                           nsIEditor::EDirection aDirection)
 {
   if (mLockRulesSniffing) return NS_OK;
   
   nsAutoLockRulesSniffing lockIt(this);
   
   NS_PRECONDITION(mActionNesting>0, "bad action nesting!");
   nsresult res = NS_OK;
   if (!--mActionNesting)
@@ -253,48 +255,50 @@ nsTextEditRules::WillDoAction(nsISelecti
   *aCancel = false;
   *aHandled = false;
 
   // my kingdom for dynamic cast
   nsTextRulesInfo *info = static_cast<nsTextRulesInfo*>(aInfo);
     
   switch (info->action)
   {
-    case kInsertBreak:
+    case nsEditor::kOpInsertBreak:
       return WillInsertBreak(aSelection, aCancel, aHandled, info->maxLength);
-    case kInsertText:
-    case kInsertTextIME:
+    case nsEditor::kOpInsertText:
+    case nsEditor::kOpInsertIMEText:
       return WillInsertText(info->action,
                             aSelection, 
                             aCancel,
                             aHandled, 
                             info->inString,
                             info->outString,
                             info->maxLength);
-    case kDeleteSelection:
+    case nsEditor::kOpDeleteSelection:
       return WillDeleteSelection(aSelection, info->collapsedAction, aCancel, aHandled);
-    case kUndo:
+    case nsEditor::kOpUndo:
       return WillUndo(aSelection, aCancel, aHandled);
-    case kRedo:
+    case nsEditor::kOpRedo:
       return WillRedo(aSelection, aCancel, aHandled);
-    case kSetTextProperty:
+    case nsEditor::kOpSetTextProperty:
       return WillSetTextProperty(aSelection, aCancel, aHandled);
-    case kRemoveTextProperty:
+    case nsEditor::kOpRemoveTextProperty:
       return WillRemoveTextProperty(aSelection, aCancel, aHandled);
-    case kOutputText:
+    case nsEditor::kOpOutputText:
       return WillOutputText(aSelection, 
                             info->outputFormat,
                             info->outString,                            
                             aCancel,
                             aHandled);
-    case kInsertElement:  // i had thought this would be html rules only.  but we put pre elements
-                          // into plaintext mail when doing quoting for reply!  doh!
+    case nsEditor::kOpInsertElement:
+      // i had thought this would be html rules only.  but we put pre elements
+      // into plaintext mail when doing quoting for reply!  doh!
       return WillInsert(aSelection, aCancel);
+    default:
+      return NS_ERROR_FAILURE;
   }
-  return NS_ERROR_FAILURE;
 }
   
 NS_IMETHODIMP 
 nsTextEditRules::DidDoAction(nsISelection *aSelection,
                              nsRulesInfo *aInfo, nsresult aResult)
 {
   // don't let any txns in here move the selection around behind our back.
   // Note that this won't prevent explicit selection setting from working.
@@ -302,36 +306,37 @@ nsTextEditRules::DidDoAction(nsISelectio
 
   NS_ENSURE_TRUE(aSelection && aInfo, NS_ERROR_NULL_POINTER);
     
   // my kingdom for dynamic cast
   nsTextRulesInfo *info = static_cast<nsTextRulesInfo*>(aInfo);
 
   switch (info->action)
   {
-   case kInsertBreak:
-     return DidInsertBreak(aSelection, aResult);
-    case kInsertText:
-    case kInsertTextIME:
+    case nsEditor::kOpInsertBreak:
+      return DidInsertBreak(aSelection, aResult);
+    case nsEditor::kOpInsertText:
+    case nsEditor::kOpInsertIMEText:
       return DidInsertText(aSelection, aResult);
-    case kDeleteSelection:
+    case nsEditor::kOpDeleteSelection:
       return DidDeleteSelection(aSelection, info->collapsedAction, aResult);
-    case kUndo:
+    case nsEditor::kOpUndo:
       return DidUndo(aSelection, aResult);
-    case kRedo:
+    case nsEditor::kOpRedo:
       return DidRedo(aSelection, aResult);
-    case kSetTextProperty:
+    case nsEditor::kOpSetTextProperty:
       return DidSetTextProperty(aSelection, aResult);
-    case kRemoveTextProperty:
+    case nsEditor::kOpRemoveTextProperty:
       return DidRemoveTextProperty(aSelection, aResult);
-    case kOutputText:
+    case nsEditor::kOpOutputText:
       return DidOutputText(aSelection, aResult);
+    default:
+      // Don't fail on transactions we don't handle here!
+      return NS_OK;
   }
-  // Don't fail on transactions we don't handle here!
-  return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsTextEditRules::DocumentIsEmpty(bool *aDocumentIsEmpty)
 {
   NS_ENSURE_TRUE(aDocumentIsEmpty, NS_ERROR_NULL_POINTER);
   
@@ -572,28 +577,27 @@ nsTextEditRules::HandleNewLines(nsString
   case nsIPlaintextEditor::eNewlinesPasteIntact:
     // even if we're pasting newlines, don't paste leading/trailing ones
     aString.Trim(CRLF, true, true);
     break;
   }
 }
 
 nsresult
-nsTextEditRules::WillInsertText(PRInt32          aAction,
+nsTextEditRules::WillInsertText(nsEditor::OperationID aAction,
                                 nsISelection *aSelection, 
                                 bool            *aCancel,
                                 bool            *aHandled,
                                 const nsAString *inString,
                                 nsAString *outString,
                                 PRInt32          aMaxLength)
 {  
   if (!aSelection || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; }
 
-  if (inString->IsEmpty() && (aAction != kInsertTextIME))
-  {
+  if (inString->IsEmpty() && aAction != nsEditor::kOpInsertIMEText) {
     // HACK: this is a fix for bug 19395
     // I can't outlaw all empty insertions
     // because IME transaction depend on them
     // There is more work to do to make the 
     // world safe for IME.
     *aCancel = true;
     *aHandled = false;
     return NS_OK;
@@ -606,17 +610,18 @@ nsTextEditRules::WillInsertText(PRInt32 
   // handle docs with a max length
   // NOTE, this function copies inString into outString for us.
   bool truncated = false;
   nsresult res = TruncateInsertionIfNeeded(aSelection, inString, outString,
                                            aMaxLength, &truncated);
   NS_ENSURE_SUCCESS(res, res);
   // If we're exceeding the maxlength when composing IME, we need to clean up
   // the composing text, so we shouldn't return early.
-  if (truncated && outString->IsEmpty() && aAction != kInsertTextIME) {
+  if (truncated && outString->IsEmpty() &&
+      aAction != nsEditor::kOpInsertIMEText) {
     *aCancel = true;
     return NS_OK;
   }
   
   PRUint32 start = 0;
   PRUint32 end = 0;  
 
   // handle password field docs
@@ -643,17 +648,17 @@ nsTextEditRules::WillInsertText(PRInt32 
   // we want to ignore result of WillInsert()
   *aCancel = false;
   
   // handle password field data
   // this has the side effect of changing all the characters in aOutString
   // to the replacement character
   if (IsPasswordEditor())
   {
-    if (aAction == kInsertTextIME)  {
+    if (aAction == nsEditor::kOpInsertIMEText) {
       res = RemoveIMETextFromPWBuf(start, outString);
       NS_ENSURE_SUCCESS(res, res);
     }
   }
 
   // People have lots of different ideas about what text fields
   // should do with multiline pastes.  See bugs 21032, 23485, 23485, 50935.
   // The six possible options are:
@@ -711,24 +716,21 @@ nsTextEditRules::WillInsertText(PRInt32 
       !mEditor->CanContainTag(selNode, nsGkAtoms::textTagName)) {
     return NS_ERROR_FAILURE;
   }
 
   // we need to get the doc
   nsCOMPtr<nsIDOMDocument> doc = mEditor->GetDOMDocument();
   NS_ENSURE_TRUE(doc, NS_ERROR_NOT_INITIALIZED);
     
-  if (aAction == kInsertTextIME) 
-  { 
+  if (aAction == nsEditor::kOpInsertIMEText) {
     res = mEditor->InsertTextImpl(*outString, address_of(selNode), &selOffset, doc);
     NS_ENSURE_SUCCESS(res, res);
-  }
-  else // aAction == kInsertText
-  {
-    // find where we are
+  } else {
+    // aAction == nsEditor::kOpInsertText; find where we are
     nsCOMPtr<nsIDOMNode> curNode = selNode;
     PRInt32 curOffset = selOffset;
 
     // don't spaz my selection in subtransactions
     nsAutoTxnsConserveSelection dontSpazMySelection(mEditor);
 
     res = mEditor->InsertTextImpl(*outString, address_of(curNode),
                                   &curOffset, doc);
--- a/editor/libeditor/text/nsTextEditRules.h
+++ b/editor/libeditor/text/nsTextEditRules.h
@@ -65,55 +65,25 @@ public:
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTextEditRules, nsIEditRules)
   
               nsTextEditRules();
   virtual     ~nsTextEditRules();
 
   // nsIEditRules methods
   NS_IMETHOD Init(nsPlaintextEditor *aEditor);
   NS_IMETHOD DetachEditor();
-  NS_IMETHOD BeforeEdit(PRInt32 action, nsIEditor::EDirection aDirection);
-  NS_IMETHOD AfterEdit(PRInt32 action, nsIEditor::EDirection aDirection);
+  NS_IMETHOD BeforeEdit(nsEditor::OperationID action,
+                        nsIEditor::EDirection aDirection);
+  NS_IMETHOD AfterEdit(nsEditor::OperationID action,
+                       nsIEditor::EDirection aDirection);
   NS_IMETHOD WillDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, bool *aCancel, bool *aHandled);
   NS_IMETHOD DidDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult);
   NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty);
   NS_IMETHOD DocumentModified();
 
-  // nsTextEditRules action id's
-  enum 
-  {
-    kDefault             = 0,
-    // any editor that has a txn mgr
-    kUndo                = 1000,
-    kRedo                = 1001,
-    // text actions
-    kInsertText          = 2000,
-    kInsertTextIME       = 2001,
-    kDeleteSelection     = 2002,
-    kSetTextProperty     = 2003,
-    kRemoveTextProperty  = 2004,
-    kOutputText          = 2005,
-    // html only action
-    kInsertBreak         = 3000,
-    kMakeList            = 3001,
-    kIndent              = 3002,
-    kOutdent             = 3003,
-    kAlign               = 3004,
-    kMakeBasicBlock      = 3005,
-    kRemoveList          = 3006,
-    kMakeDefListItem     = 3007,
-    kInsertElement       = 3008,
-    kLoadHTML            = 3013,
-    kSetAbsolutePosition = 3015,
-    kRemoveAbsolutePosition = 3016,
-    kDecreaseZIndex      = 3017,
-    kIncreaseZIndex      = 3018
-
-  };
-  
 public:
   nsresult ResetIMETextPWBuf();
 
   /**
    * Handles the newline characters either according to aNewLineHandling
    * or to the default system prefs if aNewLineHandling is negative.
    *
    * @param aString the string to be modified in place.
@@ -146,17 +116,17 @@ public:
    * @param aLength the number of password characters that aOutString should
    *        contain.
    */
   static nsresult FillBufWithPWChars(nsAString *aOutString, PRInt32 aLength);
 
 protected:
 
   // nsTextEditRules implementation methods
-  nsresult WillInsertText(  PRInt32          aAction,
+  nsresult WillInsertText(  nsEditor::OperationID aAction,
                             nsISelection *aSelection, 
                             bool            *aCancel,
                             bool            *aHandled,
                             const nsAString *inString,
                             nsAString       *outString,
                             PRInt32          aMaxLength);
   nsresult DidInsertText(nsISelection *aSelection, nsresult aResult);
   nsresult GetTopEnclosingPre(nsIDOMNode *aNode, nsIDOMNode** aOutPreNode);
@@ -278,32 +248,32 @@ protected:
   PRInt32              mCachedSelectionOffset;  // cached selected offset
   PRUint32             mActionNesting;
   bool                 mLockRulesSniffing;
   bool                 mDidExplicitlySetInterline;
   bool                 mDeleteBidiImmediately; // in bidirectional text, delete
                                                // characters not visually 
                                                // adjacent to the caret without
                                                // moving the caret first.
-  PRInt32              mTheAction;     // the top level editor action
+  nsEditor::OperationID mTheAction;     // the top level editor action
   nsCOMPtr<nsITimer>   mTimer;
   PRUint32             mLastStart, mLastLength;
 
   // friends
   friend class nsAutoLockRulesSniffing;
 
 };
 
 
 
 class nsTextRulesInfo : public nsRulesInfo
 {
  public:
  
-  nsTextRulesInfo(int aAction) : 
+  nsTextRulesInfo(nsEditor::OperationID aAction) :
     nsRulesInfo(aAction),
     inString(0),
     outString(0),
     outputFormat(0),
     maxLength(-1),
     collapsedAction(nsIEditor::eNext),
     bOrdered(false),
     entireList(false),