mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
parent
99ad3678fa
commit
138a0480fe
22 changed files with 500 additions and 20 deletions
|
@ -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(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue