Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hook up Stylo error reporter to Firefox devtools #17655

Merged
merged 2 commits into from Jul 11, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

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

  • Loading branch information
jdm committed Jul 11, 2017
commit a08371e8eb343bd6372aa60d7658ff4b7bb5da15
@@ -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.
@@ -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:
@@ -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(),
@@ -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);
@@ -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;
@@ -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,
@@ -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
@@ -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
}
@@ -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;
@@ -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;
@@ -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" {
@@ -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" {
@@ -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:
@@ -2493,7 +2497,8 @@ extern "C" {
*mut RawGeckoURLExtraData,
parsing_mode: ParsingMode,
quirks_mode:
nsCompatibility)
nsCompatibility,
loader: *mut Loader)
-> bool;
}
extern "C" {
@@ -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);
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.