mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 15:49:11 +00:00
LibWeb: Avoid copying the CSS @namespace every time we run a selector
This commit is contained in:
parent
a378303629
commit
038e0ceee7
Notes:
sideshowbarker
2024-07-16 23:23:26 +09:00
Author: https://github.com/awesomekling
Commit: 038e0ceee7
Pull-request: https://github.com/SerenityOS/serenity/pull/23602
2 changed files with 5 additions and 3 deletions
|
@ -65,6 +65,8 @@ public:
|
||||||
void set_style_sheet_list(Badge<StyleSheetList>, StyleSheetList*);
|
void set_style_sheet_list(Badge<StyleSheetList>, StyleSheetList*);
|
||||||
|
|
||||||
Optional<FlyString> default_namespace() const;
|
Optional<FlyString> default_namespace() const;
|
||||||
|
JS::GCPtr<CSSNamespaceRule> default_namespace_rule() const { return m_default_namespace_rule; }
|
||||||
|
|
||||||
Optional<FlyString> namespace_uri(StringView namespace_prefix) const;
|
Optional<FlyString> namespace_uri(StringView namespace_prefix) const;
|
||||||
|
|
||||||
Optional<URL> base_url() const { return m_base_url; }
|
Optional<URL> base_url() const { return m_base_url; }
|
||||||
|
|
|
@ -295,8 +295,8 @@ StyleComputer::RuleCache const& StyleComputer::rule_cache_for_cascade_origin(Cas
|
||||||
[[nodiscard]] static bool filter_namespace_rule(DOM::Element const& element, MatchingRule const& rule)
|
[[nodiscard]] static bool filter_namespace_rule(DOM::Element const& element, MatchingRule const& rule)
|
||||||
{
|
{
|
||||||
// FIXME: Filter out non-default namespace using prefixes
|
// FIXME: Filter out non-default namespace using prefixes
|
||||||
auto namespace_uri = rule.sheet->default_namespace();
|
if (auto namespace_rule = rule.sheet->default_namespace_rule()) {
|
||||||
if (namespace_uri.has_value() && namespace_uri.value() != element.namespace_uri()) {
|
if (namespace_rule->namespace_uri() != element.namespace_uri())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue