Bug 1060978 - Fix more bad implicit constructors in editor; r=roc
authorEhsan Akhgari <ehsan@mozilla.com>
Sun, 31 Aug 2014 23:33:43 -0400
changeset 224483 bb7c757ff1f56cdbd12d8838010eca7e4b4d67a9
parent 224482 ee786b13a270149e76e8cfab2781c8ba7da9fbb2
child 224484 9d4e083655b993f73ba3eca84e0f14cdd270bcda
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1060978
milestone34.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 1060978 - Fix more bad implicit constructors in editor; r=roc
editor/libeditor/nsEditRules.h
editor/libeditor/nsEditorUtils.h
editor/libeditor/nsHTMLEditRules.cpp
editor/libeditor/nsHTMLObjectResizer.h
editor/libeditor/nsSelectionState.h
editor/libeditor/nsTableEditor.cpp
editor/libeditor/nsTextEditRules.h
editor/libeditor/nsWSRunObject.h
editor/txmgr/nsTransactionManager.h
editor/txmgr/tests/TestTXMgr.cpp
editor/txtsvc/nsFilteredContentIterator.h
--- a/editor/libeditor/nsEditRules.h
+++ b/editor/libeditor/nsEditRules.h
@@ -18,17 +18,17 @@ 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(EditAction aAction) : action(aAction) {}
+  explicit nsRulesInfo(EditAction aAction) : action(aAction) {}
   virtual ~nsRulesInfo() {}
   
   EditAction action;
 };
 
 /***************************************************************************
  * Interface of editing rules.
  *  
--- a/editor/libeditor/nsEditorUtils.h
+++ b/editor/libeditor/nsEditorUtils.h
@@ -39,17 +39,17 @@ class MOZ_STACK_CLASS nsAutoPlaceHolderB
 /***************************************************************************
  * stack based helper class for batching a collection of txns.  
  * Note: I changed this to use placeholder batching so that we get
  * proper selection save/restore across undo/redo.
  */
 class MOZ_STACK_CLASS nsAutoEditBatch : public nsAutoPlaceHolderBatch
 {
   public:
-    nsAutoEditBatch( nsIEditor *aEd) : nsAutoPlaceHolderBatch(aEd,nullptr)  {}
+    explicit nsAutoEditBatch( nsIEditor *aEd) : nsAutoPlaceHolderBatch(aEd,nullptr)  {}
     ~nsAutoEditBatch() {}
 };
 
 /***************************************************************************
  * stack based helper class for saving/restoring selection.  Note that this
  * assumes that the nodes involved are still around afterwards!
  */
 class MOZ_STACK_CLASS nsAutoSelectionReset
@@ -104,17 +104,17 @@ class MOZ_STACK_CLASS nsAutoRules
 /***************************************************************************
  * stack based helper class for turning off active selection adjustment
  * by low level transactions
  */
 class MOZ_STACK_CLASS nsAutoTxnsConserveSelection
 {
   public:
   
-  nsAutoTxnsConserveSelection(nsEditor *ed) : mEd(ed), mOldState(true)
+  explicit nsAutoTxnsConserveSelection(nsEditor *ed) : mEd(ed), mOldState(true)
   {
     if (mEd) 
     {
       mOldState = mEd->GetShouldTxnSetSelection();
       mEd->SetShouldTxnSetSelection(false);
     }
   }
   
@@ -133,17 +133,17 @@ class MOZ_STACK_CLASS nsAutoTxnsConserve
 
 /***************************************************************************
  * stack based helper class for batching reflow and paint requests.
  */
 class MOZ_STACK_CLASS nsAutoUpdateViewBatch
 {
   public:
   
-  nsAutoUpdateViewBatch(nsEditor *ed) : mEd(ed)
+  explicit nsAutoUpdateViewBatch(nsEditor *ed) : mEd(ed)
   {
     NS_ASSERTION(mEd, "null mEd pointer!");
 
     if (mEd) 
       mEd->BeginUpdateViewBatch();
   }
   
   ~nsAutoUpdateViewBatch() 
--- a/editor/libeditor/nsHTMLEditRules.cpp
+++ b/editor/libeditor/nsHTMLEditRules.cpp
@@ -124,17 +124,17 @@ class nsBRNodeFunctor : public nsBoolDom
       if (nsTextEditUtils::IsBreak(aNode)) return true;
       return false;
     }
 };
 
 class nsEmptyEditableFunctor : public nsBoolDomIterFunctor
 {
   public:
-    nsEmptyEditableFunctor(nsHTMLEditor* editor) : mHTMLEditor(editor) {}
+    explicit nsEmptyEditableFunctor(nsHTMLEditor* editor) : mHTMLEditor(editor) {}
     virtual bool operator()(nsIDOMNode* aNode)  
     {
       if (mHTMLEditor->IsEditable(aNode) &&
         (nsHTMLEditUtils::IsListItem(aNode) ||
         nsHTMLEditUtils::IsTableCellOrCaption(aNode)))
       {
         bool bIsEmptyNode;
         nsresult res = mHTMLEditor->IsEmptyNode(aNode, &bIsEmptyNode, false, false);
@@ -146,17 +146,17 @@ class nsEmptyEditableFunctor : public ns
     }
   protected:
     nsHTMLEditor* mHTMLEditor;
 };
 
 class nsEditableTextFunctor : public nsBoolDomIterFunctor
 {
   public:
-    nsEditableTextFunctor(nsHTMLEditor* editor) : mHTMLEditor(editor) {}
+    explicit nsEditableTextFunctor(nsHTMLEditor* editor) : mHTMLEditor(editor) {}
     virtual bool operator()(nsIDOMNode* aNode)  
     {
       if (nsEditor::IsTextNode(aNode) && mHTMLEditor->IsEditable(aNode)) 
       {
         return true;
       }
       return false;
     }
@@ -5927,17 +5927,17 @@ nsHTMLEditRules::PromoteRange(nsIDOMRang
   NS_ENSURE_SUCCESS(res, res);
   res = inRange->SetEnd(opEndNode, opEndOffset);
   return res;
 } 
 
 class nsUniqueFunctor : public nsBoolDomIterFunctor
 {
 public:
-  nsUniqueFunctor(nsCOMArray<nsIDOMNode> &aArray) : mArray(aArray)
+  explicit nsUniqueFunctor(nsCOMArray<nsIDOMNode> &aArray) : mArray(aArray)
   {
   }
   virtual bool operator()(nsIDOMNode* aNode)  // used to build list of all nodes iterator covers
   {
     return mArray.IndexOf(aNode) < 0;
   }
 
 private:
--- a/editor/libeditor/nsHTMLObjectResizer.h
+++ b/editor/libeditor/nsHTMLObjectResizer.h
@@ -26,17 +26,17 @@ class nsIHTMLEditor;
 // ==================================================================
 // ResizerSelectionListener
 // ==================================================================
 
 class ResizerSelectionListener : public nsISelectionListener
 {
 public:
 
-  ResizerSelectionListener(nsIHTMLEditor * aEditor);
+  explicit ResizerSelectionListener(nsIHTMLEditor * aEditor);
   void Reset();
 
   /*interfaces for addref and release and queryinterface*/
   NS_DECL_ISUPPORTS
 
   NS_DECL_NSISELECTIONLISTENER
 
 protected:
@@ -47,17 +47,17 @@ protected:
 
 // ==================================================================
 // ResizerMouseMotionListener
 // ==================================================================
 
 class ResizerMouseMotionListener : public nsIDOMEventListener
 {
 public:
-  ResizerMouseMotionListener(nsIHTMLEditor * aEditor);
+  explicit ResizerMouseMotionListener(nsIHTMLEditor * aEditor);
 
 /*interfaces for addref and release and queryinterface*/
   NS_DECL_ISUPPORTS
 
   NS_DECL_NSIDOMEVENTLISTENER
 
  protected:
   virtual ~ResizerMouseMotionListener();
@@ -68,17 +68,17 @@ public:
 
 // ==================================================================
 // DocumentResizeEventListener
 // ==================================================================
 
 class DocumentResizeEventListener: public nsIDOMEventListener
 {
 public:
-  DocumentResizeEventListener(nsIHTMLEditor * aEditor);
+  explicit DocumentResizeEventListener(nsIHTMLEditor * aEditor);
 
   /*interfaces for addref and release and queryinterface*/
   NS_DECL_ISUPPORTS
 
   NS_DECL_NSIDOMEVENTLISTENER
 
  protected:
   virtual ~DocumentResizeEventListener();
--- a/editor/libeditor/nsSelectionState.h
+++ b/editor/libeditor/nsSelectionState.h
@@ -268,17 +268,17 @@ class MOZ_STACK_CLASS nsAutoRemoveContai
  */
 
 class MOZ_STACK_CLASS nsAutoInsertContainerSelNotify
 {
   private:
     nsRangeUpdater &mRU;
 
   public:
-    nsAutoInsertContainerSelNotify(nsRangeUpdater &aRangeUpdater) :
+    explicit nsAutoInsertContainerSelNotify(nsRangeUpdater &aRangeUpdater) :
     mRU(aRangeUpdater)
     {
       mRU.WillInsertContainer();
     }
     
     ~nsAutoInsertContainerSelNotify()
     {
       mRU.DidInsertContainer();
--- a/editor/libeditor/nsTableEditor.cpp
+++ b/editor/libeditor/nsTableEditor.cpp
@@ -76,17 +76,17 @@ class MOZ_STACK_CLASS nsSetSelectionAfte
 };
 
 // Stack-class to turn on/off selection batching for table selection
 class MOZ_STACK_CLASS nsSelectionBatcherForTable
 {
 private:
   nsCOMPtr<nsISelectionPrivate> mSelection;
 public:
-  nsSelectionBatcherForTable(nsISelection *aSelection)
+  explicit nsSelectionBatcherForTable(nsISelection *aSelection)
   {
     nsCOMPtr<nsISelection> sel(aSelection);
     mSelection = do_QueryInterface(sel);
     if (mSelection)  mSelection->StartBatchChanges();
   }
   virtual ~nsSelectionBatcherForTable() 
   { 
     if (mSelection) mSelection->EndBatchChanges();
--- a/editor/libeditor/nsTextEditRules.h
+++ b/editor/libeditor/nsTextEditRules.h
@@ -249,17 +249,17 @@ protected:
 };
 
 
 
 class nsTextRulesInfo : public nsRulesInfo
 {
  public:
  
-  nsTextRulesInfo(EditAction aAction) :
+  explicit nsTextRulesInfo(EditAction aAction) :
     nsRulesInfo(aAction),
     inString(0),
     outString(0),
     outputFormat(0),
     maxLength(-1),
     collapsedAction(nsIEditor::eNext),
     stripWrappers(nsIEditor::eStrip),
     bOrdered(false),
@@ -302,17 +302,17 @@ class nsTextRulesInfo : public nsRulesIn
  * stack based helper class for StartOperation()/EndOperation() sandwich.
  * this class sets a bool letting us know to ignore any rules sniffing
  * that tries to occur reentrantly. 
  */
 class nsAutoLockRulesSniffing
 {
   public:
   
-  nsAutoLockRulesSniffing(nsTextEditRules *rules) : mRules(rules) 
+  explicit nsAutoLockRulesSniffing(nsTextEditRules *rules) : mRules(rules) 
                  {if (mRules) mRules->mLockRulesSniffing = true;}
   ~nsAutoLockRulesSniffing() 
                  {if (mRules) mRules->mLockRulesSniffing = false;}
   
   protected:
   nsTextEditRules *mRules;
 };
 
@@ -320,17 +320,17 @@ class nsAutoLockRulesSniffing
 
 /***************************************************************************
  * stack based helper class for turning on/off the edit listener.
  */
 class nsAutoLockListener
 {
   public:
   
-  nsAutoLockListener(bool *enabled) : mEnabled(enabled)
+  explicit nsAutoLockListener(bool *enabled) : mEnabled(enabled)
                  {if (mEnabled) { mOldState=*mEnabled; *mEnabled = false;}}
   ~nsAutoLockListener() 
                  {if (mEnabled) *mEnabled = mOldState;}
   
   protected:
   bool *mEnabled;
   bool mOldState;
 };
--- a/editor/libeditor/nsWSRunObject.h
+++ b/editor/libeditor/nsWSRunObject.h
@@ -5,16 +5,17 @@
 
 #ifndef __wsrunobject_h__
 #define __wsrunobject_h__
 
 #include "nsCOMPtr.h"
 #include "nsIEditor.h" // for EDirection
 #include "nsINode.h"
 #include "nscore.h"
+#include "mozilla/Attributes.h"
 #include "mozilla/dom/Text.h"
 
 class nsHTMLEditor;
 class nsIDOMDocument;
 class nsIDOMNode;
 struct DOMPoint;
 
 // class nsWSRunObject represents the entire whitespace situation
@@ -57,17 +58,17 @@ public:
     block      = otherBlock | thisBlock // block found
   };
 
   /**
    * Implicit constructor, because the enums are logically just WSTypes
    * themselves, and are only a separate type because there's no other obvious
    * way to name specific WSType values.
    */
-  WSType(const Enum& aEnum = none) : mEnum(aEnum) {}
+  MOZ_IMPLICIT WSType(const Enum& aEnum = none) : mEnum(aEnum) {}
   // operator==, &, and | need to access mEnum
   friend bool operator==(const WSType& aLeft, const WSType& aRight);
   friend const WSType operator&(const WSType& aLeft, const WSType& aRight);
   friend const WSType operator|(const WSType& aLeft, const WSType& aRight);
   WSType& operator=(const WSType& aOther) {
     // This handles self-assignment fine
     mEnum = aOther.mEnum;
     return *this;
--- a/editor/txmgr/nsTransactionManager.h
+++ b/editor/txmgr/nsTransactionManager.h
@@ -37,17 +37,17 @@ private:
   /** The default destructor.
    */
   virtual ~nsTransactionManager();
 
 public:
 
   /** The default constructor.
    */
-  nsTransactionManager(int32_t aMaxTransactionCount=-1);
+  explicit nsTransactionManager(int32_t aMaxTransactionCount=-1);
 
   /* Macro for AddRef(), Release(), and QueryInterface() */
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTransactionManager,
                                            nsITransactionManager)
 
   /* nsITransactionManager method implementations. */
   NS_DECL_NSITRANSACTIONMANAGER
--- a/editor/txmgr/tests/TestTXMgr.cpp
+++ b/editor/txmgr/tests/TestTXMgr.cpp
@@ -430,18 +430,18 @@ protected:
 #define BATCH_FLAG             32
 #define ALL_ERROR_FLAGS        (THROWS_DO_ERROR_FLAG|THROWS_UNDO_ERROR_FLAG|THROWS_REDO_ERROR_FLAG)
 
   int32_t mVal;
   int32_t mFlags;
 
 public:
 
-  SimpleTransaction(int32_t aFlags=NONE_FLAG)
-                    : mVal(++sConstructorCount), mFlags(aFlags)
+  explicit SimpleTransaction(int32_t aFlags=NONE_FLAG)
+    : mVal(++sConstructorCount), mFlags(aFlags)
   {}
 
   virtual ~SimpleTransaction()
   {
     //
     // Make sure transactions are being destroyed in the order we expect!
     // Notice that we don't check to see if we go past the end of the array.
     // This is done on purpose since we want to crash if the order array is out
--- a/editor/txtsvc/nsFilteredContentIterator.h
+++ b/editor/txtsvc/nsFilteredContentIterator.h
@@ -21,17 +21,17 @@ class nsITextServicesFilter;
 class nsFilteredContentIterator MOZ_FINAL : public nsIContentIterator
 {
 public:
 
   // nsISupports interface...
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS(nsFilteredContentIterator)
 
-  nsFilteredContentIterator(nsITextServicesFilter* aFilter);
+  explicit nsFilteredContentIterator(nsITextServicesFilter* aFilter);
 
   /* nsIContentIterator */
   virtual nsresult Init(nsINode* aRoot);
   virtual nsresult Init(nsIDOMRange* aRange);
   virtual void First();
   virtual void Last();
   virtual void Next();
   virtual void Prev();