Implement gecko glue for border-image-width

This commit is contained in:
Nazım Can Altınova 2016-11-03 18:42:38 +03:00
parent cbd43f7acc
commit 8387d7e8b6
2 changed files with 28 additions and 2 deletions

View file

@ -640,7 +640,8 @@ fn static_assert() {
["border-{0}-radius".format(x.ident.replace("_", "-"))
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"
skip_longhands="${skip_border_longhands} border-image-source border-image-outset
border-image-repeat border-image-width"
skip_additionals="*">
% for side in SIDES:
@ -725,6 +726,31 @@ fn static_assert() {
self.gecko.mBorderImageRepeatH = other.gecko.mBorderImageRepeatH;
self.gecko.mBorderImageRepeatV = other.gecko.mBorderImageRepeatV;
}
pub fn set_border_image_width(&mut self, v: longhands::border_image_width::computed_value::T) {
use properties::longhands::border_image_width::computed_value::SingleComputedValue;
% for side in SIDES:
match v.${side.index} {
SingleComputedValue::Auto => {
self.gecko.mBorderImageWidth.data_at_mut(${side.index}).set_value(CoordDataValue::Auto)
},
SingleComputedValue::LengthOrPercentage(l) => {
l.to_gecko_style_coord(&mut self.gecko.mBorderImageWidth.data_at_mut(${side.index}))
},
SingleComputedValue::Number(n) => {
self.gecko.mBorderImageWidth.data_at_mut(${side.index}).set_value(CoordDataValue::Factor(n))
},
}
% endfor
}
pub fn copy_border_image_width_from(&mut self, other: &Self) {
% for side in SIDES:
self.gecko.mBorderImageWidth.data_at_mut(${side.index})
.copy_from(&other.gecko.mBorderImageWidth.data_at(${side.index}));
% endfor
}
</%self:impl_trait>
<% skip_margin_longhands = " ".join(["margin-%s" % x.ident for x in SIDES]) %>

View file

@ -383,7 +383,7 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
</%helpers:longhand>
// https://drafts.csswg.org/css-backgrounds-3/#border-image-width
<%helpers:longhand name="border-image-width" products="none" animatable="False">
<%helpers:longhand name="border-image-width" products="gecko" animatable="False">
use cssparser::ToCss;
use std::fmt;
use values::LocalToCss;