1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +00:00

LibWeb: Add support for "place-items" CSS property

Adds support for place-items property which allows to specify both
align-items and justify-items in a single declaration.
This commit is contained in:
Aliaksandr Kalenik 2023-07-17 16:34:12 +02:00 committed by Andreas Kling
parent a74c56bc1b
commit a8587fe54e
12 changed files with 135 additions and 0 deletions

View file

@ -54,6 +54,7 @@
#include <LibWeb/CSS/StyleValues/OverflowStyleValue.h>
#include <LibWeb/CSS/StyleValues/PercentageStyleValue.h>
#include <LibWeb/CSS/StyleValues/PlaceContentStyleValue.h>
#include <LibWeb/CSS/StyleValues/PlaceItemsStyleValue.h>
#include <LibWeb/CSS/StyleValues/PositionStyleValue.h>
#include <LibWeb/CSS/StyleValues/RectStyleValue.h>
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
@ -432,6 +433,19 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
return;
}
if (property_id == CSS::PropertyID::PlaceItems) {
if (value.is_place_items()) {
auto const& place_items = value.as_place_items();
style.set_property(CSS::PropertyID::AlignItems, place_items.align_items());
style.set_property(CSS::PropertyID::JustifyItems, place_items.justify_items());
return;
}
style.set_property(CSS::PropertyID::AlignItems, value);
style.set_property(CSS::PropertyID::JustifyItems, value);
return;
}
if (property_id == CSS::PropertyID::Border) {
set_property_expanding_shorthands(style, CSS::PropertyID::BorderTop, value, document, declaration);
set_property_expanding_shorthands(style, CSS::PropertyID::BorderRight, value, document, declaration);