mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-02 22:29:10 +00:00
LibWeb/CSS: Correct definition of CSSNumericType
What I thought was a spec issue was actually a combination of my own misunderstanding and a bug in our IDL generator. With that bug fixed, I can correct this to how it is in the spec.
This commit is contained in:
parent
ffb236adbd
commit
9264f540dd
Notes:
github-actions[bot]
2025-08-29 09:58:35 +00:00
Author: https://github.com/AtkinsSJ
Commit: 9264f540dd
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5955
Reviewed-by: https://github.com/trflynn89
7 changed files with 45 additions and 48 deletions
|
@ -15,14 +15,14 @@
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
struct CSSNumericType {
|
struct CSSNumericType {
|
||||||
WebIDL::Long length {};
|
Optional<WebIDL::Long> length;
|
||||||
WebIDL::Long angle {};
|
Optional<WebIDL::Long> angle;
|
||||||
WebIDL::Long time {};
|
Optional<WebIDL::Long> time;
|
||||||
WebIDL::Long frequency {};
|
Optional<WebIDL::Long> frequency;
|
||||||
WebIDL::Long resolution {};
|
Optional<WebIDL::Long> resolution;
|
||||||
WebIDL::Long flex {};
|
Optional<WebIDL::Long> flex;
|
||||||
WebIDL::Long percent {};
|
Optional<WebIDL::Long> percent;
|
||||||
Optional<Bindings::CSSNumericBaseType> percent_hint {};
|
Optional<Bindings::CSSNumericBaseType> percent_hint;
|
||||||
};
|
};
|
||||||
|
|
||||||
// https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue
|
// https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue
|
||||||
|
|
|
@ -12,16 +12,15 @@ enum CSSNumericBaseType {
|
||||||
};
|
};
|
||||||
|
|
||||||
// https://drafts.css-houdini.org/css-typed-om-1/#dictdef-cssnumerictype
|
// https://drafts.css-houdini.org/css-typed-om-1/#dictdef-cssnumerictype
|
||||||
// AD-HOC: We give these default values and mark percentHint as nullable. https://github.com/w3c/css-houdini-drafts/issues/1149
|
|
||||||
dictionary CSSNumericType {
|
dictionary CSSNumericType {
|
||||||
long length = 0;
|
long length;
|
||||||
long angle = 0;
|
long angle;
|
||||||
long time = 0;
|
long time;
|
||||||
long frequency = 0;
|
long frequency;
|
||||||
long resolution = 0;
|
long resolution;
|
||||||
long flex = 0;
|
long flex;
|
||||||
long percent = 0;
|
long percent;
|
||||||
CSSNumericBaseType? percentHint;
|
CSSNumericBaseType percentHint;
|
||||||
};
|
};
|
||||||
|
|
||||||
// https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue
|
// https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue
|
||||||
|
|
|
@ -2,12 +2,11 @@ Harness status: OK
|
||||||
|
|
||||||
Found 7 tests
|
Found 7 tests
|
||||||
|
|
||||||
2 Pass
|
7 Pass
|
||||||
5 Fail
|
|
||||||
Pass Adding two types with different non-null percent hints throws TypeError
|
Pass Adding two types with different non-null percent hints throws TypeError
|
||||||
Fail Adding two types with the same nonzero values returns same type
|
Pass Adding two types with the same nonzero values returns same type
|
||||||
Fail Adding two types with empty maps with returns empty map
|
Pass Adding two types with empty maps with returns empty map
|
||||||
Fail Adding a type with percent returns type with percent hint
|
Pass Adding a type with percent returns type with percent hint
|
||||||
Pass Adding a type with percent 2 returns type with percent hint throws TypeError
|
Pass Adding a type with percent 2 returns type with percent hint throws TypeError
|
||||||
Fail Adding a type with a percent hint returns a type with the percent hint
|
Pass Adding a type with a percent hint returns a type with the percent hint
|
||||||
Fail Adding two types with the same percent hint returns a type with the percent hint
|
Pass Adding two types with the same percent hint returns a type with the percent hint
|
|
@ -2,12 +2,12 @@ Harness status: OK
|
||||||
|
|
||||||
Found 8 tests
|
Found 8 tests
|
||||||
|
|
||||||
8 Fail
|
8 Pass
|
||||||
Fail Creating a type from "number" returns {}
|
Pass Creating a type from "number" returns {}
|
||||||
Fail Creating a type from "percent" returns { percent: 1 }
|
Pass Creating a type from "percent" returns { percent: 1 }
|
||||||
Fail Creating a type from <length> returns { length: 1 }
|
Pass Creating a type from <length> returns { length: 1 }
|
||||||
Fail Creating a type from <angle> returns { angle: 1 }
|
Pass Creating a type from <angle> returns { angle: 1 }
|
||||||
Fail Creating a type from <time> returns { time: 1 }
|
Pass Creating a type from <time> returns { time: 1 }
|
||||||
Fail Creating a type from <frequency> returns { frequency: 1 }
|
Pass Creating a type from <frequency> returns { frequency: 1 }
|
||||||
Fail Creating a type from <resolution> returns { resolution: 1 }
|
Pass Creating a type from <resolution> returns { resolution: 1 }
|
||||||
Fail Creating a type from <flex> returns { flex: 1 }
|
Pass Creating a type from <flex> returns { flex: 1 }
|
|
@ -2,7 +2,7 @@ Harness status: OK
|
||||||
|
|
||||||
Found 3 tests
|
Found 3 tests
|
||||||
|
|
||||||
3 Fail
|
3 Pass
|
||||||
Fail Inverting a type with empty map returns the empty map
|
Pass Inverting a type with empty map returns the empty map
|
||||||
Fail Inverting a type negates all its exponents
|
Pass Inverting a type negates all its exponents
|
||||||
Fail Inverting an inverted type returns the original type
|
Pass Inverting an inverted type returns the original type
|
|
@ -2,6 +2,6 @@ Harness status: OK
|
||||||
|
|
||||||
Found 2 tests
|
Found 2 tests
|
||||||
|
|
||||||
2 Fail
|
2 Pass
|
||||||
Fail Negating a type with empty map returns the empty map
|
Pass Negating a type with empty map returns the empty map
|
||||||
Fail Negating a type returns the same type
|
Pass Negating a type returns the same type
|
|
@ -2,12 +2,11 @@ Harness status: OK
|
||||||
|
|
||||||
Found 7 tests
|
Found 7 tests
|
||||||
|
|
||||||
1 Pass
|
7 Pass
|
||||||
6 Fail
|
|
||||||
Pass Multiplying two types with different non-null percent hints throws TypeError
|
Pass Multiplying two types with different non-null percent hints throws TypeError
|
||||||
Fail Multiplying two types with same base types adds exponents
|
Pass Multiplying two types with same base types adds exponents
|
||||||
Fail Multiplying two types with different base types adds exponents
|
Pass Multiplying two types with different base types adds exponents
|
||||||
Fail Multiplying two types respects the sign of the exponents
|
Pass Multiplying two types respects the sign of the exponents
|
||||||
Fail Multiplying a type with no exponents is a no-op
|
Pass Multiplying a type with no exponents is a no-op
|
||||||
Fail Multiplying a type with percent hint applies the percent hint
|
Pass Multiplying a type with percent hint applies the percent hint
|
||||||
Fail Multiplying two types with same percent hint applies the percent hint
|
Pass Multiplying two types with same percent hint applies the percent hint
|
Loading…
Add table
Add a link
Reference in a new issue