bug 821593 - add webidl api to RGBColor and store its members as nsROCSSPrimitiveValue* not nsIDOMCSSPrimitiveValue* r=bz
authorTrevor Saunders <trev.saunders@gmail.com>
Sat, 20 Oct 2012 14:04:36 -0400
changeset 125355 7c8138b6848a740319b3b8fbb8a5611d91bdb3e7
parent 125354 9ea3572c80b338b518ec3f211e4a739a13f010f0
child 125356 7645d0b506dc159ffa0c475df6d8b0dd066f7943
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs821593
milestone20.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 821593 - add webidl api to RGBColor and store its members as nsROCSSPrimitiveValue* not nsIDOMCSSPrimitiveValue* r=bz
layout/style/nsDOMCSSRGBColor.cpp
layout/style/nsDOMCSSRGBColor.h
--- a/layout/style/nsDOMCSSRGBColor.cpp
+++ b/layout/style/nsDOMCSSRGBColor.cpp
@@ -5,22 +5,23 @@
 
 /* DOM object representing color values in DOM computed style */
 
 #include "nsISupports.h"
 #include "nsCOMPtr.h"
 #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)
 {
 }
 
 nsDOMCSSRGBColor::~nsDOMCSSRGBColor(void)
 {
--- a/layout/style/nsDOMCSSRGBColor.h
+++ b/layout/style/nsDOMCSSRGBColor.h
@@ -3,39 +3,57 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* DOM object representing color values in DOM computed style */
 
 #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);
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMRGBCOLOR
   NS_DECL_NSIDOMNSRGBACOLOR
 
   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<nsIDOMCSSPrimitiveValue> mRed;
-  nsCOMPtr<nsIDOMCSSPrimitiveValue> mGreen;
-  nsCOMPtr<nsIDOMCSSPrimitiveValue> mBlue;
-  nsCOMPtr<nsIDOMCSSPrimitiveValue> mAlpha;
+  nsRefPtr<nsROCSSPrimitiveValue> mRed;
+  nsRefPtr<nsROCSSPrimitiveValue> mGreen;
+  nsRefPtr<nsROCSSPrimitiveValue> mBlue;
+  nsRefPtr<nsROCSSPrimitiveValue> mAlpha;
   bool mHasAlpha;
 };
 
 #endif // nsDOMCSSRGBColor_h__