1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:37:46 +00:00

LibWeb: Make display: foo box constructors take the Element by pointer

This means we can instantiate them for pseudo-elements, which don't have
an associated Element. They all pass it to their parent as a
`Layout::Node*` and handle a lack of `layout_node()` already so this
won't affect any functionality.
This commit is contained in:
Sam Atkins 2022-02-23 20:25:35 +00:00 committed by Andreas Kling
parent adaab23149
commit 7bb721bea2
7 changed files with 13 additions and 13 deletions

View file

@ -17,8 +17,8 @@
namespace Web::Layout {
InlineNode::InlineNode(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
: Layout::NodeWithStyleAndBoxModelMetrics(document, &element, move(style))
InlineNode::InlineNode(DOM::Document& document, DOM::Element* element, NonnullRefPtr<CSS::StyleProperties> style)
: Layout::NodeWithStyleAndBoxModelMetrics(document, element, move(style))
{
set_inline(true);
}

View file

@ -12,7 +12,7 @@ namespace Web::Layout {
class InlineNode : public NodeWithStyleAndBoxModelMetrics {
public:
InlineNode(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>);
InlineNode(DOM::Document&, DOM::Element*, NonnullRefPtr<CSS::StyleProperties>);
virtual ~InlineNode() override;
virtual void paint(PaintContext&, PaintPhase) override;

View file

@ -10,8 +10,8 @@
namespace Web::Layout {
ListItemBox::ListItemBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
: Layout::BlockContainer(document, &element, move(style))
ListItemBox::ListItemBox(DOM::Document& document, DOM::Element* element, NonnullRefPtr<CSS::StyleProperties> style)
: Layout::BlockContainer(document, element, move(style))
{
}

View file

@ -13,7 +13,7 @@ namespace Web::Layout {
class ListItemBox final : public BlockContainer {
public:
ListItemBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>);
ListItemBox(DOM::Document&, DOM::Element*, NonnullRefPtr<CSS::StyleProperties>);
virtual ~ListItemBox() override;
DOM::Element& dom_node() { return static_cast<DOM::Element&>(*BlockContainer::dom_node()); }

View file

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

View file

@ -12,7 +12,7 @@ namespace Web::Layout {
class TableRowGroupBox final : public BlockContainer {
public:
TableRowGroupBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>);
TableRowGroupBox(DOM::Document&, DOM::Element*, NonnullRefPtr<CSS::StyleProperties>);
virtual ~TableRowGroupBox() override;
size_t column_count() const;