LibWeb/CSS: Serialize background-repeat correctly

This gets us 4 WPT subtest passes.
This commit is contained in:
Sam Atkins 2024-11-28 15:48:07 +00:00 committed by Andreas Kling
commit 5bcd9abc42
Notes: github-actions[bot] 2024-11-30 10:03:31 +00:00
6 changed files with 21 additions and 13 deletions

View file

@ -22,6 +22,14 @@ BackgroundRepeatStyleValue::~BackgroundRepeatStyleValue() = default;
String BackgroundRepeatStyleValue::to_string() const
{
if (m_properties.repeat_x == m_properties.repeat_y)
return MUST(String::from_utf8(CSS::to_string(m_properties.repeat_x)));
if (m_properties.repeat_x == Repeat::Repeat && m_properties.repeat_y == Repeat::NoRepeat)
return "repeat-x"_string;
if (m_properties.repeat_x == Repeat::NoRepeat && m_properties.repeat_y == Repeat::Repeat)
return "repeat-y"_string;
return MUST(String::formatted("{} {}", CSS::to_string(m_properties.repeat_x), CSS::to_string(m_properties.repeat_y)));
}