1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:08:12 +00:00

LibWeb: Move border width and color into LayoutStyle

To make this possible, I also had to give each LayoutNode a Document&
so it can resolve document-specific colors correctly. There's probably
ways to avoid having this extra member by resolving colors later, but
this works for now.
This commit is contained in:
Andreas Kling 2020-06-24 19:41:12 +02:00
parent 4b2ac34725
commit 440b4ece22
57 changed files with 173 additions and 190 deletions

View file

@ -107,7 +107,7 @@ bool Element::has_class(const FlyString& class_name) const
return false;
}
RefPtr<LayoutNode> Element::create_layout_node(const StyleProperties* parent_style) const
RefPtr<LayoutNode> Element::create_layout_node(const StyleProperties* parent_style)
{
auto style = document().style_resolver().resolve_style(*this, parent_style);
const_cast<Element&>(*this).m_resolved_style = style;
@ -120,21 +120,21 @@ RefPtr<LayoutNode> Element::create_layout_node(const StyleProperties* parent_sty
return nullptr;
if (display == CSS::Display::Block)
return adopt(*new LayoutBlock(this, move(style)));
return adopt(*new LayoutBlock(document(), this, move(style)));
if (display == CSS::Display::Inline)
return adopt(*new LayoutInline(*this, move(style)));
return adopt(*new LayoutInline(document(), *this, move(style)));
if (display == CSS::Display::ListItem)
return adopt(*new LayoutListItem(*this, move(style)));
return adopt(*new LayoutListItem(document(), *this, move(style)));
if (display == CSS::Display::Table)
return adopt(*new LayoutTable(*this, move(style)));
return adopt(*new LayoutTable(document(), *this, move(style)));
if (display == CSS::Display::TableRow)
return adopt(*new LayoutTableRow(*this, move(style)));
return adopt(*new LayoutTableRow(document(), *this, move(style)));
if (display == CSS::Display::TableCell)
return adopt(*new LayoutTableCell(*this, move(style)));
return adopt(*new LayoutTableCell(document(), *this, move(style)));
if (display == CSS::Display::TableRowGroup)
return adopt(*new LayoutTableRowGroup(*this, move(style)));
return adopt(*new LayoutTableRowGroup(document(), *this, move(style)));
if (display == CSS::Display::InlineBlock) {
auto inline_block = adopt(*new LayoutBlock(this, move(style)));
auto inline_block = adopt(*new LayoutBlock(document(), this, move(style)));
inline_block->set_inline(true);
return inline_block;
}