From 34cd7f4c2276a459f2a5fc884dfb1f9328ca766a Mon Sep 17 00:00:00 2001 From: Andi Gallo Date: Wed, 9 Aug 2023 21:15:11 +0000 Subject: [PATCH] LibWeb: Verify that table cells have a paintable when collecting them Replicate the more conservative way it's done for other nodes, for which we verify whether they have a paintable before doing painting-related operations with it. Fixes crash on https://www.haiku-os.org/. --- .../expected/table/table-cell-not-paintable.txt | 17 +++++++++++++++++ .../input/table/table-cell-not-paintable.html | 2 ++ .../LibWeb/Painting/TableBordersPainting.cpp | 5 +++-- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 Tests/LibWeb/Layout/expected/table/table-cell-not-paintable.txt create mode 100644 Tests/LibWeb/Layout/input/table/table-cell-not-paintable.html diff --git a/Tests/LibWeb/Layout/expected/table/table-cell-not-paintable.txt b/Tests/LibWeb/Layout/expected/table/table-cell-not-paintable.txt new file mode 100644 index 0000000000..2cdca45771 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/table/table-cell-not-paintable.txt @@ -0,0 +1,17 @@ +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 784x17.46875 children: inline + line 0 width: 10, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from BlockContainer start: 0, length: 0, rect: [13,19 0x0] + BlockContainer \ No newline at end of file diff --git a/Userland/Libraries/LibWeb/Painting/TableBordersPainting.cpp b/Userland/Libraries/LibWeb/Painting/TableBordersPainting.cpp index 5535328e90..ece705f1d4 100644 --- a/Userland/Libraries/LibWeb/Painting/TableBordersPainting.cpp +++ b/Userland/Libraries/LibWeb/Painting/TableBordersPainting.cpp @@ -34,8 +34,9 @@ static void collect_cell_boxes(Vector& cell_boxes, Layout:: { box.for_each_child([&](auto& child) { if (child.display().is_table_cell()) { - VERIFY(is(child) && child.paintable()); - cell_boxes.append(static_cast(child).paintable_box()); + VERIFY(is(child)); + if (child.paintable()) + cell_boxes.append(static_cast(child).paintable_box()); } else { collect_cell_boxes(cell_boxes, child); }