Add pipeline information to CSS error reporting.

This commit is contained in:
GauriGNaik 2015-12-04 19:19:21 -05:00 committed by Josh Matthews
parent 6032f8225b
commit fc81276c8e
27 changed files with 103 additions and 29 deletions

View file

@ -9,6 +9,9 @@ build = "build.rs"
name = "style"
path = "lib.rs"
[dependencies.msg]
path = "../msg"
[dependencies.plugins]
path = "../plugins"

View file

@ -28,6 +28,7 @@ extern crate lazy_static;
extern crate log;
#[macro_use]
extern crate matches;
extern crate msg;
extern crate num;
extern crate rustc_serialize;
#[macro_use(state_pseudo_classes)] extern crate selectors;

View file

@ -4,8 +4,8 @@
use cssparser::{Parser, SourcePosition};
use msg::ParseErrorReporter;
use selectors::parser::ParserContext as SelectorParserContext;
use style_traits::ParseErrorReporter;
use stylesheets::Origin;
use url::{Url, UrlParser};
@ -13,7 +13,7 @@ pub struct ParserContext<'a> {
pub stylesheet_origin: Origin,
pub base_url: &'a Url,
pub selector_context: SelectorParserContext,
pub error_reporter: Box<ParseErrorReporter + Send>
pub error_reporter: Box<ParseErrorReporter + Send>,
}
impl<'a> ParserContext<'a> {

View file

@ -21,8 +21,8 @@ use util::logical_geometry::{LogicalMargin, PhysicalSide, WritingMode};
use euclid::SideOffsets2D;
use euclid::size::Size2D;
use fnv::FnvHasher;
use msg::ParseErrorReporter;
use string_cache::Atom;
use style_traits::ParseErrorReporter;
use computed_values;
use parser::{ParserContext, log_css_error};
use selectors::matching::DeclarationBlock;
@ -130,12 +130,12 @@ pub mod longhands {
use parser::ParserContext;
use properties::{CSSWideKeyword, DeclaredValue, Shorthand};
% endif
use msg::ParseErrorReporter;
use properties::longhands;
use properties::property_bit_field::PropertyBitField;
use properties::{ComputedValues, PropertyDeclaration};
use std::collections::HashMap;
use std::sync::Arc;
use style_traits::ParseErrorReporter;
use values::computed::ToComputedValue;
use values::{computed, specified};
use string_cache::Atom;

View file

@ -5,6 +5,8 @@
use cssparser::{Parser, SourcePosition};
use log;
use media_queries::{Device, MediaType};
use msg::ParseErrorReporter;
use msg::constellation_msg::PipelineId;
use node::TElementAttributes;
use properties::{PropertyDeclaration, PropertyDeclarationBlock};
use restyle_hints::{ElementSnapshot, RestyleHint, DependencySet};
@ -16,7 +18,6 @@ use selectors::parser::PseudoElement;
use selectors::states::*;
use smallvec::VecLike;
use std::process;
use style_traits::ParseErrorReporter;
use style_traits::viewport::ViewportConstraints;
use stylesheets::{CSSRuleIteratorExt, Origin, Stylesheet};
use url::Url;
@ -27,7 +28,7 @@ use viewport::{MaybeNew, ViewportRuleCascade};
pub type DeclarationBlock = GenericDeclarationBlock<Vec<PropertyDeclaration>>;
struct StdoutErrorReporter;
pub struct StdoutErrorReporter;
impl ParseErrorReporter for StdoutErrorReporter {
fn report_error(&self, input: &mut Parser, position: SourcePosition, message: &str) {
@ -40,6 +41,10 @@ impl ParseErrorReporter for StdoutErrorReporter {
fn clone(&self) -> Box<ParseErrorReporter + Send + Sync> {
box StdoutErrorReporter
}
fn pipeline(&self) -> PipelineId {
return PipelineId::fake_root_pipeline_id();
}
}
lazy_static! {

View file

@ -7,6 +7,7 @@ use cssparser::{AtRuleType, RuleListParser};
use encoding::EncodingRef;
use font_face::{FontFaceRule, parse_font_face_block};
use media_queries::{Device, MediaQueryList, parse_media_query_list};
use msg::ParseErrorReporter;
use parser::{ParserContext, log_css_error};
use properties::{PropertyDeclarationBlock, parse_property_declaration_list};
use selectors::parser::{Selector, parse_selector_list};
@ -16,7 +17,6 @@ use std::cell::Cell;
use std::iter::Iterator;
use std::slice;
use string_cache::{Atom, Namespace};
use style_traits::ParseErrorReporter;
use url::Url;
use util::mem::HeapSizeOf;
use viewport::ViewportRule;