LibWeb/CSS: Support creating a NumericType from Flex units

This commit is contained in:
Sam Atkins 2025-08-18 14:45:26 +01:00
commit 0fa1099ce5
Notes: github-actions[bot] 2025-08-22 08:49:50 +00:00

View file

@ -1,11 +1,12 @@
/* /*
* Copyright (c) 2023-2024, Sam Atkins <sam@ladybird.org> * Copyright (c) 2023-2025, Sam Atkins <sam@ladybird.org>
* *
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
#include "NumericType.h" #include "NumericType.h"
#include <LibWeb/CSS/Angle.h> #include <LibWeb/CSS/Angle.h>
#include <LibWeb/CSS/Flex.h>
#include <LibWeb/CSS/Frequency.h> #include <LibWeb/CSS/Frequency.h>
#include <LibWeb/CSS/Length.h> #include <LibWeb/CSS/Length.h>
#include <LibWeb/CSS/Resolution.h> #include <LibWeb/CSS/Resolution.h>
@ -85,8 +86,10 @@ Optional<NumericType> NumericType::create_from_unit(StringView unit)
} }
// unit is a <flex> unit // unit is a <flex> unit
// FIXME: We don't have <flex> as a type yet. if (Flex::unit_from_name(unit).has_value()) {
// Return «[ "flex" → 1 ]» // Return «[ "flex" → 1 ]»
return NumericType { BaseType::Flex, 1 };
}
// anything else // anything else
// Return failure. // Return failure.