diff --git a/Libraries/LibWeb/CSS/StyleValues/BackgroundSizeStyleValue.cpp b/Libraries/LibWeb/CSS/StyleValues/BackgroundSizeStyleValue.cpp index fe8eed9ac96..a0b9b2c90b0 100644 --- a/Libraries/LibWeb/CSS/StyleValues/BackgroundSizeStyleValue.cpp +++ b/Libraries/LibWeb/CSS/StyleValues/BackgroundSizeStyleValue.cpp @@ -21,6 +21,8 @@ BackgroundSizeStyleValue::~BackgroundSizeStyleValue() = default; String BackgroundSizeStyleValue::to_string(SerializationMode) const { + if (m_properties.size_x.is_auto() && m_properties.size_y.is_auto()) + return "auto"_string; return MUST(String::formatted("{} {}", m_properties.size_x.to_string(), m_properties.size_y.to_string())); } diff --git a/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt b/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt index 941ff4579a9..0f8472d2675 100644 --- a/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt +++ b/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt @@ -45,9 +45,9 @@ All supported properties and their default values exposed from CSSStylePropertie 'WebkitBackgroundOrigin': 'padding-box' 'webkitBackgroundOrigin': 'padding-box' '-webkit-background-origin': 'padding-box' -'WebkitBackgroundSize': 'auto auto' -'webkitBackgroundSize': 'auto auto' -'-webkit-background-size': 'auto auto' +'WebkitBackgroundSize': 'auto' +'webkitBackgroundSize': 'auto' +'-webkit-background-size': 'auto' 'WebkitBorderBottomLeftRadius': '0px' 'webkitBorderBottomLeftRadius': '0px' '-webkit-border-bottom-left-radius': '0px' @@ -199,8 +199,8 @@ All supported properties and their default values exposed from CSSStylePropertie 'background-position-y': '0%' 'backgroundRepeat': 'repeat' 'background-repeat': 'repeat' -'backgroundSize': 'auto auto' -'background-size': 'auto auto' +'backgroundSize': 'auto' +'background-size': 'auto' 'blockSize': '0px' 'block-size': '0px' 'border': '0px rgb(0, 0, 0)' diff --git a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt index b1302f767a5..eee1d00ec33 100644 --- a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt +++ b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt @@ -88,7 +88,7 @@ background-origin: padding-box background-position-x: 0% background-position-y: 0% background-repeat: repeat -background-size: auto auto +background-size: auto block-size: 1365px border-block-end-color: rgb(0, 0, 0) border-block-end-style: none diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-backgrounds/background-size-001.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-backgrounds/background-size-001.txt new file mode 100644 index 00000000000..26504191463 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-backgrounds/background-size-001.txt @@ -0,0 +1,25 @@ +Harness status: OK + +Found 20 tests + +20 Pass +Pass background-size_initial +Pass background-size_auto +Pass background-size_cover +Pass background-size_contain +Pass background-size_length_zero +Pass background-size_length_negative_zero +Pass background-size_length_positive_zero +Pass background-size_length_normal +Pass background-size_percentage_min +Pass background-size_percentage_normal +Pass background-size_percentage_max +Pass background-size_auto_auto +Pass background-size_auto_length +Pass background-size_auto_percentage +Pass background-size_length_auto +Pass background-size_length_length +Pass background-size_length_percentage +Pass background-size_percentage_auto +Pass background-size_percentage_length +Pass background-size_percentage_percentage \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-backgrounds/inheritance.sub.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-backgrounds/inheritance.sub.txt new file mode 100644 index 00000000000..3ca41a768bc --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-backgrounds/inheritance.sub.txt @@ -0,0 +1,69 @@ +Harness status: OK + +Found 64 tests + +64 Pass +Pass Property background-attachment has initial value scroll +Pass Property background-attachment does not inherit +Pass Property background-clip has initial value border-box +Pass Property background-clip does not inherit +Pass Property background-color has initial value rgba(0, 0, 0, 0) +Pass Property background-color does not inherit +Pass Property background-image has initial value none +Pass Property background-image does not inherit +Pass Property background-origin has initial value padding-box +Pass Property background-origin does not inherit +Pass Property background-position has initial value 0% 0% +Pass Property background-position does not inherit +Pass Property background-position-x has initial value 0% +Pass Property background-position-x does not inherit +Pass Property background-position-y has initial value 0% +Pass Property background-position-y does not inherit +Pass Property background-repeat has initial value repeat +Pass Property background-repeat does not inherit +Pass Property background-size has initial value auto +Pass Property background-size does not inherit +Pass Property border-bottom-color has initial value rgb(2, 3, 4) +Pass Property border-bottom-color does not inherit +Pass Property border-bottom-left-radius has initial value 0px +Pass Property border-bottom-left-radius does not inherit +Pass Property border-bottom-right-radius has initial value 0px +Pass Property border-bottom-right-radius does not inherit +Pass Property border-bottom-style has initial value none +Pass Property border-bottom-style does not inherit +Pass Property border-bottom-width has initial value 3px +Pass Property border-bottom-width does not inherit +Pass Property border-image-outset has initial value 0 +Pass Property border-image-outset does not inherit +Pass Property border-image-repeat has initial value stretch +Pass Property border-image-repeat does not inherit +Pass Property border-image-slice has initial value 100% +Pass Property border-image-slice does not inherit +Pass Property border-image-source has initial value none +Pass Property border-image-source does not inherit +Pass Property border-image-width has initial value 1 +Pass Property border-image-width does not inherit +Pass Property border-left-color has initial value rgb(2, 3, 4) +Pass Property border-left-color does not inherit +Pass Property border-left-style has initial value none +Pass Property border-left-style does not inherit +Pass Property border-left-width has initial value 3px +Pass Property border-left-width does not inherit +Pass Property border-right-color has initial value rgb(2, 3, 4) +Pass Property border-right-color does not inherit +Pass Property border-right-style has initial value none +Pass Property border-right-style does not inherit +Pass Property border-right-width has initial value 3px +Pass Property border-right-width does not inherit +Pass Property border-top-color has initial value rgb(2, 3, 4) +Pass Property border-top-color does not inherit +Pass Property border-top-left-radius has initial value 0px +Pass Property border-top-left-radius does not inherit +Pass Property border-top-right-radius has initial value 0px +Pass Property border-top-right-radius does not inherit +Pass Property border-top-style has initial value none +Pass Property border-top-style does not inherit +Pass Property border-top-width has initial value 3px +Pass Property border-top-width does not inherit +Pass Property box-shadow has initial value none +Pass Property box-shadow does not inherit \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-backgrounds/background-size-001.html b/Tests/LibWeb/Text/input/wpt-import/css/css-backgrounds/background-size-001.html new file mode 100644 index 00000000000..fa32779aba6 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/css/css-backgrounds/background-size-001.html @@ -0,0 +1,136 @@ + + + + CSS Backgrounds and Borders Test: background-size - initial and supported values + + + + + + + + +
+
+ + + diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-backgrounds/inheritance.sub.html b/Tests/LibWeb/Text/input/wpt-import/css/css-backgrounds/inheritance.sub.html new file mode 100644 index 00000000000..3b32c5ff813 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/css/css-backgrounds/inheritance.sub.html @@ -0,0 +1,80 @@ + + + + +Inheritance of CSS Backgrounds and Borders properties + + + + + + + + + +
+ +
+
+
+ + + +