LibWeb: Make CSSStyleRule::qualified_layer_name() return a const-ref

And also make it inline. We were spending 8% of selector matching on
creating and destroying FlyString copies here. With this change, it's
now ~1%.
This commit is contained in:
Andreas Kling
2024-09-09 17:35:13 +02:00
committed by Andreas Kling
parent ef4f5ac8fb
commit b2aff403fc
4 changed files with 34 additions and 34 deletions

View File

@@ -58,7 +58,14 @@ protected:
virtual void visit_edges(Cell::Visitor&) override;
FlyString const& parent_layer_internal_qualified_name() const;
[[nodiscard]] FlyString const& parent_layer_internal_qualified_name() const
{
if (!m_cached_layer_name.has_value())
return parent_layer_internal_qualified_name_slow_case();
return m_cached_layer_name.value();
}
[[nodiscard]] FlyString const& parent_layer_internal_qualified_name_slow_case() const;
JS::GCPtr<CSSRule> m_parent_rule;
JS::GCPtr<CSSStyleSheet> m_parent_style_sheet;