aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBobby Holley <bobbyholley@gmail.com>2016-01-08 20:04:53 -0800
committerBobby Holley <bobbyholley@gmail.com>2016-01-11 18:01:48 -0800
commit384cdfcfff157afb3d02c5fafb7fbf1e347f5e7b (patch)
treec11ca103b2c3e655d02a20182080c5df32f72025
parenta03747e12b839e6fd4d2140742006fc7b049fce4 (diff)
downloadservo-384cdfcfff157afb3d02c5fafb7fbf1e347f5e7b.tar.gz
servo-384cdfcfff157afb3d02c5fafb7fbf1e347f5e7b.zip
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.
-rw-r--r--components/layout/layout_thread.rs2
-rw-r--r--components/msg/lib.rs10
-rw-r--r--components/script/dom/cssstyledeclaration.rs2
-rw-r--r--components/script/dom/element.rs2
-rw-r--r--components/script/dom/window.rs2
-rw-r--r--components/script/reporter.rs5
-rw-r--r--components/servo/Cargo.lock1
-rw-r--r--components/style/Cargo.toml3
-rw-r--r--components/style/context.rs2
-rw-r--r--components/style/error_reporting.rs25
-rw-r--r--components/style/lib.rs2
-rw-r--r--components/style/parser.rs2
-rw-r--r--components/style/properties.mako.rs4
-rw-r--r--components/style/selector_matching.rs24
-rw-r--r--components/style/stylesheets.rs2
-rw-r--r--ports/cef/Cargo.lock1
-rw-r--r--ports/geckolib/Cargo.lock20
-rw-r--r--ports/gonk/Cargo.lock1
-rw-r--r--tests/unit/style/media_queries.rs6
-rw-r--r--tests/unit/style/viewport.rs2
20 files changed, 39 insertions, 79 deletions
diff --git a/components/layout/layout_thread.rs b/components/layout/layout_thread.rs
index 57e92dc8bf2..6f28c18ee9c 100644
--- a/components/layout/layout_thread.rs
+++ b/components/layout/layout_thread.rs
@@ -34,7 +34,6 @@ use ipc_channel::router::ROUTER;
use layout_debug;
use layout_traits::LayoutThreadFactory;
use log;
-use msg::ParseErrorReporter;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheResult, ImageCacheThread};
use parallel;
@@ -65,6 +64,7 @@ use style::animation::Animation;
use style::computed_values::{filter, mix_blend_mode};
use style::context::{SharedStyleContext, StylistWrapper, ReflowGoal};
use style::dom::{TDocument, TElement, TNode};
+use style::error_reporting::ParseErrorReporter;
use style::media_queries::{Device, MediaType};
use style::parallel::WorkQueueData;
use style::selector_matching::{Stylist, USER_OR_USER_AGENT_STYLESHEETS};
diff --git a/components/msg/lib.rs b/components/msg/lib.rs
index 473793b1bed..13a50e6a962 100644
--- a/components/msg/lib.rs
+++ b/components/msg/lib.rs
@@ -7,7 +7,6 @@
#[macro_use]
extern crate bitflags;
-extern crate cssparser;
extern crate euclid;
extern crate hyper;
extern crate ipc_channel;
@@ -20,12 +19,3 @@ extern crate util;
pub mod compositor_msg;
pub mod constellation_msg;
pub mod webdriver_msg;
-
-use constellation_msg::PipelineId;
-use cssparser::{Parser, SourcePosition};
-
-pub trait ParseErrorReporter {
- fn report_error(&self, input: &mut Parser, position: SourcePosition, message: &str);
- fn clone(&self) -> Box<ParseErrorReporter + Send + Sync>;
- fn pipeline(&self) -> PipelineId;
-}
diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs
index 12d3425d520..abf4b1310db 100644
--- a/components/script/dom/cssstyledeclaration.rs
+++ b/components/script/dom/cssstyledeclaration.rs
@@ -11,12 +11,12 @@ use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::element::{Element, StylePriority};
use dom::node::{Node, NodeDamage, document_from_node, window_from_node};
use dom::window::Window;
-use msg::ParseErrorReporter;
use selectors::parser::PseudoElement;
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::cell::Ref;
use string_cache::Atom;
+use style::error_reporting::ParseErrorReporter;
use style::properties::{PropertyDeclaration, Shorthand};
use style::properties::{is_supported_property, parse_one_declaration};
use util::str::{DOMString, str_join};
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index 0cea588a64e..4fcdea83dcf 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -65,7 +65,6 @@ use html5ever::serialize::SerializeOpts;
use html5ever::serialize::TraversalScope;
use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode};
use html5ever::tree_builder::{LimitedQuirks, NoQuirks, Quirks};
-use msg::ParseErrorReporter;
use selectors::matching::{DeclarationBlock, matches};
use selectors::matching::{common_style_affecting_attributes, rare_style_affecting_attributes};
use selectors::parser::{AttrSelector, NamespaceConstraint, parse_author_origin_selector_list_from_str};
@@ -78,6 +77,7 @@ use std::default::Default;
use std::mem;
use std::sync::Arc;
use string_cache::{Atom, Namespace, QualName};
+use style::error_reporting::ParseErrorReporter;
use style::properties::DeclaredValue;
use style::properties::longhands::{self, background_image, border_spacing, font_family, font_size};
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, parse_style_attribute};
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index ced5e919bda..90c416d93eb 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -43,7 +43,6 @@ use js::rust::Runtime;
use layout_interface::{ContentBoxResponse, ContentBoxesResponse, ResolvedStyleResponse, ScriptReflow};
use layout_interface::{LayoutChan, LayoutRPC, Msg, Reflow, ReflowQueryType};
use libc;
-use msg::ParseErrorReporter;
use msg::constellation_msg::{ConstellationChan, DocumentState, LoadData};
use msg::constellation_msg::{MozBrowserEvent, PipelineId, SubpageId, WindowSizeData};
use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
@@ -75,6 +74,7 @@ use std::sync::mpsc::TryRecvError::{Disconnected, Empty};
use std::sync::mpsc::{Sender, channel};
use string_cache::Atom;
use style::context::ReflowGoal;
+use style::error_reporting::ParseErrorReporter;
use time;
use timers::{ActiveTimers, IsInterval, ScheduledCallback, TimerCallback, TimerHandle};
use url::Url;
diff --git a/components/script/reporter.rs b/components/script/reporter.rs
index 9893cb12ebe..95b036933d3 100644
--- a/components/script/reporter.rs
+++ b/components/script/reporter.rs
@@ -4,8 +4,8 @@
use cssparser::{Parser, SourcePosition};
use log;
-use msg::ParseErrorReporter;
use msg::constellation_msg::PipelineId;
+use style::error_reporting::ParseErrorReporter;
#[derive(JSTraceable, HeapSizeOf)]
pub struct CSSErrorReporter {
@@ -24,7 +24,4 @@ impl ParseErrorReporter for CSSErrorReporter {
fn clone(&self) -> Box<ParseErrorReporter + Send + Sync> {
box CSSErrorReporter { pipelineid: self.pipelineid, }
}
- fn pipeline(&self) -> PipelineId {
- self.pipelineid
- }
}
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock
index 62415749c64..9fbcfe932ff 100644
--- a/components/servo/Cargo.lock
+++ b/components/servo/Cargo.lock
@@ -1778,7 +1778,6 @@ dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "msg 0.0.1",
"num 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/components/style/Cargo.toml b/components/style/Cargo.toml
index 608df090869..d44f27588ae 100644
--- a/components/style/Cargo.toml
+++ b/components/style/Cargo.toml
@@ -9,9 +9,6 @@ build = "build.rs"
name = "style"
path = "lib.rs"
-[dependencies.msg]
-path = "../msg"
-
[dependencies.plugins]
path = "../plugins"
diff --git a/components/style/context.rs b/components/style/context.rs
index 772b53f1f3d..f6b3cf86631 100644
--- a/components/style/context.rs
+++ b/components/style/context.rs
@@ -5,9 +5,9 @@
use animation::Animation;
use app_units::Au;
use dom::OpaqueNode;
+use error_reporting::ParseErrorReporter;
use euclid::Size2D;
use matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache};
-use msg::ParseErrorReporter;
use selector_matching::Stylist;
use std::cell::RefCell;
use std::collections::HashMap;
diff --git a/components/style/error_reporting.rs b/components/style/error_reporting.rs
new file mode 100644
index 00000000000..d2977d28b3a
--- /dev/null
+++ b/components/style/error_reporting.rs
@@ -0,0 +1,25 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use cssparser::{Parser, SourcePosition};
+use log;
+
+pub trait ParseErrorReporter {
+ fn report_error(&self, input: &mut Parser, position: SourcePosition, message: &str);
+ fn clone(&self) -> Box<ParseErrorReporter + Send + Sync>;
+}
+
+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
+ }
+}
diff --git a/components/style/lib.rs b/components/style/lib.rs
index 0f0dfca30cf..7fd0b5b132c 100644
--- a/components/style/lib.rs
+++ b/components/style/lib.rs
@@ -31,7 +31,6 @@ 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;
@@ -50,6 +49,7 @@ pub mod context;
mod custom_properties;
pub mod data;
pub mod dom;
+pub mod error_reporting;
pub mod font_face;
pub mod matching;
pub mod media_queries;
diff --git a/components/style/parser.rs b/components/style/parser.rs
index f30ae18b4ea..44ee04bd5f2 100644
--- a/components/style/parser.rs
+++ b/components/style/parser.rs
@@ -4,7 +4,7 @@
use cssparser::{Parser, SourcePosition};
-use msg::ParseErrorReporter;
+use error_reporting::ParseErrorReporter;
use selectors::parser::ParserContext as SelectorParserContext;
use stylesheets::Origin;
use url::Url;
diff --git a/components/style/properties.mako.rs b/components/style/properties.mako.rs
index 72b57a931ef..b3dc4fa70ce 100644
--- a/components/style/properties.mako.rs
+++ b/components/style/properties.mako.rs
@@ -16,12 +16,12 @@ use std::sync::Arc;
use app_units::Au;
use cssparser::{Parser, Color, RGBA, AtRuleParser, DeclarationParser, Delimiter,
DeclarationListParser, parse_important, ToCss, TokenSerializationType};
+use error_reporting::ParseErrorReporter;
use url::Url;
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 computed_values;
use parser::{ParserContext, log_css_error};
@@ -130,7 +130,7 @@ pub mod longhands {
use parser::ParserContext;
use properties::{CSSWideKeyword, DeclaredValue, Shorthand};
% endif
- use msg::ParseErrorReporter;
+ use error_reporting::ParseErrorReporter;
use properties::longhands;
use properties::property_bit_field::PropertyBitField;
use properties::{ComputedValues, PropertyDeclaration};
diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs
index 1f3f187027b..27b1bdde118 100644
--- a/components/style/selector_matching.rs
+++ b/components/style/selector_matching.rs
@@ -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!();
diff --git a/components/style/stylesheets.rs b/components/style/stylesheets.rs
index a2efb95e80e..cfe932fc505 100644
--- a/components/style/stylesheets.rs
+++ b/components/style/stylesheets.rs
@@ -5,9 +5,9 @@
use cssparser::{AtRuleParser, Parser, QualifiedRuleParser, decode_stylesheet_bytes};
use cssparser::{AtRuleType, RuleListParser};
use encoding::EncodingRef;
+use error_reporting::ParseErrorReporter;
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};
diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock
index d060c2111e3..6bc547973ba 100644
--- a/ports/cef/Cargo.lock
+++ b/ports/cef/Cargo.lock
@@ -1728,7 +1728,6 @@ dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "msg 0.0.1",
"num 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/ports/geckolib/Cargo.lock b/ports/geckolib/Cargo.lock
index c1e53d28694..28b46a337ee 100644
--- a/ports/geckolib/Cargo.lock
+++ b/ports/geckolib/Cargo.lock
@@ -416,7 +416,6 @@ dependencies = [
"num_cpus 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
"traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -595,24 +594,6 @@ dependencies = [
]
[[package]]
-name = "msg"
-version = "0.0.1"
-dependencies = [
- "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
- "layers 0.2.0 (git+https://github.com/servo/rust-layers)",
- "plugins 0.0.1",
- "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "util 0.0.1",
-]
-
-[[package]]
name = "num"
version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -966,7 +947,6 @@ dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "msg 0.0.1",
"num 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock
index fe8da40f430..448dc229598 100644
--- a/ports/gonk/Cargo.lock
+++ b/ports/gonk/Cargo.lock
@@ -1694,7 +1694,6 @@ dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "msg 0.0.1",
"num 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/tests/unit/style/media_queries.rs b/tests/unit/style/media_queries.rs
index bc14ccab671..34a8a54197f 100644
--- a/tests/unit/style/media_queries.rs
+++ b/tests/unit/style/media_queries.rs
@@ -5,9 +5,8 @@
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::error_reporting::ParseErrorReporter;
use style::media_queries::*;
use style::stylesheets::{Origin, Stylesheet, CSSRuleIteratorExt};
use style::values::specified;
@@ -20,9 +19,6 @@ impl ParseErrorReporter for CSSErrorReporterTest {
fn clone(&self) -> Box<ParseErrorReporter + Send + Sync> {
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) {
diff --git a/tests/unit/style/viewport.rs b/tests/unit/style/viewport.rs
index 08ac70dfca5..c3fb4dd59f1 100644
--- a/tests/unit/style/viewport.rs
+++ b/tests/unit/style/viewport.rs
@@ -6,7 +6,7 @@ use cssparser::Parser;
use euclid::scale_factor::ScaleFactor;
use euclid::size::Size2D;
use media_queries::CSSErrorReporterTest;
-use msg::ParseErrorReporter;
+use style::error_reporting::ParseErrorReporter;
use style::media_queries::{Device, MediaType};
use style::parser::ParserContext;
use style::stylesheets::{Origin, Stylesheet, CSSRuleIteratorExt};