LibWeb: Avoid copying the CSS @namespace every time we run a selector

This commit is contained in:
Andreas Kling 2024-03-16 08:03:46 +01:00
commit 038e0ceee7
Notes: sideshowbarker 2024-07-16 23:23:26 +09:00
2 changed files with 5 additions and 3 deletions

View file

@ -295,9 +295,9 @@ StyleComputer::RuleCache const& StyleComputer::rule_cache_for_cascade_origin(Cas
[[nodiscard]] static bool filter_namespace_rule(DOM::Element const& element, MatchingRule const& rule)
{
// FIXME: Filter out non-default namespace using prefixes
auto namespace_uri = rule.sheet->default_namespace();
if (namespace_uri.has_value() && namespace_uri.value() != element.namespace_uri()) {
return false;
if (auto namespace_rule = rule.sheet->default_namespace_rule()) {
if (namespace_rule->namespace_uri() != element.namespace_uri())
return false;
}
return true;
}