mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 17:28:30 +00:00
Meta: Add basic-shape as a CSS property value type
This commit is contained in:
@@ -22,7 +22,7 @@ bool is_animatable_property(JsonObject& properties, StringView property_name);
|
|||||||
static bool type_name_is_enum(StringView type_name)
|
static bool type_name_is_enum(StringView type_name)
|
||||||
{
|
{
|
||||||
return !AK::first_is_one_of(type_name,
|
return !AK::first_is_one_of(type_name,
|
||||||
"angle"sv, "background-position"sv, "color"sv, "custom-ident"sv, "easing-function"sv, "flex"sv, "frequency"sv, "image"sv,
|
"angle"sv, "background-position"sv, "basic-shape"sv, "color"sv, "custom-ident"sv, "easing-function"sv, "flex"sv, "frequency"sv, "image"sv,
|
||||||
"integer"sv, "length"sv, "number"sv, "paint"sv, "percentage"sv, "position"sv, "ratio"sv, "rect"sv,
|
"integer"sv, "length"sv, "number"sv, "paint"sv, "percentage"sv, "position"sv, "ratio"sv, "rect"sv,
|
||||||
"resolution"sv, "string"sv, "time"sv, "url"sv);
|
"resolution"sv, "string"sv, "time"sv, "url"sv);
|
||||||
}
|
}
|
||||||
@@ -180,6 +180,7 @@ NonnullRefPtr<StyleValue> property_initial_value(JS::Realm&, PropertyID);
|
|||||||
enum class ValueType {
|
enum class ValueType {
|
||||||
Angle,
|
Angle,
|
||||||
BackgroundPosition,
|
BackgroundPosition,
|
||||||
|
BasicShape,
|
||||||
Color,
|
Color,
|
||||||
CustomIdent,
|
CustomIdent,
|
||||||
EasingFunction,
|
EasingFunction,
|
||||||
@@ -699,6 +700,8 @@ bool property_accepts_type(PropertyID property_id, ValueType value_type)
|
|||||||
property_generator.appendln(" case ValueType::Angle:");
|
property_generator.appendln(" case ValueType::Angle:");
|
||||||
} else if (type_name == "background-position") {
|
} else if (type_name == "background-position") {
|
||||||
property_generator.appendln(" case ValueType::BackgroundPosition:");
|
property_generator.appendln(" case ValueType::BackgroundPosition:");
|
||||||
|
} else if (type_name == "basic-shape") {
|
||||||
|
property_generator.appendln(" case ValueType::BasicShape:");
|
||||||
} else if (type_name == "color") {
|
} else if (type_name == "color") {
|
||||||
property_generator.appendln(" case ValueType::Color:");
|
property_generator.appendln(" case ValueType::Color:");
|
||||||
} else if (type_name == "custom-ident") {
|
} else if (type_name == "custom-ident") {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ Optional<CSSNumericType::BaseType> CSSNumericType::base_type_from_value_type(Val
|
|||||||
return BaseType::Time;
|
return BaseType::Time;
|
||||||
|
|
||||||
case ValueType::BackgroundPosition:
|
case ValueType::BackgroundPosition:
|
||||||
|
case ValueType::BasicShape:
|
||||||
case ValueType::Color:
|
case ValueType::Color:
|
||||||
case ValueType::CustomIdent:
|
case ValueType::CustomIdent:
|
||||||
case ValueType::EasingFunction:
|
case ValueType::EasingFunction:
|
||||||
|
|||||||
@@ -6587,6 +6587,11 @@ Optional<Parser::PropertyAndValue> Parser::parse_css_value_for_properties(Readon
|
|||||||
return PropertyAndValue { *property, maybe_position };
|
return PropertyAndValue { *property, maybe_position };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (auto property = any_property_accepts_type(property_ids, ValueType::BasicShape); property.has_value()) {
|
||||||
|
if (auto maybe_basic_shape = parse_basic_shape_value(tokens))
|
||||||
|
return PropertyAndValue { *property, maybe_basic_shape };
|
||||||
|
}
|
||||||
|
|
||||||
if (auto property = any_property_accepts_type(property_ids, ValueType::Ratio); property.has_value()) {
|
if (auto property = any_property_accepts_type(property_ids, ValueType::Ratio); property.has_value()) {
|
||||||
if (auto maybe_ratio = parse_ratio_value(tokens))
|
if (auto maybe_ratio = parse_ratio_value(tokens))
|
||||||
return PropertyAndValue { *property, maybe_ratio };
|
return PropertyAndValue { *property, maybe_ratio };
|
||||||
|
|||||||
Reference in New Issue
Block a user