From db121c7af12013f80be5e9154aeaa69a0529e59a Mon Sep 17 00:00:00 2001 From: Andi Gallo Date: Thu, 15 Jun 2023 03:13:52 +0000 Subject: [PATCH] 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. --- .../grid-template-block-components-whitespace-crash.txt | 3 +++ .../grid-template-block-components-whitespace-crash.html | 7 +++++++ Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 1 + 3 files changed, 11 insertions(+) create mode 100644 Tests/LibWeb/Layout/expected/misc/grid-template-block-components-whitespace-crash.txt create mode 100644 Tests/LibWeb/Layout/input/misc/grid-template-block-components-whitespace-crash.html diff --git a/Tests/LibWeb/Layout/expected/misc/grid-template-block-components-whitespace-crash.txt b/Tests/LibWeb/Layout/expected/misc/grid-template-block-components-whitespace-crash.txt new file mode 100644 index 0000000000..8daf021063 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/misc/grid-template-block-components-whitespace-crash.txt @@ -0,0 +1,3 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline + BlockContainer at (8,8) content-size 784x0 children: not-inline diff --git a/Tests/LibWeb/Layout/input/misc/grid-template-block-components-whitespace-crash.html b/Tests/LibWeb/Layout/input/misc/grid-template-block-components-whitespace-crash.html new file mode 100644 index 0000000000..a126c67655 --- /dev/null +++ b/Tests/LibWeb/Layout/input/misc/grid-template-block-components-whitespace-crash.html @@ -0,0 +1,7 @@ + diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index ba7e886e43..4fc03f122e 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -7565,6 +7565,7 @@ ErrorOr> Parser::parse_grid_track_size_list(Vector