From 71c0c3a5d3b1e0662c49e4cc174c0e7227eaeac8 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Sat, 3 Mar 2018 00:31:11 +0100 Subject: [PATCH] Derive ToCss for DocumentCondition --- components/style/stylesheets/document_rule.rs | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/components/style/stylesheets/document_rule.rs b/components/style/stylesheets/document_rule.rs index df1aac0fae2..104f13ec710 100644 --- a/components/style/stylesheets/document_rule.rs +++ b/components/style/stylesheets/document_rule.rs @@ -176,7 +176,8 @@ impl UrlMatchingFunction { /// The `@document` rule's condition is written as a comma-separated list of /// URL matching functions, and the condition evaluates to true whenever any /// one of those functions evaluates to true. -#[derive(Clone, Debug)] +#[css(comma, iterable)] +#[derive(Clone, Debug, ToCss)] pub struct DocumentCondition(Vec); impl DocumentCondition { @@ -194,20 +195,3 @@ impl DocumentCondition { ) } } - -impl ToCss for DocumentCondition { - fn to_css(&self, dest: &mut CssWriter) -> fmt::Result - where - W: Write, - { - let mut iter = self.0.iter(); - let first = iter.next() - .expect("Empty DocumentCondition, should contain at least one URL matching function"); - first.to_css(dest)?; - for url_matching_function in iter { - dest.write_str(", ")?; - url_matching_function.to_css(dest)?; - } - Ok(()) - } -}