mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Implement iframe.contentWindow.
This commit is contained in:
parent
85285113e4
commit
765cea73d9
2 changed files with 14 additions and 2 deletions
|
@ -14,6 +14,7 @@ use dom::htmlelement::HTMLElement;
|
|||
use dom::node::{Node, ElementNodeTypeId, window_from_node};
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom::window::Window;
|
||||
use script_task::IterablePage;
|
||||
use servo_msg::constellation_msg::{PipelineId, SubpageId};
|
||||
use servo_msg::constellation_msg::{IFrameSandboxed, IFrameUnsandboxed};
|
||||
use servo_msg::constellation_msg::{ConstellationChan, LoadIframeUrlMsg};
|
||||
|
@ -184,7 +185,18 @@ impl<'a> HTMLIFrameElementMethods for JSRef<'a, HTMLIFrameElement> {
|
|||
}
|
||||
|
||||
fn GetContentWindow(&self) -> Option<Temporary<Window>> {
|
||||
None
|
||||
self.size.and_then(|size| {
|
||||
let window = window_from_node(self).root();
|
||||
let children = &*window.deref().page.children.deref().borrow();
|
||||
let child = children.iter().find(|child| {
|
||||
child.subpage_id.unwrap() == size.subpage_id
|
||||
});
|
||||
child.and_then(|page| {
|
||||
page.frame.deref().borrow().as_ref().map(|frame| {
|
||||
Temporary::new(frame.window.clone())
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
fn Align(&self) -> DOMString {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue