mirror of
https://github.com/servo/servo.git
synced 2025-08-16 10:55:34 +01:00
style: Move the error reporter into ParserContext.
Summary: This should make it easier to report errors, and also reduce codesize. The reason this was so generic is that error reporting was unconditionally enabled and was super-hot, but now that's no longer the case after bug 1452143, so we can afford the virtual call in the "error reporting enabled" case. This opens the possibility of simplifying a lot the error setup as well, though this patch doesn't do it. Test Plan: No behavior change, so no new tests. Reviewers: xidorn Bug #: 1469957 Differential Revision: https://phabricator.services.mozilla.com/D1734 MozReview-Commit-ID: F3wTdhX9MB5
This commit is contained in:
parent
bab7be63b2
commit
3a0c3224b9
13 changed files with 128 additions and 194 deletions
|
@ -11,11 +11,11 @@ use app_units::Au;
|
|||
use context::QuirksMode;
|
||||
use cssparser::{parse_important, AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
|
||||
use cssparser::CowRcStr;
|
||||
use error_reporting::{ContextualParseError, ParseErrorReporter};
|
||||
use error_reporting::ContextualParseError;
|
||||
use euclid::TypedSize2D;
|
||||
use font_metrics::get_metrics_provider_for_product;
|
||||
use media_queries::Device;
|
||||
use parser::{ParserContext, ParserErrorContext};
|
||||
use parser::ParserContext;
|
||||
use properties::StyleBuilder;
|
||||
use rule_cache::RuleCacheConditions;
|
||||
use selectors::parser::SelectorParseErrorKind;
|
||||
|
@ -355,15 +355,13 @@ fn is_whitespace_separator_or_equals(c: &char) -> bool {
|
|||
|
||||
impl ViewportRule {
|
||||
/// Parse a single @viewport rule.
|
||||
pub fn parse<'i, 't, R>(
|
||||
///
|
||||
/// TODO(emilio): This could use the `Parse` trait now.
|
||||
pub fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
error_context: &ParserErrorContext<R>,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>>
|
||||
where
|
||||
R: ParseErrorReporter,
|
||||
{
|
||||
let parser = ViewportRuleParser { context: context };
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
let parser = ViewportRuleParser { context };
|
||||
|
||||
let mut cascade = Cascade::new();
|
||||
let mut parser = DeclarationListParser::new(input, parser);
|
||||
|
@ -380,7 +378,7 @@ impl ViewportRule {
|
|||
slice,
|
||||
error,
|
||||
);
|
||||
context.log_css_error(error_context, location, error);
|
||||
context.log_css_error(location, error);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue