LibWeb/CSS: Add String->ValueType conversion function

And also move this out of PropertyID.h because it's a separate thing.

I considered generating this but there's really not much to it.
This commit is contained in:
Sam Atkins 2025-07-10 16:09:34 +01:00 committed by Tim Ledbetter
commit 08bf9d39de
Notes: github-actions[bot] 2025-07-16 13:49:40 +00:00
4 changed files with 112 additions and 47 deletions

View file

@ -165,6 +165,7 @@ ErrorOr<void> generate_header_file(JsonObject& properties, JsonObject& logical_p
#include <AK/Variant.h>
#include <LibJS/Forward.h>
#include <LibWeb/CSS/Enums.h>
#include <LibWeb/CSS/ValueType.h>
#include <LibWeb/Forward.h>
namespace Web::CSS {
@ -255,33 +256,6 @@ Optional<PropertyID> property_id_from_string(StringView);
bool is_inherited_property(PropertyID);
NonnullRefPtr<CSSStyleValue const> property_initial_value(PropertyID);
enum class ValueType {
Angle,
BackgroundPosition,
BasicShape,
Color,
Counter,
CustomIdent,
EasingFunction,
FilterValueList,
FitContent,
Flex,
Frequency,
Image,
Integer,
Length,
Number,
OpenTypeTag,
Paint,
Percentage,
Position,
Ratio,
Rect,
Resolution,
String,
Time,
Url,
};
bool property_accepts_type(PropertyID, ValueType);
bool property_accepts_keyword(PropertyID, Keyword);
Optional<ValueType> property_resolves_percentages_relative_to(PropertyID);