From ccd7022457c90580c195d4c1c821bd4e8d9c9350 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 7 Jun 2017 13:16:58 +1000 Subject: [PATCH] Reuse ToCss of Shadow types in drop-shadow filter. --- .../style/properties/longhand/effects.mako.rs | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/components/style/properties/longhand/effects.mako.rs b/components/style/properties/longhand/effects.mako.rs index 0a672851ab4..d78d1911ff3 100644 --- a/components/style/properties/longhand/effects.mako.rs +++ b/components/style/properties/longhand/effects.mako.rs @@ -210,15 +210,9 @@ ${helpers.predefined_type("clip", computed_value::Filter::Sepia(value) => try!(write!(dest, "sepia({})", value)), % if product == "gecko": computed_value::Filter::DropShadow(shadow) => { - try!(dest.write_str("drop-shadow(")); - try!(shadow.offset_x.to_css(dest)); - try!(dest.write_str(" ")); - try!(shadow.offset_y.to_css(dest)); - try!(dest.write_str(" ")); - try!(shadow.blur_radius.to_css(dest)); - try!(dest.write_str(" ")); - try!(shadow.color.to_css(dest)); - try!(dest.write_str(")")); + dest.write_str("drop-shadow(")?; + shadow.to_css(dest)?; + dest.write_str(")")?; } computed_value::Filter::Url(ref url) => { url.to_css(dest)?; @@ -251,17 +245,9 @@ ${helpers.predefined_type("clip", SpecifiedFilter::Sepia(value) => try!(write!(dest, "sepia({})", value)), % if product == "gecko": SpecifiedFilter::DropShadow(ref shadow) => { - try!(dest.write_str("drop-shadow(")); - try!(shadow.offset_x.to_css(dest)); - try!(dest.write_str(" ")); - try!(shadow.offset_y.to_css(dest)); - try!(dest.write_str(" ")); - try!(shadow.blur_radius.to_css(dest)); - if let Some(ref color) = shadow.color { - try!(dest.write_str(" ")); - try!(color.to_css(dest)); - } - try!(dest.write_str(")")); + dest.write_str("drop-shadow(")?; + shadow.to_css(dest)?; + dest.write_str(")")?; } SpecifiedFilter::Url(ref url) => { url.to_css(dest)?;