mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:58:11 +00:00
LibHTML: Add stub classes for basic table layout
This class introduces LayoutTable, LayoutTableRow and LayoutTableCell. These are produced by "display" values table, table-row and table-cell respectively. Note that there's no layout happening yet, I'm just adding the classes.
This commit is contained in:
parent
14f380f87a
commit
41896ff521
9 changed files with 107 additions and 0 deletions
|
@ -109,3 +109,15 @@ hr {
|
|||
blink {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
table {
|
||||
display: table;
|
||||
}
|
||||
|
||||
tr {
|
||||
display: table-row;
|
||||
}
|
||||
|
||||
td {
|
||||
display: table-cell;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
#include <LibHTML/Layout/LayoutBlock.h>
|
||||
#include <LibHTML/Layout/LayoutInline.h>
|
||||
#include <LibHTML/Layout/LayoutListItem.h>
|
||||
#include <LibHTML/Layout/LayoutTable.h>
|
||||
#include <LibHTML/Layout/LayoutTableCell.h>
|
||||
#include <LibHTML/Layout/LayoutTableRow.h>
|
||||
|
||||
Element::Element(Document& document, const String& tag_name)
|
||||
: ParentNode(document, NodeType::ELEMENT_NODE)
|
||||
|
@ -84,6 +87,12 @@ RefPtr<LayoutNode> Element::create_layout_node(const StyleProperties* parent_sty
|
|||
return adopt(*new LayoutInline(*this, move(style)));
|
||||
if (display == "list-item")
|
||||
return adopt(*new LayoutListItem(*this, move(style)));
|
||||
if (display == "table")
|
||||
return adopt(*new LayoutTable(*this, move(style)));
|
||||
if (display == "table-row")
|
||||
return adopt(*new LayoutTableRow(*this, move(style)));
|
||||
if (display == "table-cell")
|
||||
return adopt(*new LayoutTableCell(*this, move(style)));
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
|
16
Libraries/LibHTML/Layout/LayoutTable.cpp
Normal file
16
Libraries/LibHTML/Layout/LayoutTable.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include <LibHTML/DOM/Element.h>
|
||||
#include <LibHTML/Layout/LayoutTable.h>
|
||||
|
||||
LayoutTable::LayoutTable(const Element& element, NonnullRefPtr<StyleProperties> style)
|
||||
: LayoutBlock(&element, move(style))
|
||||
{
|
||||
}
|
||||
|
||||
LayoutTable::~LayoutTable()
|
||||
{
|
||||
}
|
||||
|
||||
void LayoutTable::layout()
|
||||
{
|
||||
LayoutBlock::layout();
|
||||
}
|
14
Libraries/LibHTML/Layout/LayoutTable.h
Normal file
14
Libraries/LibHTML/Layout/LayoutTable.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibHTML/Layout/LayoutBlock.h>
|
||||
|
||||
class LayoutTable final : public LayoutBlock {
|
||||
public:
|
||||
LayoutTable(const Element&, NonnullRefPtr<StyleProperties>);
|
||||
virtual ~LayoutTable() override;
|
||||
|
||||
virtual void layout() override;
|
||||
|
||||
private:
|
||||
virtual const char* class_name() const override { return "LayoutTable"; }
|
||||
};
|
11
Libraries/LibHTML/Layout/LayoutTableCell.cpp
Normal file
11
Libraries/LibHTML/Layout/LayoutTableCell.cpp
Normal file
|
@ -0,0 +1,11 @@
|
|||
#include <LibHTML/DOM/Element.h>
|
||||
#include <LibHTML/Layout/LayoutTableCell.h>
|
||||
|
||||
LayoutTableCell::LayoutTableCell(const Element& element, NonnullRefPtr<StyleProperties> style)
|
||||
: LayoutBlock(&element, move(style))
|
||||
{
|
||||
}
|
||||
|
||||
LayoutTableCell::~LayoutTableCell()
|
||||
{
|
||||
}
|
12
Libraries/LibHTML/Layout/LayoutTableCell.h
Normal file
12
Libraries/LibHTML/Layout/LayoutTableCell.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibHTML/Layout/LayoutBlock.h>
|
||||
|
||||
class LayoutTableCell final : public LayoutBlock {
|
||||
public:
|
||||
LayoutTableCell(const Element&, NonnullRefPtr<StyleProperties>);
|
||||
virtual ~LayoutTableCell() override;
|
||||
|
||||
private:
|
||||
virtual const char* class_name() const override { return "LayoutTableCell"; }
|
||||
};
|
16
Libraries/LibHTML/Layout/LayoutTableRow.cpp
Normal file
16
Libraries/LibHTML/Layout/LayoutTableRow.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include <LibHTML/DOM/Element.h>
|
||||
#include <LibHTML/Layout/LayoutTableRow.h>
|
||||
|
||||
LayoutTableRow::LayoutTableRow(const Element& element, NonnullRefPtr<StyleProperties> style)
|
||||
: LayoutBox(&element, move(style))
|
||||
{
|
||||
}
|
||||
|
||||
LayoutTableRow::~LayoutTableRow()
|
||||
{
|
||||
}
|
||||
|
||||
void LayoutTableRow::layout()
|
||||
{
|
||||
LayoutBox::layout();
|
||||
}
|
14
Libraries/LibHTML/Layout/LayoutTableRow.h
Normal file
14
Libraries/LibHTML/Layout/LayoutTableRow.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibHTML/Layout/LayoutBox.h>
|
||||
|
||||
class LayoutTableRow final : public LayoutBox {
|
||||
public:
|
||||
LayoutTableRow(const Element&, NonnullRefPtr<StyleProperties>);
|
||||
virtual ~LayoutTableRow() override;
|
||||
|
||||
virtual void layout() override;
|
||||
|
||||
private:
|
||||
virtual const char* class_name() const override { return "LayoutTableRow"; }
|
||||
};
|
|
@ -44,6 +44,9 @@ LIBHTML_OBJS = \
|
|||
Layout/LayoutListItem.o \
|
||||
Layout/LayoutListItemMarker.o \
|
||||
Layout/LayoutBreak.o \
|
||||
Layout/LayoutTable.o \
|
||||
Layout/LayoutTableRow.o \
|
||||
Layout/LayoutTableCell.o \
|
||||
Layout/BoxModelMetrics.o \
|
||||
Layout/LineBox.o \
|
||||
Layout/LineBoxFragment.o \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue