Hoist ParseErrorReporter into style and remove the dependency on msg.

The pipeline id stuff is currently unused. If someone needs it, they can add
an additional trait bound on their css error reporter to get the pipeline id.
This commit is contained in:
Bobby Holley 2016-01-08 20:04:53 -08:00
parent a03747e12b
commit 384cdfcfff
20 changed files with 39 additions and 79 deletions

View file

@ -5,12 +5,9 @@
// For lazy_static
#![allow(unsafe_code)]
use cssparser::{Parser, SourcePosition};
use dom::TElement;
use log;
use error_reporting::{ParseErrorReporter, StdoutErrorReporter};
use media_queries::{Device, MediaType};
use msg::ParseErrorReporter;
use msg::constellation_msg::PipelineId;
use properties::{PropertyDeclaration, PropertyDeclarationBlock};
use restyle_hints::{ElementSnapshot, RestyleHint, DependencySet};
use selectors::Element;
@ -32,25 +29,6 @@ use viewport::{MaybeNew, ViewportRuleCascade};
pub type DeclarationBlock = GenericDeclarationBlock<Vec<PropertyDeclaration>>;
pub struct StdoutErrorReporter;
impl ParseErrorReporter for StdoutErrorReporter {
fn report_error(&self, input: &mut Parser, position: SourcePosition, message: &str) {
if log_enabled!(log::LogLevel::Info) {
let location = input.source_location(position);
info!("{}:{} {}", location.line, location.column, message)
}
}
fn clone(&self) -> Box<ParseErrorReporter + Send + Sync> {
box StdoutErrorReporter
}
fn pipeline(&self) -> PipelineId {
PipelineId::fake_root_pipeline_id()
}
}
lazy_static! {
pub static ref USER_OR_USER_AGENT_STYLESHEETS: Vec<Stylesheet> = {
let mut stylesheets = vec!();