mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWeb/CSS: Rewrite CSS Parser core methods according to new spec
CSS Syntax 3 (https://drafts.csswg.org/css-syntax) has changed significantly since we implemented it a couple of years ago. Just about every parsing algorithm has been rewritten in terms of the new token stream concept, and to support nested styles. As all of those algorithms call into each other, this is an unfortunately chonky diff. As part of this, the transitory types (Declaration, Function, AtRule...) have been rewritten. That's both because we have new requirements of what they should be and contain, and also because the spec asks us to create and then gradually modify them in place, which is easier if they are plain structs.
This commit is contained in:
committed by
Andreas Kling
parent
f11c0e6cc0
commit
e0be17e4fb
@@ -118,7 +118,7 @@ static Optional<RoundingStrategy> parse_rounding_strategy(Vector<ComponentValue>
|
||||
|
||||
OwnPtr<CalculationNode> Parser::parse_math_function(PropertyID property_id, Function const& function)
|
||||
{
|
||||
TokenStream stream { function.values() };
|
||||
TokenStream stream { function.value };
|
||||
auto arguments = parse_a_comma_separated_list_of_component_values(stream);
|
||||
)~~~");
|
||||
|
||||
@@ -129,7 +129,7 @@ OwnPtr<CalculationNode> Parser::parse_math_function(PropertyID property_id, Func
|
||||
auto function_generator = generator.fork();
|
||||
function_generator.set("name:lowercase", name);
|
||||
function_generator.set("name:titlecase", title_casify(name));
|
||||
function_generator.appendln(" if (function.name().equals_ignoring_ascii_case(\"@name:lowercase@\"sv)) {");
|
||||
function_generator.appendln(" if (function.name.equals_ignoring_ascii_case(\"@name:lowercase@\"sv)) {");
|
||||
if (function_data.get_bool("is-variadic"sv).value_or(false)) {
|
||||
// Variadic function
|
||||
function_generator.append(R"~~~(
|
||||
|
||||
Reference in New Issue
Block a user