Fix serialization of inherit/initial nsCSSRect values. Bug 225841, r+sr=dbaron

This commit is contained in:
bzbarsky%mit.edu 2003-11-16 02:06:38 +00:00
Родитель 74b98017ac
Коммит 5d2f30714a
2 изменённых файлов: 42 добавлений и 20 удалений

Просмотреть файл

@ -194,16 +194,27 @@ PRBool nsCSSDeclaration::AppendValueToString(nsCSSProperty aProperty, nsAString&
} break; } break;
case eCSSType_Rect: { case eCSSType_Rect: {
const nsCSSRect *rect = NS_STATIC_CAST(const nsCSSRect*, storage); const nsCSSRect *rect = NS_STATIC_CAST(const nsCSSRect*, storage);
aResult.Append(NS_LITERAL_STRING("rect(")); if (rect->mTop.GetUnit() == eCSSUnit_Inherit ||
AppendCSSValueToString(aProperty, rect->mTop, aResult); rect->mTop.GetUnit() == eCSSUnit_Initial) {
NS_NAMED_LITERAL_STRING(comma, ", "); NS_ASSERTION(rect->mRight.GetUnit() == rect->mTop.GetUnit(),
aResult.Append(comma); "Top inherit or initial, right isn't. Fix the parser!");
AppendCSSValueToString(aProperty, rect->mRight, aResult); NS_ASSERTION(rect->mBottom.GetUnit() == rect->mTop.GetUnit(),
aResult.Append(comma); "Top inherit or initial, bottom isn't. Fix the parser!");
AppendCSSValueToString(aProperty, rect->mBottom, aResult); NS_ASSERTION(rect->mLeft.GetUnit() == rect->mTop.GetUnit(),
aResult.Append(comma); "Top inherit or initial, left isn't. Fix the parser!");
AppendCSSValueToString(aProperty, rect->mLeft, aResult); AppendCSSValueToString(aProperty, rect->mTop, aResult);
aResult.Append(PRUnichar(')')); } else {
aResult.Append(NS_LITERAL_STRING("rect("));
AppendCSSValueToString(aProperty, rect->mTop, aResult);
NS_NAMED_LITERAL_STRING(comma, ", ");
aResult.Append(comma);
AppendCSSValueToString(aProperty, rect->mRight, aResult);
aResult.Append(comma);
AppendCSSValueToString(aProperty, rect->mBottom, aResult);
aResult.Append(comma);
AppendCSSValueToString(aProperty, rect->mLeft, aResult);
aResult.Append(PRUnichar(')'));
}
} break; } break;
case eCSSType_ValueList: { case eCSSType_ValueList: {
const nsCSSValueList* val = const nsCSSValueList* val =

Просмотреть файл

@ -194,16 +194,27 @@ PRBool nsCSSDeclaration::AppendValueToString(nsCSSProperty aProperty, nsAString&
} break; } break;
case eCSSType_Rect: { case eCSSType_Rect: {
const nsCSSRect *rect = NS_STATIC_CAST(const nsCSSRect*, storage); const nsCSSRect *rect = NS_STATIC_CAST(const nsCSSRect*, storage);
aResult.Append(NS_LITERAL_STRING("rect(")); if (rect->mTop.GetUnit() == eCSSUnit_Inherit ||
AppendCSSValueToString(aProperty, rect->mTop, aResult); rect->mTop.GetUnit() == eCSSUnit_Initial) {
NS_NAMED_LITERAL_STRING(comma, ", "); NS_ASSERTION(rect->mRight.GetUnit() == rect->mTop.GetUnit(),
aResult.Append(comma); "Top inherit or initial, right isn't. Fix the parser!");
AppendCSSValueToString(aProperty, rect->mRight, aResult); NS_ASSERTION(rect->mBottom.GetUnit() == rect->mTop.GetUnit(),
aResult.Append(comma); "Top inherit or initial, bottom isn't. Fix the parser!");
AppendCSSValueToString(aProperty, rect->mBottom, aResult); NS_ASSERTION(rect->mLeft.GetUnit() == rect->mTop.GetUnit(),
aResult.Append(comma); "Top inherit or initial, left isn't. Fix the parser!");
AppendCSSValueToString(aProperty, rect->mLeft, aResult); AppendCSSValueToString(aProperty, rect->mTop, aResult);
aResult.Append(PRUnichar(')')); } else {
aResult.Append(NS_LITERAL_STRING("rect("));
AppendCSSValueToString(aProperty, rect->mTop, aResult);
NS_NAMED_LITERAL_STRING(comma, ", ");
aResult.Append(comma);
AppendCSSValueToString(aProperty, rect->mRight, aResult);
aResult.Append(comma);
AppendCSSValueToString(aProperty, rect->mBottom, aResult);
aResult.Append(comma);
AppendCSSValueToString(aProperty, rect->mLeft, aResult);
aResult.Append(PRUnichar(')'));
}
} break; } break;
case eCSSType_ValueList: { case eCSSType_ValueList: {
const nsCSSValueList* val = const nsCSSValueList* val =