Skip to content

Commit 0135af6

Browse files
MacDueawesomekling
authored andcommitted
Meta: Add basic-shape as a CSS property value type
1 parent 1209150 commit 0135af6

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ bool is_animatable_property(JsonObject& properties, StringView property_name);
2222
static bool type_name_is_enum(StringView type_name)
2323
{
2424
return !AK::first_is_one_of(type_name,
25-
"angle"sv, "background-position"sv, "color"sv, "custom-ident"sv, "easing-function"sv, "flex"sv, "frequency"sv, "image"sv,
25+
"angle"sv, "background-position"sv, "basic-shape"sv, "color"sv, "custom-ident"sv, "easing-function"sv, "flex"sv, "frequency"sv, "image"sv,
2626
"integer"sv, "length"sv, "number"sv, "paint"sv, "percentage"sv, "position"sv, "ratio"sv, "rect"sv,
2727
"resolution"sv, "string"sv, "time"sv, "url"sv);
2828
}
@@ -180,6 +180,7 @@ NonnullRefPtr<StyleValue> property_initial_value(JS::Realm&, PropertyID);
180180
enum class ValueType {
181181
Angle,
182182
BackgroundPosition,
183+
BasicShape,
183184
Color,
184185
CustomIdent,
185186
EasingFunction,
@@ -699,6 +700,8 @@ bool property_accepts_type(PropertyID property_id, ValueType value_type)
699700
property_generator.appendln(" case ValueType::Angle:");
700701
} else if (type_name == "background-position") {
701702
property_generator.appendln(" case ValueType::BackgroundPosition:");
703+
} else if (type_name == "basic-shape") {
704+
property_generator.appendln(" case ValueType::BasicShape:");
702705
} else if (type_name == "color") {
703706
property_generator.appendln(" case ValueType::Color:");
704707
} else if (type_name == "custom-ident") {

Userland/Libraries/LibWeb/CSS/CSSNumericType.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Optional<CSSNumericType::BaseType> CSSNumericType::base_type_from_value_type(Val
3434
return BaseType::Time;
3535

3636
case ValueType::BackgroundPosition:
37+
case ValueType::BasicShape:
3738
case ValueType::Color:
3839
case ValueType::CustomIdent:
3940
case ValueType::EasingFunction:

Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6587,6 +6587,11 @@ Optional<Parser::PropertyAndValue> Parser::parse_css_value_for_properties(Readon
65876587
return PropertyAndValue { *property, maybe_position };
65886588
}
65896589

6590+
if (auto property = any_property_accepts_type(property_ids, ValueType::BasicShape); property.has_value()) {
6591+
if (auto maybe_basic_shape = parse_basic_shape_value(tokens))
6592+
return PropertyAndValue { *property, maybe_basic_shape };
6593+
}
6594+
65906595
if (auto property = any_property_accepts_type(property_ids, ValueType::Ratio); property.has_value()) {
65916596
if (auto maybe_ratio = parse_ratio_value(tokens))
65926597
return PropertyAndValue { *property, maybe_ratio };

0 commit comments

Comments
 (0)