aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/script_task.rs
diff options
context:
space:
mode:
authorbors-servo <release+servo@mozilla.com>2014-05-20 11:43:46 -0400
committerbors-servo <release+servo@mozilla.com>2014-05-20 11:43:46 -0400
commitca9396ff9c7ebeea48d881b421854168b9afb825 (patch)
treeac6081bf013c32d4b91cf15c2b202406e6412b82 /src/components/script/script_task.rs
parent90a0bcfa78ddf89031d54e4ed8ae84e2b171b4d0 (diff)
parent81821052040eab42e9b3ca72aeccbb17cd002197 (diff)
downloadservo-ca9396ff9c7ebeea48d881b421854168b9afb825.tar.gz
servo-ca9396ff9c7ebeea48d881b421854168b9afb825.zip
auto merge of #2434 : Ms2ger/servo/contentWindow, r=jdm
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 a750903e45d..0ce993d5e19 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};
@@ -91,8 +92,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,
}
@@ -120,6 +122,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>>,
@@ -168,7 +173,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>>;
}
@@ -190,7 +195,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 {
@@ -200,6 +206,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)),
@@ -606,7 +613,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());
@@ -641,11 +648,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();
@@ -782,18 +789,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())