From ed39e0f6f7bd8c623c25253fd63f2a7b747e5e19 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 29 Sep 2019 17:22:44 +0200 Subject: [PATCH] LibHTML: Non-element (Text) Nodes should get style from their parent Text nodes don't have style of their own, so just inherit all the style from the parent element. --- Libraries/LibHTML/DOM/Node.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Libraries/LibHTML/DOM/Node.cpp b/Libraries/LibHTML/DOM/Node.cpp index d477cfd1a5..2e81d3de3d 100644 --- a/Libraries/LibHTML/DOM/Node.cpp +++ b/Libraries/LibHTML/DOM/Node.cpp @@ -24,7 +24,12 @@ RefPtr Node::create_layout_node(const StyleResolver& resolver, const if (is_document()) return adopt(*new LayoutDocument(static_cast(*this), {})); - auto style_properties = resolver.resolve_style(static_cast(*this), parent_properties); + StyleProperties style_properties; + if (is_element()) + style_properties = resolver.resolve_style(static_cast(*this), parent_properties); + else + style_properties = *parent_properties; + auto display_property = style_properties.property("display"); String display = display_property.has_value() ? display_property.release_value()->to_string() : "inline";