mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:28:11 +00: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
4 changed files with 21 additions and 21 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue