2020-06-09 21:08:15 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-06-09 21:08:15 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <LibWeb/DOM/Element.h>
|
2020-11-22 15:53:01 +01:00
|
|
|
#include <LibWeb/Layout/TableCellBox.h>
|
|
|
|
|
#include <LibWeb/Layout/TableRowBox.h>
|
|
|
|
|
#include <LibWeb/Layout/TableRowGroupBox.h>
|
2020-06-09 21:08:15 +02:00
|
|
|
|
2020-11-22 15:53:01 +01:00
|
|
|
namespace Web::Layout {
|
2020-06-09 21:08:15 +02:00
|
|
|
|
2020-11-22 15:53:01 +01:00
|
|
|
TableRowGroupBox::TableRowGroupBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
|
|
|
|
|
: Layout::BlockBox(document, &element, move(style))
|
2020-06-09 21:08:15 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-22 15:53:01 +01:00
|
|
|
TableRowGroupBox::~TableRowGroupBox()
|
2020-06-09 21:08:15 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-22 15:53:01 +01:00
|
|
|
size_t TableRowGroupBox::column_count() const
|
2020-06-13 00:12:23 +02:00
|
|
|
{
|
|
|
|
|
size_t table_column_count = 0;
|
2020-11-22 15:53:01 +01:00
|
|
|
for_each_child_of_type<TableRowBox>([&](auto& row) {
|
2020-06-13 00:12:23 +02:00
|
|
|
size_t row_column_count = 0;
|
2020-11-22 15:53:01 +01:00
|
|
|
row.template for_each_child_of_type<TableCellBox>([&](auto& cell) {
|
2020-06-13 00:12:23 +02:00
|
|
|
row_column_count += cell.colspan();
|
|
|
|
|
});
|
|
|
|
|
table_column_count = max(table_column_count, row_column_count);
|
|
|
|
|
});
|
|
|
|
|
return table_column_count;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-09 21:08:15 +02:00
|
|
|
}
|