1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:38:12 +00:00

LibWeb: Parse rect style value

Add ability to parse a rect when it is used as the value of a style
property.
This commit is contained in:
Tom 2022-07-31 18:46:35 +02:00 committed by Andreas Kling
parent 4d1ceaaa43
commit b4dd477644
7 changed files with 117 additions and 0 deletions

View file

@ -501,6 +501,11 @@ bool property_accepts_value(PropertyID property_id, StyleValue& style_value)
output_numeric_value_check(property_generator, "has_number"sv, "to_number()"sv, Array { "Integer"sv, "Number"sv }, min_value, max_value);
} else if (type_name == "percentage") {
output_numeric_value_check(property_generator, "is_percentage"sv, "as_percentage().percentage().value()"sv, Array { "Percentage"sv }, min_value, max_value);
} else if (type_name == "rect") {
property_generator.append(R"~~~(
if (style_value.has_rect())
return true;
)~~~");
} else if (type_name == "resolution") {
output_numeric_value_check(property_generator, "is_resolution"sv, "as_resolution().resolution().to_dots_per_pixel()"sv, Array<StringView, 0> {}, min_value, max_value);
} else if (type_name == "string") {