LibWeb/CSS: Tokenize custom property values when substituting var()
Co-authored-by: Shannon Booth <shannon@serenityos.org>
This commit is contained in:
parent
7f2ff6df4e
commit
08dbbf24c2
4 changed files with 16 additions and 23 deletions
|
|
@ -412,14 +412,7 @@ static Vector<ComponentValue> replace_a_var_function(DOM::AbstractElement& eleme
|
|||
// Look up the value of the custom property
|
||||
auto& custom_property_name = name_token.token().ident();
|
||||
auto custom_property_value = StyleComputer::compute_value_of_custom_property(element, custom_property_name, guarded_contexts);
|
||||
if (custom_property_value->is_guaranteed_invalid()) {
|
||||
result = { ComponentValue { GuaranteedInvalidValue {} } };
|
||||
} else if (custom_property_value->is_unresolved()) {
|
||||
result = custom_property_value->as_unresolved().values();
|
||||
} else {
|
||||
dbgln_if(CSS_PARSER_DEBUG, "Custom property `{}` is an unsupported type: {}", custom_property_name, to_underlying(custom_property_value->type()));
|
||||
result = { ComponentValue { GuaranteedInvalidValue {} } };
|
||||
}
|
||||
result = custom_property_value->tokenize();
|
||||
}
|
||||
|
||||
// FIXME: 3. If the custom property named by the var()’s first argument is animation-tainted, and the var() is being used
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ Harness status: OK
|
|||
|
||||
Found 29 tests
|
||||
|
||||
13 Pass
|
||||
16 Fail
|
||||
18 Pass
|
||||
11 Fail
|
||||
Pass Initial value for <length> correctly computed [calc(10px + 15px)]
|
||||
Pass Initial value for <length> correctly computed [1in]
|
||||
Pass Initial value for <length> correctly computed [2.54cm]
|
||||
|
|
@ -19,14 +19,14 @@ Pass Initial value for <transform-list> correctly computed [scale(calc(2 + 2))]
|
|||
Pass Initial value for <transform-list> correctly computed [scale(calc(2 + 1)) translateX(calc(3px + 1px))]
|
||||
Fail Initial value for <url> correctly computed [url(a)]
|
||||
Fail Initial value for <url>+ correctly computed [url(a) url(a)]
|
||||
Fail Initial inherited value can be substituted [purple, color]
|
||||
Fail Initial non-inherited value can be substituted [pink, background-color]
|
||||
Fail Initial non-inherited value can be substituted [ foo , --x]
|
||||
Pass Initial inherited value can be substituted [purple, color]
|
||||
Pass Initial non-inherited value can be substituted [pink, background-color]
|
||||
Pass Initial non-inherited value can be substituted [ foo , --x]
|
||||
Fail Initial non-inherited value can be substituted [ 1turn, --x]
|
||||
Fail Initial non-inherited value can be substituted [ pink , --x]
|
||||
Fail Initial non-inherited value can be substituted [ test, --x]
|
||||
Pass Initial non-inherited value can be substituted [ test, --x]
|
||||
Fail Initial non-inherited value can be substituted [calc(20 + 20 + 10), --x]
|
||||
Fail Initial non-inherited value can be substituted [ calc(13% + 37px), --x]
|
||||
Pass Initial non-inherited value can be substituted [ calc(13% + 37px), --x]
|
||||
Fail Initial non-inherited value can be substituted [calc(10px + 15px), --x]
|
||||
Fail Initial non-inherited value can be substituted [calc(13 + 37), --x]
|
||||
Fail Initial non-inherited value can be substituted [calc(13% + 37%), --x]
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ Harness status: OK
|
|||
|
||||
Found 172 tests
|
||||
|
||||
162 Pass
|
||||
10 Fail
|
||||
164 Pass
|
||||
8 Fail
|
||||
Pass Invariant behaviour for var
|
||||
Pass CSS Values and Units Test: attr
|
||||
Pass CSS Values and Units Test: attr 1
|
||||
|
|
@ -79,12 +79,12 @@ Pass CSS Values and Units Test: attr 70
|
|||
Pass CSS Values and Units Test: attr 71
|
||||
Pass CSS Values and Units Test: attr 72
|
||||
Pass CSS Values and Units Test: attr 73
|
||||
Fail CSS Values and Units Test: attr 74
|
||||
Pass CSS Values and Units Test: attr 74
|
||||
Pass CSS Values and Units Test: attr 75
|
||||
Pass CSS Values and Units Test: attr 76
|
||||
Pass CSS Values and Units Test: attr 77
|
||||
Pass CSS Values and Units Test: attr 78
|
||||
Fail CSS Values and Units Test: attr 79
|
||||
Pass CSS Values and Units Test: attr 79
|
||||
Pass CSS Values and Units Test: attr 80
|
||||
Fail CSS Values and Units Test: attr 81
|
||||
Pass CSS Values and Units Test: attr 82
|
||||
|
|
|
|||
|
|
@ -2,15 +2,15 @@ Harness status: OK
|
|||
|
||||
Found 30 tests
|
||||
|
||||
9 Pass
|
||||
21 Fail
|
||||
11 Pass
|
||||
19 Fail
|
||||
Pass `initial` as a value for an unregistered custom property
|
||||
Pass `inherit` as a value for an unregistered custom property
|
||||
Pass `unset` as a value for an unregistered custom property
|
||||
Fail `revert` as a value for an unregistered custom property
|
||||
Pass `revert-layer` as a value for an unregistered custom property
|
||||
Fail `initial` as a value for a non-inheriting registered custom property
|
||||
Fail `initial` as a value for an inheriting registered custom property
|
||||
Pass `initial` as a value for a non-inheriting registered custom property
|
||||
Pass `initial` as a value for an inheriting registered custom property
|
||||
Pass `inherit` as a value for a non-inheriting registered custom property
|
||||
Pass `inherit` as a value for an inheriting registered custom property
|
||||
Fail `unset` as a value for a non-inheriting registered custom property
|
||||
|
|
|
|||
Loading…
Reference in a new issue