LibWeb: Remove inheritance of TableRowGroupBox from BlockContainer

Having `TableRowGroupBox` not inherited from `BlockContainer`
allows to write more simpler layout code.
This commit is contained in:
Aliaksandr Kalenik 2023-01-09 07:17:28 +03:00 committed by Andreas Kling
parent 1bdc4e6b29
commit c8337e9ee8
Notes: sideshowbarker 2024-07-17 03:30:41 +09:00
3 changed files with 7 additions and 10 deletions

View file

@ -457,19 +457,16 @@ void TableFormattingContext::run(Box const& box, LayoutMode, AvailableSpace cons
auto& row_group_box_state = m_state.get_mutable(row_group_box);
row_group_box_state.set_content_y(row_group_top_offset);
CSSPixels row_top_offset = 0.0f;
row_group_box.template for_each_child_of_type<TableRowBox>([&](auto& row) {
auto& row_state = m_state.get_mutable(row);
row_state.set_content_y(row_top_offset);
auto const& row_state = m_state.get(row);
row_group_height += row_state.border_box_height();
row_group_width = max(row_group_width, row_state.border_box_width());
row_top_offset += row_state.border_box_height();
});
row_group_top_offset += row_top_offset;
row_group_box_state.set_content_height(row_group_height);
row_group_box_state.set_content_width(row_group_width);
row_group_top_offset += row_group_height;
});
for (auto& cell : m_cells) {

View file

@ -12,7 +12,7 @@
namespace Web::Layout {
TableRowGroupBox::TableRowGroupBox(DOM::Document& document, DOM::Element* element, NonnullRefPtr<CSS::StyleProperties> style)
: Layout::BlockContainer(document, element, move(style))
: Layout::Box(document, element, move(style))
{
}

View file

@ -6,12 +6,12 @@
#pragma once
#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/Box.h>
namespace Web::Layout {
class TableRowGroupBox final : public BlockContainer {
JS_CELL(TableRowGroupBox, BlockContainer);
class TableRowGroupBox final : public Box {
JS_CELL(TableRowGroupBox, Box);
public:
TableRowGroupBox(DOM::Document&, DOM::Element*, NonnullRefPtr<CSS::StyleProperties>);