mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-26 17:17:31 +09:00
Issue #2045 - Part 2: Add handling and storage for the revert unit and value
This commit is contained in:
parent
dd2cf17d30
commit
7f3f90eed4
2 changed files with 55 additions and 7 deletions
|
|
@ -166,6 +166,9 @@ nsCSSValue::nsCSSValue(const nsCSSValue& aCopy)
|
||||||
mValue.mComplexColor = aCopy.mValue.mComplexColor;
|
mValue.mComplexColor = aCopy.mValue.mComplexColor;
|
||||||
mValue.mComplexColor->AddRef();
|
mValue.mComplexColor->AddRef();
|
||||||
}
|
}
|
||||||
|
else if (eCSSUnit_Revert == mUnit) {
|
||||||
|
mValue.mCascadeOrigin = aCopy.mValue.mCascadeOrigin;
|
||||||
|
}
|
||||||
else if (UnitHasArrayValue()) {
|
else if (UnitHasArrayValue()) {
|
||||||
mValue.mArray = aCopy.mValue.mArray;
|
mValue.mArray = aCopy.mValue.mArray;
|
||||||
mValue.mArray->AddRef();
|
mValue.mArray->AddRef();
|
||||||
|
|
@ -279,6 +282,9 @@ bool nsCSSValue::operator==(const nsCSSValue& aOther) const
|
||||||
else if (eCSSUnit_ComplexColor == mUnit) {
|
else if (eCSSUnit_ComplexColor == mUnit) {
|
||||||
return *mValue.mComplexColor == *aOther.mValue.mComplexColor;
|
return *mValue.mComplexColor == *aOther.mValue.mComplexColor;
|
||||||
}
|
}
|
||||||
|
else if (eCSSUnit_Revert == mUnit) {
|
||||||
|
return mValue.mCascadeOrigin == aOther.mValue.mCascadeOrigin;
|
||||||
|
}
|
||||||
else if (UnitHasArrayValue()) {
|
else if (UnitHasArrayValue()) {
|
||||||
return *mValue.mArray == *aOther.mValue.mArray;
|
return *mValue.mArray == *aOther.mValue.mArray;
|
||||||
}
|
}
|
||||||
|
|
@ -539,6 +545,15 @@ nsCSSValue::SetComplexColorValue(already_AddRefed<ComplexColorValue> aValue)
|
||||||
mValue.mComplexColor = aValue.take();
|
mValue.mComplexColor = aValue.take();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsCSSValue::SetCascadeOriginValue(mozilla::SheetType aValue, nsCSSUnit aUnit)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(aUnit == eCSSUnit_Revert, "bad unit");
|
||||||
|
Reset();
|
||||||
|
mUnit = aUnit;
|
||||||
|
mValue.mCascadeOrigin = aValue;
|
||||||
|
}
|
||||||
|
|
||||||
void nsCSSValue::SetArrayValue(nsCSSValue::Array* aValue, nsCSSUnit aUnit)
|
void nsCSSValue::SetArrayValue(nsCSSValue::Array* aValue, nsCSSUnit aUnit)
|
||||||
{
|
{
|
||||||
Reset();
|
Reset();
|
||||||
|
|
@ -598,7 +613,7 @@ void nsCSSValue::SetFontFamilyListValue(css::FontFamilyListRefCnt* aValue)
|
||||||
|
|
||||||
void nsCSSValue::SetPairValue(const nsCSSValuePair* aValue)
|
void nsCSSValue::SetPairValue(const nsCSSValuePair* aValue)
|
||||||
{
|
{
|
||||||
// pairs should not be used for null/inherit/initial values
|
// pairs should not be used for null/inherit/initial/unset/revert values
|
||||||
MOZ_ASSERT(aValue &&
|
MOZ_ASSERT(aValue &&
|
||||||
aValue->mXValue.GetUnit() != eCSSUnit_Null &&
|
aValue->mXValue.GetUnit() != eCSSUnit_Null &&
|
||||||
aValue->mYValue.GetUnit() != eCSSUnit_Null &&
|
aValue->mYValue.GetUnit() != eCSSUnit_Null &&
|
||||||
|
|
@ -607,7 +622,9 @@ void nsCSSValue::SetPairValue(const nsCSSValuePair* aValue)
|
||||||
aValue->mXValue.GetUnit() != eCSSUnit_Initial &&
|
aValue->mXValue.GetUnit() != eCSSUnit_Initial &&
|
||||||
aValue->mYValue.GetUnit() != eCSSUnit_Initial &&
|
aValue->mYValue.GetUnit() != eCSSUnit_Initial &&
|
||||||
aValue->mXValue.GetUnit() != eCSSUnit_Unset &&
|
aValue->mXValue.GetUnit() != eCSSUnit_Unset &&
|
||||||
aValue->mYValue.GetUnit() != eCSSUnit_Unset,
|
aValue->mYValue.GetUnit() != eCSSUnit_Unset &&
|
||||||
|
aValue->mXValue.GetUnit() != eCSSUnit_Revert &&
|
||||||
|
aValue->mYValue.GetUnit() != eCSSUnit_Revert,
|
||||||
"missing or inappropriate pair value");
|
"missing or inappropriate pair value");
|
||||||
Reset();
|
Reset();
|
||||||
mUnit = eCSSUnit_Pair;
|
mUnit = eCSSUnit_Pair;
|
||||||
|
|
@ -625,7 +642,9 @@ void nsCSSValue::SetPairValue(const nsCSSValue& xValue,
|
||||||
xValue.GetUnit() != eCSSUnit_Initial &&
|
xValue.GetUnit() != eCSSUnit_Initial &&
|
||||||
yValue.GetUnit() != eCSSUnit_Initial &&
|
yValue.GetUnit() != eCSSUnit_Initial &&
|
||||||
xValue.GetUnit() != eCSSUnit_Unset &&
|
xValue.GetUnit() != eCSSUnit_Unset &&
|
||||||
yValue.GetUnit() != eCSSUnit_Unset,
|
yValue.GetUnit() != eCSSUnit_Unset &&
|
||||||
|
xValue.GetUnit() != eCSSUnit_Revert &&
|
||||||
|
yValue.GetUnit() != eCSSUnit_Revert,
|
||||||
"inappropriate pair value");
|
"inappropriate pair value");
|
||||||
Reset();
|
Reset();
|
||||||
mUnit = eCSSUnit_Pair;
|
mUnit = eCSSUnit_Pair;
|
||||||
|
|
@ -635,7 +654,7 @@ void nsCSSValue::SetPairValue(const nsCSSValue& xValue,
|
||||||
|
|
||||||
void nsCSSValue::SetTripletValue(const nsCSSValueTriplet* aValue)
|
void nsCSSValue::SetTripletValue(const nsCSSValueTriplet* aValue)
|
||||||
{
|
{
|
||||||
// triplet should not be used for null/inherit/initial values
|
// triplet should not be used for null/inherit/initial/unset/revert values
|
||||||
MOZ_ASSERT(aValue &&
|
MOZ_ASSERT(aValue &&
|
||||||
aValue->mXValue.GetUnit() != eCSSUnit_Null &&
|
aValue->mXValue.GetUnit() != eCSSUnit_Null &&
|
||||||
aValue->mYValue.GetUnit() != eCSSUnit_Null &&
|
aValue->mYValue.GetUnit() != eCSSUnit_Null &&
|
||||||
|
|
@ -648,7 +667,10 @@ void nsCSSValue::SetTripletValue(const nsCSSValueTriplet* aValue)
|
||||||
aValue->mZValue.GetUnit() != eCSSUnit_Initial &&
|
aValue->mZValue.GetUnit() != eCSSUnit_Initial &&
|
||||||
aValue->mXValue.GetUnit() != eCSSUnit_Unset &&
|
aValue->mXValue.GetUnit() != eCSSUnit_Unset &&
|
||||||
aValue->mYValue.GetUnit() != eCSSUnit_Unset &&
|
aValue->mYValue.GetUnit() != eCSSUnit_Unset &&
|
||||||
aValue->mZValue.GetUnit() != eCSSUnit_Unset,
|
aValue->mZValue.GetUnit() != eCSSUnit_Unset &&
|
||||||
|
aValue->mXValue.GetUnit() != eCSSUnit_Revert &&
|
||||||
|
aValue->mYValue.GetUnit() != eCSSUnit_Revert &&
|
||||||
|
aValue->mZValue.GetUnit() != eCSSUnit_Revert,
|
||||||
"missing or inappropriate triplet value");
|
"missing or inappropriate triplet value");
|
||||||
Reset();
|
Reset();
|
||||||
mUnit = eCSSUnit_Triplet;
|
mUnit = eCSSUnit_Triplet;
|
||||||
|
|
@ -671,7 +693,10 @@ void nsCSSValue::SetTripletValue(const nsCSSValue& xValue,
|
||||||
zValue.GetUnit() != eCSSUnit_Initial &&
|
zValue.GetUnit() != eCSSUnit_Initial &&
|
||||||
xValue.GetUnit() != eCSSUnit_Unset &&
|
xValue.GetUnit() != eCSSUnit_Unset &&
|
||||||
yValue.GetUnit() != eCSSUnit_Unset &&
|
yValue.GetUnit() != eCSSUnit_Unset &&
|
||||||
zValue.GetUnit() != eCSSUnit_Unset,
|
zValue.GetUnit() != eCSSUnit_Unset &&
|
||||||
|
xValue.GetUnit() != eCSSUnit_Revert &&
|
||||||
|
yValue.GetUnit() != eCSSUnit_Revert &&
|
||||||
|
zValue.GetUnit() != eCSSUnit_Revert,
|
||||||
"inappropriate triplet value");
|
"inappropriate triplet value");
|
||||||
Reset();
|
Reset();
|
||||||
mUnit = eCSSUnit_Triplet;
|
mUnit = eCSSUnit_Triplet;
|
||||||
|
|
@ -781,6 +806,12 @@ void nsCSSValue::SetUnsetValue()
|
||||||
mUnit = eCSSUnit_Unset;
|
mUnit = eCSSUnit_Unset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsCSSValue::SetRevertValue(mozilla::SheetType aValue)
|
||||||
|
{
|
||||||
|
SetCascadeOriginValue(aValue, eCSSUnit_Revert);
|
||||||
|
}
|
||||||
|
|
||||||
void nsCSSValue::SetNoneValue()
|
void nsCSSValue::SetNoneValue()
|
||||||
{
|
{
|
||||||
Reset();
|
Reset();
|
||||||
|
|
@ -1930,6 +1961,7 @@ nsCSSValue::AppendToString(nsCSSPropertyID aProperty, nsAString& aResult,
|
||||||
case eCSSUnit_Inherit: aResult.AppendLiteral("inherit"); break;
|
case eCSSUnit_Inherit: aResult.AppendLiteral("inherit"); break;
|
||||||
case eCSSUnit_Initial: aResult.AppendLiteral("initial"); break;
|
case eCSSUnit_Initial: aResult.AppendLiteral("initial"); break;
|
||||||
case eCSSUnit_Unset: aResult.AppendLiteral("unset"); break;
|
case eCSSUnit_Unset: aResult.AppendLiteral("unset"); break;
|
||||||
|
case eCSSUnit_Revert: aResult.AppendLiteral("revert"); break;
|
||||||
case eCSSUnit_None: aResult.AppendLiteral("none"); break;
|
case eCSSUnit_None: aResult.AppendLiteral("none"); break;
|
||||||
case eCSSUnit_Normal: aResult.AppendLiteral("normal"); break;
|
case eCSSUnit_Normal: aResult.AppendLiteral("normal"); break;
|
||||||
case eCSSUnit_System_Font: aResult.AppendLiteral("-moz-use-system-font"); break;
|
case eCSSUnit_System_Font: aResult.AppendLiteral("-moz-use-system-font"); break;
|
||||||
|
|
@ -2189,6 +2221,10 @@ nsCSSValue::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||||
n += mValue.mComplexColor->SizeOfIncludingThis(aMallocSizeOf);
|
n += mValue.mComplexColor->SizeOfIncludingThis(aMallocSizeOf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Cascade Origin: nothing extra to measure.
|
||||||
|
case eCSSUnit_Revert:
|
||||||
|
break;
|
||||||
|
|
||||||
// Float: nothing extra to measure.
|
// Float: nothing extra to measure.
|
||||||
case eCSSUnit_Percent:
|
case eCSSUnit_Percent:
|
||||||
case eCSSUnit_Number:
|
case eCSSUnit_Number:
|
||||||
|
|
@ -2511,7 +2547,8 @@ nsCSSRect::AppendToString(nsCSSPropertyID aProperty, nsAString& aResult,
|
||||||
MOZ_ASSERT(mTop.GetUnit() != eCSSUnit_Null &&
|
MOZ_ASSERT(mTop.GetUnit() != eCSSUnit_Null &&
|
||||||
mTop.GetUnit() != eCSSUnit_Inherit &&
|
mTop.GetUnit() != eCSSUnit_Inherit &&
|
||||||
mTop.GetUnit() != eCSSUnit_Initial &&
|
mTop.GetUnit() != eCSSUnit_Initial &&
|
||||||
mTop.GetUnit() != eCSSUnit_Unset,
|
mTop.GetUnit() != eCSSUnit_Unset &&
|
||||||
|
mTop.GetUnit() != eCSSUnit_Revert,
|
||||||
"parser should have used a bare value");
|
"parser should have used a bare value");
|
||||||
|
|
||||||
if (eCSSProperty_border_image_slice == aProperty ||
|
if (eCSSProperty_border_image_slice == aProperty ||
|
||||||
|
|
@ -2681,6 +2718,7 @@ nsCSSValuePairList::AppendToString(nsCSSPropertyID aProperty,
|
||||||
if (item->mXValue.GetUnit() != eCSSUnit_Inherit &&
|
if (item->mXValue.GetUnit() != eCSSUnit_Inherit &&
|
||||||
item->mXValue.GetUnit() != eCSSUnit_Initial &&
|
item->mXValue.GetUnit() != eCSSUnit_Initial &&
|
||||||
item->mXValue.GetUnit() != eCSSUnit_Unset &&
|
item->mXValue.GetUnit() != eCSSUnit_Unset &&
|
||||||
|
item->mXValue.GetUnit() != eCSSUnit_Revert &&
|
||||||
item->mYValue.GetUnit() != eCSSUnit_Null) {
|
item->mYValue.GetUnit() != eCSSUnit_Null) {
|
||||||
aResult.Append(char16_t(' '));
|
aResult.Append(char16_t(' '));
|
||||||
item->mYValue.AppendToString(aProperty, aResult, aSerialization);
|
item->mYValue.AppendToString(aProperty, aResult, aSerialization);
|
||||||
|
|
|
||||||
|
|
@ -484,6 +484,7 @@ enum nsCSSUnit {
|
||||||
eCSSUnit_TokenStream = 43, // (nsCSSValueTokenStream*) value
|
eCSSUnit_TokenStream = 43, // (nsCSSValueTokenStream*) value
|
||||||
eCSSUnit_GridTemplateAreas = 44, // (GridTemplateAreasValue*)
|
eCSSUnit_GridTemplateAreas = 44, // (GridTemplateAreasValue*)
|
||||||
// for grid-template-areas
|
// for grid-template-areas
|
||||||
|
eCSSUnit_Revert = 45, // (SheetType) value is the current cascade origin
|
||||||
|
|
||||||
eCSSUnit_Pair = 50, // (nsCSSValuePair*) pair of values
|
eCSSUnit_Pair = 50, // (nsCSSValuePair*) pair of values
|
||||||
eCSSUnit_Triplet = 51, // (nsCSSValueTriplet*) triplet of values
|
eCSSUnit_Triplet = 51, // (nsCSSValueTriplet*) triplet of values
|
||||||
|
|
@ -911,6 +912,12 @@ public:
|
||||||
return mValue.mFloatColor;
|
return mValue.mFloatColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mozilla::SheetType GetCascadeOriginValue() const
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(mUnit == eCSSUnit_Revert, "not a cascade origin value");
|
||||||
|
return mValue.mCascadeOrigin;
|
||||||
|
}
|
||||||
|
|
||||||
void Reset() // sets to null
|
void Reset() // sets to null
|
||||||
{
|
{
|
||||||
if (mUnit != eCSSUnit_Null)
|
if (mUnit != eCSSUnit_Null)
|
||||||
|
|
@ -943,6 +950,7 @@ public:
|
||||||
void SetRGBAColorValue(const mozilla::css::RGBAColorData& aValue);
|
void SetRGBAColorValue(const mozilla::css::RGBAColorData& aValue);
|
||||||
void SetComplexColorValue(
|
void SetComplexColorValue(
|
||||||
already_AddRefed<mozilla::css::ComplexColorValue> aValue);
|
already_AddRefed<mozilla::css::ComplexColorValue> aValue);
|
||||||
|
void SetCascadeOriginValue(mozilla::SheetType aValue, nsCSSUnit aUnit);
|
||||||
void SetArrayValue(nsCSSValue::Array* aArray, nsCSSUnit aUnit);
|
void SetArrayValue(nsCSSValue::Array* aArray, nsCSSUnit aUnit);
|
||||||
void SetURLValue(mozilla::css::URLValue* aURI);
|
void SetURLValue(mozilla::css::URLValue* aURI);
|
||||||
void SetImageValue(mozilla::css::ImageValue* aImage);
|
void SetImageValue(mozilla::css::ImageValue* aImage);
|
||||||
|
|
@ -961,6 +969,7 @@ public:
|
||||||
void SetInheritValue();
|
void SetInheritValue();
|
||||||
void SetInitialValue();
|
void SetInitialValue();
|
||||||
void SetUnsetValue();
|
void SetUnsetValue();
|
||||||
|
void SetRevertValue(mozilla::SheetType aValue);
|
||||||
void SetNoneValue();
|
void SetNoneValue();
|
||||||
void SetAllValue();
|
void SetAllValue();
|
||||||
void SetNormalValue();
|
void SetNormalValue();
|
||||||
|
|
@ -1054,6 +1063,7 @@ protected:
|
||||||
nsCSSValueFloatColor* MOZ_OWNING_REF mFloatColor;
|
nsCSSValueFloatColor* MOZ_OWNING_REF mFloatColor;
|
||||||
mozilla::css::FontFamilyListRefCnt* MOZ_OWNING_REF mFontFamilyList;
|
mozilla::css::FontFamilyListRefCnt* MOZ_OWNING_REF mFontFamilyList;
|
||||||
mozilla::css::ComplexColorValue* MOZ_OWNING_REF mComplexColor;
|
mozilla::css::ComplexColorValue* MOZ_OWNING_REF mComplexColor;
|
||||||
|
mozilla::SheetType mCascadeOrigin;
|
||||||
} mValue;
|
} mValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue