Defined new trait ParseErrorReporter and added error_reporter member to ParserContext

This commit is contained in:
GauriGNaik 2015-10-26 11:31:28 -04:00 committed by Josh Matthews
parent 8efc954531
commit 996e9e06b2
24 changed files with 194 additions and 69 deletions

View file

@ -38,6 +38,9 @@ path = "../script_traits"
[dependencies.style]
path = "../style"
[dependencies.style_traits]
path = "../style_traits"
[dependencies.plugins]
path = "../plugins"

View file

@ -27,6 +27,7 @@ use std::rc::Rc;
use std::sync::mpsc::{Sender, channel};
use std::sync::{Arc, Mutex, RwLock};
use style::selector_matching::Stylist;
use style_traits::ParseErrorReporter;
use url::Url;
use util::mem::HeapSizeOf;
use util::opts;
@ -127,6 +128,9 @@ pub struct SharedLayoutContext {
/// Why is this reflow occurring
pub goal: ReflowGoal,
///The CSS error reporter for all CSS loaded in this layout thread
pub error_reporter: Box<ParseErrorReporter + Sync>
}
pub struct LayoutContext<'a> {

View file

@ -27,6 +27,7 @@ use string_cache::{Atom, Namespace};
use style::node::TElementAttributes;
use style::properties::{ComputedValues, PropertyDeclaration, cascade};
use style::selector_matching::{DeclarationBlock, Stylist};
use style_traits::ParseErrorReporter;
use util::arc_ptr_eq;
use util::cache::{LRUCache, SimpleHashCache};
use util::opts;
@ -456,7 +457,8 @@ impl<'ln> PrivateMatchMethods for ServoLayoutNode<'ln> {
applicable_declarations,
shareable,
Some(&***parent_style),
cached_computed_values);
cached_computed_values,
layout_context.error_reporter.clone());
cacheable = cacheable && is_cacheable;
this_style = the_style
}
@ -465,7 +467,8 @@ impl<'ln> PrivateMatchMethods for ServoLayoutNode<'ln> {
applicable_declarations,
shareable,
None,
None);
None,
layout_context.error_reporter.clone());
cacheable = cacheable && is_cacheable;
this_style = the_style
}

View file

@ -49,6 +49,7 @@ use script::layout_interface::Animation;
use script::layout_interface::{LayoutRPC, OffsetParentResponse};
use script::layout_interface::{Msg, NewLayoutTaskInfo, Reflow, ReflowGoal, ReflowQueryType};
use script::layout_interface::{ScriptLayoutChan, ScriptReflow};
use script::reporter::CSSErrorReporter;
use script_traits::{ConstellationControlMsg, LayoutControlMsg, OpaqueScriptLayoutChannel};
use sequential;
use serde_json;
@ -64,6 +65,7 @@ use style::computed_values::{filter, mix_blend_mode};
use style::media_queries::{Device, MediaType};
use style::selector_matching::{Stylist, USER_OR_USER_AGENT_STYLESHEETS};
use style::stylesheets::{CSSRuleIteratorExt, Stylesheet};
use style_traits::ParseErrorReporter;
use url::Url;
use util::geometry::MAX_RECT;
use util::ipc::OptionalIpcSender;
@ -211,6 +213,10 @@ pub struct LayoutTask {
///
/// All the other elements of this struct are read-only.
rw_data: Arc<Mutex<LayoutTaskData>>,
/// The CSS error reporter for all CSS loaded in this layout thread
error_reporter: CSSErrorReporter,
}
impl LayoutTaskFactory for LayoutTask {
@ -438,6 +444,7 @@ impl LayoutTask {
resolved_style_response: None,
offset_parent_response: OffsetParentResponse::empty(),
})),
error_reporter: CSSErrorReporter,
}
}
@ -476,6 +483,7 @@ impl LayoutTask {
goal: goal,
running_animations: self.running_animations.clone(),
expired_animations: self.expired_animations.clone(),
error_reporter: self.error_reporter.clone(),
}
}
@ -557,7 +565,6 @@ impl LayoutTask {
goal: ReflowGoal::ForDisplay,
page_clip_rect: MAX_RECT,
};
let mut layout_context = self.build_shared_layout_context(&*rw_data,
false,
&self.url,

View file

@ -53,6 +53,7 @@ extern crate serde_json;
extern crate smallvec;
#[macro_use(atom, ns)] extern crate string_cache;
extern crate style;
extern crate style_traits;
extern crate unicode_bidi;
extern crate unicode_script;
extern crate url;