mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
style: Use ColorMix for interpolated colors in the computed style rather than ComplexColorRatios
This among other things preserves the right color-space when interpolating currentColor. Differential Revision: https://phabricator.services.mozilla.com/D147512
This commit is contained in:
parent
0ac6aaa357
commit
b6e8088e8e
10 changed files with 460 additions and 537 deletions
|
@ -418,7 +418,7 @@ fn tweak_when_ignoring_colors(
|
|||
|
||||
fn alpha_channel(color: &Color, context: &computed::Context) -> u8 {
|
||||
// We assume here currentColor is opaque.
|
||||
let color = color.to_computed_value(context).to_rgba(RGBA::new(0, 0, 0, 255));
|
||||
let color = color.to_computed_value(context).into_rgba(RGBA::new(0, 0, 0, 255));
|
||||
color.alpha
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ ${helpers.single_keyword(
|
|||
${helpers.predefined_type(
|
||||
"stop-color",
|
||||
"Color",
|
||||
"RGBA::new(0, 0, 0, 255).into()",
|
||||
"computed::Color::black()",
|
||||
engines="gecko",
|
||||
animation_value_type="AnimatedRGBA",
|
||||
spec="https://www.w3.org/TR/SVGTiny12/painting.html#StopColorProperty",
|
||||
|
@ -40,7 +40,7 @@ ${helpers.predefined_type(
|
|||
${helpers.predefined_type(
|
||||
"flood-color",
|
||||
"Color",
|
||||
"RGBA::new(0, 0, 0, 255).into()",
|
||||
"computed::Color::black()",
|
||||
engines="gecko",
|
||||
animation_value_type="AnimatedColor",
|
||||
spec="https://www.w3.org/TR/SVG/filters.html#FloodColorProperty",
|
||||
|
@ -58,7 +58,7 @@ ${helpers.predefined_type(
|
|||
${helpers.predefined_type(
|
||||
"lighting-color",
|
||||
"Color",
|
||||
"RGBA::new(255, 255, 255, 255).into()",
|
||||
"computed::Color::white()",
|
||||
engines="gecko",
|
||||
animation_value_type="AnimatedColor",
|
||||
spec="https://www.w3.org/TR/SVG/filters.html#LightingColorProperty",
|
||||
|
|
|
@ -3219,7 +3219,7 @@ impl ComputedValues {
|
|||
/// style.resolve_color(style.get_border().clone_border_top_color());
|
||||
#[inline]
|
||||
pub fn resolve_color(&self, color: computed::Color) -> RGBA {
|
||||
color.to_rgba(self.get_inherited_text().clone_color())
|
||||
color.into_rgba(self.get_inherited_text().clone_color())
|
||||
}
|
||||
|
||||
/// Returns which longhand properties have different values in the two
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue