Upgrade to rust-cssparser master.

* Use associated types
* Avoid mutation to gather parsing results.
This commit is contained in:
Simon Sapin 2015-01-28 16:29:35 +01:00
parent 7359f99f20
commit 966af0030a
11 changed files with 183 additions and 165 deletions

View file

@ -3,12 +3,19 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::collections::HashMap;
use string_cache::Namespace;
use cssparser::{Parser, SourcePosition};
use url::{Url, UrlParser};
use log;
use stylesheets::Origin;
use namespaces::NamespaceMap;
pub struct NamespaceMap {
pub default: Option<Namespace>,
pub prefix_map: HashMap<String, Namespace>,
}
pub struct ParserContext<'a> {
@ -17,6 +24,19 @@ pub struct ParserContext<'a> {
pub namespaces: NamespaceMap,
}
impl<'a> ParserContext<'a> {
pub fn new(stylesheet_origin: Origin, base_url: &'a Url) -> ParserContext<'a> {
ParserContext {
stylesheet_origin: stylesheet_origin,
base_url: base_url,
namespaces: NamespaceMap {
default: None,
prefix_map: HashMap::new()
}
}
}
}
impl<'a> ParserContext<'a> {
pub fn in_user_agent_stylesheet(&self) -> bool {