mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:48:14 +00:00
LibWeb: Store the used font in Layout::NodeWithStyle
This is a step towards not having to carry the full set of specified values around with every layout node.
This commit is contained in:
parent
5721b2a3da
commit
e187a5365a
7 changed files with 22 additions and 10 deletions
|
@ -125,6 +125,7 @@ public:
|
|||
|
||||
bool can_contain_boxes_with_position_absolute() const;
|
||||
|
||||
const Gfx::Font& font() const;
|
||||
const CSS::StyleProperties& specified_style() const;
|
||||
const CSS::ImmutableComputedValues& style() const;
|
||||
|
||||
|
@ -204,11 +205,14 @@ public:
|
|||
|
||||
void apply_style(const CSS::StyleProperties&);
|
||||
|
||||
const Gfx::Font& font() const { return *m_font; }
|
||||
|
||||
protected:
|
||||
NodeWithStyle(DOM::Document&, DOM::Node*, NonnullRefPtr<CSS::StyleProperties>);
|
||||
|
||||
private:
|
||||
CSS::ComputedValues m_computed_values;
|
||||
RefPtr<Gfx::Font> m_font;
|
||||
|
||||
NonnullRefPtr<CSS::StyleProperties> m_specified_style;
|
||||
CSS::Position m_position;
|
||||
|
@ -229,6 +233,13 @@ private:
|
|||
BoxModelMetrics m_box_model;
|
||||
};
|
||||
|
||||
inline const Gfx::Font& Node::font() const
|
||||
{
|
||||
if (m_has_style)
|
||||
return static_cast<const NodeWithStyle*>(this)->font();
|
||||
return parent()->font();
|
||||
}
|
||||
|
||||
inline const CSS::StyleProperties& Node::specified_style() const
|
||||
{
|
||||
if (m_has_style)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue