mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-17 21:49:42 +00:00
LibWeb/CSS: Take AbstractElement in cascade_custom_properties()
This commit is contained in:
parent
b49d00996b
commit
77f1057992
Notes:
github-actions[bot]
2025-09-11 16:46:57 +00:00
Author: https://github.com/AtkinsSJ
Commit: 77f1057992
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6118
1 changed files with 6 additions and 6 deletions
|
@ -849,14 +849,14 @@ void StyleComputer::cascade_declarations(
|
|||
}
|
||||
}
|
||||
|
||||
static void cascade_custom_properties(DOM::Element& element, Optional<CSS::PseudoElement> pseudo_element, Vector<MatchingRule const*> const& matching_rules, HashMap<FlyString, StyleProperty>& custom_properties)
|
||||
static void cascade_custom_properties(DOM::AbstractElement abstract_element, Vector<MatchingRule const*> const& matching_rules, HashMap<FlyString, StyleProperty>& custom_properties)
|
||||
{
|
||||
size_t needed_capacity = 0;
|
||||
for (auto const& matching_rule : matching_rules)
|
||||
needed_capacity += matching_rule->declaration().custom_properties().size();
|
||||
|
||||
if (!pseudo_element.has_value()) {
|
||||
if (auto const inline_style = element.inline_style())
|
||||
if (!abstract_element.pseudo_element().has_value()) {
|
||||
if (auto const inline_style = abstract_element.element().inline_style())
|
||||
needed_capacity += inline_style->custom_properties().size();
|
||||
}
|
||||
|
||||
|
@ -871,8 +871,8 @@ static void cascade_custom_properties(DOM::Element& element, Optional<CSS::Pseud
|
|||
}
|
||||
}
|
||||
|
||||
if (!pseudo_element.has_value()) {
|
||||
if (auto const inline_style = element.inline_style())
|
||||
if (!abstract_element.pseudo_element().has_value()) {
|
||||
if (auto const inline_style = abstract_element.element().inline_style())
|
||||
custom_properties.update(inline_style->custom_properties());
|
||||
}
|
||||
}
|
||||
|
@ -2374,7 +2374,7 @@ GC::Ptr<ComputedProperties> StyleComputer::compute_style_impl(DOM::AbstractEleme
|
|||
if (!abstract_element.pseudo_element().has_value() || pseudo_element_supports_property(*abstract_element.pseudo_element(), PropertyID::Custom)) {
|
||||
HashMap<FlyString, StyleProperty> custom_properties;
|
||||
for (auto& layer : matching_rule_set.author_rules) {
|
||||
cascade_custom_properties(abstract_element.element(), abstract_element.pseudo_element(), layer.rules, custom_properties);
|
||||
cascade_custom_properties(abstract_element, layer.rules, custom_properties);
|
||||
}
|
||||
abstract_element.set_custom_properties(move(custom_properties));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue