mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-26 13:58:49 +00:00
[DOM] Pass error up the chain in SetColorValue.
This commit is contained in:
@@ -1598,12 +1598,12 @@ nsAttrValue::ParsePositiveIntValue(const nsAString& aString)
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
nsAttrValue::SetColorValue(nscolor aColor, const nsAString& aString)
|
||||
{
|
||||
nsStringBuffer* buf = GetStringBuffer(aString).take();
|
||||
if (!buf) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
MiscContainer* cont = EnsureEmptyMiscContainer();
|
||||
@@ -1612,6 +1612,7 @@ nsAttrValue::SetColorValue(nscolor aColor, const nsAString& aString)
|
||||
|
||||
// Save the literal string we were passed for round-tripping.
|
||||
cont->mStringBits = reinterpret_cast<uintptr_t>(buf) | eStringBase;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -1635,13 +1636,11 @@ nsAttrValue::ParseColor(const nsAString& aString)
|
||||
if (colorStr.First() == '#') {
|
||||
nsDependentString withoutHash(colorStr.get() + 1, colorStr.Length() - 1);
|
||||
if (NS_HexToRGBA(withoutHash, nsHexColorType::NoAlpha, &color)) {
|
||||
SetColorValue(color, aString);
|
||||
return true;
|
||||
return SetColorValue(color, aString);
|
||||
}
|
||||
} else {
|
||||
if (NS_ColorNameToRGB(colorStr, &color)) {
|
||||
SetColorValue(color, aString);
|
||||
return true;
|
||||
return SetColorValue(color, aString);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1652,8 +1651,7 @@ nsAttrValue::ParseColor(const nsAString& aString)
|
||||
|
||||
// Use NS_LooseHexToRGB as a fallback if nothing above worked.
|
||||
if (NS_LooseHexToRGB(colorStr, &color)) {
|
||||
SetColorValue(color, aString);
|
||||
return true;
|
||||
return SetColorValue(color, aString);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -463,7 +463,7 @@ private:
|
||||
inline void SetPtrValueAndType(void* aValue, ValueBaseType aType);
|
||||
void SetIntValueAndType(int32_t aValue, ValueType aType,
|
||||
const nsAString* aStringValue);
|
||||
void SetColorValue(nscolor aColor, const nsAString& aString);
|
||||
bool SetColorValue(nscolor aColor, const nsAString& aString);
|
||||
void SetMiscAtomOrString(const nsAString* aValue);
|
||||
void ResetMiscAtomOrString();
|
||||
void SetSVGType(ValueType aType, const void* aValue,
|
||||
|
||||
Reference in New Issue
Block a user