From e405f81065b220638241654fd6e378a052328911 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Tue, 6 May 2014 18:02:13 +0100 Subject: [PATCH] Set the border-*-width computed values to 0 as appropriate. Fix #2288 --- src/components/main/layout/model.rs | 18 ++++-------------- src/components/style/properties.rs.mako | 10 ++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/components/main/layout/model.rs b/src/components/main/layout/model.rs index 14b312a0596..3fda7357fe7 100644 --- a/src/components/main/layout/model.rs +++ b/src/components/main/layout/model.rs @@ -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 { - #[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] diff --git a/src/components/style/properties.rs.mako b/src/components/style/properties.rs.mako index 00e572f6d64..bb2de3571a4 100644 --- a/src/components/style/properties.rs.mako +++ b/src/components/style/properties.rs.mako @@ -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},