Skip to content
Permalink
Browse files
Stop allowing numbers during parsing of cx, cy, x, y CSS properties
https://bugs.webkit.org/show_bug.cgi?id=249479

Reviewed by Sam Weinig.

Stop allowing numbers during parsing of cx, cy, x, y CSS properties.

Per the specification, we should allow <length-percentage>, not <number>:
- https://svgwg.org/svg2-draft/geometry.html#CX
- https://svgwg.org/svg2-draft/geometry.html#CY
- https://svgwg.org/svg2-draft/geometry.html#X
- https://svgwg.org/svg2-draft/geometry.html#Y

* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/center-coordinate-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/coordinate-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/geometry/parsing/cx-invalid-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/geometry/parsing/cy-invalid-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/geometry/parsing/x-invalid-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/geometry/parsing/y-invalid-expected.txt:
Rebaseline WPT tests now that more checks are passing.

* Source/WebCore/css/CSSProperties.json:
Use <length-percentage> instead of <length-percentage svg> for the parser grammar,
since the svg attribute parsing mode allows unitless values.

Canonical link: https://commits.webkit.org/258029@main
  • Loading branch information
cdumez committed Dec 17, 2022
1 parent b357325 commit 90112a7d702fa28ce9886a5b0ca62ff2edb9d708
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
@@ -24,9 +24,9 @@ PASS Setting 'cx' to a flexible length: 0fr throws TypeError
PASS Setting 'cx' to a flexible length: 1fr throws TypeError
PASS Setting 'cx' to a flexible length: -3.14fr throws TypeError
FAIL Setting 'cx' to a number: 0 throws TypeError assert_throws_js: function "() => styleMap.set(propertyName, example.input)" did not throw
FAIL Setting 'cx' to a number: -3.14 throws TypeError assert_throws_js: function "() => styleMap.set(propertyName, example.input)" did not throw
FAIL Setting 'cx' to a number: 3.14 throws TypeError assert_throws_js: function "() => styleMap.set(propertyName, example.input)" did not throw
FAIL Setting 'cx' to a number: calc(2 + 3) throws TypeError assert_throws_js: function "() => styleMap.set(propertyName, example.input)" did not throw
PASS Setting 'cx' to a number: -3.14 throws TypeError
PASS Setting 'cx' to a number: 3.14 throws TypeError
PASS Setting 'cx' to a number: calc(2 + 3) throws TypeError
PASS Setting 'cx' to a transform: translate(50%, 50%) throws TypeError
PASS Setting 'cx' to a transform: perspective(10em) throws TypeError
PASS Setting 'cx' to a transform: translate3d(0px, 1px, 2px) translate(0px, 1px) rotate3d(1, 2, 3, 45deg) rotate(45deg) scale3d(1, 2, 3) scale(1, 2) skew(1deg, 1deg) skewX(1deg) skewY(45deg) perspective(1px) matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) matrix(1, 2, 3, 4, 5, 6) throws TypeError
@@ -55,9 +55,9 @@ PASS Setting 'cy' to a flexible length: 0fr throws TypeError
PASS Setting 'cy' to a flexible length: 1fr throws TypeError
PASS Setting 'cy' to a flexible length: -3.14fr throws TypeError
FAIL Setting 'cy' to a number: 0 throws TypeError assert_throws_js: function "() => styleMap.set(propertyName, example.input)" did not throw
FAIL Setting 'cy' to a number: -3.14 throws TypeError assert_throws_js: function "() => styleMap.set(propertyName, example.input)" did not throw
FAIL Setting 'cy' to a number: 3.14 throws TypeError assert_throws_js: function "() => styleMap.set(propertyName, example.input)" did not throw
FAIL Setting 'cy' to a number: calc(2 + 3) throws TypeError assert_throws_js: function "() => styleMap.set(propertyName, example.input)" did not throw
PASS Setting 'cy' to a number: -3.14 throws TypeError
PASS Setting 'cy' to a number: 3.14 throws TypeError
PASS Setting 'cy' to a number: calc(2 + 3) throws TypeError
PASS Setting 'cy' to a transform: translate(50%, 50%) throws TypeError
PASS Setting 'cy' to a transform: perspective(10em) throws TypeError
PASS Setting 'cy' to a transform: translate3d(0px, 1px, 2px) translate(0px, 1px) rotate3d(1, 2, 3, 45deg) rotate(45deg) scale3d(1, 2, 3) scale(1, 2) skew(1deg, 1deg) skewX(1deg) skewY(45deg) perspective(1px) matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) matrix(1, 2, 3, 4, 5, 6) throws TypeError
@@ -24,9 +24,9 @@ PASS Setting 'x' to a flexible length: 0fr throws TypeError
PASS Setting 'x' to a flexible length: 1fr throws TypeError
PASS Setting 'x' to a flexible length: -3.14fr throws TypeError
FAIL Setting 'x' to a number: 0 throws TypeError assert_throws_js: function "() => styleMap.set(propertyName, example.input)" did not throw
FAIL Setting 'x' to a number: -3.14 throws TypeError assert_throws_js: function "() => styleMap.set(propertyName, example.input)" did not throw
FAIL Setting 'x' to a number: 3.14 throws TypeError assert_throws_js: function "() => styleMap.set(propertyName, example.input)" did not throw
FAIL Setting 'x' to a number: calc(2 + 3) throws TypeError assert_throws_js: function "() => styleMap.set(propertyName, example.input)" did not throw
PASS Setting 'x' to a number: -3.14 throws TypeError
PASS Setting 'x' to a number: 3.14 throws TypeError
PASS Setting 'x' to a number: calc(2 + 3) throws TypeError
PASS Setting 'x' to a transform: translate(50%, 50%) throws TypeError
PASS Setting 'x' to a transform: perspective(10em) throws TypeError
PASS Setting 'x' to a transform: translate3d(0px, 1px, 2px) translate(0px, 1px) rotate3d(1, 2, 3, 45deg) rotate(45deg) scale3d(1, 2, 3) scale(1, 2) skew(1deg, 1deg) skewX(1deg) skewY(45deg) perspective(1px) matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) matrix(1, 2, 3, 4, 5, 6) throws TypeError
@@ -55,9 +55,9 @@ PASS Setting 'y' to a flexible length: 0fr throws TypeError
PASS Setting 'y' to a flexible length: 1fr throws TypeError
PASS Setting 'y' to a flexible length: -3.14fr throws TypeError
FAIL Setting 'y' to a number: 0 throws TypeError assert_throws_js: function "() => styleMap.set(propertyName, example.input)" did not throw
FAIL Setting 'y' to a number: -3.14 throws TypeError assert_throws_js: function "() => styleMap.set(propertyName, example.input)" did not throw
FAIL Setting 'y' to a number: 3.14 throws TypeError assert_throws_js: function "() => styleMap.set(propertyName, example.input)" did not throw
FAIL Setting 'y' to a number: calc(2 + 3) throws TypeError assert_throws_js: function "() => styleMap.set(propertyName, example.input)" did not throw
PASS Setting 'y' to a number: -3.14 throws TypeError
PASS Setting 'y' to a number: 3.14 throws TypeError
PASS Setting 'y' to a number: calc(2 + 3) throws TypeError
PASS Setting 'y' to a transform: translate(50%, 50%) throws TypeError
PASS Setting 'y' to a transform: perspective(10em) throws TypeError
PASS Setting 'y' to a transform: translate3d(0px, 1px, 2px) translate(0px, 1px) rotate3d(1, 2, 3, 45deg) rotate(45deg) scale3d(1, 2, 3) scale(1, 2) skew(1deg, 1deg) skewX(1deg) skewY(45deg) perspective(1px) matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) matrix(1, 2, 3, 4, 5, 6) throws TypeError
@@ -1,5 +1,5 @@

FAIL e.style['cx'] = "10" should not set the property value assert_equals: expected "" but got "10px"
PASS e.style['cx'] = "10" should not set the property value
PASS e.style['cx'] = "auto" should not set the property value
PASS e.style['cx'] = "10px 20px" should not set the property value

@@ -1,5 +1,5 @@

FAIL e.style['cy'] = "10" should not set the property value assert_equals: expected "" but got "10px"
PASS e.style['cy'] = "10" should not set the property value
PASS e.style['cy'] = "auto" should not set the property value
PASS e.style['cy'] = "10px 20px" should not set the property value

@@ -1,5 +1,5 @@

FAIL e.style['x'] = "10" should not set the property value assert_equals: expected "" but got "10px"
PASS e.style['x'] = "10" should not set the property value
PASS e.style['x'] = "auto" should not set the property value
PASS e.style['x'] = "10px 20px" should not set the property value

@@ -1,5 +1,5 @@

FAIL e.style['y'] = "10" should not set the property value assert_equals: expected "" but got "10px"
PASS e.style['y'] = "10" should not set the property value
PASS e.style['y'] = "auto" should not set the property value
PASS e.style['y'] = "10px 20px" should not set the property value

@@ -2898,7 +2898,7 @@
"codegen-properties": {
"initial": "initialZeroLength",
"converter": "Length",
"parser-grammar": "<length-percentage svg>"
"parser-grammar": "<length-percentage>"
},
"specification": {
"category": "svg",
@@ -2909,7 +2909,7 @@
"codegen-properties": {
"initial": "initialZeroLength",
"converter": "Length",
"parser-grammar": "<length-percentage svg>"
"parser-grammar": "<length-percentage>"
},
"specification": {
"category": "svg",
@@ -5767,7 +5767,7 @@
"codegen-properties": {
"initial": "initialZeroLength",
"converter": "Length",
"parser-grammar": "<length-percentage svg>"
"parser-grammar": "<length-percentage>"
},
"specification": {
"category": "svg",
@@ -5778,7 +5778,7 @@
"codegen-properties": {
"initial": "initialZeroLength",
"converter": "Length",
"parser-grammar": "<length-percentage svg>"
"parser-grammar": "<length-percentage>"
},
"specification": {
"category": "svg",

0 comments on commit 90112a7

Please sign in to comment.