diff --git a/layout/reftests/counters/reftest.list b/layout/reftests/counters/reftest.list index f13f3d0777949..0f3fd46ba2831 100644 --- a/layout/reftests/counters/reftest.list +++ b/layout/reftests/counters/reftest.list @@ -50,30 +50,6 @@ t1202 - counter - -01 -- -b -- -test -. -html -t1202 -- -counter -- -01 -- -b -- -reference -. -html -= -= -t1202 -- -counter -- 02 - b @@ -517,17 +493,9 @@ b test . html -t1202 -- -counters -- -01 -- -b -- -reference -. -html +about +: +blank = = t1202 diff --git a/layout/reftests/counters/t1202-counter-01-b-test.html b/layout/reftests/counters/t1202-counter-01-b-test.html deleted file mode 100644 index 47d562676256c..0000000000000 --- a/layout/reftests/counters/t1202-counter-01-b-test.html +++ /dev/null @@ -1,351 +0,0 @@ -< -! -DOCTYPE -html -PUBLIC -" -- -/ -/ -W3C -/ -/ -DTD -XHTML -1 -. -1 -/ -/ -EN -" -" -http -: -/ -/ -www -. -w3 -. -org -/ -TR -/ -xhtml11 -/ -DTD -/ -xhtml11 -. -dtd -" -> -< -html -xmlns -= -" -http -: -/ -/ -www -. -w3 -. -org -/ -1999 -/ -xhtml -" -> -< -head -> -< -title -> -CSS -2 -. -1 -Test -Suite -: -content -: -counter -( -c -none -) -< -/ -title -> -< -link -rel -= -" -help -" -href -= -" -http -: -/ -/ -www -. -w3 -. -org -/ -TR -/ -CSS21 -/ -generate -. -html -# -propdef -- -content -" -/ -> -< -link -rel -= -" -help -" -href -= -" -http -: -/ -/ -www -. -w3 -. -org -/ -TR -/ -CSS21 -/ -syndata -. -html -# -counter -" -/ -> -< -link -rel -= -" -help -" -href -= -" -http -: -/ -/ -www -. -w3 -. -org -/ -TR -/ -CSS21 -/ -generate -. -html -# -counter -- -styles -" -/ -> -< -style -type -= -" -text -/ -css -" -> -# -test -{ -counter -- -reset -: -c -; -} -# -test -span -{ -counter -- -increment -: -c -; -} -# -test -span -: -before -{ -content -: -counter -( -c -none -) -" -z -" -; -} -< -/ -style -> -< -/ -head -> -< -body -> -< -div -id -= -" -test -" -> -< -span -> -< -/ -span -> -< -span -> -< -/ -span -> -< -span -> -< -/ -span -> -< -span -> -< -/ -span -> -< -span -> -< -/ -span -> -< -span -> -< -/ -span -> -< -span -> -< -/ -span -> -< -span -> -< -/ -span -> -< -span -> -< -/ -span -> -< -span -> -< -/ -span -> -< -span -> -< -/ -span -> -< -span -> -< -/ -span -> -< -/ -div -> -< -/ -body -> -< -/ -html -> diff --git a/layout/reftests/counters/t1202-counters-01-b-reference.html b/layout/reftests/counters/t1202-counters-01-b-reference.html deleted file mode 100644 index f13339e36ae7d..0000000000000 --- a/layout/reftests/counters/t1202-counters-01-b-reference.html +++ /dev/null @@ -1,327 +0,0 @@ -< -! -DOCTYPE -html -PUBLIC -" -- -/ -/ -W3C -/ -/ -DTD -XHTML -1 -. -1 -/ -/ -EN -" -" -http -: -/ -/ -www -. -w3 -. -org -/ -TR -/ -xhtml11 -/ -DTD -/ -xhtml11 -. -dtd -" -> -< -html -xmlns -= -" -http -: -/ -/ -www -. -w3 -. -org -/ -1999 -/ -xhtml -" -> -< -head -> -< -title -> -CSS -2 -. -1 -Test -Suite -: -content -: -counters -( -c -" -. -" -none -) -< -/ -title -> -< -link -rel -= -" -help -" -href -= -" -http -: -/ -/ -www -. -w3 -. -org -/ -TR -/ -CSS21 -/ -generate -. -html -# -propdef -- -content -" -/ -> -< -link -rel -= -" -help -" -href -= -" -http -: -/ -/ -www -. -w3 -. -org -/ -TR -/ -CSS21 -/ -syndata -. -html -# -counter -" -/ -> -< -link -rel -= -" -help -" -href -= -" -http -: -/ -/ -www -. -w3 -. -org -/ -TR -/ -CSS21 -/ -generate -. -html -# -counter -- -styles -" -/ -> -< -/ -head -> -< -body -> -< -p -> -< -/ -p -> -< -div -> -< -span -> -. -z -< -/ -span -> -< -span -> -. -z -< -/ -span -> -< -span -> -. -z -< -/ -span -> -< -span -> -. -z -< -/ -span -> -< -span -> -. -z -< -/ -span -> -< -span -> -. -z -< -/ -span -> -< -span -> -. -z -< -/ -span -> -< -span -> -. -z -< -/ -span -> -< -span -> -. -z -< -/ -span -> -< -span -> -. -z -< -/ -span -> -< -span -> -. -z -< -/ -span -> -< -span -> -. -z -< -/ -span -> -< -/ -div -> -< -/ -body -> -< -/ -html -> diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index d9bd8828b3267..b8bbbf052f826 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -41524,23 +41524,6 @@ alpha ) " " -counter -( -foo -none -) -" -" -counters -( -bar -' -. -' -none -) -" -" attr ( \ @@ -41727,6 +41710,23 @@ invalid_values : [ " +counter +( +foo +none +) +" +" +counters +( +bar +' +. +' +none +) +" +" counters ( foo diff --git a/servo/components/style/gecko/values.rs b/servo/components/style/gecko/values.rs index 9a98898344e57..f9aedfd909b04 100644 --- a/servo/components/style/gecko/values.rs +++ b/servo/components/style/gecko/values.rs @@ -111,7 +111,7 @@ values generics : : -CounterStyleOrNone +CounterStyle ; use crate @@ -406,7 +406,7 @@ au_per_device_px } } impl -CounterStyleOrNone +CounterStyle { / / @@ -463,17 +463,23 @@ set_symbols match self { -CounterStyleOrNone +CounterStyle : : -None +Name +( +name +) = > unsafe { -set_name +debug_assert_ne +! ( -gecko_value +name +. +0 atom ! ( @@ -481,24 +487,8 @@ atom none " ) -. -into_addrefed -( -) ) ; -} -CounterStyleOrNone -: -: -Name -( -name -) -= -> -unsafe -{ set_name ( gecko_value @@ -512,7 +502,7 @@ into_addrefed ) ; } -CounterStyleOrNone +CounterStyle : : Symbols @@ -666,7 +656,7 @@ Convert Gecko CounterStylePtr to -CounterStyleOrNone +CounterStyle or String . @@ -753,10 +743,10 @@ name ) } ; -if +debug_assert_ne +! +( name -= -= atom ! ( @@ -764,26 +754,14 @@ atom none " ) -{ -Either -: -: -First -( -CounterStyleOrNone -: -: -None ) -} -else -{ +; Either : : First ( -CounterStyleOrNone +CounterStyle : : Name @@ -795,7 +773,6 @@ name ) ) } -} else { let @@ -916,7 +893,7 @@ Either : First ( -CounterStyleOrNone +CounterStyle : : Symbols diff --git a/servo/components/style/properties/gecko.mako.rs b/servo/components/style/properties/gecko.mako.rs index 8711db006ce84..a336b3eb9aedd 100644 --- a/servo/components/style/properties/gecko.mako.rs +++ b/servo/components/style/properties/gecko.mako.rs @@ -18086,6 +18086,18 @@ gecko_bindings bindings : : +Gecko_SetCounterStyleToName +; +use +crate +: +: +gecko_bindings +: +: +bindings +: +: Gecko_SetCounterStyleToString ; use @@ -18118,6 +18130,37 @@ v T : : +None += +> +unsafe +{ +Gecko_SetCounterStyleToName +( +& +mut +self +. +gecko +. +mCounterStyle +atom +! +( +" +none +" +) +. +into_addrefed +( +) +) +; +} +T +: +: CounterStyle ( s @@ -18280,12 +18323,82 @@ values generics : : -CounterStyleOrNone +CounterStyle +; +use +crate +: +: +gecko_bindings +: +: +bindings +; +let +name += +unsafe +{ +bindings +: +: +Gecko_CounterStyle_GetName +( +& +self +. +gecko +. +mCounterStyle +) +} +; +if +! +name +. +is_null +( +) +{ +let +name += +unsafe +{ +Atom +: +: +from_raw +( +name +) +} +; +if +name += += +atom +! +( +" +none +" +) +{ +return +T +: +: +None ; +} +} let result = -CounterStyleOrNone +CounterStyle : : from_gecko_value @@ -20893,7 +21006,7 @@ values generics : : -CounterStyleOrNone +CounterStyle ; use crate @@ -21048,7 +21161,7 @@ sep str style : -CounterStyleOrNone +CounterStyle ) { debug_assert @@ -21955,7 +22068,7 @@ values generics : : -CounterStyleOrNone +CounterStyle ; use crate @@ -22326,7 +22439,7 @@ mRawPtr let style = -CounterStyleOrNone +CounterStyle : : from_gecko_value diff --git a/servo/components/style/properties/shorthands/list.mako.rs b/servo/components/style/properties/shorthands/list.mako.rs index ba91e7ffcbfaf..4542fbe5e44d4 100644 --- a/servo/components/style/properties/shorthands/list.mako.rs +++ b/servo/components/style/properties/shorthands/list.mako.rs @@ -513,64 +513,6 @@ list_style_position position ) ; -fn -list_style_type_none -( -) -- -> -list_style_type -: -: -SpecifiedValue -{ -% -if -engine -= -= -" -gecko -" -: -use -crate -: -: -values -: -: -generics -: -: -CounterStyleOrNone -; -list_style_type -: -: -SpecifiedValue -: -: -CounterStyle -( -CounterStyleOrNone -: -: -None -) -% -else -: -list_style_type -: -: -SpecifiedValue -: -: -None -% -endif -} / / If @@ -631,6 +573,17 @@ we parsed something . +use +self +: +: +list_style_type +: +: +SpecifiedValue +as +ListStyleType +; match ( any @@ -666,9 +619,10 @@ none ) list_style_type : -list_style_type_none -( -) +ListStyleType +: +: +None } ) } @@ -697,9 +651,10 @@ list_style_image image list_style_type : -list_style_type_none -( -) +ListStyleType +: +: +None } ) } @@ -764,9 +719,10 @@ none ) list_style_type : -list_style_type_none -( -) +ListStyleType +: +: +None } ) } diff --git a/servo/components/style/values/generics/counters.rs b/servo/components/style/values/generics/counters.rs index ce4dd04eeaf18..ded8e6f6cc31b 100644 --- a/servo/components/style/values/generics/counters.rs +++ b/servo/components/style/values/generics/counters.rs @@ -114,7 +114,7 @@ values generics : : -CounterStyleOrNone +CounterStyle ; # [ @@ -729,7 +729,7 @@ gecko type CounterStyleType = -CounterStyleOrNone +CounterStyle ; # [ @@ -798,7 +798,7 @@ bool counter_type = = -CounterStyleOrNone +CounterStyle : : decimal diff --git a/servo/components/style/values/generics/mod.rs b/servo/components/style/values/generics/mod.rs index f5932a2d14422..5a0083a7f273c 100644 --- a/servo/components/style/values/generics/mod.rs +++ b/servo/components/style/values/generics/mod.rs @@ -564,37 +564,16 @@ style / / / -Since -wherever -< -counter -- -style -> -is -used +Note +that ' none ' is +not a valid -value -as -/ -/ -/ -well -we -combine -them -into -one -type -to -make -code -simpler +name . # [ @@ -627,16 +606,11 @@ ToShmem ] pub enum -CounterStyleOrNone +CounterStyle { / / / -none -None -/ -/ -/ < counter - @@ -704,7 +678,7 @@ SymbolsType Symbolic } impl -CounterStyleOrNone +CounterStyle { / / @@ -720,7 +694,7 @@ disc > Self { -CounterStyleOrNone +CounterStyle : : Name @@ -751,7 +725,7 @@ decimal > Self { -CounterStyleOrNone +CounterStyle : : Name @@ -772,7 +746,7 @@ decimal impl Parse for -CounterStyleOrNone +CounterStyle { fn parse @@ -834,7 +808,7 @@ i return Ok ( -CounterStyleOrNone +CounterStyle : : Name @@ -844,38 +818,6 @@ name ) ; } -if -input -. -try -( -| -i -| -i -. -expect_ident_matching -( -" -none -" -) -) -. -is_ok -( -) -{ -return -Ok -( -CounterStyleOrNone -: -: -None -) -; -} input . expect_function_matching @@ -1042,7 +984,7 @@ UnspecifiedError } Ok ( -CounterStyleOrNone +CounterStyle : : Symbols @@ -1058,7 +1000,7 @@ symbols impl SpecifiedValueInfo for -CounterStyleOrNone +CounterStyle { fn collect_completion_keywords @@ -1143,9 +1085,6 @@ f & [ " -none -" -" symbols " ( diff --git a/servo/components/style/values/specified/counters.rs b/servo/components/style/values/specified/counters.rs index f7befb8921515..d1173c299101b 100644 --- a/servo/components/style/values/specified/counters.rs +++ b/servo/components/style/values/specified/counters.rs @@ -186,7 +186,7 @@ values generics : : -CounterStyleOrNone +CounterStyle ; use crate @@ -822,7 +822,7 @@ Parser ) - > -CounterStyleOrNone +CounterStyle { input . @@ -839,7 +839,7 @@ expect_comma ) ? ; -CounterStyleOrNone +CounterStyle : : parse @@ -852,7 +852,7 @@ input . unwrap_or ( -CounterStyleOrNone +CounterStyle : : decimal diff --git a/servo/components/style/values/specified/list.rs b/servo/components/style/values/specified/list.rs index 6950d619e9224..bf8e74ebdbf3c 100644 --- a/servo/components/style/values/specified/list.rs +++ b/servo/components/style/values/specified/list.rs @@ -96,7 +96,7 @@ values generics : : -CounterStyleOrNone +CounterStyle ; # [ @@ -183,16 +183,19 @@ ListStyleType / / / +none +None +/ +/ +/ < counter - style > -| -none CounterStyle ( -CounterStyleOrNone +CounterStyle ) / / @@ -250,7 +253,7 @@ ListStyleType : CounterStyle ( -CounterStyleOrNone +CounterStyle : : disc @@ -345,13 +348,7 @@ return ListStyleType : : -CounterStyle -( -CounterStyleOrNone -: -: None -) ; } ListStyleType @@ -359,7 +356,7 @@ ListStyleType : CounterStyle ( -CounterStyleOrNone +CounterStyle : : Name @@ -568,7 +565,7 @@ try | i | -CounterStyleOrNone +CounterStyle : : parse @@ -591,6 +588,38 @@ style ) ; } +if +input +. +try +( +| +i +| +i +. +expect_ident_matching +( +" +none +" +) +) +. +is_ok +( +) +{ +return +Ok +( +ListStyleType +: +: +None +) +; +} Ok ( ListStyleType diff --git a/testing/web-platform/tests/css/CSS2/generated-content/content-counter-001-ref.xht b/testing/web-platform/tests/css/CSS2/generated-content/content-counter-001-ref.xht deleted file mode 100644 index fd54c5d453171..0000000000000 --- a/testing/web-platform/tests/css/CSS2/generated-content/content-counter-001-ref.xht +++ /dev/null @@ -1,195 +0,0 @@ -< -! -DOCTYPE -html -PUBLIC -" -- -/ -/ -W3C -/ -/ -DTD -XHTML -1 -. -0 -Strict -/ -/ -EN -" -" -http -: -/ -/ -www -. -w3 -. -org -/ -TR -/ -xhtml1 -/ -DTD -/ -xhtml1 -- -strict -. -dtd -" -> -< -html -xmlns -= -" -http -: -/ -/ -www -. -w3 -. -org -/ -1999 -/ -xhtml -" -> -< -head -> -< -title -> -CSS -Reftest -Reference -< -/ -title -> -< -link -rel -= -" -author -" -title -= -" -Ms2ger -" -href -= -" -mailto -: -Ms2ger -gmail -. -com -" -/ -> -< -style -type -= -" -text -/ -css -" -> -body -{ -white -- -space -: -nowrap -; -} -< -/ -style -> -< -/ -head -> -< -body -> -< -p -> -The -following -two -lines -should -look -the -same -: -< -/ -p -> -< -div -> -z -z -z -z -z -z -z -z -z -z -z -z -< -/ -div -> -< -div -> -z -z -z -z -z -z -z -z -z -z -z -z -< -/ -div -> -< -/ -body -> -< -/ -html -> diff --git a/testing/web-platform/tests/css/CSS2/generated-content/content-counter-001.xht b/testing/web-platform/tests/css/CSS2/generated-content/content-counter-001.xht index 412c94806645b..53587fafdb940 100644 --- a/testing/web-platform/tests/css/CSS2/generated-content/content-counter-001.xht +++ b/testing/web-platform/tests/css/CSS2/generated-content/content-counter-001.xht @@ -220,15 +220,9 @@ match href = " -content -- -counter -- -001 -- -ref -. -xht +about +: +blank " / > @@ -302,22 +296,6 @@ head body > < -p -> -The -following -two -lines -should -look -the -same -: -< -/ -p -> -< div id = @@ -414,25 +392,6 @@ span div > < -div -> -z -z -z -z -z -z -z -z -z -z -z -z -< -/ -div -> -< / body > diff --git a/testing/web-platform/tests/css/css-lists/parsing/content-invalid.html b/testing/web-platform/tests/css/css-lists/parsing/content-invalid.html new file mode 100644 index 0000000000000..4d44146c9a7cb --- /dev/null +++ b/testing/web-platform/tests/css/css-lists/parsing/content-invalid.html @@ -0,0 +1,563 @@ +< +! +DOCTYPE +html +> +< +html +> +< +head +> +< +meta +charset += +" +utf +- +8 +" +> +< +title +> +CSS +Lists +: +parsing +counter +( +) +/ +counters +( +) +values +for +the +' +content +' +property +< +/ +title +> +< +link +rel += +" +help +" +href += +" +https +: +/ +/ +drafts +. +csswg +. +org +/ +css +- +lists +- +3 +/ +# +counter +- +functions +" +> +< +script +src += +" +/ +resources +/ +testharness +. +js +" +> +< +/ +script +> +< +script +src += +" +/ +resources +/ +testharnessreport +. +js +" +> +< +/ +script +> +< +script +src += +" +/ +css +/ +support +/ +parsing +- +testcommon +. +js +" +> +< +/ +script +> +< +/ +head +> +< +body +> +< +script +> +test_invalid_value +( +' +content +' +' +counter +( +foo +none +) +' +) +; +test_invalid_value +( +' +content +' +' +counters +( +foo +" +" +none +) +' +) +; +test_invalid_value +( +' +content +' +' +counter +( +foo +unset +) +' +) +; +test_invalid_value +( +' +content +' +' +counters +( +foo +" +" +unset +) +' +) +; +test_invalid_value +( +' +content +' +' +counter +( +foo +initial +) +' +) +; +test_invalid_value +( +' +content +' +' +counters +( +foo +" +" +initial +) +' +) +; +test_invalid_value +( +' +content +' +' +counter +( +foo +inherit +) +' +) +; +test_invalid_value +( +' +content +' +' +counters +( +foo +" +" +inherit +) +' +) +; +test_invalid_value +( +' +content +' +' +" +z +" +counter +( +foo +none +) +' +) +; +test_invalid_value +( +' +content +' +' +" +z +" +counters +( +foo +" +" +none +) +' +) +; +test_invalid_value +( +' +content +' +' +" +z +" +counter +( +foo +unset +) +' +) +; +test_invalid_value +( +' +content +' +' +" +z +" +counters +( +foo +" +" +unset +) +' +) +; +test_invalid_value +( +' +content +' +' +" +z +" +counter +( +foo +initial +) +' +) +; +test_invalid_value +( +' +content +' +' +" +z +" +counters +( +foo +" +" +initial +) +' +) +; +test_invalid_value +( +' +content +' +' +" +z +" +counter +( +foo +inherit +) +' +) +; +test_invalid_value +( +' +content +' +' +" +z +" +counters +( +foo +" +" +inherit +) +' +) +; +test_invalid_value +( +' +content +' +' +counter +( +foo +none +) +" +z +" +' +) +; +test_invalid_value +( +' +content +' +' +counters +( +foo +" +" +none +) +" +z +" +' +) +; +test_invalid_value +( +' +content +' +' +counter +( +foo +unset +) +" +z +" +' +) +; +test_invalid_value +( +' +content +' +' +counters +( +foo +" +" +unset +) +" +z +" +' +) +; +test_invalid_value +( +' +content +' +' +counter +( +foo +initial +) +" +z +" +' +) +; +test_invalid_value +( +' +content +' +' +counters +( +foo +" +" +initial +) +" +z +" +' +) +; +test_invalid_value +( +' +content +' +' +counter +( +foo +inherit +) +" +z +" +' +) +; +test_invalid_value +( +' +content +' +' +counters +( +foo +" +" +inherit +) +" +z +" +' +) +; +< +/ +script +> +< +/ +body +> +< +/ +html +>