Bug 907547: Update nsCSSValue::BufferFromString documentation to indicate that it's infallible, and remove callers' unneeded null-checks. r=bz

This commit is contained in:
Daniel Holbert 2013-08-21 12:31:38 -07:00
parent e176529eae
commit 706bb34072
3 changed files with 2 additions and 17 deletions

View File

@ -56,11 +56,6 @@ nsCSSValue::nsCSSValue(const nsString& aValue, nsCSSUnit aUnit)
NS_ABORT_IF_FALSE(UnitHasStringValue(), "not a string value");
if (UnitHasStringValue()) {
mValue.mString = BufferFromString(aValue).get();
if (MOZ_UNLIKELY(!mValue.mString)) {
// XXXbz not much we can do here; just make sure that our promise of a
// non-null mValue.mString holds for string units.
mUnit = eCSSUnit_Null;
}
}
else {
mUnit = eCSSUnit_Null;
@ -345,11 +340,6 @@ void nsCSSValue::SetStringValue(const nsString& aValue,
NS_ABORT_IF_FALSE(UnitHasStringValue(), "not a string unit");
if (UnitHasStringValue()) {
mValue.mString = BufferFromString(aValue).get();
if (MOZ_UNLIKELY(!mValue.mString)) {
// XXXbz not much we can do here; just make sure that our promise of a
// non-null mValue.mString holds for string units.
mUnit = eCSSUnit_Null;
}
} else
mUnit = eCSSUnit_Null;
}

View File

@ -514,8 +514,8 @@ public:
// Checks if this is a function value with the specified function id.
bool EqualsFunction(nsCSSKeyword aFunctionId) const;
// Returns an already addrefed buffer. Can return null on allocation
// failure.
// Returns an already addrefed buffer. Guaranteed to return non-null.
// (Will abort on allocation failure.)
static already_AddRefed<nsStringBuffer>
BufferFromString(const nsString& aValue);

View File

@ -3402,11 +3402,6 @@ nsStyleAnimation::Value::SetUnparsedStringValue(const nsString& aString)
FreeValue();
mUnit = eUnit_UnparsedString;
mValue.mString = nsCSSValue::BufferFromString(aString).get();
if (MOZ_UNLIKELY(!mValue.mString)) {
// not much we can do here; just make sure that our promise of a
// non-null mValue.mString holds for string units.
mUnit = eUnit_Null;
}
}
void