diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 287dfe7d20d2..f1bbfe8fe35e 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -641,7 +641,7 @@ fn static_assert() { for x in CORNERS]) %> <%self:impl_trait style_struct_name="Border" skip_longhands="${skip_border_longhands} border-image-source border-image-outset - border-image-repeat border-image-width" + border-image-repeat border-image-width border-image-slice" skip_additionals="*"> % for side in SIDES: @@ -751,6 +751,37 @@ fn static_assert() { .copy_from(&other.gecko.mBorderImageWidth.data_at(${side.index})); % endfor } + + pub fn set_border_image_slice(&mut self, v: longhands::border_image_slice::computed_value::T) { + use gecko_bindings::structs::{NS_STYLE_BORDER_IMAGE_SLICE_NOFILL, NS_STYLE_BORDER_IMAGE_SLICE_FILL}; + use properties::longhands::border_image_slice::computed_value::PercentageOrNumber; + + for (i, corner) in v.corners.iter().enumerate() { + match *corner { + PercentageOrNumber::Percentage(p) => { + self.gecko.mBorderImageSlice.data_at_mut(i).set_value(CoordDataValue::Percent(p.0)) + }, + PercentageOrNumber::Number(n) => { + self.gecko.mBorderImageSlice.data_at_mut(i).set_value(CoordDataValue::Factor(n)) + }, + } + } + + let fill = if v.fill { + NS_STYLE_BORDER_IMAGE_SLICE_FILL + } else { + NS_STYLE_BORDER_IMAGE_SLICE_NOFILL + }; + self.gecko.mBorderImageFill = fill as u8; + } + + pub fn copy_border_image_slice_from(&mut self, other: &Self) { + for i in 0..4 { + self.gecko.mBorderImageSlice.data_at_mut(i) + .copy_from(&other.gecko.mBorderImageSlice.data_at(i)); + } + self.gecko.mBorderImageFill = other.gecko.mBorderImageFill; + } <% skip_margin_longhands = " ".join(["margin-%s" % x.ident for x in SIDES]) %> diff --git a/components/style/properties/longhand/border.mako.rs b/components/style/properties/longhand/border.mako.rs index 597a5c2fda89..0d98a0c1600a 100644 --- a/components/style/properties/longhand/border.mako.rs +++ b/components/style/properties/longhand/border.mako.rs @@ -579,7 +579,7 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box", // https://drafts.csswg.org/css-backgrounds-3/#border-image-slice -<%helpers:longhand name="border-image-slice" products="none" animatable="False"> +<%helpers:longhand name="border-image-slice" products="gecko" animatable="False"> use cssparser::ToCss; use std::fmt; use values::LocalToCss;