Bug 1357350 - reset longhands of border-image to their initial value while parsing border shorthand.
To do so, we need to declare the border-image longhands as part of border
shorthand and always reset them.
Spec link: https://drafts.csswg.org/css-backgrounds-3/#the-border-shorthands
MozReview-Commit-ID: LqQjSa9yFB1
--- a/servo/components/style/properties/shorthand/border.mako.rs
+++ b/servo/components/style/properties/shorthand/border.mako.rs
@@ -117,30 +117,41 @@ pub fn parse_border(context: &ParserCont
self.border_${to_rust_ident(side)}_color
)
}
}
</%helpers:shorthand>
% endfor
-<%helpers:shorthand name="border" sub_properties="${' '.join(
- 'border-%s-%s' % (side, prop)
- for side in ['top', 'right', 'bottom', 'left']
- for prop in ['color', 'style', 'width']
-)}" spec="https://drafts.csswg.org/css-backgrounds/#border">
+<%helpers:shorthand name="border"
+ sub_properties="${' '.join('border-%s-%s' % (side, prop)
+ for side in ['top', 'right', 'bottom', 'left']
+ for prop in ['color', 'style', 'width'])}
+ ${' '.join('border-image-%s' % name
+ for name in ['outset', 'repeat', 'slice', 'source', 'width'])}"
+ spec="https://drafts.csswg.org/css-backgrounds/#border">
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
+ use properties::longhands::{border_image_outset, border_image_repeat, border_image_slice};
+ use properties::longhands::{border_image_source, border_image_width};
+
let (color, style, width) = try!(super::parse_border(context, input));
Ok(Longhands {
% for side in ["top", "right", "bottom", "left"]:
border_${side}_color: color.clone(),
border_${side}_style: style,
border_${side}_width: width.clone(),
% endfor
+
+ // The ‘border’ shorthand resets ‘border-image’ to its initial value.
+ // See https://drafts.csswg.org/css-backgrounds-3/#the-border-shorthands
+ % for name in "outset repeat slice source width".split():
+ border_image_${name}: border_image_${name}::get_initial_specified_value(),
+ % endfor
})
}
impl<'a> ToCss for LonghandsToSerialize<'a> {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
let all_equal = {
% for side in PHYSICAL_SIDES:
let border_${side}_width = self.border_${side}_width;