aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/style/media_queries.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/components/style/media_queries.rs b/components/style/media_queries.rs
index 569265b323f..522a252a05b 100644
--- a/components/style/media_queries.rs
+++ b/components/style/media_queries.rs
@@ -42,7 +42,7 @@ impl Default for MediaList {
pub enum Range<T> {
Min(T),
Max(T),
- //Eq(T), // FIXME: Implement parsing support for equality then re-enable this.
+ Eq(T),
}
impl Range<specified::Length> {
@@ -54,7 +54,7 @@ impl Range<specified::Length> {
match *self {
Range::Min(ref width) => Range::Min(width.to_computed_value(&context)),
Range::Max(ref width) => Range::Max(width.to_computed_value(&context)),
- //Range::Eq(ref width) => Range::Eq(compute_width(width))
+ Range::Eq(ref width) => Range::Eq(width.to_computed_value(&context))
}
}
}
@@ -64,7 +64,7 @@ impl<T: Ord> Range<T> {
match *self {
Range::Min(ref width) => { value >= *width },
Range::Max(ref width) => { value <= *width },
- //Range::Eq(ref width) => { value == *width },
+ Range::Eq(ref width) => { value == *width },
}
}
}
@@ -127,10 +127,11 @@ impl ToCss for MediaQuery {
for (i, &e) in self.expressions.iter().enumerate() {
try!(write!(dest, "("));
let (mm, l) = match e {
- Expression::Width(Range::Min(ref l)) => ("min", l),
- Expression::Width(Range::Max(ref l)) => ("max", l),
+ Expression::Width(Range::Min(ref l)) => ("min-", l),
+ Expression::Width(Range::Max(ref l)) => ("max-", l),
+ Expression::Width(Range::Eq(ref l)) => ("", l),
};
- try!(write!(dest, "{}-width: ", mm));
+ try!(write!(dest, "{}width: ", mm));
try!(l.to_css(dest));
if i == self.expressions.len() - 1 {
try!(write!(dest, ")"));
@@ -195,6 +196,9 @@ impl Expression {
"max-width" => {
Ok(Expression::Width(Range::Max(try!(specified::Length::parse_non_negative(input)))))
},
+ "width" => {
+ Ok(Expression::Width(Range::Eq(try!(specified::Length::parse_non_negative(input)))))
+ },
_ => Err(())
}
})