summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Christiansen <tobi@tobyase.de>2021-06-05 23:54:02 +0200
committerLinus Groh <mail@linusgroh.de>2021-06-06 00:16:27 +0100
commitb253b63bb4dc15218cd98380fef4f0485822c100 (patch)
tree7c03bc5526a40d3749d02dc8feb8e56c45cc7c78
parent2a8f4f097c30fd15f8d421aa062dcab3f63cc13f (diff)
downloadserenity-b253b63bb4dc15218cd98380fef4f0485822c100.zip
LibWeb: Resolve flex: shorthand correctly
This patch removes some FIXMEs from the StyleResolver, specifically adding the proper float-parsing to the flex: shorthand. The functionality was already there it just didn't get plumbed in before.
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleResolver.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp b/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp
index cf09c494a3..cd5b07ea5e 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp
@@ -329,32 +329,30 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
auto parts = split_on_whitespace(value.to_string());
if (parts.size() == 1) {
- // FIXME: Parse float value here.
- // FIXME: Maybe add NumericStyleValue or sth for that.
- // Also extend parse_css_value.
- style.set_property(CSS::PropertyID::FlexGrow, ""sv);
+ auto flex_grow = parse_css_value(context, parts[0]);
+ style.set_property(CSS::PropertyID::FlexGrow, *flex_grow);
return;
}
if (parts.size() == 2) {
- // FIXME: Parse float value from parts[0] here.
- style.set_property(CSS::PropertyID::FlexGrow, ""sv);
+ auto flex_grow = parse_css_value(context, parts[0]);
+ style.set_property(CSS::PropertyID::FlexGrow, *flex_grow);
auto second_value = parse_css_value(context, parts[1]);
if (second_value->is_length() || (second_value->is_identifier() && second_value->to_identifier() == CSS::ValueID::Content)) {
style.set_property(CSS::PropertyID::FlexBasis, *second_value);
} else {
- // FIXME: Parse float value from parts[1] here.
- style.set_property(CSS::PropertyID::FlexShrink, ""sv);
+ auto flex_shrink = parse_css_value(context, parts[1]);
+ style.set_property(CSS::PropertyID::FlexShrink, *flex_shrink);
}
return;
}
if (parts.size() == 3) {
- // FIXME: Parse float value from parts[0] here.
- style.set_property(CSS::PropertyID::FlexGrow, ""sv);
- // FIXME: Parse float value from parts[1] here.
- style.set_property(CSS::PropertyID::FlexShrink, ""sv);
+ auto flex_grow = parse_css_value(context, parts[0]);
+ style.set_property(CSS::PropertyID::FlexGrow, *flex_grow);
+ auto flex_shrink = parse_css_value(context, parts[1]);
+ style.set_property(CSS::PropertyID::FlexShrink, *flex_shrink);
auto third_value = parse_css_value(context, parts[2]);
if (third_value->is_length() || (third_value->is_identifier() && third_value->to_identifier() == CSS::ValueID::Content))