LibWeb: Take rowspan into account while table formatting

This commit is contained in:
Aliaksandr Kalenik 2022-12-04 22:44:19 +03:00 committed by Andreas Kling
parent 1c6783cd7e
commit dbf76e8ae1
Notes: sideshowbarker 2024-07-17 22:55:25 +09:00
3 changed files with 9 additions and 1 deletions

View file

@ -29,4 +29,11 @@ size_t TableCellBox::colspan() const
return verify_cast<DOM::Element>(*dom_node()).attribute(HTML::AttributeNames::colspan).to_uint().value_or(1);
}
size_t TableCellBox::rowspan() const
{
if (!dom_node())
return 1;
return verify_cast<DOM::Element>(*dom_node()).attribute(HTML::AttributeNames::rowspan).to_uint().value_or(1);
}
}

View file

@ -22,6 +22,7 @@ public:
TableCellBox const* next_cell() const { return next_sibling_of_type<TableCellBox>(); }
size_t colspan() const;
size_t rowspan() const;
static CSS::Display static_display() { return CSS::Display { CSS::Display::Internal::TableCell }; }
};

View file

@ -66,7 +66,7 @@ void TableFormattingContext::calculate_row_column_grid(Box const& box)
x_width++;
const size_t colspan = static_cast<TableCellBox*>(child)->colspan();
const size_t rowspan = 1;
const size_t rowspan = static_cast<TableCellBox*>(child)->rowspan();
if (x_width < x_current + colspan)
x_width = x_current + colspan;