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
parent 1cea4e6407
commit c0e0cb86e1
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)