mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Add pipeline information to CSS error reporting.
This commit is contained in:
parent
6032f8225b
commit
fc81276c8e
27 changed files with 103 additions and 29 deletions
|
@ -8,6 +8,9 @@ name = "style_tests"
|
|||
path = "lib.rs"
|
||||
doctest = false
|
||||
|
||||
[dependencies.msg]
|
||||
path = "../../../components/msg"
|
||||
|
||||
[dependencies.plugins]
|
||||
path = "../../../components/plugins"
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
extern crate app_units;
|
||||
extern crate cssparser;
|
||||
extern crate euclid;
|
||||
extern crate msg;
|
||||
extern crate selectors;
|
||||
#[macro_use(atom, ns)] extern crate string_cache;
|
||||
extern crate style;
|
||||
|
|
|
@ -5,11 +5,12 @@
|
|||
use app_units::Au;
|
||||
use cssparser::{Parser, SourcePosition};
|
||||
use euclid::size::Size2D;
|
||||
use msg::ParseErrorReporter;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use std::borrow::ToOwned;
|
||||
use style::media_queries::*;
|
||||
use style::stylesheets::{Origin, Stylesheet, CSSRuleIteratorExt};
|
||||
use style::values::specified;
|
||||
use style_traits::ParseErrorReporter;
|
||||
|
||||
pub struct CSSErrorReporterTest;
|
||||
|
||||
|
@ -17,9 +18,11 @@ impl ParseErrorReporter for CSSErrorReporterTest {
|
|||
fn report_error(&self, _input: &mut Parser, _position: SourcePosition, _message: &str) {
|
||||
}
|
||||
fn clone(&self) -> Box<ParseErrorReporter + Send + Sync> {
|
||||
let error_reporter = Box::new(CSSErrorReporterTest);
|
||||
return error_reporter;
|
||||
Box::new(CSSErrorReporterTest)
|
||||
}
|
||||
fn pipeline(&self) -> PipelineId {
|
||||
return PipelineId::fake_root_pipeline_id();
|
||||
}
|
||||
}
|
||||
|
||||
fn test_media_rule<F>(css: &str, callback: F) where F: Fn(&MediaQueryList, &str) {
|
||||
|
|
|
@ -21,7 +21,8 @@ fn test_parse_stylesheet() {
|
|||
#d1 > .ok { background: blue; }
|
||||
";
|
||||
let url = url!("about::test");
|
||||
let stylesheet = Stylesheet::from_str(css, url, Origin::UserAgent, Box::new(CSSErrorReporterTest));
|
||||
let stylesheet = Stylesheet::from_str(css, url, Origin::UserAgent,
|
||||
Box::new(CSSErrorReporterTest));
|
||||
assert_eq!(stylesheet, Stylesheet {
|
||||
origin: Origin::UserAgent,
|
||||
media: None,
|
||||
|
|
|
@ -6,6 +6,7 @@ use cssparser::Parser;
|
|||
use euclid::scale_factor::ScaleFactor;
|
||||
use euclid::size::Size2D;
|
||||
use media_queries::CSSErrorReporterTest;
|
||||
use msg::ParseErrorReporter;
|
||||
use style::media_queries::{Device, MediaType};
|
||||
use style::parser::ParserContext;
|
||||
use style::stylesheets::{Origin, Stylesheet, CSSRuleIteratorExt};
|
||||
|
@ -13,7 +14,6 @@ use style::values::specified::Length::{self, ViewportPercentage};
|
|||
use style::values::specified::LengthOrPercentageOrAuto::{self, Auto};
|
||||
use style::values::specified::ViewportPercentageLength::Vw;
|
||||
use style::viewport::*;
|
||||
use style_traits::ParseErrorReporter;
|
||||
use style_traits::viewport::*;
|
||||
|
||||
macro_rules! stylesheet {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue