mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
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:
parent
493c6cf0fd
commit
0613972f0c
Notes:
sideshowbarker
2024-07-18 22:57:59 +09:00
Author: https://github.com/martinfalisse Commit: https://github.com/SerenityOS/serenity/commit/0613972f0c Pull-request: https://github.com/SerenityOS/serenity/pull/15155 Reviewed-by: https://github.com/MacDue
1 changed files with 10 additions and 4 deletions
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue