Skip to content

Commit

Permalink
LibWeb/CSS: Insert whitespace between tokens in serialized UnresolvedSV
Browse files Browse the repository at this point in the history
Otherwise, `margin: var(--foo) var(--bar)` would be wrongly serialized
as `margin: var(--foo)var(--bar)`
  • Loading branch information
AtkinsSJ committed Oct 15, 2024
1 parent 9b5d0ae commit 24a7d98
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions Tests/LibWeb/Text/expected/css/attr-serialization.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ attr(foo string)
attr( foo string )
attr(foo string, "fallback")
attr( foo string , "fallback" )
attr(foo) attr(bar) attr(baz)
1 change: 1 addition & 0 deletions Tests/LibWeb/Text/input/css/attr-serialization.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
serialize('attr(foo string, "fallback")');
// FIXME: This should produce `attr(foo string, "fallback")` but doesn't yet.
serialize('attr( foo string , "fallback" )');
serialize(' attr(foo) attr(bar) attr(baz) ');
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ String UnresolvedStyleValue::to_string() const
if (m_original_source_text.has_value())
return *m_original_source_text;

StringBuilder builder;
for (auto& value : m_values)
builder.append(value.to_string());
return MUST(builder.to_string());
return MUST(String::join(' ', m_values));
}

bool UnresolvedStyleValue::equals(CSSStyleValue const& other) const
Expand Down

0 comments on commit 24a7d98

Please sign in to comment.