diff options
author | Glenn Watson <gw@intuitionlibrary.com> | 2015-08-03 09:00:46 +1000 |
---|---|---|
committer | Glenn Watson <gw@intuitionlibrary.com> | 2015-08-03 10:47:56 +1000 |
commit | b9fea3deb3afd0abba81ae7aaa282bb2ca553cfa (patch) | |
tree | b32a31cf02568708af66bea50743b49fa6f9a84e /components/script/dom | |
parent | ffe4bd25a495efd672986f090150b165811b6708 (diff) | |
download | servo-b9fea3deb3afd0abba81ae7aaa282bb2ca553cfa.tar.gz servo-b9fea3deb3afd0abba81ae7aaa282bb2ca553cfa.zip |
Fix percentage height calculation, absolute containing block height calculations.
It's not possible to correctly determine during the css cascade whether the container height
is explicitly specified. Additionally, the spec https://drafts.csswg.org/css2/visudet.html#the-height-property
says this should affect the *used* height, rather than the computed height.
This significantly improves the layout in #6643.
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/element.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 5ead9ead378..046b9a57c5f 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -390,15 +390,15 @@ impl RawLayoutElementHelpers for Element { match height { LengthOrPercentageOrAuto::Auto => {} LengthOrPercentageOrAuto::Percentage(percentage) => { - let width_value = specified::LengthOrPercentageOrAuto::Percentage(percentage); - hints.push(from_declaration(PropertyDeclaration::Height(SpecifiedValue( - height::SpecifiedValue(width_value))))); + let height_value = specified::LengthOrPercentageOrAuto::Percentage(percentage); + hints.push(from_declaration( + PropertyDeclaration::Height(SpecifiedValue(height_value)))); } LengthOrPercentageOrAuto::Length(length) => { - let width_value = specified::LengthOrPercentageOrAuto::Length( + let height_value = specified::LengthOrPercentageOrAuto::Length( specified::Length::Absolute(length)); - hints.push(from_declaration(PropertyDeclaration::Height(SpecifiedValue( - height::SpecifiedValue(width_value))))); + hints.push(from_declaration( + PropertyDeclaration::Height(SpecifiedValue(height_value)))); } } @@ -443,8 +443,7 @@ impl RawLayoutElementHelpers for Element { let value = specified::Length::FontRelative(specified::FontRelativeLength::Em(rows as CSSFloat)); hints.push(from_declaration( PropertyDeclaration::Height(SpecifiedValue( - longhands::height::SpecifiedValue( - specified::LengthOrPercentageOrAuto::Length(value)))))); + specified::LengthOrPercentageOrAuto::Length(value))))); } |