mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-24 08:59:50 +00:00
LibWeb/CSS: Add ValueTypes for <foo-percentage>
This commit is contained in:
parent
c619c90e23
commit
7ba496b798
Notes:
github-actions[bot]
2025-10-20 12:56:27 +00:00
Author: https://github.com/AtkinsSJ
Commit: 7ba496b798
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6476
4 changed files with 32 additions and 4 deletions
|
|
@ -4847,6 +4847,8 @@ RefPtr<StyleValue const> Parser::parse_value(ValueType value_type, TokenStream<C
|
|||
return parse_anchor_size(tokens);
|
||||
case ValueType::Angle:
|
||||
return parse_angle_value(tokens);
|
||||
case ValueType::AnglePercentage:
|
||||
return parse_angle_percentage_value(tokens);
|
||||
case ValueType::BackgroundPosition:
|
||||
return parse_position_value(tokens, PositionParsingMode::BackgroundPosition);
|
||||
case ValueType::BasicShape:
|
||||
|
|
@ -4870,12 +4872,16 @@ RefPtr<StyleValue const> Parser::parse_value(ValueType value_type, TokenStream<C
|
|||
return parse_flex_value(tokens);
|
||||
case ValueType::Frequency:
|
||||
return parse_frequency_value(tokens);
|
||||
case ValueType::FrequencyPercentage:
|
||||
return parse_frequency_percentage_value(tokens);
|
||||
case ValueType::Image:
|
||||
return parse_image_value(tokens);
|
||||
case ValueType::Integer:
|
||||
return parse_integer_value(tokens);
|
||||
case ValueType::Length:
|
||||
return parse_length_value(tokens);
|
||||
case ValueType::LengthPercentage:
|
||||
return parse_length_percentage_value(tokens);
|
||||
case ValueType::Number:
|
||||
return parse_number_value(tokens);
|
||||
case ValueType::Opacity:
|
||||
|
|
@ -4898,6 +4904,8 @@ RefPtr<StyleValue const> Parser::parse_value(ValueType value_type, TokenStream<C
|
|||
return parse_string_value(tokens);
|
||||
case ValueType::Time:
|
||||
return parse_time_value(tokens);
|
||||
case ValueType::TimePercentage:
|
||||
return parse_time_percentage_value(tokens);
|
||||
case ValueType::TransformFunction:
|
||||
return parse_transform_function_value(tokens);
|
||||
case ValueType::TransformList:
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ Optional<ValueType> value_type_from_string(StringView string)
|
|||
return ValueType::AnchorSize;
|
||||
if (string.equals_ignoring_ascii_case("angle"sv))
|
||||
return ValueType::Angle;
|
||||
if (string.equals_ignoring_ascii_case("angle-percentage"sv))
|
||||
return ValueType::AnglePercentage;
|
||||
if (string.equals_ignoring_ascii_case("background-position"sv))
|
||||
return ValueType::BackgroundPosition;
|
||||
if (string.equals_ignoring_ascii_case("basic-shape"sv))
|
||||
|
|
@ -35,12 +37,16 @@ Optional<ValueType> value_type_from_string(StringView string)
|
|||
return ValueType::Flex;
|
||||
if (string.equals_ignoring_ascii_case("frequency"sv))
|
||||
return ValueType::Frequency;
|
||||
if (string.equals_ignoring_ascii_case("frequency-percentage"sv))
|
||||
return ValueType::FrequencyPercentage;
|
||||
if (string.equals_ignoring_ascii_case("image"sv))
|
||||
return ValueType::Image;
|
||||
if (string.equals_ignoring_ascii_case("integer"sv))
|
||||
return ValueType::Integer;
|
||||
if (string.equals_ignoring_ascii_case("length"sv))
|
||||
return ValueType::Length;
|
||||
if (string.equals_ignoring_ascii_case("length-percentage"sv))
|
||||
return ValueType::LengthPercentage;
|
||||
if (string.equals_ignoring_ascii_case("number"sv))
|
||||
return ValueType::Number;
|
||||
if (string.equals_ignoring_ascii_case("opacity"sv))
|
||||
|
|
@ -63,6 +69,8 @@ Optional<ValueType> value_type_from_string(StringView string)
|
|||
return ValueType::String;
|
||||
if (string.equals_ignoring_ascii_case("time"sv))
|
||||
return ValueType::Time;
|
||||
if (string.equals_ignoring_ascii_case("time-percentage"sv))
|
||||
return ValueType::TimePercentage;
|
||||
if (string.equals_ignoring_ascii_case("transform-function"sv))
|
||||
return ValueType::TransformFunction;
|
||||
if (string.equals_ignoring_ascii_case("transform-list"sv))
|
||||
|
|
@ -81,6 +89,8 @@ StringView value_type_to_string(ValueType value_type)
|
|||
return "AnchorSize"sv;
|
||||
case Web::CSS::ValueType::Angle:
|
||||
return "Angle"sv;
|
||||
case Web::CSS::ValueType::AnglePercentage:
|
||||
return "AnglePercentage"sv;
|
||||
case Web::CSS::ValueType::BackgroundPosition:
|
||||
return "BackgroundPosition"sv;
|
||||
case Web::CSS::ValueType::BasicShape:
|
||||
|
|
@ -103,12 +113,16 @@ StringView value_type_to_string(ValueType value_type)
|
|||
return "Flex"sv;
|
||||
case Web::CSS::ValueType::Frequency:
|
||||
return "Frequency"sv;
|
||||
case Web::CSS::ValueType::FrequencyPercentage:
|
||||
return "FrequencyPercentage"sv;
|
||||
case Web::CSS::ValueType::Image:
|
||||
return "Image"sv;
|
||||
case Web::CSS::ValueType::Integer:
|
||||
return "Integer"sv;
|
||||
case Web::CSS::ValueType::Length:
|
||||
return "Length"sv;
|
||||
case Web::CSS::ValueType::LengthPercentage:
|
||||
return "LengthPercentage"sv;
|
||||
case Web::CSS::ValueType::Number:
|
||||
return "Number"sv;
|
||||
case Web::CSS::ValueType::Opacity:
|
||||
|
|
@ -131,6 +145,8 @@ StringView value_type_to_string(ValueType value_type)
|
|||
return "String"sv;
|
||||
case Web::CSS::ValueType::Time:
|
||||
return "Time"sv;
|
||||
case Web::CSS::ValueType::TimePercentage:
|
||||
return "TimePercentage"sv;
|
||||
case Web::CSS::ValueType::TransformFunction:
|
||||
return "TransformFunction"sv;
|
||||
case Web::CSS::ValueType::TransformList:
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ enum class ValueType : u8 {
|
|||
Anchor,
|
||||
AnchorSize,
|
||||
Angle,
|
||||
AnglePercentage,
|
||||
BackgroundPosition,
|
||||
BasicShape,
|
||||
Color,
|
||||
|
|
@ -27,9 +28,11 @@ enum class ValueType : u8 {
|
|||
FitContent,
|
||||
Flex,
|
||||
Frequency,
|
||||
FrequencyPercentage,
|
||||
Image,
|
||||
Integer,
|
||||
Length,
|
||||
LengthPercentage,
|
||||
Number,
|
||||
Opacity,
|
||||
OpentypeTag,
|
||||
|
|
@ -41,6 +44,7 @@ enum class ValueType : u8 {
|
|||
Resolution,
|
||||
String,
|
||||
Time,
|
||||
TimePercentage,
|
||||
TransformFunction,
|
||||
TransformList,
|
||||
Url,
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ Harness status: OK
|
|||
|
||||
Found 239 tests
|
||||
|
||||
189 Pass
|
||||
50 Fail
|
||||
191 Pass
|
||||
48 Fail
|
||||
Pass syntax:'*', initialValue:'a' is valid
|
||||
Pass syntax:' * ', initialValue:'b' is valid
|
||||
Pass syntax:'<length>', initialValue:'2px' is valid
|
||||
|
|
@ -32,8 +32,8 @@ Pass syntax:'<length>', initialValue:'calc(7in - 12px)' is valid
|
|||
Pass syntax:'<length>+', initialValue:'2px 7px calc(8px)' is valid
|
||||
Fail syntax:'<length>#', initialValue:'2px, 7px, calc(8px)' is valid
|
||||
Pass syntax:'<percentage>', initialValue:'-9.3e3%' is valid
|
||||
Fail syntax:'<length-percentage>', initialValue:'-54%' is valid
|
||||
Fail syntax:'<length-percentage>', initialValue:'0' is valid
|
||||
Pass syntax:'<length-percentage>', initialValue:'-54%' is valid
|
||||
Pass syntax:'<length-percentage>', initialValue:'0' is valid
|
||||
Fail syntax:'<length-percentage>', initialValue:'calc(-11px + 10.4%)' is valid
|
||||
Pass syntax:'<length>', initialValue:'10vmin' is valid
|
||||
Pass syntax:'<percentage> | <length>+', initialValue:'calc(100vh - 10px) 30px' is valid
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue