Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
stylo: Create error reporters linked to documents (bug 1352669)
  • Loading branch information
jdm committed Jul 11, 2017
1 parent 4b91014 commit a08371e
Show file tree
Hide file tree
Showing 19 changed files with 2,544 additions and 1,332 deletions.
8 changes: 0 additions & 8 deletions components/layout_thread/lib.rs
Expand Up @@ -219,9 +219,6 @@ pub struct LayoutThread {
/// All the other elements of this struct are read-only.
rw_data: Arc<Mutex<LayoutThreadData>>,

/// The CSS error reporter for all CSS loaded in this layout thread
error_reporter: CSSErrorReporter,

webrender_image_cache: Arc<RwLock<FnvHashMap<(ServoUrl, UsePlaceholder),
WebRenderImageInfo>>>,
/// The executor for paint worklets.
Expand Down Expand Up @@ -532,10 +529,6 @@ impl LayoutThread {
text_index_response: TextIndexResponse(None),
nodes_from_point_response: vec![],
})),
error_reporter: CSSErrorReporter {
pipelineid: id,
script_chan: Arc::new(Mutex::new(script_chan)),
},
webrender_image_cache:
Arc::new(RwLock::new(FnvHashMap::default())),
timer:
Expand Down Expand Up @@ -580,7 +573,6 @@ impl LayoutThread {
guards: guards,
running_animations: self.running_animations.clone(),
expired_animations: self.expired_animations.clone(),
error_reporter: &self.error_reporter,
local_context_creation_data: Mutex::new(thread_local_style_context_creation_data),
timer: self.timer.clone(),
quirks_mode: self.quirks_mode.unwrap(),
Expand Down
1 change: 0 additions & 1 deletion components/style/animation.rs
Expand Up @@ -508,7 +508,6 @@ fn compute_style_for_animation_step(context: &SharedStyleContext,
previous_style,
/* cascade_info = */ None,
/* visited_style = */ None,
&*context.error_reporter,
font_metrics_provider,
CascadeFlags::empty(),
context.quirks_mode);
Expand Down
4 changes: 0 additions & 4 deletions components/style/context.rs
Expand Up @@ -12,7 +12,6 @@ use bloom::StyleBloom;
use cache::LRUCache;
use data::{EagerPseudoStyles, ElementData};
use dom::{OpaqueNode, TNode, TElement, SendElement};
use error_reporting::ParseErrorReporter;
use euclid::Size2D;
use fnv::FnvHashMap;
use font_metrics::FontMetricsProvider;
Expand Down Expand Up @@ -122,9 +121,6 @@ pub struct SharedStyleContext<'a> {
/// Guards for pre-acquired locks
pub guards: StylesheetGuards<'a>,

///The CSS error reporter for all CSS loaded in this layout thread
pub error_reporter: &'a ParseErrorReporter,

/// The current timer for transitions and animations. This is needed to test
/// them.
pub timer: Timer,
Expand Down
7 changes: 1 addition & 6 deletions components/style/error_reporting.rs
Expand Up @@ -139,7 +139,7 @@ impl<'a> ContextualParseError<'a> {
}

/// A generic trait for an error reporter.
pub trait ParseErrorReporter : Sync {
pub trait ParseErrorReporter {
/// Called when the style engine detects an error.
///
/// Returns the current input being parsed, the source position it was
Expand Down Expand Up @@ -188,8 +188,3 @@ impl ParseErrorReporter for NullReporter {
// do nothing
}
}

/// Create an instance of the default error reporter.
pub fn create_error_reporter() -> RustLogReporter {
RustLogReporter
}
35 changes: 30 additions & 5 deletions components/style/gecko/generated/bindings.rs
Expand Up @@ -6,6 +6,7 @@ use gecko_bindings::structs::nsTArray;
type nsACString_internal = nsACString;
type nsAString_internal = nsAString;
use gecko_bindings::structs::mozilla::css::GridTemplateAreasValue;
use gecko_bindings::structs::mozilla::css::ErrorReporter;
use gecko_bindings::structs::mozilla::css::ImageValue;
use gecko_bindings::structs::mozilla::css::URLValue;
use gecko_bindings::structs::mozilla::css::URLValueData;
Expand Down Expand Up @@ -71,6 +72,7 @@ use gecko_bindings::structs::nsChangeHint;
use gecko_bindings::structs::nsCursorImage;
use gecko_bindings::structs::nsFont;
use gecko_bindings::structs::nsIAtom;
use gecko_bindings::structs::nsIURI;
use gecko_bindings::structs::nsCompatibility;
use gecko_bindings::structs::nsMediaFeature;
use gecko_bindings::structs::nsRestyleHint;
Expand Down Expand Up @@ -2262,7 +2264,8 @@ extern "C" {
value: *const nsACString,
data: *mut RawGeckoURLExtraData,
parsing_mode: ParsingMode,
quirks_mode: nsCompatibility)
quirks_mode: nsCompatibility,
loader: *mut Loader)
-> RawServoDeclarationBlockStrong;
}
extern "C" {
Expand Down Expand Up @@ -2411,7 +2414,8 @@ extern "C" {
extern "C" {
pub fn Servo_ParseStyleAttribute(data: *const nsACString,
extra_data: *mut RawGeckoURLExtraData,
quirks_mode: nsCompatibility)
quirks_mode: nsCompatibility,
loader: *mut Loader)
-> RawServoDeclarationBlockStrong;
}
extern "C" {
Expand Down Expand Up @@ -2480,8 +2484,8 @@ extern "C" {
is_important: bool,
data: *mut RawGeckoURLExtraData,
parsing_mode: ParsingMode,
quirks_mode: nsCompatibility)
-> bool;
quirks_mode: nsCompatibility,
loader: *mut Loader) -> bool;
}
extern "C" {
pub fn Servo_DeclarationBlock_SetPropertyById(declarations:
Expand All @@ -2493,7 +2497,8 @@ extern "C" {
*mut RawGeckoURLExtraData,
parsing_mode: ParsingMode,
quirks_mode:
nsCompatibility)
nsCompatibility,
loader: *mut Loader)
-> bool;
}
extern "C" {
Expand Down Expand Up @@ -2891,3 +2896,23 @@ extern "C" {
ServoComputedValuesBorrowedOrNull)
-> *const nsStyleEffects;
}
extern "C" {
pub fn Gecko_CreateCSSErrorReporter(sheet: *mut ServoStyleSheet,
loader: *mut Loader, uri: *mut nsIURI)
-> *mut ErrorReporter;
}
extern "C" {
pub fn Gecko_DestroyCSSErrorReporter(reporter: *mut ErrorReporter);
}
extern "C" {
pub fn Gecko_ReportUnexpectedCSSError(reporter: *mut ErrorReporter,
message:
*const ::std::os::raw::c_char,
param:
*const ::std::os::raw::c_char,
paramLen: u32,
source:
*const ::std::os::raw::c_char,
sourceLen: u32, lineNumber: u32,
colNumber: u32, aURI: *mut nsIURI);
}

0 comments on commit a08371e

Please sign in to comment.