mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
LibWeb: Distinguish between integer and float in NumericStyleValue
We have this information when parsing, and some properties specifically only allow integers, so it makes sense to keep that around.
This commit is contained in:
parent
450b782c18
commit
78e57096e2
7 changed files with 55 additions and 30 deletions
|
@ -2060,11 +2060,11 @@ RefPtr<StyleValue> Parser::parse_numeric_value(ParsingContext const&, StyleCompo
|
|||
if (component_value.is(Token::Type::Number)) {
|
||||
auto number = component_value.token();
|
||||
if (number.m_number_type == Token::NumberType::Integer) {
|
||||
return NumericStyleValue::create(number.to_integer());
|
||||
return NumericStyleValue::create_integer(number.to_integer());
|
||||
} else {
|
||||
auto float_value = try_parse_float(number.m_value.string_view());
|
||||
if (float_value.has_value())
|
||||
return NumericStyleValue::create(float_value.value());
|
||||
return NumericStyleValue::create_float(float_value.value());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2626,11 +2626,11 @@ RefPtr<StyleValue> Parser::parse_flex_value(ParsingContext const& context, Vecto
|
|||
|
||||
switch (value->to_identifier()) {
|
||||
case ValueID::Auto: {
|
||||
auto one = NumericStyleValue::create(1);
|
||||
auto one = NumericStyleValue::create_integer(1);
|
||||
return FlexStyleValue::create(one, one, IdentifierStyleValue::create(ValueID::Auto));
|
||||
}
|
||||
case ValueID::None: {
|
||||
auto zero = NumericStyleValue::create(0);
|
||||
auto zero = NumericStyleValue::create_integer(0);
|
||||
return FlexStyleValue::create(zero, zero, IdentifierStyleValue::create(ValueID::Auto));
|
||||
}
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue