mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:48:12 +00:00
LibWeb: Set CSS custom properties from the element inline style
This commit is contained in:
parent
55ac11a0ae
commit
0934573deb
1 changed files with 7 additions and 0 deletions
|
@ -582,6 +582,8 @@ static void cascade_custom_properties(DOM::Element& element, Vector<MatchingRule
|
|||
size_t needed_capacity = 0;
|
||||
for (auto const& matching_rule : matching_rules)
|
||||
needed_capacity += verify_cast<PropertyOwningCSSStyleDeclaration>(matching_rule.rule->declaration()).custom_properties().size();
|
||||
if (auto const* inline_style = verify_cast<PropertyOwningCSSStyleDeclaration>(element.inline_style()))
|
||||
needed_capacity += inline_style->custom_properties().size();
|
||||
|
||||
HashMap<FlyString, StyleProperty> custom_properties;
|
||||
custom_properties.ensure_capacity(needed_capacity);
|
||||
|
@ -591,6 +593,11 @@ static void cascade_custom_properties(DOM::Element& element, Vector<MatchingRule
|
|||
custom_properties.set(it.key, it.value);
|
||||
}
|
||||
|
||||
if (auto const* inline_style = verify_cast<PropertyOwningCSSStyleDeclaration>(element.inline_style())) {
|
||||
for (auto const& it : inline_style->custom_properties())
|
||||
custom_properties.set(it.key, it.value);
|
||||
}
|
||||
|
||||
element.set_custom_properties(move(custom_properties));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue