Rename StdoutErrorReporter to RustLogReporter.

This commit is contained in:
Simon Sapin 2017-04-24 08:00:20 +02:00
parent de1fe51dc6
commit 7fe57ecaea
7 changed files with 34 additions and 30 deletions

View file

@ -110,7 +110,7 @@ use style::context::{QuirksMode, ReflowGoal, SharedStyleContext};
use style::context::{StyleSystemOptions, ThreadLocalStyleContextCreationInfo};
use style::data::StoredRestyleHint;
use style::dom::{ShowSubtree, ShowSubtreeDataAndPrimaryValues, TElement, TNode};
use style::error_reporting::StdoutErrorReporter;
use style::error_reporting::RustLogReporter;
use style::logical_geometry::LogicalPoint;
use style::media_queries::{Device, MediaList, MediaType};
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, REPOSITION, STORE_OVERFLOW};
@ -1587,7 +1587,7 @@ fn get_ua_stylesheets() -> Result<UserAgentStylesheets, &'static str> {
MediaList::empty(),
shared_lock.clone(),
None,
&StdoutErrorReporter))
&RustLogReporter))
}
let shared_lock = SharedRwLock::new();
@ -1600,7 +1600,7 @@ fn get_ua_stylesheets() -> Result<UserAgentStylesheets, &'static str> {
for &(ref contents, ref url) in &opts::get().user_stylesheets {
user_or_user_agent_stylesheets.push(Stylesheet::from_bytes(
&contents, url.clone(), None, None, Origin::User, MediaList::empty(),
shared_lock.clone(), None, &StdoutErrorReporter));
shared_lock.clone(), None, &RustLogReporter));
}
let quirks_mode_stylesheet = try!(parse_ua_stylesheet(&shared_lock, "quirks-mode.css"));

View file

@ -24,11 +24,15 @@ pub trait ParseErrorReporter : Sync + Send {
line_number_offset: u64);
}
/// An error reporter that reports the errors to the `info` log channel.
/// An error reporter that uses [the `log` crate](https://github.com/rust-lang-nursery/log)
/// at `info` level.
///
/// TODO(emilio): The name of this reporter is a lie, and should be renamed!
pub struct StdoutErrorReporter;
impl ParseErrorReporter for StdoutErrorReporter {
/// This logging is silent by default, and can be enabled with a `RUST_LOG=style=info`
/// environment variable.
/// (See [`env_logger`](https://rust-lang-nursery.github.io/log/env_logger/).)
pub struct RustLogReporter;
impl ParseErrorReporter for RustLogReporter {
fn report_error(&self,
input: &mut Parser,
position: SourcePosition,

View file

@ -21,7 +21,7 @@ use data::ElementData;
use dom::{self, AnimationRules, DescendantsBit, LayoutIterator, NodeInfo, TElement, TNode, UnsafeNode};
use dom::{OpaqueNode, PresentationalHintsSynthetizer};
use element_state::ElementState;
use error_reporting::StdoutErrorReporter;
use error_reporting::RustLogReporter;
use font_metrics::{FontMetricsProvider, FontMetricsQueryResult};
use gecko::global_style_data::GLOBAL_STYLE_DATA;
use gecko::selector_parser::{SelectorImpl, NonTSPseudoClass, PseudoElement};
@ -324,7 +324,7 @@ impl<'le> GeckoElement<'le> {
/// Parse the style attribute of an element.
pub fn parse_style_attribute(value: &str,
url_data: &UrlExtraData) -> PropertyDeclarationBlock {
parse_style_attribute(value, url_data, &StdoutErrorReporter)
parse_style_attribute(value, url_data, &RustLogReporter)
}
fn flags(&self) -> u32 {

View file

@ -413,7 +413,7 @@ impl AnimationValue {
/// Construct an AnimationValue from a property declaration
pub fn from_declaration(decl: &PropertyDeclaration, context: &mut Context,
initial: &ComputedValues) -> Option<Self> {
use error_reporting::StdoutErrorReporter;
use error_reporting::RustLogReporter;
use properties::LonghandId;
use properties::DeclaredValue;
@ -467,7 +467,7 @@ impl AnimationValue {
},
PropertyDeclaration::WithVariables(id, ref variables) => {
let custom_props = context.style().custom_properties();
let reporter = StdoutErrorReporter;
let reporter = RustLogReporter;
match id {
% for prop in data.longhands:
% if prop.animatable:

View file

@ -8,7 +8,7 @@
use {Atom, Prefix, Namespace};
use cssparser::{AtRuleParser, Parser, QualifiedRuleParser};
use cssparser::{AtRuleType, RuleListParser, SourcePosition, Token, parse_one_rule};
use cssparser::{AtRuleType, RuleListParser, Token, parse_one_rule};
use cssparser::ToCss as ParserToCss;
use error_reporting::{ParseErrorReporter, NullReporter};
#[cfg(feature = "servo")]

View file

@ -10,7 +10,7 @@ use {Atom, LocalName};
use bit_vec::BitVec;
use data::ComputedStyle;
use dom::{AnimationRules, PresentationalHintsSynthetizer, TElement};
use error_reporting::StdoutErrorReporter;
use error_reporting::RustLogReporter;
use font_metrics::FontMetricsProvider;
use keyframes::KeyframesAnimation;
use media_queries::Device;
@ -415,7 +415,7 @@ impl Stylist {
parent.map(|p| &**p),
parent.map(|p| &**p),
None,
&StdoutErrorReporter,
&RustLogReporter,
font_metrics,
cascade_flags);
ComputedStyle::new(rule_node, Arc::new(computed))
@ -533,7 +533,7 @@ impl Stylist {
Some(&**parent),
Some(&**parent),
None,
&StdoutErrorReporter,
&RustLogReporter,
font_metrics,
CascadeFlags::empty());
@ -863,7 +863,7 @@ impl Stylist {
Some(parent_style),
Some(parent_style),
None,
&StdoutErrorReporter,
&RustLogReporter,
&metrics,
CascadeFlags::empty()))
}