Set the border-*-width computed values to 0 as appropriate. Fix #2288

This commit is contained in:
Simon Sapin 2014-05-06 18:02:13 +01:00
parent 416cbf472a
commit e405f81065
2 changed files with 14 additions and 14 deletions

View file

@ -9,7 +9,6 @@ use layout::box_::Box;
use computed = style::computed_values;
use geom::SideOffsets2D;
use style::computed_values::{LPA_Auto, LPA_Length, LPA_Percentage, LP_Length, LP_Percentage};
use style::computed_values::{border_style};
use style::ComputedValues;
use servo_util::geometry::Au;
use servo_util::geometry;
@ -316,20 +315,11 @@ pub fn specified(length: computed::LengthOrPercentage, containing_length: Au) ->
#[inline]
pub fn border_from_style(style: &ComputedValues) -> SideOffsets2D<Au> {
#[inline]
fn width(width: Au, style: border_style::T) -> Au {
if style == border_style::none {
Au(0)
} else {
width
}
}
let border_style = style.Border.get();
SideOffsets2D::new(width(border_style.border_top_width, border_style.border_top_style),
width(border_style.border_right_width, border_style.border_right_style),
width(border_style.border_bottom_width, border_style.border_bottom_style),
width(border_style.border_left_width, border_style.border_left_style))
SideOffsets2D::new(border_style.border_top_width,
border_style.border_right_width,
border_style.border_bottom_width,
border_style.border_left_width)
}
#[inline]

View file

@ -1878,6 +1878,16 @@ pub fn cascade(applicable_declarations: &[MatchedProperty],
}
}
{
let border = style_Border.get_mut();
% for side in ["top", "right", "bottom", "left"]:
// Like calling to_computed_value, which wouldn't type check.
if !(seen.get_border_${side}_width() || context.border_${side}_present) {
border.border_${side}_width = Au(0);
}
% endfor
}
(ComputedValues {
% for style_struct in STYLE_STRUCTS:
${style_struct.name}: style_${style_struct.name},