1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

LibWeb/CSS: Serialize short version if possible for "place-" properties

Output short version when both parts of place-content, place-items,
place-self are the same.
This commit is contained in:
Aliaksandr Kalenik 2023-08-05 11:12:18 +02:00 committed by Andreas Kling
parent da2cd73bcf
commit c72a2f9e46
3 changed files with 15 additions and 3 deletions

View file

@ -10,7 +10,11 @@ namespace Web::CSS {
ErrorOr<String> PlaceItemsStyleValue::to_string() const
{
return String::formatted("{} {}", TRY(m_properties.align_items->to_string()), TRY(m_properties.justify_items->to_string()));
auto align_items = TRY(m_properties.align_items->to_string());
auto justify_items = TRY(m_properties.justify_items->to_string());
if (align_items == justify_items)
return String::formatted("{}", align_items);
return String::formatted("{} {}", align_items, justify_items);
}
}