mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 22:24:08 +03: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:
parent
da2cd73bcf
commit
c72a2f9e46
Notes:
sideshowbarker
2024-07-17 09:47:09 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/c72a2f9e46 Pull-request: https://github.com/SerenityOS/serenity/pull/20359 Reviewed-by: https://github.com/AtkinsSJ
@ -10,7 +10,11 @@ namespace Web::CSS {
|
||||
|
||||
ErrorOr<String> PlaceContentStyleValue::to_string() const
|
||||
{
|
||||
return String::formatted("{} {}", TRY(m_properties.align_content->to_string()), TRY(m_properties.justify_content->to_string()));
|
||||
auto align_content = TRY(m_properties.align_content->to_string());
|
||||
auto justify_content = TRY(m_properties.justify_content->to_string());
|
||||
if (align_content == justify_content)
|
||||
return String::formatted("{}", align_content);
|
||||
return String::formatted("{} {}", align_content, justify_content);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,11 @@ namespace Web::CSS {
|
||||
|
||||
ErrorOr<String> PlaceSelfStyleValue::to_string() const
|
||||
{
|
||||
return String::formatted("{} {}", TRY(m_properties.align_self->to_string()), TRY(m_properties.justify_self->to_string()));
|
||||
auto align_self = TRY(m_properties.align_self->to_string());
|
||||
auto justify_self = TRY(m_properties.justify_self->to_string());
|
||||
if (align_self == justify_self)
|
||||
return String::formatted("{}", align_self);
|
||||
return String::formatted("{} {}", align_self, justify_self);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user