Implement matchMedia and MediaQueryList

Fixes #13376.
This commit is contained in:
Jack Moffitt 2016-09-26 02:41:09 -06:00
parent 99ad3678fa
commit 138a0480fe
22 changed files with 500 additions and 20 deletions

View file

@ -135,6 +135,8 @@ pub mod values;
pub mod viewport;
pub mod workqueue;
use cssparser::ToCss;
use std::fmt;
use std::sync::Arc;
/// The CSS properties supported by the style system.
@ -174,3 +176,16 @@ pub fn arc_ptr_eq<T: 'static>(a: &Arc<T>, b: &Arc<T>) -> bool {
let b: &T = &**b;
(a as *const T) == (b as *const T)
}
pub fn serialize_comma_separated_list<W, T>(dest: &mut W, list: &[T])
-> fmt::Result where W: fmt::Write, T: ToCss {
if list.len() > 0 {
for item in &list[..list.len()-1] {
try!(item.to_css(dest));
try!(write!(dest, ", "));
}
list[list.len()-1].to_css(dest)
} else {
Ok(())
}
}