summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/Layout/LayoutNode.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-24 00:09:45 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-24 00:09:45 +0200
commit26eef6501765e6801a86497b5ab98e059c05ea61 (patch)
tree60de6fa541161b64c99444f7538ca286c17b5604 /Libraries/LibWeb/Layout/LayoutNode.h
parentf4ecb5362f1929b95f253e3e4eb700b4484069cc (diff)
downloadserenity-26eef6501765e6801a86497b5ab98e059c05ea61.zip
LibWeb: Use the cached text-align value in LineBox::add_fragment()
Diffstat (limited to 'Libraries/LibWeb/Layout/LayoutNode.h')
-rw-r--r--Libraries/LibWeb/Layout/LayoutNode.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/Libraries/LibWeb/Layout/LayoutNode.h b/Libraries/LibWeb/Layout/LayoutNode.h
index 2dcca0b67a..2369ed7661 100644
--- a/Libraries/LibWeb/Layout/LayoutNode.h
+++ b/Libraries/LibWeb/Layout/LayoutNode.h
@@ -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());