bug 821593 - GetRGBColorValue() should return nsDOMCSSRGBColor* r=bz
authorTrevor Saunders <trev.saunders@gmail.com>
Wed, 24 Oct 2012 20:43:56 -0400
changeset 125356 7645d0b506dc159ffa0c475df6d8b0dd066f7943
parent 125355 7c8138b6848a740319b3b8fbb8a5611d91bdb3e7
child 125357 477a1c6b95f90d6cc417ddc09a67ac2fd7f0103e
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 - GetRGBColorValue() should return nsDOMCSSRGBColor* r=bz
dom/bindings/Bindings.conf
layout/style/nsROCSSPrimitiveValue.cpp
layout/style/nsROCSSPrimitiveValue.h
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -144,17 +144,18 @@ DOMInterfaces = {
     'resultNotAddRefed': [ 'item' ]
 },
 
 'CSS2Properties': {
   'nativeType': 'nsDOMCSSDeclaration'
 },
 
 "CSSPrimitiveValue": {
-  "nativeType": "nsROCSSPrimitiveValue"
+    "nativeType": "nsROCSSPrimitiveValue",
+    "resultNotAddRefed": ["GetRGBColorValue"]
 },
 
 'CSSStyleDeclaration': {
   'nativeType': 'nsICSSDeclaration'
 },
 
 "CSSValue": {
   "concrete": False
--- a/layout/style/nsROCSSPrimitiveValue.cpp
+++ b/layout/style/nsROCSSPrimitiveValue.cpp
@@ -490,29 +490,29 @@ nsROCSSPrimitiveValue::GetRectValue(nsID
   *aRect = GetRectValue(error).get();
   return error.ErrorCode();
 }
 
 NS_IMETHODIMP
 nsROCSSPrimitiveValue::GetRGBColorValue(nsIDOMRGBColor** aColor)
 {
   ErrorResult error;
-  *aColor = GetRGBColorValue(error).get();
+  NS_IF_ADDREF(*aColor = GetRGBColorValue(error));
   return error.ErrorCode();
 }
 
-already_AddRefed<nsIDOMRGBColor>
+nsDOMCSSRGBColor*
 nsROCSSPrimitiveValue::GetRGBColorValue(ErrorResult& aRv)
 {
   if (mType != CSS_RGBCOLOR) {
     aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
     return nullptr;
   }
+
   NS_ASSERTION(mValue.mColor, "mValue.mColor should never be null");
-  NS_ADDREF(mValue.mColor);
   return mValue.mColor;
 }
 
 void
 nsROCSSPrimitiveValue::SetNumber(float aValue)
 {
     Reset();
     mValue.mFloat = aValue;
--- a/layout/style/nsROCSSPrimitiveValue.h
+++ b/layout/style/nsROCSSPrimitiveValue.h
@@ -50,17 +50,17 @@ public:
   void SetFloatValue(uint16_t aUnitType, float aValue,
                      mozilla::ErrorResult& aRv);
   float GetFloatValue(uint16_t aUnitType, mozilla::ErrorResult& aRv);
   void GetStringValue(nsString& aString, mozilla::ErrorResult& aRv);
   void SetStringValue(uint16_t aUnitType, const nsAString& aString,
                       mozilla::ErrorResult& aRv);
   already_AddRefed<nsIDOMCounter> GetCounterValue(mozilla::ErrorResult& aRv);
   already_AddRefed<nsIDOMRect> GetRectValue(mozilla::ErrorResult& aRv);
-  already_AddRefed<nsIDOMRGBColor> GetRGBColorValue(mozilla::ErrorResult& aRv);
+  nsDOMCSSRGBColor *GetRGBColorValue(mozilla::ErrorResult& aRv);
 
   // nsROCSSPrimitiveValue
   nsROCSSPrimitiveValue();
   ~nsROCSSPrimitiveValue();
 
   void SetNumber(float aValue);
   void SetNumber(int32_t aValue);
   void SetNumber(uint32_t aValue);