Bug 657160 - Remove NS_NewTextEditRules; r=ehsan
authorMs2ger <ms2ger@gmail.com>
Sun, 15 May 2011 12:16:45 +0200
changeset 69544 a247d033b5aac4305d77ae67e8697addd794932c
parent 69543 8319e176934642050371d9731bd9a2b8cae6d6de
child 69545 9bfceb76e15e1be5fa3d77ae13bd8b1028b99e57
push id20009
push userMs2ger@gmail.com
push dateSun, 15 May 2011 13:28:32 +0000
treeherdermozilla-central@62b546e80604 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs657160
milestone6.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 657160 - Remove NS_NewTextEditRules; r=ehsan
editor/libeditor/html/nsHTMLEditor.cpp
editor/libeditor/text/nsPlaintextEditor.cpp
editor/libeditor/text/nsTextEditRules.cpp
editor/libeditor/text/nsTextEditRules.h
--- a/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/editor/libeditor/html/nsHTMLEditor.cpp
@@ -102,19 +102,16 @@
 
 // Some utilities to handle annoying overloading of "A" tag for link and named anchor
 static char hrefText[] = "href";
 static char anchorTxt[] = "anchor";
 static char namedanchorText[] = "namedanchor";
 
 nsIRangeUtils* nsHTMLEditor::sRangeHelper;
 
-// some prototypes for rules creation shortcuts
-nsresult NS_NewTextEditRules(nsIEditRules** aInstancePtrResult);
-
 #define IsLinkTag(s) (s.EqualsIgnoreCase(hrefText))
 #define IsNamedAnchorTag(s) (s.EqualsIgnoreCase(anchorTxt) || s.EqualsIgnoreCase(namedanchorText))
 
 nsHTMLEditor::nsHTMLEditor()
 : nsPlaintextEditor()
 , mIgnoreSpuriousDragEvent(PR_FALSE)
 , mCRInParagraphCreatesParagraph(PR_FALSE)
 , mSelectedCellIndex(0)
--- a/editor/libeditor/text/nsPlaintextEditor.cpp
+++ b/editor/libeditor/text/nsPlaintextEditor.cpp
@@ -82,19 +82,16 @@
 
 // Drag & Drop, Clipboard
 #include "nsIClipboard.h"
 #include "nsITransferable.h"
 #include "nsCopySupport.h"
 
 #include "mozilla/FunctionTimer.h"
 
-// prototype for rules creation shortcut
-nsresult NS_NewTextEditRules(nsIEditRules** aInstancePtrResult);
-
 nsPlaintextEditor::nsPlaintextEditor()
 : nsEditor()
 , mIgnoreSpuriousDragEvent(PR_FALSE)
 , mRules(nsnull)
 , mWrapToWindow(PR_FALSE)
 , mWrapColumn(0)
 , mMaxTextLength(-1)
 , mInitTriggerCounter(0)
@@ -324,19 +321,17 @@ nsPlaintextEditor::SetDocumentCharacterS
 
   return result; 
 } 
 
 
 NS_IMETHODIMP nsPlaintextEditor::InitRules()
 {
   // instantiate the rules for this text editor
-  nsresult res = NS_NewTextEditRules(getter_AddRefs(mRules));
-  NS_ENSURE_SUCCESS(res, res);
-  NS_ENSURE_TRUE(mRules, NS_ERROR_UNEXPECTED);
+  mRules = new nsTextEditRules();
   return mRules->Init(this);
 }
 
 
 NS_IMETHODIMP
 nsPlaintextEditor::GetIsDocumentEditable(PRBool *aIsDocumentEditable)
 {
   NS_ENSURE_ARG_POINTER(aIsDocumentEditable);
--- a/editor/libeditor/text/nsTextEditRules.cpp
+++ b/editor/libeditor/text/nsTextEditRules.cpp
@@ -75,26 +75,16 @@ static NS_DEFINE_CID(kLookAndFeelCID, NS
 #define CANCEL_OPERATION_IF_READONLY_OR_DISABLED \
   if (IsReadonly() || IsDisabled()) \
   {                     \
     *aCancel = PR_TRUE; \
     return NS_OK;       \
   };
 
 
-nsresult
-NS_NewTextEditRules(nsIEditRules** aInstancePtrResult)
-{
-  nsTextEditRules * rules = new nsTextEditRules();
-  if (rules)
-    return rules->QueryInterface(NS_GET_IID(nsIEditRules), (void**) aInstancePtrResult);
-  return NS_ERROR_OUT_OF_MEMORY;
-}
-
-
 /********************************************************
  *  Constructor/Destructor 
  ********************************************************/
 
 nsTextEditRules::nsTextEditRules()
 : mEditor(nsnull)
 , mPasswordText()
 , mPasswordIMEText()
--- a/editor/libeditor/text/nsTextEditRules.h
+++ b/editor/libeditor/text/nsTextEditRules.h
@@ -368,13 +368,9 @@ class nsAutoLockListener
   ~nsAutoLockListener() 
                  {if (mEnabled) *mEnabled = mOldState;}
   
   protected:
   PRPackedBool *mEnabled;
   PRPackedBool mOldState;
 };
 
-
-nsresult NS_NewTextEditRules(nsIEditRules** aInstancePtrResult);
-
 #endif //nsTextEditRules_h__
-