1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-28 23:22:11 +00:00

LibWeb: Allow comma- or space-separated StyleValueLists

This lets us produce valid CSS in its to_string() method, instead of
always adding commas as before. :^)

Also, finally added a Formatter for StyleValues.
This commit is contained in:
Sam Atkins 2022-02-02 20:53:55 +00:00 committed by Andreas Kling
parent f71db4afd8
commit 5826fe094f
4 changed files with 43 additions and 25 deletions

View file

@ -83,7 +83,7 @@ static RefPtr<StyleValue> style_value_for_display(CSS::Display display)
break;
}
return StyleValueList::create(move(values));
return StyleValueList::create(move(values), StyleValueList::Separator::Space);
}
if (display.is_internal()) {
@ -550,7 +550,7 @@ RefPtr<StyleValue> ResolvedCSSStyleDeclaration::style_value_for_property(Layout:
values.append(style_value_for_length_percentage(margin.right));
values.append(style_value_for_length_percentage(margin.bottom));
values.append(style_value_for_length_percentage(margin.left));
return StyleValueList::create(move(values));
return StyleValueList::create(move(values), StyleValueList::Separator::Space);
}
case CSS::PropertyID::MarginTop:
return style_value_for_length_percentage(layout_node.computed_values().margin().top);
@ -567,7 +567,7 @@ RefPtr<StyleValue> ResolvedCSSStyleDeclaration::style_value_for_property(Layout:
values.append(style_value_for_length_percentage(padding.right));
values.append(style_value_for_length_percentage(padding.bottom));
values.append(style_value_for_length_percentage(padding.left));
return StyleValueList::create(move(values));
return StyleValueList::create(move(values), StyleValueList::Separator::Space);
}
case CSS::PropertyID::PaddingTop:
return style_value_for_length_percentage(layout_node.computed_values().padding().top);