mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02: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:
Notes:
sideshowbarker
2024-07-17 05:09:48 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/189d1e8291 Pull-request: https://github.com/SerenityOS/serenity/pull/22112 Reviewed-by: https://github.com/AtkinsSJ ✅
@@ -16,16 +16,16 @@ namespace Web::CSS {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(CSSNamespaceRule);
|
||||
|
||||
CSSNamespaceRule::CSSNamespaceRule(JS::Realm& realm, Optional<DeprecatedString> prefix, StringView namespace_uri)
|
||||
CSSNamespaceRule::CSSNamespaceRule(JS::Realm& realm, Optional<FlyString> prefix, FlyString namespace_uri)
|
||||
: CSSRule(realm)
|
||||
, m_namespace_uri(namespace_uri)
|
||||
, m_prefix(prefix.value_or(""sv))
|
||||
, m_namespace_uri(move(namespace_uri))
|
||||
, m_prefix(prefix.value_or(""_fly_string))
|
||||
{
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<CSSNamespaceRule> CSSNamespaceRule::create(JS::Realm& realm, Optional<DeprecatedString> prefix, AK::StringView namespace_uri)
|
||||
JS::NonnullGCPtr<CSSNamespaceRule> CSSNamespaceRule::create(JS::Realm& realm, Optional<FlyString> prefix, FlyString namespace_uri)
|
||||
{
|
||||
return realm.heap().allocate<CSSNamespaceRule>(realm, realm, prefix, namespace_uri);
|
||||
return realm.heap().allocate<CSSNamespaceRule>(realm, realm, move(prefix), move(namespace_uri));
|
||||
}
|
||||
|
||||
void CSSNamespaceRule::initialize(JS::Realm& realm)
|
||||
|
||||
Reference in New Issue
Block a user