Style: Do not immediately convert absolute specified lengths

The NoCalcLength::Absolute variant has been rewritten to accommodate
other units than Au with the new AbsoluteLength enum. This avoids loss
of precision for some operations.

The conversion from floating point absolute lengths to integer
application unit values adopts the same clamping limits as Gecko.
This commit is contained in:
Tom Houlé 2017-04-01 23:11:50 +02:00 committed by Manish Goregaokar
parent d77d752990
commit 7ecee05e4a
12 changed files with 161 additions and 51 deletions

View file

@ -561,7 +561,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
}
LengthOrPercentageOrAuto::Length(length) => {
let width_value = specified::LengthOrPercentageOrAuto::Length(
specified::NoCalcLength::Absolute(length));
specified::NoCalcLength::Absolute(specified::AbsoluteLength::Px(length.to_f32_px())));
hints.push(from_declaration(
shared_lock,
PropertyDeclaration::Width(width_value)));
@ -590,7 +590,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
}
LengthOrPercentageOrAuto::Length(length) => {
let height_value = specified::LengthOrPercentageOrAuto::Length(
specified::NoCalcLength::Absolute(length));
specified::NoCalcLength::Absolute(specified::AbsoluteLength::Px(length.to_f32_px())));
hints.push(from_declaration(
shared_lock,
PropertyDeclaration::Height(height_value)));