Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2024-08-09 15:16:24 +08:00
commit fde09c8b49
2 changed files with 7 additions and 9 deletions

View file

@ -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;

View file

@ -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,