Bug 1363968 - Change how counter-{reset,increment} is parsed to align serialization of specified value with Servo and Blink. r?heycam
This also includes a small fix to manifest of the affected mochitest.
MozReview-Commit-ID: 1b8lba5JiHr
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -14020,24 +14020,25 @@ CSSParserImpl::ParseCounterData(nsCSSPro
return false;
}
nsCSSValuePairList *cur = value.SetPairListValue();
for (;;) {
if (!ParseCustomIdent(cur->mXValue, mToken.mIdent, kCounterDataKTable)) {
return false;
}
- if (!GetToken(true)) {
- break;
- }
- if (mToken.mType == eCSSToken_Number && mToken.mIntegerValid) {
- cur->mYValue.SetIntValue(mToken.mInteger, eCSSUnit_Integer);
- } else {
- UngetToken();
- }
+ int32_t value = aPropID == eCSSProperty_counter_increment ? 1 : 0;
+ if (GetToken(true)) {
+ if (mToken.mType == eCSSToken_Number && mToken.mIntegerValid) {
+ value = mToken.mInteger;
+ } else {
+ UngetToken();
+ }
+ }
+ cur->mYValue.SetIntValue(value, eCSSUnit_Integer);
if (!GetToken(true)) {
break;
}
if (mToken.mType != eCSSToken_Ident) {
UngetToken();
break;
}
cur->mNext = new nsCSSValuePairList;
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -8967,24 +8967,19 @@ nsRuleNode::ComputeContentData(void* aSt
counterIncrementValue->GetPairListValue();
MOZ_ASSERT(ourIncrement->mXValue.GetUnit() == eCSSUnit_Ident,
"unexpected value unit");
count = ListLength(ourIncrement);
content->AllocateCounterIncrements(count);
count = 0;
for (const nsCSSValuePairList* p = ourIncrement; p; p = p->mNext, count++) {
- int32_t increment;
- if (p->mYValue.GetUnit() == eCSSUnit_Integer) {
- increment = p->mYValue.GetIntValue();
- } else {
- increment = 1;
- }
+ MOZ_ASSERT(p->mYValue.GetUnit() == eCSSUnit_Integer);
p->mXValue.GetStringValue(buffer);
- content->SetCounterIncrementAt(count, buffer, increment);
+ content->SetCounterIncrementAt(count, buffer, p->mYValue.GetIntValue());
}
break;
}
default:
MOZ_ASSERT(false, "unexpected value unit");
}
@@ -9015,24 +9010,19 @@ nsRuleNode::ComputeContentData(void* aSt
const nsCSSValuePairList* ourReset =
counterResetValue->GetPairListValue();
MOZ_ASSERT(ourReset->mXValue.GetUnit() == eCSSUnit_Ident,
"unexpected value unit");
count = ListLength(ourReset);
content->AllocateCounterResets(count);
count = 0;
for (const nsCSSValuePairList* p = ourReset; p; p = p->mNext, count++) {
- int32_t reset;
- if (p->mYValue.GetUnit() == eCSSUnit_Integer) {
- reset = p->mYValue.GetIntValue();
- } else {
- reset = 0;
- }
+ MOZ_ASSERT(p->mYValue.GetUnit() == eCSSUnit_Integer);
p->mXValue.GetStringValue(buffer);
- content->SetCounterResetAt(count, buffer, reset);
+ content->SetCounterResetAt(count, buffer, p->mYValue.GetIntValue());
}
break;
}
default:
MOZ_ASSERT(false, "unexpected value unit");
}
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -140,18 +140,18 @@ support-files = file_bug645998-1.css fil
[test_bug732209.html]
support-files = bug732209-css.sjs
[test_bug765590.html]
[test_bug771043.html]
[test_bug795520.html]
[test_bug798567.html]
[test_bug798843_pref.html]
[test_bug829816.html]
+support-files = file_bug829816.css
[test_bug874919.html]
-support-files = file_bug829816.css
[test_bug887741_at-rules_in_declaration_lists.html]
[test_bug892929.html]
[test_bug1055933.html]
support-files = file_bug1055933_circle-xxl.png
[test_bug1089417.html]
support-files = file_bug1089417_iframe.html
[test_bug1112014.html]
[test_bug1203766.html]
--- a/layout/style/test/stylo-failures.md
+++ b/layout/style/test/stylo-failures.md
@@ -49,17 +49,16 @@ to mochitest command.
* test_bug413958.html `monitorConsole` [3]
* test_parser_diagnostics_unprintables.html [550]
* Transition support:
* test_transitions.html: pseudo elements [4]
* test_transitions_and_reframes.html `pseudo-element`: bug 1366422 [4]
* Events:
* test_animations_event_order.html [2]
* test_computed_style.html `gradient`: -webkit-prefixed gradient values [13]
-* test_bug829816.html: counter-{reset,increment} serialization difference bug 1363968 [8]
* dynamic change on \@counter-style rule bug 1363590
* test_counter_style.html asserts [11]
* test_counter_descriptor_storage.html asserts [110]
* symbols() function and string value on list-style-type bug 1363596
* test_value_storage.html `symbols(` [30]
* ... `list-style-type` [8]
* ... `'list-style'` [18]
* Unimplemented \@font-face descriptors:
--- a/layout/style/test/test_bug829816.html
+++ b/layout/style/test/test_bug829816.html
@@ -24,27 +24,27 @@ https://bugzilla.mozilla.org/show_bug.cg
<script type="application/javascript">
/** Test for Bug 829816 **/
var ss = document.styleSheets[1];
for (var i = 0; i < 6; i++) {
is(ss.cssRules[i].style.content, "\"\uFFFD\"",
"\\0 in strings should be converted to U+FFFD");
- is(ss.cssRules[i].style.counterReset, "\uFFFD",
+ is(ss.cssRules[i].style.counterReset, "\uFFFD 0",
"\\0 in identifiers should be converted to U+FFFD");
}
is(document.styleSheets[2].cssRules[0].style.content, "\"\uFFFD\"",
"U+0000 in strings should be converted to U+FFFD");
- is(document.styleSheets[2].cssRules[0].style.counterReset, "\uFFFD",
+ is(document.styleSheets[2].cssRules[0].style.counterReset, "\uFFFD 0",
"U+0000 in identifiers should be converted to U+FFFD");
is(document.styleSheets[2].cssRules[1].style.content, "\"\uFFFD\"",
"U+0000 in strings should be converted to U+FFFD");
- is(document.styleSheets[2].cssRules[1].style.counterReset, "\uFFFD",
+ is(document.styleSheets[2].cssRules[1].style.counterReset, "\uFFFD 0",
"U+0000 in identifiers should be converted to U+FFFD");
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=829816">Mozilla Bug 829816</a>
<p id="display"></p>