diff options
author | Tim Kuehn <tkuehn@cmu.edu> | 2013-06-26 22:42:01 -0700 |
---|---|---|
committer | Tim Kuehn <tkuehn@cmu.edu> | 2013-07-01 11:03:31 -0700 |
commit | fba7ec423c99a63bdcbe16029740e7ab4e38c088 (patch) | |
tree | 0e8a15014ee5bbf912153e8072c0a5505d3b4ecc /src/components/script | |
parent | fdb0d820a49fac9ae2df623751912adcbe7a119d (diff) | |
download | servo-fba7ec423c99a63bdcbe16029740e7ab4e38c088.tar.gz servo-fba7ec423c99a63bdcbe16029740e7ab4e38c088.zip |
add pipeline.rs, modularized pipelines communicating with constellation
Diffstat (limited to 'src/components/script')
-rw-r--r-- | src/components/script/dom/bindings/element.rs | 11 | ||||
-rw-r--r-- | src/components/script/dom/bindings/proxyhandler.rs | 4 | ||||
-rw-r--r-- | src/components/script/dom/bindings/utils.rs | 6 | ||||
-rw-r--r-- | src/components/script/dom/element.rs | 45 | ||||
-rw-r--r-- | src/components/script/dom/event.rs | 2 | ||||
-rw-r--r-- | src/components/script/dom/window.rs | 12 | ||||
-rw-r--r-- | src/components/script/html/hubbub_html_parser.rs | 8 | ||||
-rw-r--r-- | src/components/script/layout_interface.rs | 23 | ||||
-rw-r--r-- | src/components/script/script_task.rs | 134 |
9 files changed, 116 insertions, 129 deletions
diff --git a/src/components/script/dom/bindings/element.rs b/src/components/script/dom/bindings/element.rs index 9a34f7c5dc6..b79daf75db7 100644 --- a/src/components/script/dom/bindings/element.rs +++ b/src/components/script/dom/bindings/element.rs @@ -16,6 +16,7 @@ use std::cast; use std::i32; use std::libc; use std::libc::c_uint; +use std::comm; use std::ptr; use std::ptr::null; use std::result; @@ -229,13 +230,9 @@ extern fn HTMLImageElement_getWidth(cx: *JSContext, _argc: c_uint, vp: *mut JSVa let width = match node.type_id() { ElementNodeTypeId(HTMLImageElementTypeId) => { let script_context = task_from_context(cx); - match (*script_context).query_layout(ContentBoxQuery(node)) { - Ok(rect) => { - match rect { - ContentBoxResponse(rect) => rect.size.width.to_px(), - _ => fail!(~"unexpected layout reply") - } - } + let (port, chan) = comm::stream(); + match (*script_context).query_layout(ContentBoxQuery(node, chan), port) { + Ok(ContentBoxResponse(rect)) => rect.size.width.to_px(), Err(()) => 0 } // TODO: if nothing is being rendered(?), return zero dimensions diff --git a/src/components/script/dom/bindings/proxyhandler.rs b/src/components/script/dom/bindings/proxyhandler.rs index 2780a969eb2..cbbc4f1525d 100644 --- a/src/components/script/dom/bindings/proxyhandler.rs +++ b/src/components/script/dom/bindings/proxyhandler.rs @@ -71,7 +71,7 @@ pub fn _obj_toString(cx: *JSContext, className: *libc::c_char) -> *JSString { return ptr::null(); } - let result = ~"[object " + name + ~"]"; + let result = ~"[object " + name + "]"; for result.iter().enumerate().advance |(i, c)| { *chars.offset(i) = c as jschar; } @@ -86,4 +86,4 @@ pub fn _obj_toString(cx: *JSContext, className: *libc::c_char) -> *JSString { pub fn GetExpandoObject(_proxy: *JSObject) -> *JSObject { ptr::null() -}
\ No newline at end of file +} diff --git a/src/components/script/dom/bindings/utils.rs b/src/components/script/dom/bindings/utils.rs index 9d3105fefca..5a42e109268 100644 --- a/src/components/script/dom/bindings/utils.rs +++ b/src/components/script/dom/bindings/utils.rs @@ -21,12 +21,12 @@ use js::glue::{PROPERTY_STUB, STRICT_PROPERTY_STUB, ENUMERATE_STUB, CONVERT_STUB use js::jsapi::{JS_AlreadyHasOwnProperty, JS_NewObject, JS_NewFunction}; use js::jsapi::{JS_DefineProperties, JS_WrapValue, JS_ForwardGetPropertyTo}; use js::jsapi::{JS_EncodeString, JS_free, JS_GetStringCharsAndLength}; -use js::jsapi::{JS_GetClass, JS_GetPrototype, JS_LinkConstructorAndPrototype}; +use js::jsapi::{JS_GetClass, JS_LinkConstructorAndPrototype}; use js::jsapi::{JS_GetFunctionPrototype, JS_InternString, JS_GetFunctionObject}; use js::jsapi::{JS_HasPropertyById, JS_GetPrototype, JS_GetGlobalForObject}; use js::jsapi::{JS_NewStringCopyN, JS_DefineFunctions, JS_DefineProperty}; use js::jsapi::{JS_ValueToString, JS_GetReservedSlot, JS_SetReservedSlot}; -use js::jsapi::{JSContext, JSVal, JSObject, JSBool, jsid, JSClass, JSNative}; +use js::jsapi::{JSContext, JSObject, JSBool, jsid, JSClass, JSNative}; use js::jsapi::{JSFunctionSpec, JSPropertySpec, JSVal, JSPropertyDescriptor}; use js::jsfriendapi::bindgen::JS_NewObjectWithUniqueType; use js::rust::Compartment; @@ -83,7 +83,7 @@ extern fn InterfaceObjectToString(cx: *JSContext, _argc: uint, vp: *mut JSVal) - } let name = jsval_to_str(cx, *v).get(); - let retval = str(~"function " + name + ~"() {\n [native code]\n}"); + let retval = str(~"function " + name + "() {\n [native code]\n}"); *vp = domstring_to_jsval(cx, &retval); return 1; } diff --git a/src/components/script/dom/element.rs b/src/components/script/dom/element.rs index e707a95ebb9..2595a68657d 100644 --- a/src/components/script/dom/element.rs +++ b/src/components/script/dom/element.rs @@ -12,6 +12,7 @@ use layout_interface::{ContentBoxQuery, ContentBoxResponse, ContentBoxesQuery}; use layout_interface::{ContentBoxesResponse}; use std::cell::Cell; +use std::comm; use std::uint; use std::str::eq_slice; use extra::net::url::Url; @@ -165,20 +166,19 @@ impl<'self> Element { Some(win) => { let node = self.parent.abstract.get(); assert!(node.is_element()); - let script_context = unsafe { - &mut *win.script_context + let script_task = unsafe { + &mut *win.script_task }; - match script_context.query_layout(ContentBoxesQuery(node)) { - Ok(rects) => match rects { - ContentBoxesResponse(rects) => - do rects.map |r| { - ClientRect::new( - r.origin.y.to_f32(), - (r.origin.y + r.size.height).to_f32(), - r.origin.x.to_f32(), - (r.origin.x + r.size.width).to_f32()) - }, - _ => fail!(~"unexpected layout reply") + let (port, chan) = comm::stream(); + match script_task.query_layout(ContentBoxesQuery(node, chan), port) { + Ok(ContentBoxesResponse(rects)) => { + do rects.map |r| { + ClientRect::new( + r.origin.y.to_f32(), + (r.origin.y + r.size.height).to_f32(), + r.origin.x.to_f32(), + (r.origin.x + r.size.width).to_f32()) + } }, Err(()) => { debug!("layout query error"); @@ -207,16 +207,15 @@ impl<'self> Element { Some(win) => { let node = self.parent.abstract.get(); assert!(node.is_element()); - let script_context = unsafe { &mut *win.script_context }; - match script_context.query_layout(ContentBoxQuery(node)) { - Ok(rect) => match rect { - ContentBoxResponse(rect) => - Some(ClientRect::new( - rect.origin.y.to_f32(), - (rect.origin.y + rect.size.height).to_f32(), - rect.origin.x.to_f32(), - (rect.origin.x + rect.size.width).to_f32())), - _ => fail!(~"unexpected layout result") + let script_task = unsafe { &mut *win.script_task }; + let (port, chan) = comm::stream(); + match script_task.query_layout(ContentBoxQuery(node, chan), port) { + Ok(ContentBoxResponse(rect)) => { + Some(ClientRect::new( + rect.origin.y.to_f32(), + (rect.origin.y + rect.size.height).to_f32(), + rect.origin.x.to_f32(), + (rect.origin.x + rect.size.width).to_f32())) }, Err(()) => { debug!("error querying layout"); diff --git a/src/components/script/dom/event.rs b/src/components/script/dom/event.rs index 047b734e6b4..6b4be15b701 100644 --- a/src/components/script/dom/event.rs +++ b/src/components/script/dom/event.rs @@ -9,8 +9,6 @@ use dom::bindings::utils::{DOMString, ErrorResult, WrapperCache}; use geom::point::Point2D; -use std::comm; - pub enum Event { ResizeEvent(uint, uint), ReflowEvent, diff --git a/src/components/script/dom/window.rs b/src/components/script/dom/window.rs index 5fb07c66f07..41f99eaa9e9 100644 --- a/src/components/script/dom/window.rs +++ b/src/components/script/dom/window.rs @@ -6,7 +6,7 @@ use dom::bindings::utils::WrapperCache; use dom::bindings::window; use layout_interface::ReflowForScriptQuery; -use script_task::{ExitMsg, FireTimerMsg, ScriptChan, ScriptContext}; +use script_task::{ExitMsg, FireTimerMsg, ScriptChan, ScriptTask}; use std::comm; use std::comm::Chan; @@ -29,7 +29,7 @@ pub enum TimerControlMsg { pub struct Window { timer_chan: Chan<TimerControlMsg>, script_chan: ScriptChan, - script_context: *mut ScriptContext, + script_task: *mut ScriptTask, wrapper: WrapperCache } @@ -89,11 +89,11 @@ impl Window { pub fn content_changed(&self) { unsafe { - (*self.script_context).reflow_all(ReflowForScriptQuery) + (*self.script_task).reflow_all(ReflowForScriptQuery) } } - pub fn new(script_chan: ScriptChan, script_context: *mut ScriptContext) + pub fn new(script_chan: ScriptChan, script_task: *mut ScriptTask) -> @mut Window { let script_chan_clone = script_chan.clone(); let win = @mut Window { @@ -112,11 +112,11 @@ impl Window { } timer_chan }, - script_context: script_context, + script_task: script_task, }; unsafe { - let compartment = (*script_context).js_compartment; + let compartment = (*script_task).js_compartment; window::create(compartment, win); } win diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 6309e488d7e..9540fcc87d4 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -303,9 +303,9 @@ pub fn parse_html(url: Url, // Handle CSS style sheets from <link> elements ElementNodeTypeId(HTMLLinkElementTypeId) => { do node.with_imm_element |element| { - match (element.get_attr(~"rel"), element.get_attr(~"href")) { + match (element.get_attr("rel"), element.get_attr("href")) { (Some(rel), Some(href)) => { - if rel == ~"stylesheet" { + if rel == "stylesheet" { debug!("found CSS stylesheet: %s", href); let url = make_url(href.to_str(), Some(url2.clone())); css_chan2.send(CSSTaskNewFile(UrlProvenance(url))); @@ -317,7 +317,7 @@ pub fn parse_html(url: Url, }, ElementNodeTypeId(HTMLImageElementTypeId) => { do node.with_mut_image_element |image_element| { - let src_opt = image_element.parent.get_attr(~"src").map(|x| x.to_str()); + let src_opt = image_element.parent.get_attr("src").map(|x| x.to_str()); match src_opt { None => {} Some(src) => { @@ -401,7 +401,7 @@ pub fn parse_html(url: Url, unsafe { let script: AbstractNode<ScriptView> = NodeWrapping::from_hubbub_node(script); do script.with_imm_element |script| { - match script.get_attr(~"src") { + match script.get_attr("src") { Some(src) => { debug!("found script: %s", src); let new_url = make_url(src.to_str(), Some(url.clone())); diff --git a/src/components/script/layout_interface.rs b/src/components/script/layout_interface.rs index 3a1531b83e6..766c728067b 100644 --- a/src/components/script/layout_interface.rs +++ b/src/components/script/layout_interface.rs @@ -30,7 +30,7 @@ pub enum Msg { /// Performs a synchronous layout request. /// /// FIXME(pcwalton): As noted below, this isn't very type safe. - QueryMsg(LayoutQuery, Chan<Result<LayoutResponse,()>>), + QueryMsg(LayoutQuery), /// Routes a message (usually from the compositor) to the appropriate script task RouteScriptMsg(ScriptMsg), @@ -42,25 +42,16 @@ pub enum Msg { /// Synchronous messages that script can send to layout. pub enum LayoutQuery { /// Requests the dimensions of the content box, as in the `getBoundingClientRect()` call. - ContentBoxQuery(AbstractNode<ScriptView>), + ContentBoxQuery(AbstractNode<ScriptView>, Chan<Result<ContentBoxResponse, ()>>), /// Requests the dimensions of all the content boxes, as in the `getClientRects()` call. - ContentBoxesQuery(AbstractNode<ScriptView>), + ContentBoxesQuery(AbstractNode<ScriptView>, Chan<Result<ContentBoxesResponse, ()>>), /// Requests the node containing the point of interest - HitTestQuery(AbstractNode<ScriptView>, Point2D<f32>), + HitTestQuery(AbstractNode<ScriptView>, Point2D<f32>, Chan<Result<HitTestResponse, ()>>), } -/// The reply of a synchronous message from script to layout. -/// -/// FIXME(pcwalton): This isn't very type safe. Maybe `LayoutQuery` objects should include -/// response channels? -pub enum LayoutResponse { - /// A response to the `ContentBoxQuery` message. - ContentBoxResponse(Rect<Au>), - /// A response to the `ContentBoxesQuery` message. - ContentBoxesResponse(~[Rect<Au>]), - /// A response to the `HitTestQuery` message. - HitTestResponse(AbstractNode<LayoutView>), -} +pub struct ContentBoxResponse(Rect<Au>); +pub struct ContentBoxesResponse(~[Rect<Au>]); +pub struct HitTestResponse(AbstractNode<LayoutView>); /// Determines which part of the pub enum DocumentDamageLevel { diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs index 7ef0b0035e1..ce89ef5efd7 100644 --- a/src/components/script/script_task.rs +++ b/src/components/script/script_task.rs @@ -5,19 +5,21 @@ /// The script task is the task that owns the DOM in memory, runs JavaScript, and spawns parsing /// and layout tasks. -use servo_msg::compositor::{ReadyState, Loading, PerformingLayout, FinishedLoading}; +use servo_msg::compositor::{ScriptListener, Loading, PerformingLayout}; +use servo_msg::compositor::FinishedLoading; use dom::bindings::utils::GlobalStaticData; use dom::document::Document; use dom::element::Element; use dom::event::{Event, ResizeEvent, ReflowEvent, ClickEvent, MouseDownEvent, MouseUpEvent}; use dom::node::{AbstractNode, ScriptView, define_bindings}; use dom::window::Window; -use layout_interface::{AddStylesheetMsg, DocumentDamage, DocumentDamageLevel, HitTestQuery}; -use layout_interface::{HitTestResponse, LayoutQuery, LayoutResponse, LayoutChan}; -use layout_interface::{MatchSelectorsDocumentDamage, QueryMsg, Reflow, ReflowDocumentDamage}; -use layout_interface::{ReflowForDisplay, ReflowForScriptQuery, ReflowGoal, ReflowMsg}; +use layout_interface::{AddStylesheetMsg, DocumentDamage}; +use layout_interface::{DocumentDamageLevel, HitTestQuery, HitTestResponse, LayoutQuery}; +use layout_interface::{LayoutChan, MatchSelectorsDocumentDamage, QueryMsg, Reflow}; +use layout_interface::{ReflowDocumentDamage, ReflowForDisplay, ReflowForScriptQuery, ReflowGoal}; +use layout_interface::ReflowMsg; use layout_interface; -use servo_msg::engine::{EngineChan, LoadUrlMsg}; +use servo_msg::engine::{EngineChan, LoadUrlMsg, RendererReadyMsg}; use std::cast::transmute; use std::cell::Cell; @@ -91,7 +93,9 @@ pub struct Frame { /// frames. /// /// FIXME: Rename to `Page`, following WebKit? -pub struct ScriptContext { +pub struct ScriptTask { + /// A unique identifier to the script's pipeline + id: uint, /// A handle to the layout task. layout_chan: LayoutChan, /// A handle to the image cache task. @@ -110,8 +114,8 @@ pub struct ScriptContext { /// For communicating load url messages to the engine engine_chan: EngineChan, - /// For communicating loading messages to the compositor - compositor_task: ~fn(ReadyState), + /// For permission to communicate ready state messages to the compositor + compositor: @ScriptListener, /// The JavaScript runtime. js_runtime: js::rust::rt, @@ -134,26 +138,26 @@ pub struct ScriptContext { damage: Option<DocumentDamage>, } -fn global_script_context_key(_: @ScriptContext) {} +fn global_script_context_key(_: @ScriptTask) {} /// Returns this task's script context singleton. -pub fn global_script_context() -> @ScriptContext { +pub fn global_script_context() -> @ScriptTask { unsafe { local_data::local_data_get(global_script_context_key).get() } } -/// Returns the script context from the JS Context. +/// Returns the script task from the JS Context. /// /// FIXME: Rename to `script_context_from_js_context`. -pub fn task_from_context(js_context: *JSContext) -> *mut ScriptContext { +pub fn task_from_context(js_context: *JSContext) -> *mut ScriptTask { unsafe { - JS_GetContextPrivate(js_context) as *mut ScriptContext + JS_GetContextPrivate(js_context) as *mut ScriptTask } } #[unsafe_destructor] -impl Drop for ScriptContext { +impl Drop for ScriptTask { fn finalize(&self) { unsafe { let _ = local_data::local_data_pop(global_script_context_key); @@ -161,16 +165,17 @@ impl Drop for ScriptContext { } } -impl ScriptContext { - /// Creates a new script context. - pub fn new(layout_chan: LayoutChan, +impl ScriptTask { + /// Creates a new script task. + pub fn new(id: uint, + compositor: @ScriptListener, + layout_chan: LayoutChan, script_port: Port<ScriptMsg>, script_chan: ScriptChan, engine_chan: EngineChan, - compositor_task: ~fn(ReadyState), resource_task: ResourceTask, img_cache_task: ImageCacheTask) - -> @mut ScriptContext { + -> @mut ScriptTask { let js_runtime = js::rust::rt(); let js_context = js_runtime.cx(); @@ -182,7 +187,10 @@ impl ScriptContext { Err(()) => fail!("Failed to create a compartment"), }; - let script_context = @mut ScriptContext { + let script_task = @mut ScriptTask { + id: id, + compositor: compositor, + layout_chan: layout_chan, image_cache_task: img_cache_task, resource_task: resource_task, @@ -192,7 +200,6 @@ impl ScriptContext { script_chan: script_chan, engine_chan: engine_chan, - compositor_task: compositor_task, js_runtime: js_runtime, js_context: js_context, @@ -207,17 +214,17 @@ impl ScriptContext { damage: None, }; // Indirection for Rust Issue #6248, dynamic freeze scope artifically extended - let script_context_ptr = { - let borrowed_ctx= &mut *script_context; - borrowed_ctx as *mut ScriptContext + let script_task_ptr = { + let borrowed_ctx= &mut *script_task; + borrowed_ctx as *mut ScriptTask }; unsafe { - js_context.set_cx_private(script_context_ptr as *()); - local_data::local_data_set(global_script_context_key, transmute(script_context)) + js_context.set_cx_private(script_task_ptr as *()); + local_data::local_data_set(global_script_context_key, transmute(script_task)) } - script_context + script_task } /// Starts the script task. After calling this method, the script task will loop receiving @@ -228,27 +235,29 @@ impl ScriptContext { } } - pub fn create_script_context(layout_chan: LayoutChan, - script_port: Port<ScriptMsg>, - script_chan: ScriptChan, - engine_chan: EngineChan, - compositor_task: ~fn(ReadyState), - resource_task: ResourceTask, - image_cache_task: ImageCacheTask) { + pub fn create<C: ScriptListener + Owned>(id: uint, + compositor: C, + layout_chan: LayoutChan, + script_port: Port<ScriptMsg>, + script_chan: ScriptChan, + engine_chan: EngineChan, + resource_task: ResourceTask, + image_cache_task: ImageCacheTask) { + let compositor = Cell::new(compositor); let script_port = Cell::new(script_port); - let compositor_task = Cell::new(compositor_task); // FIXME: rust#6399 let mut the_task = task(); the_task.sched_mode(SingleThreaded); - do the_task.spawn { - let script_context = ScriptContext::new(layout_chan.clone(), - script_port.take(), - script_chan.clone(), - engine_chan.clone(), - compositor_task.take(), - resource_task.clone(), - image_cache_task.clone()); - script_context.start(); + do spawn { + let script_task = ScriptTask::new(id, + @compositor.take() as @ScriptListener, + layout_chan.clone(), + script_port.take(), + script_chan.clone(), + engine_chan.clone(), + resource_task.clone(), + image_cache_task.clone()); + script_task.start(); } } @@ -324,7 +333,8 @@ impl ScriptContext { /// Handles a notification that reflow completed. fn handle_reflow_complete_msg(&mut self) { self.layout_join_port = None; - self.set_ready_state(FinishedLoading) + self.engine_chan.send(RendererReadyMsg(self.id)); + self.compositor.set_ready_state(FinishedLoading); } /// Handles a request to exit the script task and shut down layout. @@ -337,12 +347,6 @@ impl ScriptContext { self.layout_chan.send(layout_interface::ExitMsg) } - // tells the compositor when loading starts and finishes - // FIXME ~compositor_interface doesn't work right now, which is why this is necessary - fn set_ready_state(&self, msg: ReadyState) { - (self.compositor_task)(msg); - } - /// The entry point to document loading. Defines bindings, sets up the window and document /// objects, parses HTML and CSS, and kicks off initial layout. fn load(&mut self, url: Url) { @@ -354,7 +358,7 @@ impl ScriptContext { self.bindings_initialized = true } - self.set_ready_state(Loading); + self.compositor.set_ready_state(Loading); // Parse HTML. // // Note: We can parse the next document in parallel with any previous documents. @@ -446,7 +450,7 @@ impl ScriptContext { self.join_layout(); // Tell the user that we're performing layout. - self.set_ready_state(PerformingLayout); + self.compositor.set_ready_state(PerformingLayout); // Layout will let us know when it's done. let (join_port, join_chan) = comm::stream(); @@ -478,7 +482,7 @@ impl ScriptContext { /// FIXME: This should basically never be used. pub fn reflow_all(&mut self, goal: ReflowGoal) { for self.root_frame.iter().advance |root_frame| { - ScriptContext::damage(&mut self.damage, + ScriptTask::damage(&mut self.damage, root_frame.document.root, MatchSelectorsDocumentDamage) } @@ -487,12 +491,10 @@ impl ScriptContext { } /// Sends the given query to layout. - pub fn query_layout(&mut self, query: LayoutQuery) -> Result<LayoutResponse,()> { - self.join_layout(); - - let (response_port, response_chan) = comm::stream(); - self.layout_chan.send(QueryMsg(query, response_chan)); - response_port.recv() + pub fn query_layout<T: Owned>(&mut self, query: LayoutQuery, response_port: Port<Result<T, ()>>) -> Result<T,()> { + self.join_layout(); + self.layout_chan.send(QueryMsg(query)); + response_port.recv() } /// Adds the given damage. @@ -526,7 +528,7 @@ impl ScriptContext { self.window_size = Size2D(new_width, new_height); for self.root_frame.iter().advance |root_frame| { - ScriptContext::damage(&mut self.damage, + ScriptTask::damage(&mut self.damage, root_frame.document.root, ReflowDocumentDamage); } @@ -541,7 +543,7 @@ impl ScriptContext { debug!("script got reflow event"); for self.root_frame.iter().advance |root_frame| { - ScriptContext::damage(&mut self.damage, + ScriptTask::damage(&mut self.damage, root_frame.document.root, MatchSelectorsDocumentDamage); } @@ -557,7 +559,8 @@ impl ScriptContext { Some(ref frame) => frame.document.root, None => fail!("root frame is None") }; - match self.query_layout(HitTestQuery(root, point)) { + let (port, chan) = comm::stream(); + match self.query_layout(HitTestQuery(root, point, chan), port) { Ok(node) => match node { HitTestResponse(node) => { debug!("clicked on %?", node.debug_str()); @@ -580,7 +583,6 @@ impl ScriptContext { } } } - _ => fail!(~"unexpected layout reply") }, Err(()) => { debug!(fmt!("layout query error")); @@ -594,7 +596,7 @@ impl ScriptContext { priv fn load_url_from_element(&self, element: &Element) { // if the node's element is "a," load url from href attr - for element.attrs.each |attr| { + for element.attrs.iter().advance |attr| { if attr.name == ~"href" { debug!("clicked on link to %?", attr.value); let current_url = match self.root_frame { |