LibWeb: Implement css gradient-interpolation-method

This commit is contained in:
Gingeh 2025-02-19 21:02:12 +11:00 committed by Sam Atkins
commit 31853c13d3
Notes: github-actions[bot] 2025-03-06 11:34:14 +00:00
35 changed files with 499 additions and 101 deletions

View file

@ -22,6 +22,8 @@ String ConicGradientStyleValue::to_string(SerializationMode mode) const
builder.append("conic-gradient("sv);
bool has_from_angle = m_properties.from_angle.to_degrees() != 0;
bool has_at_position = !m_properties.position->is_center();
bool has_color_space = m_properties.interpolation_method.has_value() && m_properties.interpolation_method.value().color_space != InterpolationMethod::default_color_space(m_properties.color_syntax);
if (has_from_angle)
builder.appendff("from {}", m_properties.from_angle.to_string());
if (has_at_position) {
@ -29,7 +31,12 @@ String ConicGradientStyleValue::to_string(SerializationMode mode) const
builder.append(' ');
builder.appendff("at {}"sv, m_properties.position->to_string(mode));
}
if (has_from_angle || has_at_position)
if (has_color_space) {
if (has_from_angle || has_at_position)
builder.append(' ');
builder.append(m_properties.interpolation_method.value().to_string());
}
if (has_from_angle || has_at_position || has_color_space)
builder.append(", "sv);
serialize_color_stop_list(builder, m_properties.color_stop_list, mode);
builder.append(')');