mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Avoid cloning all over the error reporter.
This commit is contained in:
parent
eaf27ccfa0
commit
b4de69e3eb
36 changed files with 186 additions and 154 deletions
|
@ -29,7 +29,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);
|
||||
let context = ParserContext::new_for_cssom(&url, win.css_error_reporter());
|
||||
decl.eval(&context)
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,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);
|
||||
let context = ParserContext::new_for_cssom(&url, win.css_error_reporter());
|
||||
cond.eval(&context)
|
||||
} else {
|
||||
false
|
||||
|
|
|
@ -56,8 +56,10 @@ impl CSSSupportsRule {
|
|||
let mut input = Parser::new(&text);
|
||||
let cond = SupportsCondition::parse(&mut input);
|
||||
if let Ok(cond) = cond {
|
||||
let url = self.global().as_window().Document().url();
|
||||
let context = ParserContext::new_for_cssom(&url);
|
||||
let global = self.global();
|
||||
let win = global.as_window();
|
||||
let url = win.Document().url();
|
||||
let context = ParserContext::new_for_cssom(&url, win.css_error_reporter());
|
||||
let enabled = cond.eval(&context);
|
||||
let mut rule = self.supportsrule.write();
|
||||
rule.condition = cond;
|
||||
|
|
|
@ -331,8 +331,8 @@ impl Window {
|
|||
&self.bluetooth_extra_permission_data
|
||||
}
|
||||
|
||||
pub fn css_error_reporter(&self) -> Box<ParseErrorReporter + Send> {
|
||||
self.error_reporter.clone()
|
||||
pub fn css_error_reporter(&self) -> &ParseErrorReporter {
|
||||
&self.error_reporter
|
||||
}
|
||||
|
||||
/// Sets a new list of scroll offsets.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue