mirror of
https://github.com/servo/servo.git
synced 2025-08-01 11:40:30 +01:00
Implement window.parent for iframes.
This commit is contained in:
parent
7e3f504d94
commit
0873e5c8ca
11 changed files with 60 additions and 25 deletions
|
@ -393,11 +393,13 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
fn new_pipeline(&mut self,
|
||||
id: PipelineId,
|
||||
subpage_id: Option<SubpageId>,
|
||||
parent_id: Option<PipelineId>,
|
||||
script_pipeline: Option<Rc<Pipeline>>,
|
||||
load_data: LoadData)
|
||||
-> Rc<Pipeline> {
|
||||
let pipe = Pipeline::create::<LTF, STF>(id,
|
||||
subpage_id,
|
||||
parent_id,
|
||||
self.chan.clone(),
|
||||
self.compositor_proxy.clone_compositor_proxy(),
|
||||
self.devtools_chan.clone(),
|
||||
|
@ -570,7 +572,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
|
||||
let new_id = self.get_next_pipeline_id();
|
||||
let new_frame_id = self.get_next_frame_id();
|
||||
let pipeline = self.new_pipeline(new_id, subpage_id, None,
|
||||
let pipeline = self.new_pipeline(new_id, subpage_id, None, None,
|
||||
LoadData::new(Url::parse("about:failure").unwrap()));
|
||||
|
||||
self.browse(Some(pipeline_id),
|
||||
|
@ -597,7 +599,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
fn handle_init_load(&mut self, url: Url) {
|
||||
let next_pipeline_id = self.get_next_pipeline_id();
|
||||
let next_frame_id = self.get_next_frame_id();
|
||||
let pipeline = self.new_pipeline(next_pipeline_id, None, None, LoadData::new(url));
|
||||
let pipeline = self.new_pipeline(next_pipeline_id, None, None, None, LoadData::new(url));
|
||||
self.browse(None,
|
||||
Rc::new(FrameTree::new(next_frame_id, pipeline.clone(), None)),
|
||||
NavigationType::Load);
|
||||
|
@ -783,6 +785,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
let pipeline = self.new_pipeline(
|
||||
new_frame_pipeline_id,
|
||||
Some(new_subpage_id),
|
||||
Some(containing_page_pipeline_id),
|
||||
script_pipeline,
|
||||
LoadData::new(url)
|
||||
);
|
||||
|
@ -827,9 +830,10 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
|
||||
let parent = source_frame.parent.clone();
|
||||
let subpage_id = source_frame.pipeline.borrow().subpage_id;
|
||||
let parent_id = source_frame.pipeline.borrow().parent_id;
|
||||
let next_pipeline_id = self.get_next_pipeline_id();
|
||||
let next_frame_id = self.get_next_frame_id();
|
||||
let pipeline = self.new_pipeline(next_pipeline_id, subpage_id, None, load_data);
|
||||
let pipeline = self.new_pipeline(next_pipeline_id, subpage_id, parent_id, None, load_data);
|
||||
self.browse(Some(source_id),
|
||||
Rc::new(FrameTree::new(next_frame_id,
|
||||
pipeline.clone(),
|
||||
|
|
|
@ -24,6 +24,7 @@ use std::sync::mpsc::{Receiver, channel};
|
|||
pub struct Pipeline {
|
||||
pub id: PipelineId,
|
||||
pub subpage_id: Option<SubpageId>,
|
||||
pub parent_id: Option<PipelineId>,
|
||||
pub script_chan: ScriptControlChan,
|
||||
pub layout_chan: LayoutControlChan,
|
||||
pub paint_chan: PaintChan,
|
||||
|
@ -49,6 +50,7 @@ impl Pipeline {
|
|||
/// If script_pipeline is not None, then subpage_id must also be not None.
|
||||
pub fn create<LTF,STF>(id: PipelineId,
|
||||
subpage_id: Option<SubpageId>,
|
||||
parent_id: Option<PipelineId>,
|
||||
constellation_chan: ConstellationChan,
|
||||
compositor_proxy: Box<CompositorProxy+'static+Send>,
|
||||
devtools_chan: Option<DevtoolsControlChan>,
|
||||
|
@ -130,6 +132,7 @@ impl Pipeline {
|
|||
|
||||
Pipeline::new(id,
|
||||
subpage_id,
|
||||
parent_id,
|
||||
script_chan,
|
||||
LayoutControlChan(pipeline_chan),
|
||||
paint_chan,
|
||||
|
@ -140,6 +143,7 @@ impl Pipeline {
|
|||
|
||||
pub fn new(id: PipelineId,
|
||||
subpage_id: Option<SubpageId>,
|
||||
parent_id: Option<PipelineId>,
|
||||
script_chan: ScriptControlChan,
|
||||
layout_chan: LayoutControlChan,
|
||||
paint_chan: PaintChan,
|
||||
|
@ -150,6 +154,7 @@ impl Pipeline {
|
|||
Pipeline {
|
||||
id: id,
|
||||
subpage_id: subpage_id,
|
||||
parent_id: parent_id,
|
||||
script_chan: script_chan,
|
||||
layout_chan: layout_chan,
|
||||
paint_chan: paint_chan,
|
||||
|
@ -162,7 +167,7 @@ impl Pipeline {
|
|||
|
||||
pub fn load(&self) {
|
||||
let ScriptControlChan(ref chan) = self.script_chan;
|
||||
chan.send(ConstellationControlMsg::Load(self.id, self.load_data.clone())).unwrap();
|
||||
chan.send(ConstellationControlMsg::Load(self.id, self.parent_id, self.load_data.clone())).unwrap();
|
||||
}
|
||||
|
||||
pub fn grant_paint_permission(&self) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue