Bug 1234707: Make nsDOMCSSValueList::AppendCSSValue() take an already_AddRefed arg (instead of a raw pointer, usually with refcount of 0). r=heycam

This commit is contained in:
Daniel Holbert 2015-12-23 16:25:43 -08:00
parent 9aa387fc77
commit 7a32a0183c
4 changed files with 227 additions and 190 deletions

File diff suppressed because it is too large Load Diff

View File

@ -607,7 +607,7 @@ private:
/* Helper functions for computing the filter property style. */ /* Helper functions for computing the filter property style. */
void SetCssTextToCoord(nsAString& aCssText, const nsStyleCoord& aCoord); void SetCssTextToCoord(nsAString& aCssText, const nsStyleCoord& aCoord);
mozilla::dom::CSSValue* CreatePrimitiveValueForStyleFilter( already_AddRefed<mozilla::dom::CSSValue> CreatePrimitiveValueForStyleFilter(
const nsStyleFilter& aStyleFilter); const nsStyleFilter& aStyleFilter);
// Helper function for computing basic shape styles. // Helper function for computing basic shape styles.

View File

@ -6,6 +6,7 @@
#include "nsDOMCSSValueList.h" #include "nsDOMCSSValueList.h"
#include "mozilla/dom/CSSValueListBinding.h" #include "mozilla/dom/CSSValueListBinding.h"
#include "mozilla/Move.h"
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
using namespace mozilla; using namespace mozilla;
@ -39,9 +40,10 @@ nsDOMCSSValueList::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
} }
void void
nsDOMCSSValueList::AppendCSSValue(CSSValue* aValue) nsDOMCSSValueList::AppendCSSValue(already_AddRefed<CSSValue> aValue)
{ {
mCSSValues.AppendElement(aValue); RefPtr<CSSValue> val = aValue;
mCSSValues.AppendElement(Move(val));
} }
// nsIDOMCSSValue // nsIDOMCSSValue

View File

@ -27,7 +27,7 @@ public:
/** /**
* Adds a value to this list. * Adds a value to this list.
*/ */
void AppendCSSValue(CSSValue* aValue); void AppendCSSValue(already_AddRefed<CSSValue> aValue);
virtual void GetCssText(nsString& aText, mozilla::ErrorResult& aRv) virtual void GetCssText(nsString& aText, mozilla::ErrorResult& aRv)
override final; override final;