mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-22 23:27:30 +09:00
[DOM] Pass error up the chain in SetColorValue.
This commit is contained in:
parent
a023a81fef
commit
314ba652f4
2 changed files with 7 additions and 9 deletions
|
|
@ -1598,12 +1598,12 @@ nsAttrValue::ParsePositiveIntValue(const nsAString& aString)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
nsAttrValue::SetColorValue(nscolor aColor, const nsAString& aString)
|
nsAttrValue::SetColorValue(nscolor aColor, const nsAString& aString)
|
||||||
{
|
{
|
||||||
nsStringBuffer* buf = GetStringBuffer(aString).take();
|
nsStringBuffer* buf = GetStringBuffer(aString).take();
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MiscContainer* cont = EnsureEmptyMiscContainer();
|
MiscContainer* cont = EnsureEmptyMiscContainer();
|
||||||
|
|
@ -1612,6 +1612,7 @@ nsAttrValue::SetColorValue(nscolor aColor, const nsAString& aString)
|
||||||
|
|
||||||
// Save the literal string we were passed for round-tripping.
|
// Save the literal string we were passed for round-tripping.
|
||||||
cont->mStringBits = reinterpret_cast<uintptr_t>(buf) | eStringBase;
|
cont->mStringBits = reinterpret_cast<uintptr_t>(buf) | eStringBase;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
@ -1635,13 +1636,11 @@ nsAttrValue::ParseColor(const nsAString& aString)
|
||||||
if (colorStr.First() == '#') {
|
if (colorStr.First() == '#') {
|
||||||
nsDependentString withoutHash(colorStr.get() + 1, colorStr.Length() - 1);
|
nsDependentString withoutHash(colorStr.get() + 1, colorStr.Length() - 1);
|
||||||
if (NS_HexToRGBA(withoutHash, nsHexColorType::NoAlpha, &color)) {
|
if (NS_HexToRGBA(withoutHash, nsHexColorType::NoAlpha, &color)) {
|
||||||
SetColorValue(color, aString);
|
return SetColorValue(color, aString);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (NS_ColorNameToRGB(colorStr, &color)) {
|
if (NS_ColorNameToRGB(colorStr, &color)) {
|
||||||
SetColorValue(color, aString);
|
return SetColorValue(color, aString);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1652,8 +1651,7 @@ nsAttrValue::ParseColor(const nsAString& aString)
|
||||||
|
|
||||||
// Use NS_LooseHexToRGB as a fallback if nothing above worked.
|
// Use NS_LooseHexToRGB as a fallback if nothing above worked.
|
||||||
if (NS_LooseHexToRGB(colorStr, &color)) {
|
if (NS_LooseHexToRGB(colorStr, &color)) {
|
||||||
SetColorValue(color, aString);
|
return SetColorValue(color, aString);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -463,7 +463,7 @@ private:
|
||||||
inline void SetPtrValueAndType(void* aValue, ValueBaseType aType);
|
inline void SetPtrValueAndType(void* aValue, ValueBaseType aType);
|
||||||
void SetIntValueAndType(int32_t aValue, ValueType aType,
|
void SetIntValueAndType(int32_t aValue, ValueType aType,
|
||||||
const nsAString* aStringValue);
|
const nsAString* aStringValue);
|
||||||
void SetColorValue(nscolor aColor, const nsAString& aString);
|
bool SetColorValue(nscolor aColor, const nsAString& aString);
|
||||||
void SetMiscAtomOrString(const nsAString* aValue);
|
void SetMiscAtomOrString(const nsAString* aValue);
|
||||||
void ResetMiscAtomOrString();
|
void ResetMiscAtomOrString();
|
||||||
void SetSVGType(ValueType aType, const void* aValue,
|
void SetSVGType(ValueType aType, const void* aValue,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue