1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:47:34 +00:00

LibWeb: Make DOM::Node::create_layout_node() not need parent's style

The StyleResolver can find the specified CSS values for the parent
element via the DOM. Forcing everyone to locate specified values for
their parent was completely unnecessary.
This commit is contained in:
Andreas Kling 2021-01-06 14:27:40 +01:00
parent d9b2650dcc
commit 29a4da30b7
28 changed files with 40 additions and 39 deletions

View file

@ -564,11 +564,11 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
style.set_property(property_id, value);
}
NonnullRefPtr<StyleProperties> StyleResolver::resolve_style(const DOM::Element& element, const StyleProperties* parent_style) const
NonnullRefPtr<StyleProperties> StyleResolver::resolve_style(const DOM::Element& element) const
{
auto style = StyleProperties::create();
if (parent_style) {
if (auto* parent_style = element.parent_element() ? element.parent_element()->specified_css_values() : nullptr) {
parent_style->for_each_property([&](auto property_id, auto& value) {
if (is_inherited_property(property_id))
set_property_expanding_shorthands(style, property_id, value, m_document);

View file

@ -48,7 +48,7 @@ public:
DOM::Document& document() { return m_document; }
const DOM::Document& document() const { return m_document; }
NonnullRefPtr<StyleProperties> resolve_style(const DOM::Element&, const StyleProperties* parent_style) const;
NonnullRefPtr<StyleProperties> resolve_style(const DOM::Element&) const;
Vector<MatchingRule> collect_matching_rules(const DOM::Element&) const;
void sort_matching_rules(Vector<MatchingRule>&) const;