mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Derive ToCss for DocumentCondition
This commit is contained in:
parent
7e1c23cb74
commit
71c0c3a5d3
1 changed files with 2 additions and 18 deletions
|
@ -176,7 +176,8 @@ impl UrlMatchingFunction {
|
||||||
/// The `@document` rule's condition is written as a comma-separated list of
|
/// The `@document` rule's condition is written as a comma-separated list of
|
||||||
/// URL matching functions, and the condition evaluates to true whenever any
|
/// URL matching functions, and the condition evaluates to true whenever any
|
||||||
/// one of those functions evaluates to true.
|
/// one of those functions evaluates to true.
|
||||||
#[derive(Clone, Debug)]
|
#[css(comma, iterable)]
|
||||||
|
#[derive(Clone, Debug, ToCss)]
|
||||||
pub struct DocumentCondition(Vec<UrlMatchingFunction>);
|
pub struct DocumentCondition(Vec<UrlMatchingFunction>);
|
||||||
|
|
||||||
impl DocumentCondition {
|
impl DocumentCondition {
|
||||||
|
@ -194,20 +195,3 @@ impl DocumentCondition {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToCss for DocumentCondition {
|
|
||||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> 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(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue