mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Pass ParserContext down to lengths
To make it possible to check the rule type when parsing lengths, we need to pass the `ParserContext` down through many layers to the place where length units are parsed. This change leaves it unused, so it's only to prepare for the next change. MozReview-Commit-ID: 70YwtcCxnWw
This commit is contained in:
parent
1ae1d370f2
commit
1a31b87c22
31 changed files with 304 additions and 251 deletions
|
@ -25,7 +25,8 @@ use script_layout_interface::message::Msg;
|
|||
use std::cell::Cell;
|
||||
use std::sync::Arc;
|
||||
use style::media_queries::parse_media_query_list;
|
||||
use style::stylesheets::{Stylesheet, Origin};
|
||||
use style::parser::ParserContext as CssParserContext;
|
||||
use style::stylesheets::{CssRuleType, Stylesheet, Origin};
|
||||
use stylesheet_loader::{StylesheetLoader, StylesheetOwner};
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -73,7 +74,6 @@ impl HTMLStyleElement {
|
|||
assert!(node.is_in_doc());
|
||||
|
||||
let win = window_from_node(node);
|
||||
let url = win.get_url();
|
||||
|
||||
let mq_attribute = element.get_attribute(&ns!(), &local_name!("media"));
|
||||
let mq_str = match mq_attribute {
|
||||
|
@ -82,10 +82,14 @@ impl HTMLStyleElement {
|
|||
};
|
||||
|
||||
let data = node.GetTextContent().expect("Element.textContent must be a string");
|
||||
let mq = parse_media_query_list(&mut CssParser::new(&mq_str));
|
||||
let url = win.get_url();
|
||||
let context = CssParserContext::new_for_cssom(&url,
|
||||
win.css_error_reporter(),
|
||||
Some(CssRuleType::Media));
|
||||
let mq = parse_media_query_list(&context, &mut CssParser::new(&mq_str));
|
||||
let shared_lock = node.owner_doc().style_shared_lock().clone();
|
||||
let loader = StylesheetLoader::for_element(self.upcast());
|
||||
let sheet = Stylesheet::from_str(&data, url, Origin::Author, mq,
|
||||
let sheet = Stylesheet::from_str(&data, win.get_url(), Origin::Author, mq,
|
||||
shared_lock, Some(&loader),
|
||||
win.css_error_reporter());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue