diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2014-04-03 19:24:33 +0100 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2014-04-03 14:51:19 -0700 |
commit | 9e3f7a005d4691f5382b757fdab22e3742b6a73f (patch) | |
tree | 0df1e9fa97578eef867d6ca60d81df14bf6825c6 /src | |
parent | 8e14579797a708d94963458a79b6a60e9352ee62 (diff) | |
download | servo-9e3f7a005d4691f5382b757fdab22e3742b6a73f.tar.gz servo-9e3f7a005d4691f5382b757fdab22e3742b6a73f.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/components/style/common_types.rs | 1 | ||||
-rw-r--r-- | src/components/style/properties.rs.mako | 27 |
2 files changed, 25 insertions, 3 deletions
diff --git a/src/components/style/common_types.rs b/src/components/style/common_types.rs index 372254a8c21..655646790bb 100644 --- a/src/components/style/common_types.rs +++ b/src/components/style/common_types.rs @@ -174,6 +174,7 @@ pub mod computed { inherited_font_weight: longhands::font_weight::computed_value::T, inherited_font_size: longhands::font_size::computed_value::T, inherited_minimum_line_height: longhands::_servo_minimum_line_height::T, + inherited_height: longhands::height::T, font_size: longhands::font_size::computed_value::T, display: longhands::display::computed_value::T, positioned: bool, diff --git a/src/components/style/properties.rs.mako b/src/components/style/properties.rs.mako index 18c8d49a38e..118eee0f010 100644 --- a/src/components/style/properties.rs.mako +++ b/src/components/style/properties.rs.mako @@ -314,9 +314,29 @@ pub mod longhands { ${predefined_type("width", "LengthOrPercentageOrAuto", "computed::LPA_Auto", "parse_non_negative")} - ${predefined_type("height", "LengthOrPercentageOrAuto", - "computed::LPA_Auto", - "parse_non_negative")} + <%self:single_component_value name="height"> + pub type SpecifiedValue = specified::LengthOrPercentageOrAuto; + 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", "computed::LP_Length(Au(0))", @@ -1538,6 +1558,7 @@ pub fn cascade(applicable_declarations: &[MatchedProperty], is_root_element: is_root_element, inherited_font_weight: inherited_font_style.font_weight, inherited_font_size: inherited_font_style.font_size, + inherited_height: inherited_style.Box.get().height, inherited_minimum_line_height: inherited_style.InheritedBox .get() ._servo_minimum_line_height, |