mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb: Use generic <color-interpolation-method> parsing for gradients
See previous commit for details We now support parsing of `display-p3-linear` (although it just falls back to using Oklab since Skia doesn't support it)
This commit is contained in:
committed by
Tim Ledbetter
parent
d8c38a294c
commit
9db607b1a7
Notes:
github-actions[bot]
2026-03-18 13:23:27 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/9db607b1a77 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8485 Reviewed-by: https://github.com/tcl3 ✅
@@ -26,7 +26,7 @@ void RadialGradientStyleValue::serialize(StringBuilder& builder, SerializationMo
|
||||
|
||||
bool has_size = serialized_size != "farthest-corner"sv;
|
||||
bool has_position = !m_properties.position->is_center(mode);
|
||||
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);
|
||||
bool has_color_space = m_properties.color_interpolation_method && m_properties.color_interpolation_method->as_color_interpolation_method().color_interpolation_method() != ColorInterpolationMethodStyleValue::default_color_interpolation_method(m_properties.color_syntax);
|
||||
|
||||
if (has_size)
|
||||
m_properties.size->serialize(builder, mode);
|
||||
@@ -43,7 +43,7 @@ void RadialGradientStyleValue::serialize(StringBuilder& builder, SerializationMo
|
||||
if (has_size || has_position)
|
||||
builder.append(' ');
|
||||
|
||||
m_properties.interpolation_method.value().serialize(builder);
|
||||
m_properties.color_interpolation_method->serialize(builder, mode);
|
||||
}
|
||||
|
||||
if (has_size || has_position || has_color_space)
|
||||
@@ -94,7 +94,9 @@ ValueComparingNonnullRefPtr<StyleValue const> RadialGradientStyleValue::absoluti
|
||||
auto absolutized_size = m_properties.size->absolutized(context);
|
||||
NonnullRefPtr absolutized_position = m_properties.position->absolutized(context)->as_position();
|
||||
|
||||
return create(m_properties.ending_shape, move(absolutized_size), move(absolutized_position), move(absolutized_color_stops), m_properties.repeating, m_properties.interpolation_method);
|
||||
auto absolutized_color_interpolation_method = m_properties.color_interpolation_method ? ValueComparingRefPtr<StyleValue const> { m_properties.color_interpolation_method->absolutized(context) } : nullptr;
|
||||
|
||||
return create(m_properties.ending_shape, move(absolutized_size), move(absolutized_position), move(absolutized_color_stops), m_properties.repeating, move(absolutized_color_interpolation_method));
|
||||
}
|
||||
|
||||
bool RadialGradientStyleValue::equals(StyleValue const& other) const
|
||||
|
||||
Reference in New Issue
Block a user