1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:17:45 +00:00

LibWeb: Consider colgroups while calculating table grid size

We should take in account <col> elements in column groups while finding
number of columns in a table.
This commit is contained in:
Aliaksandr Kalenik 2023-11-04 04:08:59 +01:00 committed by Andreas Kling
parent 6d31d81309
commit 2660bbb94f
4 changed files with 35 additions and 0 deletions

View file

@ -5,6 +5,7 @@
*/
#include <LibWeb/HTML/HTMLTableCellElement.h>
#include <LibWeb/HTML/HTMLTableColElement.h>
#include <LibWeb/Layout/TableGrid.h>
namespace Web::Layout {
@ -62,6 +63,18 @@ TableGrid TableGrid::calculate_row_column_grid(Box const& box, Vector<Cell>& cel
y_current++;
};
auto process_col_group = [&](auto& col_group) {
auto dom_node = col_group.dom_node();
dom_node->template for_each_in_subtree_of_type<HTML::HTMLTableColElement>([&](auto&) {
x_width += 1;
return IterationDecision::Continue;
});
};
for_each_child_box_matching(box, is_table_column_group, [&](auto& column_group_box) {
process_col_group(column_group_box);
});
for_each_child_box_matching(box, is_table_row_group, [&](auto& row_group_box) {
for_each_child_box_matching(row_group_box, is_table_row, [&](auto& row_box) {
process_row(row_box);