mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
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:
parent
d77d752990
commit
7ecee05e4a
12 changed files with 161 additions and 51 deletions
|
@ -6,7 +6,7 @@ use app_units::Au;
|
|||
use style::properties::PropertyDeclaration;
|
||||
use style::properties::longhands::border_top_width;
|
||||
use style::values::HasViewportPercentage;
|
||||
use style::values::specified::{Length, NoCalcLength, ViewportPercentageLength};
|
||||
use style::values::specified::{AbsoluteLength, Length, NoCalcLength, ViewportPercentageLength};
|
||||
|
||||
#[test]
|
||||
fn has_viewport_percentage_for_specified_value() {
|
||||
|
@ -20,7 +20,7 @@ fn has_viewport_percentage_for_specified_value() {
|
|||
|
||||
let pabs = PropertyDeclaration::BorderTopWidth(Box::new(
|
||||
border_top_width::SpecifiedValue::from_length(
|
||||
Length::NoCalc(NoCalcLength::Absolute(Au(100)))
|
||||
Length::NoCalc(NoCalcLength::Absolute(AbsoluteLength::Px(Au(100).to_f32_px())))
|
||||
)
|
||||
));
|
||||
assert!(!pabs.has_viewport_percentage());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue