1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00

LibWeb/CSS: Support calc() in grid placement values

Fixes reduction in https://github.com/SerenityOS/serenity/issues/22802
but does not result in visual improvement on https://kotlinlang.org/
This commit is contained in:
Aliaksandr Kalenik 2024-01-17 13:18:57 +01:00 committed by Andreas Kling
parent c254de3509
commit a22ef086f5
3 changed files with 101 additions and 0 deletions

View file

@ -5692,6 +5692,10 @@ RefPtr<StyleValue> Parser::parse_grid_track_placement(TokenStream<ComponentValue
// `parse_grid_area_shorthand_value()` using a single TokenStream.
if (tokens.remaining_token_count() == 1) {
auto& token = tokens.next_token();
if (auto maybe_calculated = parse_calculated_value(token); maybe_calculated && maybe_calculated->resolves_to_number()) {
transaction.commit();
return GridTrackPlacementStyleValue::create(GridTrackPlacement::make_line(static_cast<int>(maybe_calculated->resolve_integer().value()), {}));
}
if (token.is_ident("auto"sv)) {
transaction.commit();
return GridTrackPlacementStyleValue::create(GridTrackPlacement::make_auto());