From 6316ea3cdf171aca0a42f1ba6400c410475f4199 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Sat, 20 Oct 2012 14:04:36 -0400 Subject: [PATCH] bug 821593 - add webidl api to RGBColor and store its members as nsROCSSPrimitiveValue* not nsIDOMCSSPrimitiveValue* r=bz --- layout/style/nsDOMCSSRGBColor.cpp | 9 ++++---- layout/style/nsDOMCSSRGBColor.h | 38 +++++++++++++++++++++++-------- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/layout/style/nsDOMCSSRGBColor.cpp b/layout/style/nsDOMCSSRGBColor.cpp index 02ab9a7ee1b8..11963f1fd082 100644 --- a/layout/style/nsDOMCSSRGBColor.cpp +++ b/layout/style/nsDOMCSSRGBColor.cpp @@ -10,12 +10,13 @@ #include "nsIDOMCSSPrimitiveValue.h" #include "nsDOMCSSRGBColor.h" #include "nsContentUtils.h" +#include "nsROCSSPrimitiveValue.h" #include "nsDOMClassInfoID.h" -nsDOMCSSRGBColor::nsDOMCSSRGBColor(nsIDOMCSSPrimitiveValue* aRed, - nsIDOMCSSPrimitiveValue* aGreen, - nsIDOMCSSPrimitiveValue* aBlue, - nsIDOMCSSPrimitiveValue* aAlpha, +nsDOMCSSRGBColor::nsDOMCSSRGBColor(nsROCSSPrimitiveValue* aRed, + nsROCSSPrimitiveValue* aGreen, + nsROCSSPrimitiveValue* aBlue, + nsROCSSPrimitiveValue* aAlpha, bool aHasAlpha) : mRed(aRed), mGreen(aGreen), mBlue(aBlue), mAlpha(aAlpha) , mHasAlpha(aHasAlpha) diff --git a/layout/style/nsDOMCSSRGBColor.h b/layout/style/nsDOMCSSRGBColor.h index 14569fc68488..bd2f8de27d4e 100644 --- a/layout/style/nsDOMCSSRGBColor.h +++ b/layout/style/nsDOMCSSRGBColor.h @@ -8,18 +8,18 @@ #ifndef nsDOMCSSRGBColor_h__ #define nsDOMCSSRGBColor_h__ +#include "nsAutoPtr.h" #include "nsISupports.h" #include "nsIDOMNSRGBAColor.h" -#include "nsCOMPtr.h" -class nsIDOMCSSPrimitiveValue; +class nsROCSSPrimitiveValue; class nsDOMCSSRGBColor : public nsIDOMNSRGBAColor { public: - nsDOMCSSRGBColor(nsIDOMCSSPrimitiveValue* aRed, - nsIDOMCSSPrimitiveValue* aGreen, - nsIDOMCSSPrimitiveValue* aBlue, - nsIDOMCSSPrimitiveValue* aAlpha, + nsDOMCSSRGBColor(nsROCSSPrimitiveValue* aRed, + nsROCSSPrimitiveValue* aGreen, + nsROCSSPrimitiveValue* aBlue, + nsROCSSPrimitiveValue* aAlpha, bool aHasAlpha); virtual ~nsDOMCSSRGBColor(void); @@ -30,11 +30,29 @@ public: bool HasAlpha() const { return mHasAlpha; } + // RGBColor webidl interface + nsROCSSPrimitiveValue* Red() const + { + return mRed; + } + nsROCSSPrimitiveValue* Green() const + { + return mGreen; + } + nsROCSSPrimitiveValue* Blue() const + { + return mBlue; + } + nsROCSSPrimitiveValue* Alpha() const + { + return mAlpha; + } + private: - nsCOMPtr mRed; - nsCOMPtr mGreen; - nsCOMPtr mBlue; - nsCOMPtr mAlpha; + nsRefPtr mRed; + nsRefPtr mGreen; + nsRefPtr mBlue; + nsRefPtr mAlpha; bool mHasAlpha; };