diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-09-29 17:22:44 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-29 17:22:44 +0200 |
commit | ed39e0f6f7bd8c623c25253fd63f2a7b747e5e19 (patch) | |
tree | e49aeff7bd7caeef6dd304cb4a8caf74e01ac2a5 /Libraries/LibHTML | |
parent | 8d822ff82bd5da9b89375628710532d2622fec32 (diff) | |
download | serenity-ed39e0f6f7bd8c623c25253fd63f2a7b747e5e19.zip |
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.
Diffstat (limited to 'Libraries/LibHTML')
-rw-r--r-- | Libraries/LibHTML/DOM/Node.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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<LayoutNode> Node::create_layout_node(const StyleResolver& resolver, const if (is_document()) return adopt(*new LayoutDocument(static_cast<const Document&>(*this), {})); - auto style_properties = resolver.resolve_style(static_cast<const Element&>(*this), parent_properties); + StyleProperties style_properties; + if (is_element()) + style_properties = resolver.resolve_style(static_cast<const Element&>(*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"; |