mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-24 00:49:46 +00:00
LibWeb: Support top-level tree counting functions
Adds support for `sibling-index()` and `sibling-count()` when parsing
`<number>` and `<integer>`. This is achieved by a new
`TreeCountingFunctionStyleValue` class which is converted within
`absolutized` to `NumberStyleValue` and `IntegerStyleValue` respectively
There are still a few kinks to work out in order to support these
everywhere, namely:
- There are some `StyleValue`s which aren't absolutized (i.e. those
which are stored within another `StyleValue` without an
`absolutize()` method.
- We don't have a way to represent this new `StyleValue` within
`{Number,Integer}OrCalculated`. This would be fixed if we were to
instead just use the `StyleValue` classes until style computation at
which time they would be absolutized into their respective
primitives (double, i64, etc) bypassing the need for *OrCalculated
entirely.
This commit is contained in:
parent
9cd23e3ae5
commit
831e471444
Notes:
github-actions[bot]
2025-10-20 15:13:44 +00:00
Author: https://github.com/Calme1709
Commit: 831e471444
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6426
Reviewed-by: https://github.com/AtkinsSJ ✅
17 changed files with 184 additions and 32 deletions
|
|
@ -190,11 +190,7 @@ Optional<Parser::PropertyAndValue> Parser::parse_css_value_for_properties(Readon
|
|||
auto context_guard = push_temporary_value_parsing_context(*property);
|
||||
auto transaction = tokens.begin_transaction();
|
||||
if (auto value = parse_integer_value(tokens)) {
|
||||
if (value->is_calculated()) {
|
||||
transaction.commit();
|
||||
return PropertyAndValue { *property, value };
|
||||
}
|
||||
if (value->is_integer() && property_accepts_integer(*property, value->as_integer().integer())) {
|
||||
if ((value->is_integer() && property_accepts_integer(*property, value->as_integer().integer())) || !value->is_integer()) {
|
||||
transaction.commit();
|
||||
return PropertyAndValue { *property, value };
|
||||
}
|
||||
|
|
@ -205,11 +201,7 @@ Optional<Parser::PropertyAndValue> Parser::parse_css_value_for_properties(Readon
|
|||
auto context_guard = push_temporary_value_parsing_context(*property);
|
||||
auto transaction = tokens.begin_transaction();
|
||||
if (auto value = parse_number_value(tokens)) {
|
||||
if (value->is_calculated()) {
|
||||
transaction.commit();
|
||||
return PropertyAndValue { *property, value };
|
||||
}
|
||||
if (value->is_number() && property_accepts_number(*property, value->as_number().number())) {
|
||||
if ((value->is_number() && property_accepts_number(*property, value->as_number().number())) || !value->is_number()) {
|
||||
transaction.commit();
|
||||
return PropertyAndValue { *property, value };
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue