LibWeb: Take rowspan into account while table formatting
This commit is contained in:
parent
1c6783cd7e
commit
dbf76e8ae1
Notes:
sideshowbarker
2024-07-17 22:55:25 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/dbf76e8ae1 Pull-request: https://github.com/SerenityOS/serenity/pull/16285
3 changed files with 9 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 }; }
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue