mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-16 21:20:18 +00:00
LibWeb: Store custom properties in an OrderedHashMap
We are expected to preserve their order within a style declaration, so let's do that. Passes 1 tracked WPT subtest.
This commit is contained in:
parent
2674bd428e
commit
95aceb6ec9
Notes:
github-actions[bot]
2025-09-18 13:00:16 +00:00
Author: https://github.com/AtkinsSJ
Commit: 95aceb6ec9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6226
Reviewed-by: https://github.com/gmta ✅
11 changed files with 30 additions and 31 deletions
|
@ -849,7 +849,7 @@ void StyleComputer::cascade_declarations(
|
|||
}
|
||||
}
|
||||
|
||||
static void cascade_custom_properties(DOM::AbstractElement abstract_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, OrderedHashMap<FlyString, StyleProperty>& custom_properties)
|
||||
{
|
||||
size_t needed_capacity = 0;
|
||||
for (auto const& matching_rule : matching_rules)
|
||||
|
@ -2375,7 +2375,7 @@ GC::Ptr<ComputedProperties> StyleComputer::compute_style_impl(DOM::AbstractEleme
|
|||
// Resolve all the CSS custom properties ("variables") for this element:
|
||||
// FIXME: Also resolve !important custom properties, in a second cascade.
|
||||
if (!abstract_element.pseudo_element().has_value() || pseudo_element_supports_property(*abstract_element.pseudo_element(), PropertyID::Custom)) {
|
||||
HashMap<FlyString, StyleProperty> custom_properties;
|
||||
OrderedHashMap<FlyString, StyleProperty> custom_properties;
|
||||
for (auto& layer : matching_rule_set.author_rules) {
|
||||
cascade_custom_properties(abstract_element, layer.rules, custom_properties);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue