Bug 657160 - Remove NS_NewHTMLEditRules; r=ehsan
authorMs2ger <ms2ger@gmail.com>
Sun, 15 May 2011 12:15:35 +0200
changeset 69543 8319e176934642050371d9731bd9a2b8cae6d6de
parent 69542 4077327becc20ab5075c74ed633a06a85c22953f
child 69544 a247d033b5aac4305d77ae67e8697addd794932c
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_NewHTMLEditRules; r=ehsan
editor/libeditor/html/nsHTMLEditRules.cpp
editor/libeditor/html/nsHTMLEditRules.h
editor/libeditor/html/nsHTMLEditor.cpp
--- a/editor/libeditor/html/nsHTMLEditRules.cpp
+++ b/editor/libeditor/html/nsHTMLEditRules.cpp
@@ -166,29 +166,16 @@ class nsEditableTextFunctor : public nsB
       return PR_FALSE;
     }
   protected:
     nsHTMLEditor* mHTMLEditor;
 };
 
 
 /********************************************************
- *  routine for making new rules instance
- ********************************************************/
-
-nsresult
-NS_NewHTMLEditRules(nsIEditRules** aInstancePtrResult)
-{
-  nsHTMLEditRules * rules = new nsHTMLEditRules();
-  if (rules)
-    return rules->QueryInterface(NS_GET_IID(nsIEditRules), (void**) aInstancePtrResult);
-  return NS_ERROR_OUT_OF_MEMORY;
-}
-
-/********************************************************
  *  Constructor/Destructor 
  ********************************************************/
 
 nsHTMLEditRules::nsHTMLEditRules() : 
 mDocChangeRange(nsnull)
 ,mListenerEnabled(PR_TRUE)
 ,mReturnInEmptyLIKillsList(PR_TRUE)
 ,mDidDeleteSelection(PR_FALSE)
--- a/editor/libeditor/html/nsHTMLEditRules.h
+++ b/editor/libeditor/html/nsHTMLEditRules.h
@@ -313,12 +313,10 @@ protected:
   PRPackedBool            mRestoreContentEditableCount;
   nsCOMPtr<nsIDOMRange>   mUtilRange;
   PRUint32                mJoinOffset;  // need to remember an int across willJoin/didJoin...
   nsCOMPtr<nsIDOMNode>    mNewBlock;
   nsRangeStore            mRangeItem;
   StyleCache              mCachedStyles[SIZE_STYLE_TABLE];
 };
 
-nsresult NS_NewHTMLEditRules(nsIEditRules** aInstancePtrResult);
-
 #endif //nsHTMLEditRules_h__
 
--- a/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/editor/libeditor/html/nsHTMLEditor.cpp
@@ -104,17 +104,16 @@
 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);
-nsresult NS_NewHTMLEditRules(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)
@@ -528,22 +527,18 @@ nsHTMLEditor::SetFlags(PRUint32 aFlags)
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLEditor::InitRules()
 {
   // instantiate the rules for the html editor
-  nsresult res = NS_NewHTMLEditRules(getter_AddRefs(mRules));
-  NS_ENSURE_SUCCESS(res, res);
-  NS_ENSURE_TRUE(mRules, NS_ERROR_UNEXPECTED);
-  res = mRules->Init(static_cast<nsPlaintextEditor*>(this));
-  
-  return res;
+  mRules = new nsHTMLEditRules();
+  return mRules->Init(static_cast<nsPlaintextEditor*>(this));
 }
 
 NS_IMETHODIMP
 nsHTMLEditor::BeginningOfDocument()
 {
   if (!mDocWeak) { return NS_ERROR_NOT_INITIALIZED; }
 
   // get the selection