aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/parser.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-03-13 16:50:26 -0700
committerGitHub <noreply@github.com>2017-03-13 16:50:26 -0700
commit8c8edb8731dc01d254839d0922590fba72f278c6 (patch)
treec0c0297ced2c9b58828f4f68dadd50055e53ce6d /components/style/parser.rs
parent35028f8f60d172a6bde8133ebe26e887eb33d9e6 (diff)
parentb4de69e3ebf5b2a6e82b68b66df090e9220b9e61 (diff)
downloadservo-8c8edb8731dc01d254839d0922590fba72f278c6.tar.gz
servo-8c8edb8731dc01d254839d0922590fba72f278c6.zip
Auto merge of #15931 - emilio:die-defaultvalues-die, r=mbrubeck
style: Kill SharedStyleContext::default_computed_values. This is on top of https://github.com/servo/servo/pull/15928. Now that cascade() gets a Device ref, we can use the default computed values from there to avoid propagating that state all over the place. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15931) <!-- Reviewable:end -->
Diffstat (limited to 'components/style/parser.rs')
-rw-r--r--components/style/parser.rs19
1 files changed, 12 insertions, 7 deletions
diff --git a/components/style/parser.rs b/components/style/parser.rs
index b6ac5968c07..8a8628d2d89 100644
--- a/components/style/parser.rs
+++ b/components/style/parser.rs
@@ -12,7 +12,7 @@ use error_reporting::ParseErrorReporter;
use gecko_bindings::sugar::refptr::{GeckoArcPrincipal, GeckoArcURI};
use servo_url::ServoUrl;
use style_traits::OneOrMoreCommaSeparated;
-use stylesheets::{MemoryHoleReporter, Origin};
+use stylesheets::Origin;
/// Extra data that the style backend may need to parse stylesheets.
#[cfg(not(feature = "gecko"))]
@@ -67,7 +67,7 @@ pub struct ParserContext<'a> {
/// The base url we're parsing this stylesheet as.
pub base_url: &'a ServoUrl,
/// An error reporter to report syntax errors.
- pub error_reporter: Box<ParseErrorReporter + Send>,
+ pub error_reporter: &'a ParseErrorReporter,
/// Implementation-dependent extra data.
pub extra_data: ParserContextExtraData,
}
@@ -76,7 +76,7 @@ impl<'a> ParserContext<'a> {
/// Create a `ParserContext` with extra data.
pub fn new_with_extra_data(stylesheet_origin: Origin,
base_url: &'a ServoUrl,
- error_reporter: Box<ParseErrorReporter + Send>,
+ error_reporter: &'a ParseErrorReporter,
extra_data: ParserContextExtraData)
-> ParserContext<'a> {
ParserContext {
@@ -90,22 +90,27 @@ impl<'a> ParserContext<'a> {
/// Create a parser context with the default extra data.
pub fn new(stylesheet_origin: Origin,
base_url: &'a ServoUrl,
- error_reporter: Box<ParseErrorReporter + Send>)
+ error_reporter: &'a ParseErrorReporter)
-> ParserContext<'a> {
let extra_data = ParserContextExtraData::default();
Self::new_with_extra_data(stylesheet_origin, base_url, error_reporter, extra_data)
}
/// Create a parser context for on-the-fly parsing in CSSOM
- pub fn new_for_cssom(base_url: &'a ServoUrl) -> ParserContext<'a> {
- Self::new(Origin::User, base_url, Box::new(MemoryHoleReporter))
+ pub fn new_for_cssom(base_url: &'a ServoUrl,
+ error_reporter: &'a ParseErrorReporter)
+ -> ParserContext<'a> {
+ Self::new(Origin::User, base_url, error_reporter)
}
}
/// Defaults to a no-op.
/// Set a `RUST_LOG=style::errors` environment variable
/// to log CSS parse errors to stderr.
-pub fn log_css_error(input: &mut Parser, position: SourcePosition, message: &str, parsercontext: &ParserContext) {
+pub fn log_css_error(input: &mut Parser,
+ position: SourcePosition,
+ message: &str,
+ parsercontext: &ParserContext) {
let servo_url = parsercontext.base_url;
parsercontext.error_reporter.report_error(input, position, message, servo_url);
}