1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 18:20:43 +09:00

LibWeb: Support CSS functions other than calc() for grid sizes

Makes grid size parser to handle not only calc() but min(), max() and
other CSS functions we support.
This commit is contained in:
Aliaksandr Kalenik 2023-06-21 03:07:28 +03:00 committed by Andreas Kling
parent afe53a4856
commit a8211abc1e
Notes: sideshowbarker 2024-07-17 11:30:05 +09:00
3 changed files with 33 additions and 9 deletions

View file

@ -7339,15 +7339,9 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_as_css_value(PropertyID property_id)
Optional<CSS::GridSize> Parser::parse_grid_size(ComponentValue const& component_value)
{
if (component_value.is_function()) {
auto const& function = component_value.function();
if (function.name().equals_ignoring_ascii_case("calc"sv)) {
auto calculated_style_value = parse_calculated_value(function.values());
if (calculated_style_value.is_error() || calculated_style_value.value().is_null()) {
// FIXME: Propagate error
return {};
}
return GridSize(LengthPercentage { *calculated_style_value.release_value() });
}
if (auto maybe_dynamic = parse_dynamic_value(component_value); !maybe_dynamic.is_error() && maybe_dynamic.value())
return GridSize(LengthPercentage(maybe_dynamic.release_value()->as_calculated()));
return {};
}
auto token = component_value.token();