1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:08:10 +00:00

LibWeb: Use the cached text-align value in LineBox::add_fragment()

This commit is contained in:
Andreas Kling 2020-06-24 00:09:45 +02:00
parent f4ecb5362f
commit 26eef65017
2 changed files with 9 additions and 1 deletions

View file

@ -191,6 +191,7 @@ public:
const StyleProperties& style() const;
CSS::Position position() const;
CSS::TextAlign text_align() const;
LayoutNodeWithStyle* parent();
const LayoutNodeWithStyle* parent() const;
@ -299,6 +300,13 @@ inline CSS::Position LayoutNode::position() const
return parent()->position();
}
inline CSS::TextAlign LayoutNode::text_align() const
{
if (m_has_style)
return static_cast<const LayoutNodeWithStyle*>(this)->text_align();
return parent()->text_align();
}
inline const LayoutNodeWithStyle* LayoutNode::parent() const
{
return static_cast<const LayoutNodeWithStyle*>(TreeNode<LayoutNode>::parent());