From ead864acf30f241f71073dfe37e5505a1b3be6f2 Mon Sep 17 00:00:00 2001 From: Tobias Christiansen Date: Sun, 30 May 2021 12:25:10 +0200 Subject: [PATCH] LibWeb: Parse and resolve flex-flow property --- Userland/Libraries/LibWeb/CSS/Properties.json | 6 ++++++ Userland/Libraries/LibWeb/CSS/StyleResolver.cpp | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/Userland/Libraries/LibWeb/CSS/Properties.json b/Userland/Libraries/LibWeb/CSS/Properties.json index dbfb7d0ff5..28b52c2d26 100644 --- a/Userland/Libraries/LibWeb/CSS/Properties.json +++ b/Userland/Libraries/LibWeb/CSS/Properties.json @@ -207,6 +207,12 @@ "inherited": false, "initial": "row" }, + "flex-flow": { + "longhands": [ + "flex-direction", + "flex-wrap" + ] + }, "flex-wrap": { "inherited": false, "initial": "nowrap" diff --git a/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp b/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp index f0ed714610..f23761c832 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp @@ -762,6 +762,21 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope return; } + if (property_id == CSS::PropertyID::FlexFlow) { + auto parts = split_on_whitespace(value.to_string()); + if (parts.size() == 0) + return; + + auto direction = parse_css_value(context, parts[0]); + style.set_property(CSS::PropertyID::FlexDirection, direction.release_nonnull()); + + if (parts.size() > 1) { + auto wrap = parse_css_value(context, parts[1]); + style.set_property(CSS::PropertyID::FlexWrap, wrap.release_nonnull()); + } + return; + } + style.set_property(property_id, value); }