diff --git a/Base/res/html/misc/display-grid.html b/Base/res/html/misc/display-grid.html
index 4b50444c51a..eb7a33af172 100644
--- a/Base/res/html/misc/display-grid.html
+++ b/Base/res/html/misc/display-grid.html
@@ -48,6 +48,15 @@
3
+
+If you can see this message then the test passed.
+
+
Should render a 2x2 grid with columns 50px and 50%
Parser::parse_grid_track_placement(Vector con
// If the is omitted, it defaults to 1.
if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_case("span"sv))
return GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement(1, true));
- if (current_token.is(Token::Type::Number) && current_token.number().is_integer())
+ // https://drafts.csswg.org/css-grid/#grid-placement-int
+ // [ | ] && ?
+ // An value of zero makes the declaration invalid.
+ if (current_token.is(Token::Type::Number) && current_token.number().is_integer() && current_token.number_value() != 0)
return GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement(static_cast(current_token.number_value())));
return {};
}
@@ -5468,7 +5471,10 @@ RefPtr Parser::parse_grid_track_placement(Vector con
current_token = tokens.next_token().token();
}
- if (current_token.is(Token::Type::Number) && current_token.number().is_integer() && !tokens.has_next_token()) {
+ // https://drafts.csswg.org/css-grid/#grid-placement-int
+ // [ | ] && ?
+ // An value of zero makes the declaration invalid.
+ if (current_token.is(Token::Type::Number) && current_token.number().is_integer() && current_token.number_value() != 0 && !tokens.has_next_token()) {
// https://drafts.csswg.org/css-grid/#grid-placement-span-int
// Negative integers or zero are invalid.
if (is_span && static_cast(current_token.number_value()) < 1)
@@ -5490,25 +5496,33 @@ RefPtr Parser::parse_grid_track_placement_shorthand_value(Vector is omitted, it defaults to 1.
if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_case("span"sv))
return GridTrackPlacementShorthandStyleValue::create(CSS::GridTrackPlacement(1, true));
- if (current_token.is(Token::Type::Number) && current_token.number().is_integer())
+ // https://drafts.csswg.org/css-grid/#grid-placement-int
+ // [ | ] && ?
+ // An value of zero makes the declaration invalid.
+ if (current_token.is(Token::Type::Number) && current_token.number().is_integer() && current_token.number_value() != 0)
return GridTrackPlacementShorthandStyleValue::create(CSS::GridTrackPlacement(current_token.number_value()));
return {};
}
- auto calculate_grid_track_placement = [](auto& current_token, auto& tokens) -> CSS::GridTrackPlacement {
+ auto calculate_grid_track_placement = [](auto& current_token, auto& tokens) -> Optional {
auto is_span = false;
if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_case("span"sv)) {
is_span = true;
tokens.skip_whitespace();
current_token = tokens.next_token().token();
}
- if (current_token.is(Token::Type::Number) && current_token.number().is_integer()) {
+ if (current_token.is(Token::Type::Number) && current_token.number().is_integer() && current_token.number_value() != 0) {
// https://drafts.csswg.org/css-grid/#grid-placement-span-int
// Negative integers or zero are invalid.
if (is_span && static_cast(current_token.number_value()) < 1)
return CSS::GridTrackPlacement(1, true);
return CSS::GridTrackPlacement(static_cast(current_token.number_value()), is_span);
}
+ // https://drafts.csswg.org/css-grid/#grid-placement-int
+ // [ | ] && ?
+ // An value of zero makes the declaration invalid.
+ if (current_token.is(Token::Type::Number) && current_token.number().is_integer() && current_token.number_value() == 0)
+ return {};
// https://drafts.csswg.org/css-grid/#grid-placement-span-int
// If the is omitted, it defaults to 1.
if (is_span && current_token.is(Token::Type::Delim) && current_token.delim() == "/"sv)
@@ -5517,8 +5531,8 @@ RefPtr Parser::parse_grid_track_placement_shorthand_value(Vector Parser::parse_grid_track_placement_shorthand_value(Vector