Use Rect in InsetRect

This commit is contained in:
Anthony Ramine 2017-05-25 13:01:06 +02:00
parent 6f3c46ca61
commit 150c9df246
6 changed files with 34 additions and 47 deletions

View file

@ -3914,7 +3914,7 @@ fn static_assert() {
}
}
match servo_shape {
BasicShape::Inset(rect) => {
BasicShape::Inset(inset) => {
let mut shape = init_shape(${ident}, StyleBasicShapeType::Inset);
unsafe { shape.mCoordinates.set_len(4) };
@ -3926,15 +3926,15 @@ fn static_assert() {
// the garbage data without
// attempting to clean up.
shape.mCoordinates[0].leaky_set_null();
rect.top.to_gecko_style_coord(&mut shape.mCoordinates[0]);
inset.rect.top.to_gecko_style_coord(&mut shape.mCoordinates[0]);
shape.mCoordinates[1].leaky_set_null();
rect.right.to_gecko_style_coord(&mut shape.mCoordinates[1]);
inset.rect.right.to_gecko_style_coord(&mut shape.mCoordinates[1]);
shape.mCoordinates[2].leaky_set_null();
rect.bottom.to_gecko_style_coord(&mut shape.mCoordinates[2]);
inset.rect.bottom.to_gecko_style_coord(&mut shape.mCoordinates[2]);
shape.mCoordinates[3].leaky_set_null();
rect.left.to_gecko_style_coord(&mut shape.mCoordinates[3]);
inset.rect.left.to_gecko_style_coord(&mut shape.mCoordinates[3]);
set_corners_from_radius(rect.round, &mut shape.mRadius);
set_corners_from_radius(inset.round, &mut shape.mRadius);
}
BasicShape::Circle(circ) => {
let mut shape = init_shape(${ident}, StyleBasicShapeType::Circle);

View file

@ -33,11 +33,11 @@ ${helpers.four_sides_shorthand("border-style", "border-%s-style",
impl<'a> ToCss for LonghandsToSerialize<'a> {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
let rect = Rect::new(
let rect = Rect {
% for side in PHYSICAL_SIDES:
&self.border_${side}_width,
${side}: &self.border_${side}_width,
% endfor
);
};
rect.to_css(dest)
}
}