mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
LibWeb: Port CSSNamespaceRule to FlyString
This removes a performance problem where we'd convert the style sheet's default namespace from DeprecatedFlyString to FlyString once per rule during selector matching. The conversion now happens once, during CSS parse. It should eventually be removed from there as well, but one step at a time. :^)
This commit is contained in:
parent
d8f84ef76c
commit
189d1e8291
Notes:
sideshowbarker
2024-07-17 05:09:48 +09:00
Author: https://github.com/awesomekling
Commit: 189d1e8291
Pull-request: https://github.com/SerenityOS/serenity/pull/22112
Reviewed-by: https://github.com/AtkinsSJ ✅
4 changed files with 21 additions and 21 deletions
|
@ -149,7 +149,7 @@ void CSSStyleSheet::set_style_sheet_list(Badge<StyleSheetList>, StyleSheetList*
|
|||
Optional<FlyString> CSSStyleSheet::default_namespace() const
|
||||
{
|
||||
if (m_default_namespace_rule)
|
||||
return MUST(FlyString::from_deprecated_fly_string(m_default_namespace_rule->namespace_uri()));
|
||||
return m_default_namespace_rule->namespace_uri();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ Optional<FlyString> CSSStyleSheet::namespace_uri(StringView namespace_prefix) co
|
|||
{
|
||||
return m_namespace_rules.get(namespace_prefix)
|
||||
.map([](JS::GCPtr<CSSNamespaceRule> namespace_) {
|
||||
return MUST(FlyString::from_deprecated_fly_string(namespace_->namespace_uri()));
|
||||
return namespace_->namespace_uri();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ void CSSStyleSheet::recalculate_namespaces()
|
|||
if (!namespace_rule.namespace_uri().is_empty() && namespace_rule.prefix().is_empty())
|
||||
m_default_namespace_rule = namespace_rule;
|
||||
|
||||
m_namespace_rules.set(FlyString::from_deprecated_fly_string(namespace_rule.prefix()).release_value_but_fixme_should_propagate_errors(), namespace_rule);
|
||||
m_namespace_rules.set(namespace_rule.prefix(), namespace_rule);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue