Computed value of 'height: <percentage>' is 'auto' in some cases.

See http://dev.w3.org/csswg/css2/visudet.html#propdef-height

This is necessary but not sufficient for #2029.

A bug fix in the previous commit "broke" Acid 2 because that bug was hiding
this one. This makes Acid 2 pass again.
This commit is contained in:
Simon Sapin 2014-04-03 19:24:33 +01:00 committed by Patrick Walton
parent 8e14579797
commit 9e3f7a005d
2 changed files with 25 additions and 3 deletions

View file

@ -174,6 +174,7 @@ pub mod computed {
inherited_font_weight: longhands::font_weight::computed_value::T, inherited_font_weight: longhands::font_weight::computed_value::T,
inherited_font_size: longhands::font_size::computed_value::T, inherited_font_size: longhands::font_size::computed_value::T,
inherited_minimum_line_height: longhands::_servo_minimum_line_height::T, inherited_minimum_line_height: longhands::_servo_minimum_line_height::T,
inherited_height: longhands::height::T,
font_size: longhands::font_size::computed_value::T, font_size: longhands::font_size::computed_value::T,
display: longhands::display::computed_value::T, display: longhands::display::computed_value::T,
positioned: bool, positioned: bool,

View file

@ -314,9 +314,29 @@ pub mod longhands {
${predefined_type("width", "LengthOrPercentageOrAuto", ${predefined_type("width", "LengthOrPercentageOrAuto",
"computed::LPA_Auto", "computed::LPA_Auto",
"parse_non_negative")} "parse_non_negative")}
${predefined_type("height", "LengthOrPercentageOrAuto", <%self:single_component_value name="height">
"computed::LPA_Auto", pub type SpecifiedValue = specified::LengthOrPercentageOrAuto;
"parse_non_negative")} pub mod computed_value {
pub type T = super::super::computed::LengthOrPercentageOrAuto;
}
#[inline]
pub fn get_initial_value() -> computed_value::T { computed::LPA_Auto }
#[inline]
pub fn from_component_value(v: &ComponentValue, _base_url: &Url)
-> Option<SpecifiedValue> {
specified::LengthOrPercentageOrAuto::parse_non_negative(v)
}
pub fn to_computed_value(value: SpecifiedValue, context: &computed::Context)
-> computed_value::T {
match (value, context.inherited_height) {
(specified::LPA_Percentage(_), computed::LPA_Auto)
if !context.is_root_element && !context.positioned => {
computed::LPA_Auto
},
_ => computed::compute_LengthOrPercentageOrAuto(value, context)
}
}
</%self:single_component_value>
${predefined_type("min-width", "LengthOrPercentage", ${predefined_type("min-width", "LengthOrPercentage",
"computed::LP_Length(Au(0))", "computed::LP_Length(Au(0))",
@ -1538,6 +1558,7 @@ pub fn cascade(applicable_declarations: &[MatchedProperty],
is_root_element: is_root_element, is_root_element: is_root_element,
inherited_font_weight: inherited_font_style.font_weight, inherited_font_weight: inherited_font_style.font_weight,
inherited_font_size: inherited_font_style.font_size, inherited_font_size: inherited_font_style.font_size,
inherited_height: inherited_style.Box.get().height,
inherited_minimum_line_height: inherited_style.InheritedBox inherited_minimum_line_height: inherited_style.InheritedBox
.get() .get()
._servo_minimum_line_height, ._servo_minimum_line_height,