mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 02:48:11 +00:00
LibWeb: Allow anonymous table, table-row and table-cell layout nodes
This commit is contained in:
parent
75829c1b81
commit
d3046a2649
7 changed files with 32 additions and 13 deletions
|
@ -135,11 +135,11 @@ RefPtr<Layout::Node> Element::create_layout_node()
|
|||
if (display == CSS::Display::ListItem)
|
||||
return adopt(*new Layout::ListItemBox(document(), *this, move(style)));
|
||||
if (display == CSS::Display::Table)
|
||||
return adopt(*new Layout::TableBox(document(), *this, move(style)));
|
||||
return adopt(*new Layout::TableBox(document(), this, move(style)));
|
||||
if (display == CSS::Display::TableRow)
|
||||
return adopt(*new Layout::TableRowBox(document(), *this, move(style)));
|
||||
return adopt(*new Layout::TableRowBox(document(), this, move(style)));
|
||||
if (display == CSS::Display::TableCell)
|
||||
return adopt(*new Layout::TableCellBox(document(), *this, move(style)));
|
||||
return adopt(*new Layout::TableCellBox(document(), this, move(style)));
|
||||
if (display == CSS::Display::TableRowGroup || display == CSS::Display::TableHeaderGroup || display == CSS::Display::TableFooterGroup)
|
||||
return adopt(*new Layout::TableRowGroupBox(document(), *this, move(style)));
|
||||
if (display == CSS::Display::InlineBlock) {
|
||||
|
|
|
@ -29,8 +29,13 @@
|
|||
|
||||
namespace Web::Layout {
|
||||
|
||||
TableBox::TableBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
: Layout::BlockBox(document, &element, move(style))
|
||||
TableBox::TableBox(DOM::Document& document, DOM::Element* element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
: Layout::BlockBox(document, element, move(style))
|
||||
{
|
||||
}
|
||||
|
||||
TableBox::TableBox(DOM::Document& document, DOM::Element* element, CSS::ComputedValues computed_values)
|
||||
: Layout::BlockBox(document, element, move(computed_values))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@ namespace Web::Layout {
|
|||
|
||||
class TableBox final : public Layout::BlockBox {
|
||||
public:
|
||||
TableBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
TableBox(DOM::Document&, DOM::Element*, NonnullRefPtr<CSS::StyleProperties>);
|
||||
TableBox(DOM::Document&, DOM::Element*, CSS::ComputedValues);
|
||||
virtual ~TableBox() override;
|
||||
};
|
||||
|
||||
|
|
|
@ -30,8 +30,13 @@
|
|||
|
||||
namespace Web::Layout {
|
||||
|
||||
TableCellBox::TableCellBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
: Layout::BlockBox(document, &element, move(style))
|
||||
TableCellBox::TableCellBox(DOM::Document& document, DOM::Element* element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
: Layout::BlockBox(document, element, move(style))
|
||||
{
|
||||
}
|
||||
|
||||
TableCellBox::TableCellBox(DOM::Document& document, DOM::Element* element, CSS::ComputedValues computed_values)
|
||||
: Layout::BlockBox(document, element, move(computed_values))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -41,7 +46,8 @@ TableCellBox::~TableCellBox()
|
|||
|
||||
size_t TableCellBox::colspan() const
|
||||
{
|
||||
ASSERT(dom_node());
|
||||
if (!dom_node())
|
||||
return 0;
|
||||
return downcast<DOM::Element>(*dom_node()).attribute(HTML::AttributeNames::colspan).to_uint().value_or(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@ namespace Web::Layout {
|
|||
|
||||
class TableCellBox final : public BlockBox {
|
||||
public:
|
||||
TableCellBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
TableCellBox(DOM::Document&, DOM::Element*, NonnullRefPtr<CSS::StyleProperties>);
|
||||
TableCellBox(DOM::Document&, DOM::Element*, CSS::ComputedValues);
|
||||
virtual ~TableCellBox() override;
|
||||
|
||||
TableCellBox* next_cell() { return next_sibling_of_type<TableCellBox>(); }
|
||||
|
|
|
@ -29,8 +29,13 @@
|
|||
|
||||
namespace Web::Layout {
|
||||
|
||||
TableRowBox::TableRowBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
: Box(document, &element, move(style))
|
||||
TableRowBox::TableRowBox(DOM::Document& document, DOM::Element* element, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
: Box(document, element, move(style))
|
||||
{
|
||||
}
|
||||
|
||||
TableRowBox::TableRowBox(DOM::Document& document, DOM::Element* element, CSS::ComputedValues computed_values)
|
||||
: Box(document, element, move(computed_values))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@ namespace Web::Layout {
|
|||
|
||||
class TableRowBox final : public Box {
|
||||
public:
|
||||
TableRowBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>);
|
||||
TableRowBox(DOM::Document&, DOM::Element*, NonnullRefPtr<CSS::StyleProperties>);
|
||||
TableRowBox(DOM::Document&, DOM::Element*, CSS::ComputedValues);
|
||||
virtual ~TableRowBox() override;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue