
Since LayoutText always inherits style, it shouldn't store any style of its own. This patch adds a LayoutNodeWithStyle class to sit between LayoutNode and everyone who wants to inherit from LayoutNode except LayoutText :^) Since LayoutText can never have children, we also know that the parent of any LayoutNode is always going to be a LayoutNodeWithStyle. So this patch makes LayoutNode::parent() return LayoutNodeWithStyle*.
17 lines
543 B
C++
17 lines
543 B
C++
#include <LibHTML/DOM/Element.h>
|
|
#include <LibHTML/Layout/LayoutNode.h>
|
|
|
|
class LayoutReplaced : public LayoutNodeWithStyle {
|
|
public:
|
|
LayoutReplaced(const Element&, NonnullRefPtr<StyleProperties>);
|
|
virtual ~LayoutReplaced() override;
|
|
|
|
const Element& node() const { return to<Element>(*LayoutNode::node()); }
|
|
|
|
virtual bool is_replaced() const final { return true; }
|
|
|
|
private:
|
|
virtual const char* class_name() const override { return "LayoutReplaced"; }
|
|
|
|
virtual void split_into_lines(LayoutBlock& container) override;
|
|
};
|