1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 19:35:09 +00:00

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.
This commit is contained in:
Andreas Kling 2019-09-29 17:22:44 +02:00
parent 8d822ff82b
commit ed39e0f6f7

View file

@ -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";