mirror of
https://github.com/RGBCube/serenity
synced 2025-06-28 21:02:07 +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
|
@ -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()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue