Skip to content
Permalink
Browse files
[@Property] Add more syntax types
https://bugs.webkit.org/show_bug.cgi?id=249027
rdar://103184764

Reviewed by Alan Baradlay.

Handle <percentage> <integer>, <number> and <angle> types.

* LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/animate-invalid-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/register-property-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/register-property-syntax-parsing-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/registered-property-computation-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/registered-property-initial-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/typedom-expected.txt:
* Source/WebCore/css/CSSCustomPropertyValue.cpp:
(WebCore::CSSCustomPropertyValue::equals const):
(WebCore::CSSCustomPropertyValue::customCSSText const):
* Source/WebCore/css/CSSCustomPropertyValue.h:
* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseCustomPropertyValueWithSyntaxDefinition):
(WebCore::CSSPropertyParser::parseTypedCustomPropertyValue):
* Source/WebCore/css/parser/CSSPropertySyntax.cpp:
(WebCore::CSSPropertySyntax::parseComponent):
* Source/WebCore/css/parser/CSSPropertySyntax.h:

Canonical link: https://commits.webkit.org/257678@main
  • Loading branch information
anttijk committed Dec 10, 2022
1 parent 0a58710 commit fba580ad5100a2daa5c828f33ce45950a7c9945b
Show file tree
Hide file tree
Showing 11 changed files with 178 additions and 123 deletions.
@@ -1,3 +1,3 @@

FAIL Do not crash when animating to unresolved var() promise_test: Unhandled rejection with value: object "SyntaxError: The given initial value does not parse for the given syntax."
PASS Do not crash when animating to unresolved var()

@@ -2,7 +2,7 @@
PASS registerProperty requires a Dictionary type
PASS registerProperty requires a name matching <custom-property-name>
FAIL registerProperty only allows omitting initialValue if syntax is '*' assert_throws_dom: function "() => CSS.registerProperty({name: '--syntax-test-3', syntax: 'length', inherits: false})" did not throw
FAIL registerProperty fails for an already registered property assert_throws_dom: function "() => CSS.registerProperty({name: '--re-register', syntax: '<percentage>', initialValue: '0%', inherits: false})" threw object "SyntaxError: The given initial value does not parse for the given syntax." that is not a DOMException InvalidModificationError: property "code" is equal to 12, expected 13
PASS registerProperty fails for an already registered property
PASS registerProperty requires inherits
FAIL Registering a property should not cause a transition The given initial value does not parse for the given syntax.

@@ -2,8 +2,8 @@
PASS syntax:'*', initialValue:'a' is valid
PASS syntax:' * ', initialValue:'b' is valid
PASS syntax:'<length>', initialValue:'2px' is valid
FAIL syntax:' <number>', initialValue:'5' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<percentage> ', initialValue:'10%' is valid The given initial value does not parse for the given syntax.
PASS syntax:' <number>', initialValue:'5' is valid
PASS syntax:'<percentage> ', initialValue:'10%' is valid
FAIL syntax:'<color>+', initialValue:'red' is valid The given initial value does not parse for the given syntax.
FAIL syntax:' <length>+ | <percentage>', initialValue:'2px 8px' is valid The given initial value does not parse for the given syntax.
FAIL syntax:' <length>+ | <color>#', initialValue:'red, blue' is valid The given initial value does not parse for the given syntax.
@@ -25,30 +25,30 @@ PASS syntax:'<length>', initialValue:'7.1e-4cm' is valid
PASS syntax:'<length>', initialValue:'calc(7in - 12px)' is valid
FAIL syntax:'<length>+', initialValue:'2px 7px calc(8px)' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<length>#', initialValue:'2px, 7px, calc(8px)' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<percentage>', initialValue:'-9.3e3%' is valid The given initial value does not parse for the given syntax.
PASS syntax:'<percentage>', initialValue:'-9.3e3%' is valid
PASS syntax:'<length-percentage>', initialValue:'-54%' is valid
PASS syntax:'<length-percentage>', initialValue:'0' is valid
PASS syntax:'<length-percentage>', initialValue:'calc(-11px + 10.4%)' is valid
PASS syntax:'<length>', initialValue:'10vmin' is valid
FAIL syntax:'<percentage> | <length>+', initialValue:'calc(100vh - 10px) 30px' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<number>', initialValue:'-109' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<number>', initialValue:'2.3e4' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<integer>', initialValue:'-109' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<integer>', initialValue:'19' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<integer>', initialValue:'calc(1)' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<integer>', initialValue:'calc(1 + 2)' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<integer>', initialValue:'calc(3.1415)' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<integer>', initialValue:'calc(3.1415 + 3.1415)' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<angle>', initialValue:'10deg' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<angle>', initialValue:'20.5rad' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<angle>', initialValue:'calc(50grad + 3.14159rad)' is valid The given initial value does not parse for the given syntax.
PASS syntax:'<number>', initialValue:'-109' is valid
PASS syntax:'<number>', initialValue:'2.3e4' is valid
PASS syntax:'<integer>', initialValue:'-109' is valid
PASS syntax:'<integer>', initialValue:'19' is valid
PASS syntax:'<integer>', initialValue:'calc(1)' is valid
PASS syntax:'<integer>', initialValue:'calc(1 + 2)' is valid
PASS syntax:'<integer>', initialValue:'calc(3.1415)' is valid
PASS syntax:'<integer>', initialValue:'calc(3.1415 + 3.1415)' is valid
PASS syntax:'<angle>', initialValue:'10deg' is valid
PASS syntax:'<angle>', initialValue:'20.5rad' is valid
PASS syntax:'<angle>', initialValue:'calc(50grad + 3.14159rad)' is valid
FAIL syntax:'<time>', initialValue:'2s' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<time>', initialValue:'calc(2s - 9ms)' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<resolution>', initialValue:'10dpi' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<resolution>', initialValue:'3dPpX' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<resolution>', initialValue:'-5.3dpcm' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<transform-function>', initialValue:'translateX(2px)' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<transform-function>|<integer>', initialValue:'5' is valid The given initial value does not parse for the given syntax.
PASS syntax:'<transform-function>|<integer>', initialValue:'5' is valid
FAIL syntax:'<transform-function>|<integer>', initialValue:'scale(2)' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<transform-function>+', initialValue:'translateX(2px) rotate(42deg)' is valid The given initial value does not parse for the given syntax.
FAIL syntax:'<transform-list>', initialValue:'scale(2)' is valid The given initial value does not parse for the given syntax.
@@ -16,7 +16,7 @@ PASS <length> values are computed correctly [72pt]
PASS <length> values are computed correctly [10lh]
PASS <length-percentage> values are computed correctly [17em]
PASS <length-percentage> values are computed correctly [18%]
FAIL <length-percentage> values are computed correctly [calc(19em - 2%)] assert_equals: expected "calc(-2% + 190px)" but got "calc(19em - 2%)"
FAIL <length-percentage> values are computed correctly [calc(19em - 2%)] assert_equals: expected "calc(-2% + 190px)" but got "calc(-2% + 19em)"
FAIL <length># values are computed correctly [10px, 3em] assert_equals: expected "10px, 30px" but got "0px"
FAIL <length># values are computed correctly [4em ,9px] assert_equals: expected "40px, 9px" but got "0px"
PASS <length># values are computed correctly [8em]
@@ -31,12 +31,12 @@ FAIL <transform-function> values are computed correctly [translateX(2px)] The gi
FAIL <transform-function> values are computed correctly [translateX(10em)] The given initial value does not parse for the given syntax.
FAIL <transform-function> values are computed correctly [translateX(calc(11em + 10%))] The given initial value does not parse for the given syntax.
FAIL <transform-function>+ values are computed correctly [translateX(10%) scale(2)] The given initial value does not parse for the given syntax.
FAIL <integer> values are computed correctly [15] The given initial value does not parse for the given syntax.
FAIL <integer> values are computed correctly [calc(15 + 15)] The given initial value does not parse for the given syntax.
FAIL <integer> values are computed correctly [calc(2.4)] The given initial value does not parse for the given syntax.
FAIL <integer> values are computed correctly [calc(2.6)] The given initial value does not parse for the given syntax.
FAIL <integer> values are computed correctly [calc(2.6 + 3.1)] The given initial value does not parse for the given syntax.
FAIL <integer>+ values are computed correctly [15 calc(2.4) calc(2.6)] The given initial value does not parse for the given syntax.
PASS <integer> values are computed correctly [15]
PASS <integer> values are computed correctly [calc(15 + 15)]
PASS <integer> values are computed correctly [calc(2.4)]
PASS <integer> values are computed correctly [calc(2.6)]
PASS <integer> values are computed correctly [calc(2.6 + 3.1)]
FAIL <integer>+ values are computed correctly [15 calc(2.4) calc(2.6)] assert_equals: expected "15 2 3" but got "0"
FAIL <color> values are computed correctly [#ff0000] The given initial value does not parse for the given syntax.
FAIL <color> values are computed correctly [#000f00] The given initial value does not parse for the given syntax.
FAIL <color> values are computed correctly [#00000a] The given initial value does not parse for the given syntax.
@@ -49,9 +49,9 @@ PASS * values are computed correctly [tomato]
PASS tomato | plum values are computed correctly [plum]
PASS tomato | plum | <color> values are computed correctly [plum]
PASS * values are computed correctly [-50grad]
FAIL <angle> values are computed correctly [180deg] The given initial value does not parse for the given syntax.
FAIL <angle> values are computed correctly [400grad] The given initial value does not parse for the given syntax.
FAIL <angle> values are computed correctly [calc(360deg + 400grad)] The given initial value does not parse for the given syntax.
PASS <angle> values are computed correctly [180deg]
PASS <angle> values are computed correctly [400grad]
PASS <angle> values are computed correctly [calc(360deg + 400grad)]
PASS * values are computed correctly [50s]
FAIL <time> values are computed correctly [1s] The given initial value does not parse for the given syntax.
FAIL <time> values are computed correctly [1000ms] The given initial value does not parse for the given syntax.
@@ -5,8 +5,8 @@ PASS Initial value for <length> correctly computed [2.54cm]
PASS Initial value for <length> correctly computed [25.4mm]
PASS Initial value for <length> correctly computed [6pc]
PASS Initial value for <length> correctly computed [72pt]
FAIL Initial value for <percentage> correctly computed [calc(10% + 20%)] The given initial value does not parse for the given syntax.
FAIL Initial value for <length-percentage> correctly computed [calc(1in + 10% + 4px)] assert_equals: expected "calc(10% + 100px)" but got "calc(1in + 10% + 4px)"
PASS Initial value for <percentage> correctly computed [calc(10% + 20%)]
PASS Initial value for <length-percentage> correctly computed [calc(1in + 10% + 4px)]
FAIL Initial value for <color> correctly computed [pink, inherits] The given initial value does not parse for the given syntax.
FAIL Initial value for <color> correctly computed [purple] The given initial value does not parse for the given syntax.
FAIL Initial value for <transform-function> correctly computed [rotate(42deg)] The given initial value does not parse for the given syntax.
@@ -16,15 +16,15 @@ FAIL Initial value for <url> correctly computed [url(a)] The given initial value
FAIL Initial value for <url>+ correctly computed [url(a) url(a)] The given initial value does not parse for the given syntax.
FAIL Initial inherited value can be substituted [purple, color] The given initial value does not parse for the given syntax.
FAIL Initial non-inherited value can be substituted [pink, background-color] The given initial value does not parse for the given syntax.
FAIL Initial non-inherited value can be substituted [ foo , --x] assert_equals: expected "foo" but got " foo "
FAIL Initial non-inherited value can be substituted [ 1turn, --x] The given initial value does not parse for the given syntax.
PASS Initial non-inherited value can be substituted [ foo , --x]
PASS Initial non-inherited value can be substituted [ 1turn, --x]
FAIL Initial non-inherited value can be substituted [ pink , --x] The given initial value does not parse for the given syntax.
FAIL Initial non-inherited value can be substituted [ test, --x] assert_equals: expected "test" but got " test"
FAIL Initial non-inherited value can be substituted [calc(20 + 20 + 10), --x] The given initial value does not parse for the given syntax.
FAIL Initial non-inherited value can be substituted [ calc(13% + 37px), --x] assert_equals: expected "calc(13% + 37px)" but got " calc(13% + 37px)"
PASS Initial non-inherited value can be substituted [ test, --x]
PASS Initial non-inherited value can be substituted [calc(20 + 20 + 10), --x]
PASS Initial non-inherited value can be substituted [ calc(13% + 37px), --x]
PASS Initial non-inherited value can be substituted [calc(10px + 15px), --x]
FAIL Initial non-inherited value can be substituted [calc(13 + 37), --x] The given initial value does not parse for the given syntax.
FAIL Initial non-inherited value can be substituted [calc(13% + 37%), --x] The given initial value does not parse for the given syntax.
PASS Initial non-inherited value can be substituted [calc(13 + 37), --x]
PASS Initial non-inherited value can be substituted [calc(13% + 37%), --x]
FAIL Initial non-inherited value can be substituted [2000ms, --x] The given initial value does not parse for the given syntax.
FAIL Initial non-inherited value can be substituted [scale(calc(2 + 2)), --x] The given initial value does not parse for the given syntax.
FAIL Initial non-inherited value can be substituted [scale(calc(2 + 2)) translateX(calc(3px + 1px)), --x] The given initial value does not parse for the given syntax.

0 comments on commit fba580a

Please sign in to comment.