LibWeb/CSS: Implement CSSPerspective

Equivalent to the perspective() transform function.

+34 WPT subtests, and the transformvalue-normalization test now runs to
completion instead of throwing an error - though its cases still fail
until CSSTransformValue is implemented.
This commit is contained in:
Sam Atkins 2025-09-16 11:05:33 +01:00
parent 68ceacb0c5
commit 2ffbb284f2
Notes: github-actions[bot] 2025-09-24 11:29:00 +00:00
12 changed files with 298 additions and 45 deletions

View file

@ -65,6 +65,7 @@ CSSNumericArray
CSSNumericValue
CSSPageDescriptors
CSSPageRule
CSSPerspective
CSSPropertyRule
CSSRotate
CSSRule

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 545 tests
346 Pass
199 Fail
353 Pass
192 Fail
Pass idl_test setup
Pass idl_test validation
Pass Partial interface Element: original interface defined
@ -364,13 +364,13 @@ Fail Stringification of skewY
Fail CSSSkewY interface: skewY must inherit property "ay" with the proper type
Fail CSSTransformComponent interface: skewY must inherit property "is2D" with the proper type
Fail CSSTransformComponent interface: skewY must inherit property "toMatrix()" with the proper type
Fail CSSPerspective interface: existence and properties of interface object
Fail CSSPerspective interface object length
Fail CSSPerspective interface object name
Fail CSSPerspective interface: existence and properties of interface prototype object
Fail CSSPerspective interface: existence and properties of interface prototype object's "constructor" property
Fail CSSPerspective interface: existence and properties of interface prototype object's @@unscopables property
Fail CSSPerspective interface: attribute length
Pass CSSPerspective interface: existence and properties of interface object
Pass CSSPerspective interface object length
Pass CSSPerspective interface object name
Pass CSSPerspective interface: existence and properties of interface prototype object
Pass CSSPerspective interface: existence and properties of interface prototype object's "constructor" property
Pass CSSPerspective interface: existence and properties of interface prototype object's @@unscopables property
Pass CSSPerspective interface: attribute length
Fail CSSPerspective must be primary interface of perspective
Fail Stringification of perspective
Fail CSSPerspective interface: perspective must inherit property "length" with the proper type

View file

@ -1,7 +1,33 @@
Harness status: Error
Harness status: OK
Found 2 tests
Found 28 tests
2 Fail
28 Fail
Fail Normalizing a matrix() returns a CSSMatrixComponent
Fail Normalizing a matrix3d() returns a CSSMatrixComponent
Fail Normalizing a matrix3d() returns a CSSMatrixComponent
Fail Normalizing a translate() with X returns a CSSTranslate
Fail Normalizing a translate() with X and Y returns a CSSTranslate
Fail Normalizing a translateX() returns a CSSTranslate
Fail Normalizing a translateY() returns a CSSTranslate
Fail Normalizing a translate3d() returns a CSSTranslate
Fail Normalizing a translateZ() returns a CSSTranslate
Fail Normalizing a scale() with one argument returns a CSSScale
Fail Normalizing a scale() with two arguments returns a CSSScale
Fail Normalizing a scaleX() returns a CSSScale
Fail Normalizing a scaleY() returns a CSSScale
Fail Normalizing a scale3d() returns a CSSScale
Fail Normalizing a scaleZ() returns a CSSScale
Fail Normalizing a rotate() returns a CSSRotate
Fail Normalizing a rotate3d() returns a CSSRotate
Fail Normalizing a rotateX() returns a CSSRotate
Fail Normalizing a rotateY() returns a CSSRotate
Fail Normalizing a rotateZ() returns a CSSRotate
Fail Normalizing a skew() with only X returns a CSSSkew
Fail Normalizing a skew() with X and Y which is 0 value returns a CSSSkew
Fail Normalizing a skew() with X and Y returns a CSSSkew
Fail Normalizing a skewX() returns a CSSSkewX
Fail Normalizing a skewY() returns a CSSSkewY
Fail Normalizing a perspective() returns a CSSPerspective
Fail Normalizing a perspective(none) returns a CSSPerspective
Fail Normalizing a <transform-list> returns a CSSTransformValue containing all the transforms
Fail Normalizing transforms with calc values contains CSSMathValues

View file

@ -2,29 +2,29 @@ Harness status: OK
Found 25 tests
25 Fail
Fail Constructing a CSSPerspective with a keyword other than none (string) throws a TypeError
Fail Constructing a CSSPerspective with a keyword other than none (CSSKeywordValue) throws a TypeError
Fail Constructing a CSSPerspective with a double throws a TypeError
Fail Constructing a CSSPerspective with a unitless zero throws a TypeError
Fail Constructing a CSSPerspective with a string length throws a TypeError
Fail Constructing a CSSPerspective with a number CSSUnitValue throws a TypeError
Fail Constructing a CSSPerspective with a time dimension CSSUnitValue throws a TypeError
Fail Constructing a CSSPerspective with a CSSMathValue of angle type throws a TypeError
Fail Updating CSSPerspective.length with a keyword other than none (string) throws a TypeError
Fail Updating CSSPerspective.length with a keyword other than none (CSSKeywordValue) throws a TypeError
Fail Updating CSSPerspective.length with a double throws a TypeError
Fail Updating CSSPerspective.length with a unitless zero throws a TypeError
Fail Updating CSSPerspective.length with a string length throws a TypeError
Fail Updating CSSPerspective.length with a number CSSUnitValue throws a TypeError
Fail Updating CSSPerspective.length with a time dimension CSSUnitValue throws a TypeError
Fail Updating CSSPerspective.length with a CSSMathValue of angle type throws a TypeError
Fail CSSPerspective can be constructed from a length CSSUnitValue
Fail CSSPerspective.length can be updated to a length CSSUnitValue
Fail CSSPerspective can be constructed from a CSSMathValue of length type
Fail CSSPerspective.length can be updated to a CSSMathValue of length type
Fail CSSPerspective can be constructed from none (CSSKeywordValue)
Fail CSSPerspective.length can be updated to none (CSSKeywordValue)
Fail CSSPerspective can be constructed from none (string)
Fail CSSPerspective.length can be updated to none (string)
Fail Modifying CSSPerspective.is2D is a no-op
25 Pass
Pass Constructing a CSSPerspective with a keyword other than none (string) throws a TypeError
Pass Constructing a CSSPerspective with a keyword other than none (CSSKeywordValue) throws a TypeError
Pass Constructing a CSSPerspective with a double throws a TypeError
Pass Constructing a CSSPerspective with a unitless zero throws a TypeError
Pass Constructing a CSSPerspective with a string length throws a TypeError
Pass Constructing a CSSPerspective with a number CSSUnitValue throws a TypeError
Pass Constructing a CSSPerspective with a time dimension CSSUnitValue throws a TypeError
Pass Constructing a CSSPerspective with a CSSMathValue of angle type throws a TypeError
Pass Updating CSSPerspective.length with a keyword other than none (string) throws a TypeError
Pass Updating CSSPerspective.length with a keyword other than none (CSSKeywordValue) throws a TypeError
Pass Updating CSSPerspective.length with a double throws a TypeError
Pass Updating CSSPerspective.length with a unitless zero throws a TypeError
Pass Updating CSSPerspective.length with a string length throws a TypeError
Pass Updating CSSPerspective.length with a number CSSUnitValue throws a TypeError
Pass Updating CSSPerspective.length with a time dimension CSSUnitValue throws a TypeError
Pass Updating CSSPerspective.length with a CSSMathValue of angle type throws a TypeError
Pass CSSPerspective can be constructed from a length CSSUnitValue
Pass CSSPerspective.length can be updated to a length CSSUnitValue
Pass CSSPerspective can be constructed from a CSSMathValue of length type
Pass CSSPerspective.length can be updated to a CSSMathValue of length type
Pass CSSPerspective can be constructed from none (CSSKeywordValue)
Pass CSSPerspective.length can be updated to none (CSSKeywordValue)
Pass CSSPerspective can be constructed from none (string)
Pass CSSPerspective.length can be updated to none (string)
Pass Modifying CSSPerspective.is2D is a no-op

View file

@ -2,7 +2,6 @@ Harness status: OK
Found 2 tests
1 Pass
1 Fail
2 Pass
Pass CSSTranslate.toMatrix() containing relative units throws TypeError
Fail CSSPerspective.toMatrix() containing relative units throws TypeError
Pass CSSPerspective.toMatrix() containing relative units throws TypeError

View file

@ -2,13 +2,13 @@ Harness status: OK
Found 8 tests
6 Pass
2 Fail
7 Pass
1 Fail
Pass CSSTranslate.toMatrix() returns correct matrix
Pass CSSRotate.toMatrix() returns correct matrix
Pass CSSScale.toMatrix() returns correct matrix
Pass CSSSkew.toMatrix() returns correct matrix
Pass CSSSkewX.toMatrix() returns correct matrix
Pass CSSSkewY.toMatrix() returns correct matrix
Fail CSSPerspective.toMatrix() returns correct matrix
Pass CSSPerspective.toMatrix() returns correct matrix
Fail CSSMatrixComponent.toMatrix() returns correct matrix