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

--HG--
extra : rebase_source : e435160f2e20b8cd4954ae5536c800dcddde33d4
This commit is contained in:
Xidorn Quan 2017-05-23 13:28:47 +10:00
Родитель 9738486c01
Коммит 399614af08
5 изменённых файлов: 16 добавлений и 26 удалений

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

@ -14025,14 +14025,15 @@ CSSParserImpl::ParseCounterData(nsCSSPropertyID aPropID)
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;
}

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

@ -8965,14 +8965,9 @@ nsRuleNode::ComputeContentData(void* aStartStruct,
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;
}
@ -9013,14 +9008,9 @@ nsRuleNode::ComputeContentData(void* aStartStruct,
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;
}

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

@ -145,8 +145,8 @@ support-files = bug732209-css.sjs
[test_bug798567.html]
[test_bug798843_pref.html]
[test_bug829816.html]
[test_bug874919.html]
support-files = file_bug829816.css
[test_bug874919.html]
[test_bug887741_at-rules_in_declaration_lists.html]
[test_bug892929.html]
[test_bug1055933.html]

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

@ -54,7 +54,6 @@ to mochitest command.
* 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]

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

@ -29,17 +29,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=829816
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");