Bug 1266621 part 4 - Remove constructors of StyleComplexColor. r=heycam
authorXidorn Quan <me@upsuper.org>
Tue, 27 Sep 2016 14:00:05 +1000
changeset 315755 7b1d4a51d0e8bc6ea2f4ec2281a2fb69834a5e84
parent 315754 1e9cc5be7495bce814e961d56426281321b9be8c
child 315756 022b1fcfe8337d5bccf0e341626ab0a4cb32533e
push id20634
push usercbook@mozilla.com
push dateFri, 30 Sep 2016 10:10:13 +0000
treeherderfx-team@afe79b010d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1266621
milestone52.0a1
Bug 1266621 part 4 - Remove constructors of StyleComplexColor. r=heycam So that they can be put inside anonymous structs and unions. MozReview-Commit-ID: 8OMxkSZJEOz
layout/style/StyleComplexColor.h
layout/style/nsCSSValue.h
--- a/layout/style/StyleComplexColor.h
+++ b/layout/style/StyleComplexColor.h
@@ -20,24 +20,18 @@ namespace mozilla {
  * where p is mForegroundRatio. See mozilla::LinearBlendColors for
  * the actual algorithm.
  */
 struct StyleComplexColor
 {
   nscolor mColor;
   uint8_t mForegroundRatio;
 
-  StyleComplexColor() {}
-  StyleComplexColor(nscolor aColor, uint_fast8_t aForegroundRatio)
-    : mColor(aColor), mForegroundRatio(aForegroundRatio) {}
-
-  static StyleComplexColor FromColor(nscolor aColor)
-    { return StyleComplexColor(aColor, 0); }
-  static StyleComplexColor CurrentColor()
-    { return StyleComplexColor(NS_RGBA(0, 0, 0, 0), 255); }
+  static StyleComplexColor FromColor(nscolor aColor) { return {aColor, 0}; }
+  static StyleComplexColor CurrentColor() { return {NS_RGBA(0, 0, 0, 0), 255}; }
 
   bool IsNumericColor() const { return mForegroundRatio == 0; }
   bool IsCurrentColor() const { return mForegroundRatio == 255; }
 
   bool operator==(const StyleComplexColor& aOther) const {
     return mForegroundRatio == aOther.mForegroundRatio &&
            (IsCurrentColor() || mColor == aOther.mColor);
   }
--- a/layout/style/nsCSSValue.h
+++ b/layout/style/nsCSSValue.h
@@ -370,18 +370,17 @@ struct ComplexColorData
     return !(*this == aOther);
   }
 
   bool IsCurrentColor() const { return mForegroundRatio >= 1.0f; }
   bool IsNumericColor() const { return mForegroundRatio <= 0.0f; }
 
   StyleComplexColor ToComplexColor() const
   {
-    return StyleComplexColor(
-      mColor.ToColor(), ClampColor(mForegroundRatio * 255.0f));
+    return {mColor.ToColor(), ClampColor(mForegroundRatio * 255.0f)};
   }
 };
 
 struct ComplexColorValue final : public ComplexColorData
 {
   // Just redirect any parameter to the data struct.
   template<typename... Args>
   explicit ComplexColorValue(Args&&... aArgs)