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
parent 2fc164c0b6
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)));
}

View file

@ -1,4 +1,4 @@
style.cssText = background-color: yellow; background-image: none; background-position-x: left 0%; background-position-y: top 0%; background-size: auto auto; background-repeat: repeat repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;
style.cssText = background-color: yellow; background-image: none; background-position-x: left 0%; background-position-y: top 0%; background-size: auto auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;
style.length = 9
style[] =
1. background-color

View file

@ -159,7 +159,7 @@ All supported properties and their default values exposed from CSSStyleDeclarati
'aspect-ratio': 'auto'
'backdropFilter': 'none'
'backdrop-filter': 'none'
'background': 'scroll border-box rgba(0, 0, 0, 0) none padding-box left 0% top 0% repeat repeat auto auto'
'background': 'scroll border-box rgba(0, 0, 0, 0) none padding-box left 0% top 0% repeat auto auto'
'backgroundAttachment': 'scroll'
'background-attachment': 'scroll'
'backgroundClip': 'border-box'
@ -176,8 +176,8 @@ All supported properties and their default values exposed from CSSStyleDeclarati
'background-position-x': 'left 0%'
'backgroundPositionY': 'top 0%'
'background-position-y': 'top 0%'
'backgroundRepeat': 'repeat repeat'
'background-repeat': 'repeat repeat'
'backgroundRepeat': 'repeat'
'background-repeat': 'repeat'
'backgroundSize': 'auto auto'
'background-size': 'auto auto'
'border': 'medium none rgb(0, 0, 0)'

View file

@ -73,7 +73,7 @@ background-image: none
background-origin: padding-box
background-position-x: left 0%
background-position-y: top 0%
background-repeat: repeat repeat
background-repeat: repeat
background-size: auto auto
border-bottom-color: rgb(0, 0, 0)
border-bottom-left-radius: 0px

View file

@ -4,7 +4,7 @@ At time 400:
animation-duration: auto
aspect-ratio: 1.54415 / 1
background-color: rgb(78, 88, 99)
background-repeat: repeat no-repeat
background-repeat: repeat-x
bottom: auto
box-shadow: rgb(163, 82, 142) 40px 80px 126px 0px inset, rgba(0, 0, 72, 0.4) 20px 4px 8px 12px
color: rgb(163, 82, 142)
@ -16,7 +16,7 @@ At time 750:
animation-duration: auto
aspect-ratio: 1.36506 / 1
background-color: rgb(147, 157, 168)
background-repeat: space space
background-repeat: space
bottom: 100%
box-shadow: rgb(81, 71, 210) 75px 150px 227.5px 0px, rgba(0, 0, 174, 0.749) 37.5px 7.5px 15px 22.5px
color: rgb(81, 71, 210)

View file

@ -6,8 +6,8 @@ Rerun
Found 687 tests
458 Pass
229 Fail
462 Pass
225 Fail
Details
Result Test Name MessagePass background-attachment: scroll
Pass background-attachment: fixed
@ -192,10 +192,10 @@ Fail background-position: right top
Fail background-position: right center
Fail background-position: right bottom
Fail background-position: inherit
Fail background-repeat: repeat
Fail background-repeat: repeat-x
Fail background-repeat: repeat-y
Fail background-repeat: no-repeat
Pass background-repeat: repeat
Pass background-repeat: repeat-x
Pass background-repeat: repeat-y
Pass background-repeat: no-repeat
Pass background-repeat: inherit
Pass border-collapse: collapse
Pass border-collapse: separate