mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-21 08:48:57 +00:00
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:
parent
995c19da56
commit
09a6b179d0
Notes:
github-actions[bot]
2025-09-12 11:47:15 +00:00
Author: https://github.com/AtkinsSJ
Commit: 09a6b179d0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6162
Reviewed-by: https://github.com/gmta ✅
2 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
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:
|
||||
|
||||
// unit is "number"
|
||||
if (unit == "number"sv) {
|
||||
if (unit == "number"_fly_string) {
|
||||
// Return «[ ]» (empty map)
|
||||
return NumericType {};
|
||||
}
|
||||
|
||||
// unit is "percent"
|
||||
if (unit == "percent"sv) {
|
||||
if (unit == "percent"_fly_string) {
|
||||
// Return «[ "percent" → 1 ]»
|
||||
return NumericType { BaseType::Percent, 1 };
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
static Optional<NumericType> create_from_unit(StringView unit);
|
||||
static Optional<NumericType> create_from_unit(FlyString const& unit);
|
||||
NumericType() = default;
|
||||
NumericType(BaseType type, i32 power)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue