aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/script_task.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/script/script_task.rs')
-rw-r--r--src/components/script/script_task.rs32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs
index 5a5ba61ddb8..9c50b2f5b5d 100644
--- a/src/components/script/script_task.rs
+++ b/src/components/script/script_task.rs
@@ -11,7 +11,8 @@ use dom::bindings::codegen::InheritTypes::{EventTargetCast, NodeCast, ElementCas
use dom::bindings::js::{JS, JSRef, RootCollection, Temporary, OptionalSettable};
use dom::bindings::js::OptionalRootable;
use dom::bindings::trace::{Traceable, Untraceable};
-use dom::bindings::utils::{Reflectable, GlobalStaticData, wrap_for_same_compartment};
+use dom::bindings::utils::{Reflectable, GlobalStaticData};
+use dom::bindings::utils::{wrap_for_same_compartment, pre_wrap};
use dom::document::{Document, HTMLDocument, DocumentMethods, DocumentHelpers};
use dom::element::{Element, AttributeHandlers};
use dom::event::{Event_, ResizeEvent, ReflowEvent, ClickEvent, MouseDownEvent, MouseMoveEvent, MouseUpEvent};
@@ -94,8 +95,9 @@ pub enum ScriptMsg {
}
pub struct NewLayoutInfo {
- pub old_id: PipelineId,
- pub new_id: PipelineId,
+ pub old_pipeline_id: PipelineId,
+ pub new_pipeline_id: PipelineId,
+ pub subpage_id: SubpageId,
pub layout_chan: LayoutChan,
}
@@ -123,6 +125,9 @@ pub struct Page {
/// Pipeline id associated with this page.
pub id: PipelineId,
+ /// Subpage id associated with this page, if any.
+ pub subpage_id: Option<SubpageId>,
+
/// Unique id for last reflow request; used for confirming completion reply.
pub last_reflow_id: Traceable<Cell<uint>>,
@@ -171,7 +176,7 @@ pub struct PageIterator {
stack: Vec<Rc<Page>>,
}
-trait IterablePage {
+pub trait IterablePage {
fn iter(&self) -> PageIterator;
fn find(&self, id: PipelineId) -> Option<Rc<Page>>;
}
@@ -193,7 +198,8 @@ impl IterablePage for Rc<Page> {
}
impl Page {
- fn new(id: PipelineId, layout_chan: LayoutChan,
+ fn new(id: PipelineId, subpage_id: Option<SubpageId>,
+ layout_chan: LayoutChan,
window_size: Size2D<uint>, resource_task: ResourceTask,
constellation_chan: ConstellationChan,
js_context: Rc<Cx>) -> Page {
@@ -203,6 +209,7 @@ impl Page {
};
Page {
id: id,
+ subpage_id: subpage_id,
frame: Traceable::new(RefCell::new(None)),
layout_chan: Untraceable::new(layout_chan),
layout_join_port: Untraceable::new(RefCell::new(None)),
@@ -609,7 +616,7 @@ impl ScriptTask {
window_size: Size2D<uint>)
-> Rc<ScriptTask> {
let (js_runtime, js_context) = ScriptTask::new_rt_and_cx();
- let page = Page::new(id, layout_chan, window_size,
+ let page = Page::new(id, None, layout_chan, window_size,
resource_task.clone(),
constellation_chan.clone(),
js_context.clone());
@@ -644,11 +651,11 @@ impl ScriptTask {
let callback = JS_SetWrapObjectCallbacks((*js_runtime).ptr,
ptr::null(),
wrap_for_same_compartment,
- ptr::null());
+ None);
JS_SetWrapObjectCallbacks((*js_runtime).ptr,
callback,
wrap_for_same_compartment,
- ptr::null());
+ Some(pre_wrap));
}
let js_context = js_runtime.cx();
@@ -786,18 +793,19 @@ impl ScriptTask {
fn handle_new_layout(&self, new_layout_info: NewLayoutInfo) {
debug!("Script: new layout: {:?}", new_layout_info);
let NewLayoutInfo {
- old_id,
- new_id,
+ old_pipeline_id,
+ new_pipeline_id,
+ subpage_id,
layout_chan
} = new_layout_info;
let mut page = self.page.borrow_mut();
- let parent_page = page.find(old_id).expect("ScriptTask: received a layout
+ let parent_page = page.find(old_pipeline_id).expect("ScriptTask: received a layout
whose parent has a PipelineId which does not correspond to a pipeline in the script
task's page tree. This is a bug.");
let new_page = {
let window_size = parent_page.window_size.deref().get();
- Page::new(new_id, layout_chan, window_size,
+ Page::new(new_pipeline_id, Some(subpage_id), layout_chan, window_size,
parent_page.resource_task.deref().clone(),
self.constellation_chan.clone(),
self.js_context.borrow().get_ref().clone())