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:
Sam Atkins 2021-10-19 16:43:56 +01:00 committed by Andreas Kling
commit 78e57096e2
Notes: sideshowbarker 2024-07-18 02:09:44 +09:00
7 changed files with 55 additions and 30 deletions

View file

@ -469,7 +469,7 @@ RefPtr<StyleValue> ResolvedCSSStyleDeclaration::style_value_for_property(Layout:
auto maybe_z_index = layout_node.computed_values().z_index();
if (!maybe_z_index.has_value())
return {};
return NumericStyleValue::create(maybe_z_index.release_value());
return NumericStyleValue::create_integer(maybe_z_index.release_value());
}
case CSS::PropertyID::TextAlign:
return IdentifierStyleValue::create(to_css_value_id(layout_node.computed_values().text_align()));
@ -501,19 +501,19 @@ RefPtr<StyleValue> ResolvedCSSStyleDeclaration::style_value_for_property(Layout:
auto maybe_grow_factor = layout_node.computed_values().flex_grow_factor();
if (!maybe_grow_factor.has_value())
return {};
return NumericStyleValue::create(maybe_grow_factor.release_value());
return NumericStyleValue::create_float(maybe_grow_factor.release_value());
}
case CSS::PropertyID::FlexShrink: {
auto maybe_shrink_factor = layout_node.computed_values().flex_shrink_factor();
if (!maybe_shrink_factor.has_value())
return {};
return NumericStyleValue::create(maybe_shrink_factor.release_value());
return NumericStyleValue::create_float(maybe_shrink_factor.release_value());
}
case CSS::PropertyID::Opacity: {
auto maybe_opacity = layout_node.computed_values().opacity();
if (!maybe_opacity.has_value())
return {};
return NumericStyleValue::create(maybe_opacity.release_value());
return NumericStyleValue::create_float(maybe_opacity.release_value());
}
case CSS::PropertyID::JustifyContent:
return IdentifierStyleValue::create(to_css_value_id(layout_node.computed_values().justify_content()));