LibWeb/CSS: Take FlyString in NumericType::create_from_unit()

We only call this with FlyStrings, so we might as well.
This commit is contained in:
Sam Atkins 2025-09-11 12:13:03 +01:00 committed by Jelle Raaijmakers
commit 09a6b179d0
Notes: github-actions[bot] 2025-09-12 11:47:15 +00:00
2 changed files with 4 additions and 4 deletions

View file

@ -39,18 +39,18 @@ Optional<NumericType::BaseType> NumericType::base_type_from_value_type(ValueType
} }
// https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue-create-a-type // https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue-create-a-type
Optional<NumericType> NumericType::create_from_unit(StringView unit) Optional<NumericType> NumericType::create_from_unit(FlyString const& unit)
{ {
// To create a type from a string unit, follow the appropriate branch of the following: // To create a type from a string unit, follow the appropriate branch of the following:
// unit is "number" // unit is "number"
if (unit == "number"sv) { if (unit == "number"_fly_string) {
// Return «[ ]» (empty map) // Return «[ ]» (empty map)
return NumericType {}; return NumericType {};
} }
// unit is "percent" // unit is "percent"
if (unit == "percent"sv) { if (unit == "percent"_fly_string) {
// Return «[ "percent" → 1 ]» // Return «[ "percent" → 1 ]»
return NumericType { BaseType::Percent, 1 }; return NumericType { BaseType::Percent, 1 };
} }

View file

@ -51,7 +51,7 @@ public:
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();
} }
static Optional<NumericType> create_from_unit(StringView unit); static Optional<NumericType> create_from_unit(FlyString const& unit);
NumericType() = default; NumericType() = default;
NumericType(BaseType type, i32 power) NumericType(BaseType type, i32 power)
{ {