Fix float conversion of paint timing metrics

This commit is contained in:
Fernando Jiménez Moreno 2017-12-05 20:07:45 +01:00
parent 462409ada5
commit 4d8660c918
3 changed files with 15 additions and 4 deletions

View file

@ -20,6 +20,7 @@ use dom::performanceobserver::PerformanceObserver as DOMPerformanceObserver;
use dom::performancetiming::PerformanceTiming;
use dom::window::Window;
use dom_struct::dom_struct;
use metrics::ToMs;
use std::cell::Cell;
use std::cmp::Ordering;
use time;
@ -260,7 +261,7 @@ impl Performance {
Some(ref timing) => timing.navigation_start_precise(),
None => self.navigation_start_precise,
};
(time::precise_time_ns() - nav_start) as f64 / 1000000.
(time::precise_time_ns() - nav_start).to_ms()
}
}

View file

@ -9,6 +9,7 @@ use dom::bindings::str::DOMString;
use dom::globalscope::GlobalScope;
use dom::performanceentry::PerformanceEntry;
use dom_struct::dom_struct;
use metrics::ToMs;
use script_traits::ProgressiveWebMetricType;
#[dom_struct]
@ -26,7 +27,7 @@ impl PerformancePaintTiming {
PerformancePaintTiming {
entry: PerformanceEntry::new_inherited(name,
DOMString::from("paint"),
start_time as f64,
start_time.to_ms(),
0.)
}
}