mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Use a borrowed "device" for Media Queries matching.
This commit is contained in:
parent
e1bde72c59
commit
70c281fc25
1 changed files with 3 additions and 3 deletions
|
@ -117,13 +117,13 @@ pub fn parse_nested_at_rule(lower_name: &str, rule: AtRule,
|
||||||
|
|
||||||
|
|
||||||
impl Stylesheet {
|
impl Stylesheet {
|
||||||
fn iter_style_rules<'a>(&'a self, device: media_queries::Device) -> StyleRuleIterator<'a> {
|
fn iter_style_rules<'a>(&'a self, device: &'a media_queries::Device) -> StyleRuleIterator<'a> {
|
||||||
StyleRuleIterator { device: device, stack: ~[(self.rules.as_slice(), 0)] }
|
StyleRuleIterator { device: device, stack: ~[(self.rules.as_slice(), 0)] }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct StyleRuleIterator<'self> {
|
struct StyleRuleIterator<'self> {
|
||||||
device: media_queries::Device,
|
device: &'self media_queries::Device,
|
||||||
// FIXME: I couldn’t get this to borrow-check with a stack of VecIterator
|
// FIXME: I couldn’t get this to borrow-check with a stack of VecIterator
|
||||||
stack: ~[(&'self [CSSRule], uint)],
|
stack: ~[(&'self [CSSRule], uint)],
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ impl<'self> Iterator<&'self StyleRule> for StyleRuleIterator<'self> {
|
||||||
match rule_list[i] {
|
match rule_list[i] {
|
||||||
CSSStyleRule(ref rule) => return Some(rule),
|
CSSStyleRule(ref rule) => return Some(rule),
|
||||||
CSSMediaRule(ref rule) => {
|
CSSMediaRule(ref rule) => {
|
||||||
if rule.media_queries.evaluate(&self.device) {
|
if rule.media_queries.evaluate(self.device) {
|
||||||
self.stack.push((rule.rules.as_slice(), 0))
|
self.stack.push((rule.rules.as_slice(), 0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue