LibWeb: Only set has_span if there is a number following the css value

To follow spec more closely, only set the has_span value if there is a
number immediately following, like "span 2". Otherwise the span value
should be ignored.
This commit is contained in:
martinfalisse 2022-09-07 15:00:29 +02:00 committed by Andreas Kling
parent 493c6cf0fd
commit 0613972f0c
Notes: sideshowbarker 2024-07-18 22:57:59 +09:00

View file

@ -5363,13 +5363,16 @@ RefPtr<StyleValue> Parser::parse_grid_track_placement(Vector<ComponentValue> con
}
auto first_grid_track_placement = CSS::GridTrackPlacement();
auto has_span = false;
if (current_token.to_string() == "span"sv) {
first_grid_track_placement.set_has_span(true);
has_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()) {
first_grid_track_placement.set_position(static_cast<int>(current_token.number_value()));
first_grid_track_placement.set_has_span(has_span);
}
if (!tokens.has_next_token())
return GridTrackPlacementStyleValue::create(first_grid_track_placement);
@ -5391,13 +5394,16 @@ RefPtr<StyleValue> Parser::parse_grid_track_placement_shorthand_value(Vector<Com
auto calculate_grid_track_placement = [](auto& current_token, auto& tokens) -> CSS::GridTrackPlacement {
auto grid_track_placement = CSS::GridTrackPlacement();
auto has_span = false;
if (current_token.to_string() == "span"sv) {
grid_track_placement.set_has_span(true);
has_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()) {
grid_track_placement.set_position(static_cast<int>(current_token.number_value()));
grid_track_placement.set_has_span(has_span);
}
return grid_track_placement;
};