mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:37:43 +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:
parent
4b2ac34725
commit
440b4ece22
57 changed files with 173 additions and 190 deletions
|
@ -101,8 +101,8 @@ public:
|
|||
const Node* node() const { return m_node; }
|
||||
Node* node() { return const_cast<Node*>(m_node); }
|
||||
|
||||
Document& document();
|
||||
const Document& document() const;
|
||||
Document& document() { return m_document; }
|
||||
const Document& document() const { return m_document; }
|
||||
|
||||
const Frame& frame() const;
|
||||
Frame& frame();
|
||||
|
@ -239,11 +239,12 @@ public:
|
|||
float font_size() const;
|
||||
|
||||
protected:
|
||||
explicit LayoutNode(const Node*);
|
||||
LayoutNode(Document&, const Node*);
|
||||
|
||||
private:
|
||||
friend class LayoutNodeWithStyle;
|
||||
|
||||
Document& m_document;
|
||||
const Node* m_node { nullptr };
|
||||
|
||||
bool m_inline { false };
|
||||
|
@ -261,11 +262,12 @@ public:
|
|||
|
||||
const ImmutableLayoutStyle& style() const { return static_cast<const ImmutableLayoutStyle&>(m_style); }
|
||||
|
||||
void apply_style(const StyleProperties&);
|
||||
|
||||
protected:
|
||||
explicit LayoutNodeWithStyle(const Node*, NonnullRefPtr<StyleProperties>);
|
||||
LayoutNodeWithStyle(Document&, const Node*, NonnullRefPtr<StyleProperties>);
|
||||
|
||||
private:
|
||||
void apply_style(const StyleProperties&);
|
||||
|
||||
LayoutStyle m_style;
|
||||
|
||||
|
@ -280,8 +282,8 @@ public:
|
|||
const BoxModelMetrics& box_model() const { return m_box_model; }
|
||||
|
||||
protected:
|
||||
LayoutNodeWithStyleAndBoxModelMetrics(const Node* node, NonnullRefPtr<StyleProperties> style)
|
||||
: LayoutNodeWithStyle(node, move(style))
|
||||
LayoutNodeWithStyleAndBoxModelMetrics(Document& document, const Node* node, NonnullRefPtr<StyleProperties> style)
|
||||
: LayoutNodeWithStyle(document, node, move(style))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue