mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
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).
This commit is contained in:
parent
829186af7d
commit
994d996ab2
Notes:
sideshowbarker
2024-07-17 08:25:15 +09:00
Author: https://github.com/martinfalisse Commit: https://github.com/SerenityOS/serenity/commit/994d996ab2 Pull-request: https://github.com/SerenityOS/serenity/pull/15514
1 changed files with 2 additions and 1 deletions
|
@ -1145,8 +1145,9 @@ void OccupationGrid::maybe_add_column(int needed_number_of_columns)
|
||||||
{
|
{
|
||||||
if (needed_number_of_columns <= column_count())
|
if (needed_number_of_columns <= column_count())
|
||||||
return;
|
return;
|
||||||
|
auto column_count_before_modification = column_count();
|
||||||
for (auto& occupation_grid_row : m_occupation_grid)
|
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);
|
occupation_grid_row.append(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue