From 994d996ab20df3f19e0b6c359a743e7dd76360f0 Mon Sep 17 00:00:00 2001 From: martinfalisse Date: Sat, 8 Oct 2022 14:27:20 +0200 Subject: [PATCH] LibWeb: Fix bug in maybe_add_column() Fixes a bug in the maybe_add_column() implementation of the OccupationGrid. Previously were checking for the width of the grid based off of the first row, and so when augmenting the column count row-by-row the latter rows would have differing column counts. Also, were doing an unnecessary + 1 which I imagine comes from before when I wasn't quite clear on whether I was referring to columns by index or by the css-value of the column (column 1 in the css is column index 0). --- Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp index f41e0ecf5c..35c15ec415 100644 --- a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp @@ -1145,8 +1145,9 @@ void OccupationGrid::maybe_add_column(int needed_number_of_columns) { if (needed_number_of_columns <= column_count()) return; + auto column_count_before_modification = column_count(); for (auto& occupation_grid_row : m_occupation_grid) - for (int idx = 0; idx < (needed_number_of_columns + 1) - column_count(); idx++) + for (int idx = 0; idx < needed_number_of_columns - column_count_before_modification; idx++) occupation_grid_row.append(false); }