aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/parser.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-06-02 13:40:26 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-06-02 14:38:05 +0200
commitbbd85ccbda2ced5994205a4362cca92b7e4837ab (patch)
tree0262b3542c7972820eb11430b2fe118b00d33ab0 /components/style/parser.rs
parent26ef0f6178341d7155ac0d3bb2654f2f613bdee1 (diff)
downloadservo-bbd85ccbda2ced5994205a4362cca92b7e4837ab.tar.gz
servo-bbd85ccbda2ced5994205a4362cca92b7e4837ab.zip
style: Simplify the namespace setup for stylesheet parsing.
Diffstat (limited to 'components/style/parser.rs')
-rw-r--r--components/style/parser.rs40
1 files changed, 21 insertions, 19 deletions
diff --git a/components/style/parser.rs b/components/style/parser.rs
index cad388651f9..162c690c87c 100644
--- a/components/style/parser.rs
+++ b/components/style/parser.rs
@@ -7,7 +7,6 @@
use context::QuirksMode;
use cssparser::{Parser, SourcePosition, UnicodeRange};
use error_reporting::ParseErrorReporter;
-use parking_lot::RwLock;
use style_traits::OneOrMoreCommaSeparated;
use stylesheets::{CssRuleType, Origin, UrlExtraData, Namespaces};
@@ -82,8 +81,8 @@ pub struct ParserContext<'a> {
pub parsing_mode: ParsingMode,
/// The quirks mode of this stylesheet.
pub quirks_mode: QuirksMode,
- /// The list of all namespaces active in the current stylesheet
- pub namespaces: Option<&'a RwLock<Namespaces>>,
+ /// The currently active namespaces.
+ pub namespaces: Option<&'a Namespaces>,
}
impl<'a> ParserContext<'a> {
@@ -108,19 +107,21 @@ impl<'a> ParserContext<'a> {
}
/// Create a parser context for on-the-fly parsing in CSSOM
- pub fn new_for_cssom(url_data: &'a UrlExtraData,
- error_reporter: &'a ParseErrorReporter,
- rule_type: Option<CssRuleType>,
- parsing_mode: ParsingMode,
- quirks_mode: QuirksMode)
- -> ParserContext<'a> {
+ pub fn new_for_cssom(
+ url_data: &'a UrlExtraData,
+ error_reporter: &'a ParseErrorReporter,
+ rule_type: Option<CssRuleType>,
+ parsing_mode: ParsingMode,
+ quirks_mode: QuirksMode
+ ) -> ParserContext<'a> {
Self::new(Origin::Author, url_data, error_reporter, rule_type, parsing_mode, quirks_mode)
}
/// Create a parser context based on a previous context, but with a modified rule type.
- pub fn new_with_rule_type(context: &'a ParserContext,
- rule_type: Option<CssRuleType>)
- -> ParserContext<'a> {
+ pub fn new_with_rule_type(
+ context: &'a ParserContext,
+ rule_type: Option<CssRuleType>
+ ) -> ParserContext<'a> {
ParserContext {
stylesheet_origin: context.stylesheet_origin,
url_data: context.url_data,
@@ -134,13 +135,14 @@ impl<'a> ParserContext<'a> {
}
/// Create a parser context for inline CSS which accepts additional line offset argument.
- pub fn new_with_line_number_offset(stylesheet_origin: Origin,
- url_data: &'a UrlExtraData,
- error_reporter: &'a ParseErrorReporter,
- line_number_offset: u64,
- parsing_mode: ParsingMode,
- quirks_mode: QuirksMode)
- -> ParserContext<'a> {
+ pub fn new_with_line_number_offset(
+ stylesheet_origin: Origin,
+ url_data: &'a UrlExtraData,
+ error_reporter: &'a ParseErrorReporter,
+ line_number_offset: u64,
+ parsing_mode: ParsingMode,
+ quirks_mode: QuirksMode
+ ) -> ParserContext<'a> {
ParserContext {
stylesheet_origin: stylesheet_origin,
url_data: url_data,