Fix serialization of the list-style-type part of counter values. (Bug 481591) r+sr=bzbarsky

This commit is contained in:
L. David Baron 2009-03-06 13:05:01 +09:00
parent 7d5c8d1dac
commit 83643d3790
3 changed files with 18 additions and 8 deletions

View File

@ -106,7 +106,13 @@ nsCounterUseNode::GetText(nsString& aResult)
for (nsCounterNode *n = mScopeStart; n->mScopePrev; n = n->mScopeStart)
stack.AppendElement(n->mScopePrev);
PRInt32 style = mCounterStyle->Item(mAllCounters ? 2 : 1).GetIntValue();
const nsCSSValue& styleItem = mCounterStyle->Item(mAllCounters ? 2 : 1);
PRInt32 style;
if (styleItem.GetUnit() == eCSSUnit_None) {
style = NS_STYLE_LIST_STYLE_NONE;
} else {
style = styleItem.GetIntValue();
}
const PRUnichar* separator;
if (mAllCounters)
separator = mCounterStyle->Item(1).GetStringBufferValue();

View File

@ -4548,7 +4548,11 @@ CSSParserImpl::ParseCounter(nsCSSValue& aValue)
}
}
PRInt32 typeItem = eCSSUnit_Counters == unit ? 2 : 1;
val->Item(typeItem).SetIntValue(type, eCSSUnit_Enumerated);
if (type == NS_STYLE_LIST_STYLE_NONE) {
val->Item(typeItem).SetNoneValue();
} else {
val->Item(typeItem).SetIntValue(type, eCSSUnit_Enumerated);
}
if (!ExpectSymbol(')', PR_TRUE)) {
SkipUntil(')');

View File

@ -751,12 +751,12 @@ nsComputedDOMStyle::GetContent(nsIDOMCSSValue** aValue)
nsStyleUtil::AppendEscapedCSSString(
nsDependentString(a->Item(1).GetStringBufferValue()), str);
}
PRInt32 type = a->Item(typeItem).GetIntValue();
if (type != NS_STYLE_LIST_STYLE_DECIMAL) {
str.AppendLiteral(", ");
if (type == NS_STYLE_LIST_STYLE_NONE) {
str.AppendLiteral("none");
} else {
if (a->Item(typeItem).GetUnit() == eCSSUnit_None) {
str.AppendLiteral(", none");
} else {
PRInt32 type = a->Item(typeItem).GetIntValue();
if (type != NS_STYLE_LIST_STYLE_DECIMAL) {
str.AppendLiteral(", ");
AppendASCIItoUTF16(
nsCSSProps::ValueToKeyword(type, nsCSSProps::kListStyleKTable),
str);