1
0
Fork 0
mirror of https://github.com/servo/servo.git synced 2025-08-21 05:15:33 +01:00

Lookup frames by frame_id, not pipeline_id.

This commit is contained in:
Alan Jeffrey 2016-10-07 15:52:49 -05:00
parent 23d030e7a7
commit cda9099396
7 changed files with 112 additions and 89 deletions
components/script/dom

View file

@ -95,8 +95,8 @@ use ipc_channel::ipc::{self, IpcSender};
use js::jsapi::{JSContext, JSObject, JSRuntime};
use js::jsapi::JS_GetRuntime;
use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER};
use msg::constellation_msg::{FrameId, ReferrerPolicy};
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
use msg::constellation_msg::{PipelineId, ReferrerPolicy};
use net_traits::{FetchResponseMsg, IpcSend};
use net_traits::CookieSource::NonHTTP;
use net_traits::CoreResourceMsg::{GetCookiesForUrl, SetCookiesForUrl};
@ -1629,11 +1629,11 @@ impl Document {
}
/// Find an iframe element in the document.
pub fn find_iframe(&self, pipeline: PipelineId) -> Option<Root<HTMLIFrameElement>> {
pub fn find_iframe(&self, frame_id: FrameId) -> Option<Root<HTMLIFrameElement>> {
self.upcast::<Node>()
.traverse_preorder()
.filter_map(Root::downcast::<HTMLIFrameElement>)
.find(|node| node.pipeline_id() == Some(pipeline))
.find(|node| node.frame_id() == frame_id)
}
pub fn get_dom_loading(&self) -> u64 {

View file

@ -206,6 +206,11 @@ impl HTMLIFrameElement {
self.pipeline_id.get()
}
#[inline]
pub fn frame_id(&self) -> FrameId {
self.frame_id
}
pub fn change_visibility_status(&self, visibility: bool) {
if self.visibility.get() != visibility {
self.visibility.set(visibility);
@ -226,11 +231,7 @@ impl HTMLIFrameElement {
}
/// https://html.spec.whatwg.org/multipage/#iframe-load-event-steps steps 1-4
pub fn iframe_load_event_steps(&self, loaded_pipeline: PipelineId) {
// TODO(#9592): assert that the load blocker is present at all times when we
// can guarantee that it's created for the case of iframe.reload().
assert_eq!(loaded_pipeline, self.pipeline_id().unwrap());
pub fn iframe_load_event_steps(&self) {
// TODO A cross-origin child document would not be easily accessible
// from this script thread. It's unclear how to implement
// steps 2, 3, and 5 efficiently in this case.