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
--- 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)