LibWeb/CSS: Pull out and expand CSSStyleProperties::get_property()

This awkwardly sat as the internal final API for getting a StyleProperty
directly for a given PropertyID, and also the external API for getting
the StyleProperty for a PropertyID. For the latter, it lacked support
for shorthands, and for both it lacked support for custom properties.

This commit:
- Moves the code from get_property() into get_direct_property()
- Makes get_property() call get_property_internal() to support
  shorthands
- Adds custom property support for get_direct_property()

This also wins us some WPT points for StylePropertyMap.
This commit is contained in:
Sam Atkins 2025-09-25 17:09:22 +01:00
parent 8f456d781c
commit 47062424fb
Notes: github-actions[bot] 2025-10-02 12:47:56 +00:00
10 changed files with 95 additions and 85 deletions

View file

@ -2,12 +2,12 @@ Harness status: OK
Found 7 tests
4 Pass
3 Fail
5 Pass
2 Fail
Fail Declared StylePropertyMap only contains properties in the style rule
Pass Declared StylePropertyMap contains CSS property declarations in style rules
Pass Declared StylePropertyMap does not contain inline styles
Fail Declared StylePropertyMap contains custom property declarations
Pass Declared StylePropertyMap contains custom property declarations
Pass Declared StylePropertyMap does not contain properties with invalid values
Pass Declared StylePropertyMap contains properties with their last valid value
Fail Declared StylePropertyMap is live

View file

@ -2,12 +2,12 @@ Harness status: OK
Found 7 tests
5 Pass
2 Fail
6 Pass
1 Fail
Pass Getting a custom property not in the CSS rule returns undefined
Pass Getting a valid property not in the CSS rule returns undefined
Pass Getting a valid property from CSS rule returns the correct entry
Fail Getting a valid custom property from CSS rule returns the correct entry
Pass Getting a valid custom property from CSS rule returns the correct entry
Fail Getting a list-valued property from CSS rule returns only the first value
Pass Declared StylePropertyMap.get is not case-sensitive
Pass Declared StylePropertyMap.get reflects changes in the CSS rule

View file

@ -2,12 +2,12 @@ Harness status: OK
Found 7 tests
5 Pass
2 Fail
6 Pass
1 Fail
Pass Calling StylePropertyMap.getAll with an unsupported property throws a TypeError
Pass Calling StylePropertyMap.getAll with a property not in the property model returns an empty list
Pass Calling StylePropertyMap.getAll with a custom property not in the property model returns an empty list
Pass Calling StylePropertyMap.getAll with a valid property returns a single element list with the correct entry
Pass StylePropertyMap.getAll is case-insensitive
Fail Calling StylePropertyMap.getAll with a valid custom property returns a single element list with the correct entry
Pass Calling StylePropertyMap.getAll with a valid custom property returns a single element list with the correct entry
Fail Calling StylePropertyMap.getAll with a list-valued property returns all the values

View file

@ -2,8 +2,7 @@ Harness status: OK
Found 9 tests
8 Pass
1 Fail
9 Pass
Pass Calling StylePropertyMap.has with an unsupported property throws a TypeError
Pass Calling StylePropertyMap.has with a property not in the property model returns false
Pass Calling StylePropertyMap.has with a custom property not in the property model returns false
@ -11,5 +10,5 @@ Pass Calling StylePropertyMap.has with a valid property returns true
Pass Calling StylePropertyMap.has with a valid property in mixed case returns true
Pass Calling StylePropertyMap.has with a valid shorthand specified explicitly returns true
Pass Calling StylePropertyMap.has with a valid shorthand only partially specified returns false
Fail Calling StylePropertyMap.has with a valid custom property returns true
Pass Calling StylePropertyMap.has with a valid custom property returns true
Pass Calling StylePropertyMap.has with a valid list-valued property returns true

View file

@ -2,12 +2,12 @@ Harness status: OK
Found 7 tests
5 Pass
2 Fail
6 Pass
1 Fail
Pass Getting a custom property not in the inline style returns undefined
Pass Getting a valid property not in the inline style returns undefined
Pass Getting a valid property from inline style returns the correct entry
Fail Getting a valid custom property from inline style returns the correct entry
Pass Getting a valid custom property from inline style returns the correct entry
Fail Getting a list-valued property from inline style returns only the first value
Pass Declared StylePropertyMap.get is not case-sensitive
Pass Declared StylePropertyMap.get reflects changes in the inline style

View file

@ -2,12 +2,12 @@ Harness status: OK
Found 7 tests
5 Pass
2 Fail
6 Pass
1 Fail
Pass Calling StylePropertyMap.getAll with an unsupported property throws a TypeError
Pass Calling StylePropertyMap.getAll with a property not in the property model returns an empty list
Pass Calling StylePropertyMap.getAll with a custom property not in the property model returns an empty list
Pass Calling StylePropertyMap.getAll with a valid property returns a single element list with the correct entry
Pass StylePropertyMap.getAll is case-insensitive
Fail Calling StylePropertyMap.getAll with a valid custom property returns a single element list with the correct entry
Pass Calling StylePropertyMap.getAll with a valid custom property returns a single element list with the correct entry
Fail Calling StylePropertyMap.getAll with a list-valued property returns all the values

View file

@ -2,13 +2,12 @@ Harness status: OK
Found 8 tests
7 Pass
1 Fail
8 Pass
Pass Calling StylePropertyMap.has with an unsupported property throws a TypeError
Pass Calling StylePropertyMap.has with a property not in the property model returns false
Pass Calling StylePropertyMap.has with a custom property not in the property model returns false
Pass Calling StylePropertyMap.has with a valid property in mixed case returns false
Pass Calling StylePropertyMap.has with a valid property returns true
Pass Calling StylePropertyMap.has with a valid property in mixed case returns true
Fail Calling StylePropertyMap.has with a valid custom property returns true
Pass Calling StylePropertyMap.has with a valid custom property returns true
Pass Calling StylePropertyMap.has with a valid list-valued property returns true