counter-reset defaults to 0, not 1.

This commit is contained in:
Simon Sapin 2015-11-04 00:04:51 +01:00
parent 75bc88b3d4
commit 80dbd29528
6 changed files with 10 additions and 17 deletions

View file

@ -1305,6 +1305,10 @@ pub mod longhands {
}
pub fn parse(_: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue,()> {
parse_common(1, input)
}
pub fn parse_common(default_value: i32, input: &mut Parser) -> Result<SpecifiedValue,()> {
if input.try(|input| input.expect_ident_matching("none")).is_ok() {
return Ok(SpecifiedValue(Vec::new()))
}
@ -1320,7 +1324,7 @@ pub mod longhands {
return Err(())
}
let counter_delta =
input.try(|input| specified::parse_integer(input)).unwrap_or(1);
input.try(|input| specified::parse_integer(input)).unwrap_or(default_value);
counters.push((counter_name, counter_delta))
}
@ -1334,7 +1338,11 @@ pub mod longhands {
<%self:longhand name="counter-reset">
pub use super::counter_increment::{SpecifiedValue, computed_value, get_initial_value};
pub use super::counter_increment::{parse};
use super::counter_increment::{parse_common};
pub fn parse(_: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue,()> {
parse_common(0, input)
}
</%self:longhand>
// CSS 2.1, Section 13 - Paged media

View file

@ -1,3 +0,0 @@
[counters-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[counters-004.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[counters-006.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[counters-008.htm]
type: reftest
expected: FAIL

View file

@ -9,9 +9,6 @@
[subtest #22 with `--a: var(--b,orange)var(--c); --c:red;`]
expected: FAIL
[subtest #23 with `counter-reset: var(--a)red; --a:orange;`]
expected: FAIL
[subtest #24 with `--a: var(--b)var(--c); --c:[c\]; --b:('ab`]
expected: FAIL