Bug 1055519 - Fix some more bad implicit constructors in layout and widget; r=roc
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 20 Aug 2014 00:58:22 -0400
changeset 200504 d209e250a42eaa4229f4bb87362e93fee3d6f0c3
parent 200503 9c80746b29713544258ef6d71d62c855bf19a5ff
child 200505 a203ef1e2b8ffefa5d512446e83a73e45a0146c0
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersroc
bugs1055519
milestone34.0a1
Bug 1055519 - Fix some more bad implicit constructors in layout and widget; r=roc
layout/generic/nsTextRunTransformations.h
layout/style/AnimationCommon.h
layout/style/StyleRule.h
layout/style/nsAnimationManager.h
layout/svg/nsSVGUtils.h
widget/InputData.h
widget/cocoa/nsCocoaUtils.h
--- a/layout/generic/nsTextRunTransformations.h
+++ b/layout/generic/nsTextRunTransformations.h
@@ -38,18 +38,18 @@ class nsCaseTransformTextRunFactory : pu
 public:
   // We could add an optimization here so that when there is no inner
   // factory, no title-case conversion, and no upper-casing of SZLIG, we override
   // MakeTextRun (after making it virtual in the superclass) and have it
   // just convert the string to uppercase or lowercase and create the textrun
   // via the fontgroup.
   
   // Takes ownership of aInnerTransformTextRunFactory
-  nsCaseTransformTextRunFactory(nsTransformingTextRunFactory* aInnerTransformingTextRunFactory,
-                                bool aAllUppercase = false)
+  explicit nsCaseTransformTextRunFactory(nsTransformingTextRunFactory* aInnerTransformingTextRunFactory,
+                                         bool aAllUppercase = false)
     : mInnerTransformingTextRunFactory(aInnerTransformingTextRunFactory),
       mAllUppercase(aAllUppercase) {}
 
   virtual void RebuildTextRun(nsTransformedTextRun* aTextRun, gfxContext* aRefContext) MOZ_OVERRIDE;
 
   // Perform a transformation on the given string, writing the result into
   // aConvertedString. If aAllUppercase is true, the transform is (global)
   // upper-casing, and aLanguage is used to determine any language-specific
--- a/layout/style/AnimationCommon.h
+++ b/layout/style/AnimationCommon.h
@@ -33,17 +33,17 @@ struct AnimationPlayerCollection;
 
 namespace css {
 
 bool IsGeometricProperty(nsCSSProperty aProperty);
 
 class CommonAnimationManager : public nsIStyleRuleProcessor,
                                public nsARefreshObserver {
 public:
-  CommonAnimationManager(nsPresContext *aPresContext);
+  explicit CommonAnimationManager(nsPresContext *aPresContext);
 
   // nsISupports
   NS_DECL_ISUPPORTS
 
   // nsIStyleRuleProcessor (parts)
   virtual nsRestyleHint HasStateDependentStyle(StateRuleProcessorData* aData) MOZ_OVERRIDE;
   virtual nsRestyleHint HasStateDependentStyle(PseudoElementStateRuleProcessorData* aData) MOZ_OVERRIDE;
   virtual bool HasDocumentStateDependentStyle(StateRuleProcessorData* aData) MOZ_OVERRIDE;
--- a/layout/style/StyleRule.h
+++ b/layout/style/StyleRule.h
@@ -25,18 +25,18 @@ struct nsCSSSelectorList;
 class nsCSSCompressedDataBlock;
 
 namespace mozilla {
 class CSSStyleSheet;
 } // namespace mozilla
 
 struct nsAtomList {
 public:
-  nsAtomList(nsIAtom* aAtom);
-  nsAtomList(const nsString& aAtomValue);
+  explicit nsAtomList(nsIAtom* aAtom);
+  explicit nsAtomList(const nsString& aAtomValue);
   ~nsAtomList(void);
 
   /** Do a deep clone.  Should be used only on the first in the linked list. */
   nsAtomList* Clone() const { return Clone(true); }
 
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
 
   nsCOMPtr<nsIAtom> mAtom;
@@ -45,17 +45,17 @@ private:
   nsAtomList* Clone(bool aDeep) const;
 
   nsAtomList(const nsAtomList& aCopy) MOZ_DELETE;
   nsAtomList& operator=(const nsAtomList& aCopy) MOZ_DELETE;
 };
 
 struct nsPseudoClassList {
 public:
-  nsPseudoClassList(nsCSSPseudoClasses::Type aType);
+  explicit nsPseudoClassList(nsCSSPseudoClasses::Type aType);
   nsPseudoClassList(nsCSSPseudoClasses::Type aType, const char16_t *aString);
   nsPseudoClassList(nsCSSPseudoClasses::Type aType, const int32_t *aIntPair);
   nsPseudoClassList(nsCSSPseudoClasses::Type aType,
                     nsCSSSelectorList *aSelectorList /* takes ownership */);
   ~nsPseudoClassList(void);
 
   /** Do a deep clone.  Should be used only on the first in the linked list. */
   nsPseudoClassList* Clone() const { return Clone(true); }
@@ -279,17 +279,17 @@ namespace css {
 
 class Declaration;
 class DOMCSSStyleRule;
 
 class StyleRule;
 
 class ImportantRule : public nsIStyleRule {
 public:
-  ImportantRule(Declaration *aDeclaration);
+  explicit ImportantRule(Declaration *aDeclaration);
 
   NS_DECL_ISUPPORTS
 
   // nsIStyleRule interface
   virtual void MapRuleInfoInto(nsRuleData* aRuleData) MOZ_OVERRIDE;
 #ifdef DEBUG
   virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE;
 #endif
--- a/layout/style/nsAnimationManager.h
+++ b/layout/style/nsAnimationManager.h
@@ -47,17 +47,17 @@ struct AnimationEventInfo {
 };
 
 typedef InfallibleTArray<AnimationEventInfo> EventArray;
 
 class nsAnimationManager MOZ_FINAL
   : public mozilla::css::CommonAnimationManager
 {
 public:
-  nsAnimationManager(nsPresContext *aPresContext)
+  explicit nsAnimationManager(nsPresContext *aPresContext)
     : mozilla::css::CommonAnimationManager(aPresContext)
     , mObservingRefreshDriver(false)
   {
   }
 
   static mozilla::AnimationPlayerCollection*
   GetAnimationsForCompositor(nsIContent* aContent, nsCSSProperty aProperty)
   {
--- a/layout/svg/nsSVGUtils.h
+++ b/layout/svg/nsSVGUtils.h
@@ -85,20 +85,20 @@ bool NS_SVGNewGetBBoxEnabled();
  */
 class SVGBBox {
   typedef mozilla::gfx::Rect Rect;
 
 public:
   SVGBBox() 
     : mIsEmpty(true) {}
 
-  SVGBBox(const Rect& aRect)
+  MOZ_IMPLICIT SVGBBox(const Rect& aRect)
     : mBBox(aRect), mIsEmpty(false) {}
 
-  SVGBBox(const gfxRect& aRect)
+  MOZ_IMPLICIT SVGBBox(const gfxRect& aRect)
     : mBBox(ToRect(aRect)), mIsEmpty(false) {}
 
   gfxRect ToThebesRect() const {
     return ThebesRect(mBBox);
   }
 
   bool IsEmpty() const {
     return mIsEmpty;
--- a/widget/InputData.h
+++ b/widget/InputData.h
@@ -183,26 +183,26 @@ public:
   MultiTouchInput(const MultiTouchInput& aOther)
     : InputData(MULTITOUCH_INPUT, aOther.mTime,
                 aOther.mTimeStamp, aOther.modifiers)
     , mType(aOther.mType)
   {
     mTouches.AppendElements(aOther.mTouches);
   }
 
-  MultiTouchInput(const WidgetTouchEvent& aTouchEvent);
+  explicit MultiTouchInput(const WidgetTouchEvent& aTouchEvent);
   WidgetTouchEvent ToWidgetTouchEvent(nsIWidget* aWidget) const;
 
   // This conversion from WidgetMouseEvent to MultiTouchInput is needed because
   // on the B2G emulator we can only receive mouse events, but we need to be
   // able to pan correctly. To do this, we convert the events into a format that
   // the panning code can handle. This code is very limited and only supports
   // SingleTouchData. It also sends garbage for the identifier, radius, force
   // and rotation angle.
-  MultiTouchInput(const WidgetMouseEvent& aMouseEvent);
+  explicit MultiTouchInput(const WidgetMouseEvent& aMouseEvent);
 
   MultiTouchType mType;
   nsTArray<SingleTouchData> mTouches;
 };
 
 /**
  * Encapsulation class for pan events, can be used off-main-thread.
  * These events are currently only used for scrolling on desktop.
--- a/widget/cocoa/nsCocoaUtils.h
+++ b/widget/cocoa/nsCocoaUtils.h
@@ -49,17 +49,17 @@ namespace mozilla {
 namespace gfx {
 class SourceSurface;
 }
 }
 
 // Used to retain a Cocoa object for the remainder of a method's execution.
 class nsAutoRetainCocoaObject {
 public:
-nsAutoRetainCocoaObject(id anObject)
+explicit nsAutoRetainCocoaObject(id anObject)
 {
   mObject = NS_OBJC_TRY_EXPR_ABORT([anObject retain]);
 }
 ~nsAutoRetainCocoaObject()
 {
   NS_OBJC_TRY_ABORT([mObject release]);
 }
 private: