1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:27:35 +00:00

LibWeb: Parse and resolve flex-flow property

This commit is contained in:
Tobias Christiansen 2021-05-30 12:25:10 +02:00 committed by Ali Mohammad Pur
parent e6545d5259
commit ead864acf3
2 changed files with 21 additions and 0 deletions

View file

@ -207,6 +207,12 @@
"inherited": false, "inherited": false,
"initial": "row" "initial": "row"
}, },
"flex-flow": {
"longhands": [
"flex-direction",
"flex-wrap"
]
},
"flex-wrap": { "flex-wrap": {
"inherited": false, "inherited": false,
"initial": "nowrap" "initial": "nowrap"

View file

@ -762,6 +762,21 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
return; 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); style.set_property(property_id, value);
} }