From 3bd62cf0cd08ebaebd0298ed0560b759ffa95f05 Mon Sep 17 00:00:00 2001 From: enordin Date: Tue, 3 Dec 2019 18:28:32 +0000 Subject: [PATCH] style: Check for border-image-* initial specified values when serializing border shorthand. Differential Revision: https://phabricator.services.mozilla.com/D55588 --- components/style/properties/shorthands/border.mako.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/style/properties/shorthands/border.mako.rs b/components/style/properties/shorthands/border.mako.rs index c1bf200fe45..d584e568aed 100644 --- a/components/style/properties/shorthands/border.mako.rs +++ b/components/style/properties/shorthands/border.mako.rs @@ -179,6 +179,16 @@ pub fn parse_border<'i, 't>( impl<'a> ToCss for LonghandsToSerialize<'a> { fn to_css(&self, dest: &mut CssWriter) -> fmt::Result where W: fmt::Write { + use crate::properties::longhands; + + // If any of the border-image longhands differ from their initial specified values we should not + // invoke serialize_directional_border(), so there is no point in continuing on to compute all_equal. + % for name in "outset repeat slice source width".split(): + if *self.border_image_${name} != longhands::border_image_${name}::get_initial_specified_value() { + return Ok(()); + } + % endfor + let all_equal = { % for side in PHYSICAL_SIDES: let border_${side}_width = self.border_${side}_width;