1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 12:35:08 +00:00

LibWeb: Add support for parsing place-content shorthand CSS property

This commit is contained in:
FalseHonesty 2023-05-29 16:34:53 -04:00 committed by Andreas Kling
parent 23be1c5482
commit dcead6f5eb
12 changed files with 139 additions and 0 deletions

View file

@ -50,6 +50,7 @@
#include <LibWeb/CSS/StyleValues/NumericStyleValue.h>
#include <LibWeb/CSS/StyleValues/OverflowStyleValue.h>
#include <LibWeb/CSS/StyleValues/PercentageStyleValue.h>
#include <LibWeb/CSS/StyleValues/PlaceContentStyleValue.h>
#include <LibWeb/CSS/StyleValues/PositionStyleValue.h>
#include <LibWeb/CSS/StyleValues/RectStyleValue.h>
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
@ -343,6 +344,19 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
return;
}
if (property_id == CSS::PropertyID::PlaceContent) {
if (value.is_place_content()) {
auto const& place_content = value.as_place_content();
style.set_property(CSS::PropertyID::AlignContent, place_content.align_content());
style.set_property(CSS::PropertyID::JustifyContent, place_content.justify_content());
return;
}
style.set_property(CSS::PropertyID::AlignContent, value);
style.set_property(CSS::PropertyID::JustifyContent, 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);