stylo: Create error reporters linked to documents (bug 1352669)

This commit is contained in:
Josh Matthews 2017-07-06 13:18:36 -04:00
parent 4b91014b14
commit a08371e8eb
19 changed files with 5536 additions and 4324 deletions

View file

@ -21,10 +21,10 @@ use app_units::Au;
#[cfg(feature = "servo")] use cssparser::RGBA;
use cssparser::{Parser, TokenSerializationType, serialize_identifier};
use cssparser::{ParserInput, CompactCowStr};
use error_reporting::ParseErrorReporter;
#[cfg(feature = "servo")] use euclid::SideOffsets2D;
use computed_values;
use context::QuirksMode;
use error_reporting::NullReporter;
use font_metrics::FontMetricsProvider;
#[cfg(feature = "gecko")] use gecko_bindings::bindings;
#[cfg(feature = "gecko")] use gecko_bindings::structs::{self, nsCSSPropertyID};
@ -377,7 +377,6 @@ impl PropertyDeclarationIdSet {
% endif
custom_properties: &Option<Arc<::custom_properties::CustomPropertiesMap>>,
f: &mut F,
error_reporter: &ParseErrorReporter,
quirks_mode: QuirksMode)
% if property.boxed:
where F: FnMut(&DeclaredValue<Box<longhands::${property.ident}::SpecifiedValue>>)
@ -392,7 +391,6 @@ impl PropertyDeclarationIdSet {
with_variables.from_shorthand,
custom_properties,
f,
error_reporter,
quirks_mode);
} else {
f(value);
@ -408,7 +406,6 @@ impl PropertyDeclarationIdSet {
from_shorthand: Option<ShorthandId>,
custom_properties: &Option<Arc<::custom_properties::CustomPropertiesMap>>,
f: &mut F,
error_reporter: &ParseErrorReporter,
quirks_mode: QuirksMode)
% if property.boxed:
where F: FnMut(&DeclaredValue<Box<longhands::${property.ident}::SpecifiedValue>>)
@ -421,12 +418,10 @@ impl PropertyDeclarationIdSet {
.ok()
.and_then(|css| {
// As of this writing, only the base URL is used for property values:
//
// FIXME(pcwalton): Cloning the error reporter is slow! But so are custom
// properties, so whatever...
let reporter = NullReporter;
let context = ParserContext::new(Origin::Author,
url_data,
error_reporter,
&reporter,
None,
PARSING_MODE_DEFAULT,
quirks_mode);
@ -2514,8 +2509,7 @@ pub type CascadePropertyFn =
default_style: &ComputedValues,
context: &mut computed::Context,
cacheable: &mut bool,
cascade_info: &mut Option<<&mut CascadeInfo>,
error_reporter: &ParseErrorReporter);
cascade_info: &mut Option<<&mut CascadeInfo>);
/// A per-longhand array of functions to perform the CSS cascade on each of
/// them, effectively doing virtual dispatch.
@ -2577,7 +2571,6 @@ pub fn cascade(device: &Device,
layout_parent_style: Option<<&ComputedValues>,
visited_style: Option<Arc<ComputedValues>>,
cascade_info: Option<<&mut CascadeInfo>,
error_reporter: &ParseErrorReporter,
font_metrics_provider: &FontMetricsProvider,
flags: CascadeFlags,
quirks_mode: QuirksMode)
@ -2625,7 +2618,6 @@ pub fn cascade(device: &Device,
layout_parent_style,
visited_style,
cascade_info,
error_reporter,
font_metrics_provider,
flags,
quirks_mode)
@ -2641,7 +2633,6 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
layout_parent_style: &ComputedValues,
visited_style: Option<Arc<ComputedValues>>,
mut cascade_info: Option<<&mut CascadeInfo>,
error_reporter: &ParseErrorReporter,
font_metrics_provider: &FontMetricsProvider,
flags: CascadeFlags,
quirks_mode: QuirksMode)
@ -2795,8 +2786,7 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
default_style,
&mut context,
&mut cacheable,
&mut cascade_info,
error_reporter);
&mut cascade_info);
}
% if category_to_cascade_now == "early":
let writing_mode = get_writing_mode(context.style.get_inheritedbox());
@ -2869,8 +2859,7 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
default_style,
&mut context,
&mut cacheable,
&mut cascade_info,
error_reporter);
&mut cascade_info);
% if product == "gecko":
context.style.mutate_font().fixup_none_generic(context.device);
% endif
@ -2884,8 +2873,7 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
default_style,
&mut context,
&mut cacheable,
&mut cascade_info,
error_reporter);
&mut cascade_info);
% if product == "gecko":
// Font size must be explicitly inherited to handle lang changes and
// scriptlevel changes.
@ -2902,8 +2890,7 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
default_style,
&mut context,
&mut cacheable,
&mut cascade_info,
error_reporter);
&mut cascade_info);
% endif
}
% endif