LibWeb: Make CSS::string_from_property_id() return FlyString const&

This avoids costly conversions from StringView to FlyString in CSS
parsing and variable expansion.
This commit is contained in:
Andreas Kling 2024-03-15 20:32:45 +01:00
commit c0e0cb86e1
Notes: sideshowbarker 2024-07-16 22:11:09 +09:00
6 changed files with 21 additions and 17 deletions

View file

@ -79,7 +79,7 @@ String ResolvedCSSStyleDeclaration::item(size_t index) const
if (index > length())
return {};
auto property_id = static_cast<PropertyID>(index + to_underlying(first_longhand_property_id));
return MUST(String::from_utf8(string_from_property_id(property_id)));
return string_from_property_id(property_id).to_string();
}
static NonnullRefPtr<StyleValue const> style_value_for_background_property(Layout::NodeWithStyle const& layout_node, Function<NonnullRefPtr<StyleValue const>(BackgroundLayerData const&)> callback, Function<NonnullRefPtr<StyleValue const>()> default_value)