mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-27 19:29:52 +00:00
LibWeb: Don't put unlayered rules into into empty "service" layer
Fixes bug when `build_matching_rule_set()` mistakenly included all unlayered rules twice. This was caused by mistakenly including all unlayered rules into `""` named "service" layer, because we couldn't tell if FlyString = `""` means no layer or layer named `""`.
This commit is contained in:
parent
7ea0f13cd9
commit
4319e6b80e
Notes:
github-actions[bot]
2025-07-21 11:34:42 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 4319e6b80e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5541
Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 6 additions and 6 deletions
|
@ -407,7 +407,7 @@ void StyleComputer::for_each_stylesheet(CascadeOrigin cascade_origin, Callback c
|
|||
}
|
||||
}
|
||||
|
||||
RuleCache const* StyleComputer::rule_cache_for_cascade_origin(CascadeOrigin cascade_origin, FlyString const& qualified_layer_name, GC::Ptr<DOM::ShadowRoot const> shadow_root) const
|
||||
RuleCache const* StyleComputer::rule_cache_for_cascade_origin(CascadeOrigin cascade_origin, Optional<FlyString const> qualified_layer_name, GC::Ptr<DOM::ShadowRoot const> shadow_root) const
|
||||
{
|
||||
auto const* rule_caches_for_document_and_shadow_roots = [&]() -> RuleCachesForDocumentAndShadowRoots const* {
|
||||
switch (cascade_origin) {
|
||||
|
@ -428,9 +428,9 @@ RuleCache const* StyleComputer::rule_cache_for_cascade_origin(CascadeOrigin casc
|
|||
}();
|
||||
if (!rule_caches_by_layer)
|
||||
return nullptr;
|
||||
if (qualified_layer_name.is_empty())
|
||||
if (!qualified_layer_name.has_value())
|
||||
return &rule_caches_by_layer->main;
|
||||
return rule_caches_by_layer->by_layer.get(qualified_layer_name).value_or(nullptr);
|
||||
return rule_caches_by_layer->by_layer.get(*qualified_layer_name).value_or(nullptr);
|
||||
}
|
||||
|
||||
[[nodiscard]] static bool filter_namespace_rule(Optional<FlyString> const& element_namespace_uri, MatchingRule const& rule)
|
||||
|
@ -491,7 +491,7 @@ bool StyleComputer::invalidation_property_used_in_has_selector(InvalidationSet::
|
|||
return false;
|
||||
}
|
||||
|
||||
Vector<MatchingRule const*> StyleComputer::collect_matching_rules(DOM::Element const& element, CascadeOrigin cascade_origin, Optional<CSS::PseudoElement> pseudo_element, PseudoClassBitmap& attempted_pseudo_class_matches, FlyString const& qualified_layer_name) const
|
||||
Vector<MatchingRule const*> StyleComputer::collect_matching_rules(DOM::Element const& element, CascadeOrigin cascade_origin, Optional<CSS::PseudoElement> pseudo_element, PseudoClassBitmap& attempted_pseudo_class_matches, Optional<FlyString const> qualified_layer_name) const
|
||||
{
|
||||
auto const& root_node = element.root();
|
||||
auto shadow_root = is<DOM::ShadowRoot>(root_node) ? static_cast<DOM::ShadowRoot const*>(&root_node) : nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue