mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
LibWeb: First cut of extremely naive table row layout
This first version simply auto-sizes all table cells and then places them on a horizontal line.
This commit is contained in:
parent
c5a3d99dd5
commit
196a3986d6
Notes:
sideshowbarker
2024-07-19 05:41:32 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/196a3986d68
2 changed files with 12 additions and 2 deletions
|
@ -39,9 +39,18 @@ LayoutTableRow::~LayoutTableRow()
|
|||
{
|
||||
}
|
||||
|
||||
void LayoutTableRow::layout(LayoutMode layout_mode)
|
||||
void LayoutTableRow::layout(LayoutMode)
|
||||
{
|
||||
LayoutBox::layout(layout_mode);
|
||||
float tallest_cell_height = 0;
|
||||
float content_width = 0;
|
||||
for_each_child_of_type<LayoutTableCell>([&](auto& cell) {
|
||||
cell.layout(LayoutMode::OnlyRequiredLineBreaks);
|
||||
cell.set_offset(effective_offset().translated(content_width, 0));
|
||||
content_width += cell.width();
|
||||
tallest_cell_height = max(tallest_cell_height, cell.height());
|
||||
});
|
||||
set_width(content_width);
|
||||
set_height(tallest_cell_height);
|
||||
}
|
||||
|
||||
LayoutTableCell* LayoutTableRow::first_cell()
|
||||
|
|
|
@ -49,6 +49,7 @@ void LayoutTableRowGroup::layout(LayoutMode layout_mode)
|
|||
float content_height = 0;
|
||||
|
||||
for_each_child_of_type<LayoutTableRow>([&](auto& row) {
|
||||
row.set_offset(0, content_height);
|
||||
row.layout(layout_mode);
|
||||
content_height += row.height();
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue