diff --git a/Libraries/LibWeb/CSS/StyleValues/ShorthandStyleValue.cpp b/Libraries/LibWeb/CSS/StyleValues/ShorthandStyleValue.cpp index 98718cf377b..c0d52f5c902 100644 --- a/Libraries/LibWeb/CSS/StyleValues/ShorthandStyleValue.cpp +++ b/Libraries/LibWeb/CSS/StyleValues/ShorthandStyleValue.cpp @@ -61,8 +61,12 @@ String ShorthandStyleValue::to_string(SerializationMode mode) const } }); - if (all_same_keyword && built_in_keyword.has_value()) - return MUST(String::from_utf8(string_from_keyword(built_in_keyword.value()))); + if (built_in_keyword.has_value()) { + if (all_same_keyword) + return MUST(String::from_utf8(string_from_keyword(built_in_keyword.value()))); + + return ""_string; + } auto default_to_string = [&]() { auto all_properties_same_value = true; diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/cssom/cssom-getPropertyValue-common-checks.txt b/Tests/LibWeb/Text/expected/wpt-import/css/cssom/cssom-getPropertyValue-common-checks.txt new file mode 100644 index 00000000000..3c4b53ef90b --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/css/cssom/cssom-getPropertyValue-common-checks.txt @@ -0,0 +1,17 @@ +Harness status: OK + +Found 11 tests + +5 Pass +6 Fail +Fail All properties can serialize 'initial' +Fail All properties (except 'all') can serialize their initial value (computed) +Fail All properties (except 'all') can serialize their initial value (specified) +Fail All shorthands can serialize their longhands set to 'initial' +Fail All shorthands (except 'all') can serialize their longhands set to their initial value +Pass All aliases can serialize target property set to 'initial' +Pass All aliases can serialize target property set to its initial value +Fail Can't serialize shorthand when longhands are set to different css-wide keywords +Pass Can't serialize shorthand when longhands have different priority +Pass Can't serialize shorthand set to 'initial' when some longhand is missing +Pass Can't serialize shorthand set to initial value when some longhand is missing \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/cssom/flex-serialization.txt b/Tests/LibWeb/Text/expected/wpt-import/css/cssom/flex-serialization.txt index 932fcb30c27..c753fa8965e 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/cssom/flex-serialization.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/cssom/flex-serialization.txt @@ -2,10 +2,10 @@ Harness status: OK Found 5 tests -2 Pass -3 Fail +4 Pass +1 Fail Pass Single value flex with CSS-wide keyword should serialize correctly. Fail Single value flex with non-CSS-wide value should serialize correctly. Pass Multiple values flex with CSS-wide keyword should serialize correctly. -Fail Multiple values flex with CSS-wide keywords and non-CSS-wide value should serialize correctly. -Fail Multiple values flex with CSS-wide and two non-CSS-wide-keyword values should serialize correctly. \ No newline at end of file +Pass Multiple values flex with CSS-wide keywords and non-CSS-wide value should serialize correctly. +Pass Multiple values flex with CSS-wide and two non-CSS-wide-keyword values should serialize correctly. \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/cssom/font-variant-shorthand-serialization.txt b/Tests/LibWeb/Text/expected/wpt-import/css/cssom/font-variant-shorthand-serialization.txt index 23ad6e3ade7..9320fd402e0 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/cssom/font-variant-shorthand-serialization.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/cssom/font-variant-shorthand-serialization.txt @@ -2,12 +2,12 @@ Harness status: OK Found 7 tests -5 Pass -2 Fail +6 Pass +1 Fail Pass font-variant: normal serialization Pass font-variant: none serialization Pass font-variant-ligatures: none serialization with non-default value for another longhand Pass font-variant: normal with non-default longhands -Fail CSS-wide keyword in one longhand +Pass CSS-wide keyword in one longhand Pass CSS-wide keyword in shorthand Fail font: menu serialization \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/css/cssom/cssom-getPropertyValue-common-checks.html b/Tests/LibWeb/Text/input/wpt-import/css/cssom/cssom-getPropertyValue-common-checks.html new file mode 100644 index 00000000000..34a00cb7f16 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/css/cssom/cssom-getPropertyValue-common-checks.html @@ -0,0 +1,223 @@ + + +