LibWeb: Reserve enough space for span>1 columns in BorderConflictFinder

This code previously only allocated enough space in
m_col_elements_by_index for 1 slot per column, meaning that columns
with a span > 1 would write off the end of it.
This commit is contained in:
Sam Atkins 2024-07-27 14:17:57 +01:00 committed by Tim Ledbetter
commit 9e32c9329a
Notes: github-actions[bot] 2024-07-27 19:24:08 +00:00
3 changed files with 22 additions and 0 deletions

View file

@ -1386,6 +1386,7 @@ void TableFormattingContext::BorderConflictFinder::collect_conflicting_col_eleme
VERIFY(child_of_column_group->display().is_table_column());
auto const& col_node = static_cast<HTML::HTMLTableColElement const&>(*child_of_column_group->dom_node());
unsigned span = col_node.get_attribute_value(HTML::AttributeNames::span).to_number<unsigned>().value_or(1);
m_col_elements_by_index.resize(column_index + span);
for (size_t i = column_index; i < column_index + span; ++i) {
m_col_elements_by_index[i] = child_of_column_group;
}