mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-21 16:58:58 +00:00
LibWeb/CSS: Support creating a NumericType from Flex units
This commit is contained in:
parent
6cb8e92bd4
commit
0fa1099ce5
Notes:
github-actions[bot]
2025-08-22 08:49:50 +00:00
Author: https://github.com/AtkinsSJ
Commit: 0fa1099ce5
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5937
1 changed files with 10 additions and 7 deletions
|
@ -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.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue