LibWeb: Handle leading whitespace in grid-template-* block components

We're already handling whitespace between components, do the same for
leading whitespace. Fixes crash on https://distill.pub/2021/gnn-intro.
This commit is contained in:
Andi Gallo 2023-06-15 03:13:52 +00:00 committed by Andreas Kling
parent 586b47cede
commit db121c7af1
Notes: sideshowbarker 2024-07-17 22:55:25 +09:00
3 changed files with 11 additions and 0 deletions

View file

@ -0,0 +1,3 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x0 children: not-inline

View file

@ -0,0 +1,7 @@
<style>
test {
display: grid;
width: 100%;
grid-template-columns: 50px [ first second ] 1fr;
}
</style>

View file

@ -7565,6 +7565,7 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_grid_track_size_list(Vector<ComponentV
if (!token.block().is_square())
return GridTrackSizeListStyleValue::make_auto();
TokenStream block_tokens { token.block().values() };
block_tokens.skip_whitespace();
while (block_tokens.has_next_token()) {
auto current_block_token = block_tokens.next_token();
auto maybe_string = String::from_utf8(current_block_token.token().ident());