mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:27:45 +00:00
LibWeb: Add Layout::Node::line_height()
This allows you to call line_height() on any layout node, even if it's a text node (in which case we'll ask the parent node for its line-height.)
This commit is contained in:
parent
c914e732d2
commit
329f06d59a
1 changed files with 8 additions and 0 deletions
|
@ -108,6 +108,7 @@ public:
|
|||
|
||||
const Gfx::Font& font() const;
|
||||
const CSS::ImmutableComputedValues& computed_values() const;
|
||||
float line_height() const;
|
||||
|
||||
NodeWithStyle* parent();
|
||||
const NodeWithStyle* parent() const;
|
||||
|
@ -227,6 +228,13 @@ inline const CSS::ImmutableComputedValues& Node::computed_values() const
|
|||
return parent()->computed_values();
|
||||
}
|
||||
|
||||
inline float Node::line_height() const
|
||||
{
|
||||
if (m_has_style)
|
||||
return static_cast<NodeWithStyle const*>(this)->line_height();
|
||||
return parent()->line_height();
|
||||
}
|
||||
|
||||
inline const NodeWithStyle* Node::parent() const
|
||||
{
|
||||
return static_cast<const NodeWithStyle*>(TreeNode<Node>::parent());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue