From bf77f81ed639af0e9b305f6672db696f8a144ff4 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Thu, 8 Jun 2017 10:42:26 +1000 Subject: [PATCH] Create RGBAColor for colors compute to RGBA. --- components/layout/display_list_builder.rs | 33 +++++------- components/style/gecko/conversions.rs | 15 +----- components/style/properties/gecko.mako.rs | 44 ++++++++------- .../helpers/animated_properties.mako.rs | 4 +- .../style/properties/longhand/border.mako.rs | 10 ++-- .../style/properties/longhand/svg.mako.rs | 12 ++--- components/style/values/computed/color.rs | 10 ++++ components/style/values/computed/image.rs | 8 +-- components/style/values/computed/mod.rs | 8 +-- components/style/values/specified/color.rs | 53 +++++++++++++++++++ components/style/values/specified/image.rs | 16 +++--- components/style/values/specified/mod.rs | 13 ++--- 12 files changed, 135 insertions(+), 91 deletions(-) create mode 100644 components/style/values/computed/color.rs diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 6794d144a47..4a7f2814cbf 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -422,8 +422,7 @@ pub trait FragmentDisplayListBuilding { bounds: &Rect, stops: &[GradientItem], direction: &LineDirection, - repeating: bool, - style: &ServoComputedValues) + repeating: bool) -> display_list::Gradient; fn convert_radial_gradient(&self, @@ -431,8 +430,7 @@ pub trait FragmentDisplayListBuilding { stops: &[GradientItem], shape: &EndingShape, center: &Position, - repeating: bool, - style: &ServoComputedValues) + repeating: bool) -> display_list::RadialGradient; /// Adds the display items necessary to paint the background linear gradient of this fragment @@ -634,8 +632,7 @@ fn build_border_radius_for_inner_rect(outer_rect: &Rect, } fn convert_gradient_stops(gradient_items: &[GradientItem], - total_length: Au, - style: &ServoComputedValues) -> Vec { + total_length: Au) -> Vec { // Determine the position of each stop per CSS-IMAGES ยง 3.4. // Only keep the color stops, discard the color interpolation hints. @@ -722,7 +719,7 @@ fn convert_gradient_stops(gradient_items: &[GradientItem], }; stops.push(GradientStop { offset: offset, - color: style.resolve_color(stop.color).to_gfx_color() + color: stop.color.to_gfx_color() }) } stops @@ -1192,8 +1189,7 @@ impl FragmentDisplayListBuilding for Fragment { bounds: &Rect, stops: &[GradientItem], direction: &LineDirection, - repeating: bool, - style: &ServoComputedValues) + repeating: bool) -> display_list::Gradient { let angle = match *direction { LineDirection::Angle(angle) => angle.radians(), @@ -1234,7 +1230,7 @@ impl FragmentDisplayListBuilding for Fragment { let length = Au::from_f32_px( (delta.x.to_f32_px() * 2.0).hypot(delta.y.to_f32_px() * 2.0)); - let mut stops = convert_gradient_stops(stops, length, style); + let mut stops = convert_gradient_stops(stops, length); // Only clamped gradients need to be fixed because in repeating gradients // there is no "first" or "last" stop because they repeat infinitly in @@ -1258,8 +1254,7 @@ impl FragmentDisplayListBuilding for Fragment { stops: &[GradientItem], shape: &EndingShape, center: &Position, - repeating: bool, - style: &ServoComputedValues) + repeating: bool) -> display_list::RadialGradient { let center = Point2D::new(center.horizontal.to_used_value(bounds.size.width), center.vertical.to_used_value(bounds.size.height)); @@ -1278,7 +1273,7 @@ impl FragmentDisplayListBuilding for Fragment { }, }; - let mut stops = convert_gradient_stops(stops, radius.width, style); + let mut stops = convert_gradient_stops(stops, radius.width); // Repeating gradients have no last stops that can be ignored. So // fixup is not necessary but may actually break the gradient. if !repeating { @@ -1322,8 +1317,7 @@ impl FragmentDisplayListBuilding for Fragment { let gradient = self.convert_linear_gradient(&bounds, &gradient.items[..], angle_or_corner, - gradient.repeating, - style); + gradient.repeating); DisplayItem::Gradient(box GradientDisplayItem { base: base, gradient: gradient, @@ -1334,8 +1328,7 @@ impl FragmentDisplayListBuilding for Fragment { &gradient.items[..], shape, center, - gradient.repeating, - style); + gradient.repeating); DisplayItem::RadialGradient(box RadialGradientDisplayItem { base: base, gradient: gradient, @@ -1459,8 +1452,7 @@ impl FragmentDisplayListBuilding for Fragment { let grad = self.convert_linear_gradient(&bounds, &gradient.items[..], &angle_or_corner, - gradient.repeating, - style); + gradient.repeating); state.add_display_item(DisplayItem::Border(box BorderDisplayItem { base: base, @@ -1478,8 +1470,7 @@ impl FragmentDisplayListBuilding for Fragment { &gradient.items[..], shape, center, - gradient.repeating, - style); + gradient.repeating); state.add_display_item(DisplayItem::Border(box BorderDisplayItem { base: base, border_widths: border.to_physical(style.writing_mode), diff --git a/components/style/gecko/conversions.rs b/components/style/gecko/conversions.rs index 9f222690404..4266c61826a 100644 --- a/components/style/gecko/conversions.rs +++ b/components/style/gecko/conversions.rs @@ -183,7 +183,6 @@ impl nsStyleImage { } fn set_gradient(&mut self, gradient: Gradient) { - use cssparser::Color as CSSColor; use gecko_bindings::structs::{NS_STYLE_GRADIENT_SHAPE_CIRCULAR, NS_STYLE_GRADIENT_SHAPE_ELLIPTICAL}; use gecko_bindings::structs::{NS_STYLE_GRADIENT_SHAPE_LINEAR, NS_STYLE_GRADIENT_SIZE_CLOSEST_CORNER}; use gecko_bindings::structs::{NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE, NS_STYLE_GRADIENT_SIZE_EXPLICIT_SIZE}; @@ -321,19 +320,7 @@ impl nsStyleImage { match *item { GradientItem::ColorStop(ref stop) => { - gecko_stop.mColor = match stop.color { - CSSColor::CurrentColor => { - // TODO(emilio): gecko just stores an nscolor, - // and it doesn't seem to support currentColor - // as value in a gradient. - // - // Double-check it and either remove - // currentColor for servo or see how gecko - // handles this. - 0 - }, - CSSColor::RGBA(ref rgba) => convert_rgba_to_nscolor(rgba), - }; + gecko_stop.mColor = convert_rgba_to_nscolor(&stop.color); gecko_stop.mIsInterpolationHint = false; coord.set(stop.position); }, diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 3c0b57c9fe0..fb8a0ea8970 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -11,7 +11,6 @@ <%namespace name="helpers" file="/helpers.mako.rs" /> use app_units::Au; -use cssparser::Color; use custom_properties::ComputedValuesMap; use gecko_bindings::bindings; % for style_struct in data.style_structs: @@ -316,18 +315,6 @@ def set_gecko_property(ffi_name, expr): } -/// Convert a Servo color into an nscolor; with currentColor as 0 -/// -/// Call sites will need to be updated after https://bugzilla.mozilla.org/show_bug.cgi?id=760345 -fn color_to_nscolor_zero_currentcolor(color: Color) -> structs::nscolor { - match color { - Color::RGBA(rgba) => { - convert_rgba_to_nscolor(&rgba) - }, - Color::CurrentColor => 0, - } -} - <%def name="impl_color_setter(ident, gecko_ffi_name, complex_color=True)"> #[allow(unreachable_code)] #[allow(non_snake_case)] @@ -335,7 +322,11 @@ fn color_to_nscolor_zero_currentcolor(color: Color) -> structs::nscolor { % if complex_color: let result = v.into(); % else: - let result = color_to_nscolor_zero_currentcolor(v); + let result = match color { + Color::RGBA(rgba) => convert_rgba_to_nscolor(&rgba), + // FIXME handle currentcolor + Color::CurrentColor => 0, + }; % endif ${set_gecko_property(gecko_ffi_name, "result")} } @@ -416,6 +407,20 @@ fn color_to_nscolor_zero_currentcolor(color: Color) -> structs::nscolor { % endif +<%def name="impl_rgba_color(ident, gecko_ffi_name, need_clone=False)"> + #[allow(non_snake_case)] + pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) { + ${set_gecko_property(gecko_ffi_name, "convert_rgba_to_nscolor(&v)")} + } + <%call expr="impl_simple_copy(ident, gecko_ffi_name)"> + % if need_clone: + #[allow(non_snake_case)] + pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { + convert_nscolor_to_rgba(${get_gecko_property(gecko_ffi_name)}) + } + % endif + + <%def name="impl_svg_paint(ident, gecko_ffi_name, need_clone=False, complex_color=True)"> #[allow(non_snake_case)] pub fn set_${ident}(&mut self, mut v: longhands::${ident}::computed_value::T) { @@ -444,14 +449,14 @@ fn color_to_nscolor_zero_currentcolor(color: Color) -> structs::nscolor { SVGPaintKind::Color(color) => { paint.mType = nsStyleSVGPaintType::eStyleSVGPaintType_Color; unsafe { - *paint.mPaint.mColor.as_mut() = color_to_nscolor_zero_currentcolor(color); + *paint.mPaint.mColor.as_mut() = convert_rgba_to_nscolor(&color); } } } if let Some(fallback) = fallback { paint.mFallbackType = nsStyleSVGFallbackType::eStyleSVGFallbackType_Color; - paint.mFallbackColor = color_to_nscolor_zero_currentcolor(fallback); + paint.mFallbackColor = convert_rgba_to_nscolor(&fallback); } } @@ -472,7 +477,7 @@ fn color_to_nscolor_zero_currentcolor(color: Color) -> structs::nscolor { use self::structs::nsStyleSVGFallbackType; let ref paint = ${get_gecko_property(gecko_ffi_name)}; let fallback = if let nsStyleSVGFallbackType::eStyleSVGFallbackType_Color = paint.mFallbackType { - Some(Color::RGBA(convert_nscolor_to_rgba(paint.mFallbackColor))) + Some(convert_nscolor_to_rgba(paint.mFallbackColor)) } else { None }; @@ -485,7 +490,7 @@ fn color_to_nscolor_zero_currentcolor(color: Color) -> structs::nscolor { SVGPaintKind::None } nsStyleSVGPaintType::eStyleSVGPaintType_Color => { - unsafe { SVGPaintKind::Color(Color::RGBA(convert_nscolor_to_rgba(*paint.mPaint.mColor.as_ref()))) } + unsafe { SVGPaintKind::Color(convert_nscolor_to_rgba(*paint.mPaint.mColor.as_ref())) } } }; SVGPaint { @@ -717,6 +722,7 @@ impl Debug for ${style_struct.gecko_struct_name} { "Integer": impl_simple, "Opacity": impl_simple, "CSSColor": impl_color, + "RGBAColor": impl_rgba_color, "SVGPaint": impl_svg_paint, "UrlOrNone": impl_css_url, } @@ -948,7 +954,7 @@ fn static_assert() { structs::Side::eSide${to_camel_case(side.ident)}); } for color in colors { - let c = color_to_nscolor_zero_currentcolor(*color); + let c = convert_rgba_to_nscolor(color); unsafe { bindings::Gecko_AppendMozBorderColors(&mut self.gecko, structs::Side::eSide${to_camel_case(side.ident)}, diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 4ba7e6b505a..ce3b406d4f4 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -2823,9 +2823,9 @@ impl From for CSSParserColor { } /// Animatable SVGPaint -pub type IntermediateSVGPaint = SVGPaint; +pub type IntermediateSVGPaint = SVGPaint; /// Animatable SVGPaintKind -pub type IntermediateSVGPaintKind = SVGPaintKind; +pub type IntermediateSVGPaintKind = SVGPaintKind; impl From<::values::computed::SVGPaint> for IntermediateSVGPaint { fn from(paint: ::values::computed::SVGPaint) -> IntermediateSVGPaint { diff --git a/components/style/properties/longhand/border.mako.rs b/components/style/properties/longhand/border.mako.rs index 693d1f32551..142825cabda 100644 --- a/components/style/properties/longhand/border.mako.rs +++ b/components/style/properties/longhand/border.mako.rs @@ -66,21 +66,21 @@ ${helpers.gecko_keyword_conversion(Keyword('border-style', ignored_when_colors_disabled="True"> use std::fmt; use style_traits::ToCss; - use values::specified::CSSColor; + use values::specified::RGBAColor; no_viewport_percentage!(SpecifiedValue); pub mod computed_value { - use values::computed::CSSColor; + use cssparser::RGBA; #[derive(Debug, Clone, PartialEq)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] - pub struct T(pub Option>); + pub struct T(pub Option>); } #[derive(Debug, Clone, PartialEq)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum SpecifiedValue { None, - Colors(Vec), + Colors(Vec), } impl ToCss for computed_value::T { @@ -168,7 +168,7 @@ ${helpers.gecko_keyword_conversion(Keyword('border-style', } let mut result = Vec::new(); - while let Ok(value) = input.try(|i| CSSColor::parse(context, i)) { + while let Ok(value) = input.try(|i| RGBAColor::parse(context, i)) { result.push(value); } diff --git a/components/style/properties/longhand/svg.mako.rs b/components/style/properties/longhand/svg.mako.rs index c9704795b8a..9021121f370 100644 --- a/components/style/properties/longhand/svg.mako.rs +++ b/components/style/properties/longhand/svg.mako.rs @@ -20,8 +20,8 @@ ${helpers.single_keyword("vector-effect", "none non-scaling-stroke", // Section 13 - Gradients and Patterns ${helpers.predefined_type( - "stop-color", "CSSColor", - "CSSParserColor::RGBA(RGBA::new(0, 0, 0, 255))", + "stop-color", "RGBAColor", + "RGBA::new(0, 0, 0, 255)", products="gecko", animation_value_type="none", spec="https://www.w3.org/TR/SVGTiny12/painting.html#StopColorProperty")} @@ -34,8 +34,8 @@ ${helpers.predefined_type("stop-opacity", "Opacity", "1.0", // Section 15 - Filter Effects ${helpers.predefined_type( - "flood-color", "CSSColor", - "CSSParserColor::RGBA(RGBA::new(0, 0, 0, 255))", + "flood-color", "RGBAColor", + "RGBA::new(0, 0, 0, 255)", products="gecko", animation_value_type="none", spec="https://www.w3.org/TR/SVG/filters.html#FloodColorProperty")} @@ -45,8 +45,8 @@ ${helpers.predefined_type("flood-opacity", "Opacity", spec="https://www.w3.org/TR/SVG/filters.html#FloodOpacityProperty")} ${helpers.predefined_type( - "lighting-color", "CSSColor", - "CSSParserColor::RGBA(RGBA::new(255, 255, 255, 255))", + "lighting-color", "RGBAColor", + "RGBA::new(255, 255, 255, 255)", products="gecko", animation_value_type="none", spec="https://www.w3.org/TR/SVG/filters.html#LightingColorProperty")} diff --git a/components/style/values/computed/color.rs b/components/style/values/computed/color.rs new file mode 100644 index 00000000000..b77f55d0453 --- /dev/null +++ b/components/style/values/computed/color.rs @@ -0,0 +1,10 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//! Computed color values. + +use cssparser::RGBA; + +/// Computed value type for the specified RGBAColor. +pub type RGBAColor = RGBA; diff --git a/components/style/values/computed/image.rs b/components/style/values/computed/image.rs index 5f51dd22f85..3718be2fbd3 100644 --- a/components/style/values/computed/image.rs +++ b/components/style/values/computed/image.rs @@ -7,7 +7,7 @@ //! //! [image]: https://drafts.csswg.org/css-images/#image-values -use cssparser::Color as CSSColor; +use cssparser::RGBA; use std::f32::consts::PI; use std::fmt; use style_traits::ToCss; @@ -35,7 +35,7 @@ pub type Gradient = GenericGradient< Length, LengthOrPercentage, Position, - CSSColor, + RGBA, >; /// A computed gradient kind. @@ -60,10 +60,10 @@ pub enum LineDirection { pub type EndingShape = GenericEndingShape; /// A computed gradient item. -pub type GradientItem = GenericGradientItem; +pub type GradientItem = GenericGradientItem; /// A computed color stop. -pub type ColorStop = GenericColorStop; +pub type ColorStop = GenericColorStop; /// Computed values for ImageRect. pub type ImageRect = GenericImageRect; diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index 9c9e23887a8..b5bb04a8963 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -28,6 +28,7 @@ pub use properties::animated_properties::TransitionProperty; pub use self::background::BackgroundSize; pub use self::border::{BorderImageSlice, BorderImageWidth, BorderImageSideWidth}; pub use self::border::{BorderRadius, BorderCornerRadius}; +pub use self::color::RGBAColor; pub use self::image::{Gradient, GradientItem, ImageLayer, LineDirection, Image, ImageRect}; #[cfg(feature = "gecko")] pub use self::gecko::ScrollSnapPoint; @@ -48,6 +49,7 @@ pub use self::transform::{TimingFunction, TransformOrigin}; pub mod background; pub mod basic_shape; pub mod border; +pub mod color; pub mod image; #[cfg(feature = "gecko")] pub mod gecko; @@ -479,9 +481,9 @@ impl IntegerOrAuto { } /// Computed SVG Paint value -pub type SVGPaint = ::values::generics::SVGPaint; +pub type SVGPaint = ::values::generics::SVGPaint; /// Computed SVG Paint Kind value -pub type SVGPaintKind = ::values::generics::SVGPaintKind; +pub type SVGPaintKind = ::values::generics::SVGPaintKind; impl Default for SVGPaint { fn default() -> Self { @@ -497,7 +499,7 @@ impl SVGPaint { pub fn black() -> Self { let rgba = RGBA::from_floats(0., 0., 0., 1.); SVGPaint { - kind: ::values::generics::SVGPaintKind::Color(CSSColor::RGBA(rgba)), + kind: ::values::generics::SVGPaintKind::Color(rgba), fallback: None, } } diff --git a/components/style/values/specified/color.rs b/components/style/values/specified/color.rs index 538506bfce9..64ef534a337 100644 --- a/components/style/values/specified/color.rs +++ b/components/style/values/specified/color.rs @@ -313,3 +313,56 @@ impl ToComputedValue for CSSColor { }).into() } } + +/// Specified color value, but resolved to just RGBA for computed value +/// with value from color property at the same context. +#[derive(Clone, PartialEq, Debug)] +#[cfg_attr(feature = "servo", derive(HeapSizeOf))] +pub struct RGBAColor(pub CSSColor); + +no_viewport_percentage!(RGBAColor); + +impl Parse for RGBAColor { + fn parse(context: &ParserContext, input: &mut Parser) -> Result { + CSSColor::parse(context, input).map(RGBAColor) + } +} + +impl ToCss for RGBAColor { + fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { + self.0.to_css(dest) + } +} + +impl ToComputedValue for RGBAColor { + type ComputedValue = RGBA; + + fn to_computed_value(&self, context: &Context) -> RGBA { + match self.0.to_computed_value(context) { + CSSParserColor::RGBA(rgba) => rgba, + CSSParserColor::CurrentColor => context.style.get_color().clone_color(), + } + } + + fn from_computed_value(computed: &RGBA) -> Self { + RGBAColor(CSSColor { + parsed: Color::RGBA(*computed), + authored: None, + }) + } +} + +impl From for RGBAColor { + fn from(color: Color) -> RGBAColor { + RGBAColor(CSSColor { + parsed: color, + authored: None, + }) + } +} + +impl From for RGBAColor { + fn from(color: CSSColor) -> RGBAColor { + RGBAColor(color) + } +} diff --git a/components/style/values/specified/image.rs b/components/style/values/specified/image.rs index 4564bc0993f..a4441bcda67 100644 --- a/components/style/values/specified/image.rs +++ b/components/style/values/specified/image.rs @@ -25,7 +25,7 @@ use values::generics::image::{LineDirection as GenericsLineDirection, ShapeExten use values::generics::image::PaintWorklet; use values::generics::position::Position as GenericPosition; use values::specified::{Angle, CSSColor, Color, Length, LengthOrPercentage}; -use values::specified::{Number, NumberOrPercentage, Percentage}; +use values::specified::{Number, NumberOrPercentage, Percentage, RGBAColor}; use values::specified::position::{Position, PositionComponent, Side, X, Y}; use values::specified::url::SpecifiedUrl; @@ -43,7 +43,7 @@ pub type Gradient = GenericGradient< Length, LengthOrPercentage, Position, - CSSColor, + RGBAColor, >; /// A specified gradient kind. @@ -72,10 +72,10 @@ pub enum LineDirection { pub type EndingShape = GenericEndingShape; /// A specified gradient item. -pub type GradientItem = GenericGradientItem; +pub type GradientItem = GenericGradientItem; /// A computed color stop. -pub type ColorStop = GenericColorStop; +pub type ColorStop = GenericColorStop; /// Specified values for `moz-image-rect` /// -moz-image-rect(, top, right, bottom, left); @@ -390,7 +390,7 @@ impl Gradient { if color.parsed == Color::CurrentColor { return Err(()); } - Ok((color, p)) + Ok((color.into(), p)) })?; if reverse_stops { p = 1. - p; @@ -405,11 +405,11 @@ impl Gradient { if items.is_empty() { items = vec![ GenericGradientItem::ColorStop(GenericColorStop { - color: CSSColor::transparent(), + color: CSSColor::transparent().into(), position: Some(Percentage(0.).into()), }), GenericGradientItem::ColorStop(GenericColorStop { - color: CSSColor::transparent(), + color: CSSColor::transparent().into(), position: Some(Percentage(1.).into()), }), ]; @@ -674,7 +674,7 @@ impl GradientItem { impl Parse for ColorStop { fn parse(context: &ParserContext, input: &mut Parser) -> Result { Ok(ColorStop { - color: try!(CSSColor::parse(context, input)), + color: try!(RGBAColor::parse(context, input)), position: input.try(|i| LengthOrPercentage::parse(context, i)).ok(), }) } diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index 7be15aba77c..b157498ff61 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -31,7 +31,7 @@ pub use self::align::{AlignItems, AlignJustifyContent, AlignJustifySelf, Justify pub use self::background::BackgroundSize; pub use self::border::{BorderCornerRadius, BorderImageSlice, BorderImageWidth}; pub use self::border::{BorderImageSideWidth, BorderRadius, BorderSideWidth}; -pub use self::color::{CSSColor, Color}; +pub use self::color::{CSSColor, Color, RGBAColor}; pub use self::rect::LengthOrNumberRect; #[cfg(feature = "gecko")] pub use self::gecko::ScrollSnapPoint; @@ -799,10 +799,10 @@ impl Shadow { no_viewport_percentage!(SVGPaint); /// Specified SVG Paint value -pub type SVGPaint = ::values::generics::SVGPaint; +pub type SVGPaint = ::values::generics::SVGPaint; /// Specified SVG Paint Kind value -pub type SVGPaintKind = ::values::generics::SVGPaintKind; +pub type SVGPaintKind = ::values::generics::SVGPaintKind; impl ToComputedValue for SVGPaint { type ComputedValue = super::computed::SVGPaint; @@ -829,12 +829,7 @@ impl ToComputedValue for SVGPaintKind { #[inline] fn to_computed_value(&self, context: &Context) -> Self::ComputedValue { - self.convert(|color| { - match color.parsed { - Color::CurrentColor => cssparser::Color::RGBA(context.style().get_color().clone_color()), - _ => color.to_computed_value(context), - } - }) + self.convert(|color| color.to_computed_value(context)) } #[inline]