mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:17:45 +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
|
@ -15,24 +15,24 @@ class CSSNamespaceRule final : public CSSRule {
|
|||
JS_DECLARE_ALLOCATOR(CSSNamespaceRule);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static JS::NonnullGCPtr<CSSNamespaceRule> create(JS::Realm&, Optional<DeprecatedString> prefix, StringView namespace_uri);
|
||||
[[nodiscard]] static JS::NonnullGCPtr<CSSNamespaceRule> create(JS::Realm&, Optional<FlyString> prefix, FlyString namespace_uri);
|
||||
|
||||
virtual ~CSSNamespaceRule() = default;
|
||||
|
||||
void set_namespace_uri(DeprecatedString value) { m_namespace_uri = move(value); }
|
||||
DeprecatedString namespace_uri() const { return m_namespace_uri; }
|
||||
void set_prefix(DeprecatedString value) { m_prefix = move(value); }
|
||||
DeprecatedString prefix() const { return m_prefix; }
|
||||
void set_namespace_uri(FlyString value) { m_namespace_uri = move(value); }
|
||||
FlyString const& namespace_uri() const { return m_namespace_uri; }
|
||||
void set_prefix(FlyString value) { m_prefix = move(value); }
|
||||
FlyString const& prefix() const { return m_prefix; }
|
||||
virtual Type type() const override { return Type::Namespace; }
|
||||
|
||||
private:
|
||||
CSSNamespaceRule(JS::Realm&, Optional<DeprecatedString> prefix, StringView namespace_uri);
|
||||
CSSNamespaceRule(JS::Realm&, Optional<FlyString> prefix, FlyString namespace_uri);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
virtual String serialized() const override;
|
||||
DeprecatedString m_namespace_uri;
|
||||
DeprecatedString m_prefix;
|
||||
FlyString m_namespace_uri;
|
||||
FlyString m_prefix;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue