mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Pull rule_type into ParserContext
Absorb `rule_type` into the `ParserContext` so that it's easier to pass down to deeper levels of the parser. MozReview-Commit-ID: DjBNytLxGKX
This commit is contained in:
parent
a093b0a087
commit
4574cd8ea6
35 changed files with 125 additions and 97 deletions
|
@ -10,6 +10,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use style::parser::ParserContext;
|
||||
use style::stylesheets::CssRuleType;
|
||||
use style::supports::{Declaration, parse_condition_or_declaration};
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -29,7 +30,7 @@ impl CSS {
|
|||
pub fn Supports(win: &Window, property: DOMString, value: DOMString) -> bool {
|
||||
let decl = Declaration { prop: property.into(), val: value.into() };
|
||||
let url = win.Document().url();
|
||||
let context = ParserContext::new_for_cssom(&url, win.css_error_reporter());
|
||||
let context = ParserContext::new_for_cssom(&url, win.css_error_reporter(), Some(CssRuleType::Supports));
|
||||
decl.eval(&context)
|
||||
}
|
||||
|
||||
|
@ -39,7 +40,7 @@ impl CSS {
|
|||
let cond = parse_condition_or_declaration(&mut input);
|
||||
if let Ok(cond) = cond {
|
||||
let url = win.Document().url();
|
||||
let context = ParserContext::new_for_cssom(&url, win.css_error_reporter());
|
||||
let context = ParserContext::new_for_cssom(&url, win.css_error_reporter(), Some(CssRuleType::Supports));
|
||||
cond.eval(&context)
|
||||
} else {
|
||||
false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue