diff --git a/computed.rs b/computed.rs index e4a1fb6..ce70a0a 100644 --- a/computed.rs +++ b/computed.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use color::{Color, rgba}; -use units::{Length, Px, Em, Pt}; +use units::{Length, Px, Em}; use netsurfcss::util::css_fixed_to_float; use std::either::{Either, Left, Right}; use n; @@ -406,7 +406,11 @@ fn convert_net_unit_to_length_or_percent(unit: n::t::CssUnit) -> Either Left(Px(css_fixed_to_float(l))), n::t::CssUnitEm(l) => Left(Em(css_fixed_to_float(l))), - n::t::CssUnitPt(l) => Left(Pt(css_fixed_to_float(l))), + n::t::CssUnitPt(l) => Left(Px(css_fixed_to_float(l) / 72f * 96f)), + n::t::CssUnitCm(l) => Left(Px(css_fixed_to_float(l) / 2.54f * 96f)), + n::t::CssUnitMm(l) => Left(Px(css_fixed_to_float(l) / 25.4f * 96f)), + n::t::CssUnitIn(l) => Left(Px(css_fixed_to_float(l) / 1f * 96f)), + n::t::CssUnitPc(l) => Left(Px(css_fixed_to_float(l) / 6f * 96f)), n::t::CssUnitPct(p) => Right(css_fixed_to_float(p)), _ => unimpl("unit") } diff --git a/test.rs b/test.rs index 0363304..c8c3f8d 100644 --- a/test.rs +++ b/test.rs @@ -334,9 +334,9 @@ fn test_font_family_specific() { #[test] fn test_font_size() { - let style = "span { font-size: 10pt; }"; + let style = "span { font-size: 10px; }"; do child_test(style) |computed| { - assert!(computed.font_size() == Specified(CSSFontSizeLength(Pt(10.0)))); + assert!(computed.font_size() == Specified(CSSFontSizeLength(Px(10.0)))); } let style = "span { font-size: 10%; }"; do child_test(style) |computed| { diff --git a/units.rs b/units.rs index 3c21e6d..c743ae0 100644 --- a/units.rs +++ b/units.rs @@ -10,7 +10,6 @@ Units used by CSS pub enum Length { Em(float), // normalized to 'em' Px(float), // normalized to 'px' - Pt(float) } impl Length {