aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmliframeelement.rs
diff options
context:
space:
mode:
authorAneesh Agrawal <aneeshusa@gmail.com>2016-06-09 08:17:30 -0400
committerAneesh Agrawal <aneeshusa@gmail.com>2016-09-13 15:37:38 -0400
commit56fbfd46a4e1e31bf9cde59cffdffbb1b05f97bf (patch)
treefdfd2b2e51d840b451ef01a65a4398e1030bb596 /components/script/dom/htmliframeelement.rs
parentb9b25b6f82d838c7bb6f87b71d7726f7a58847d9 (diff)
downloadservo-56fbfd46a4e1e31bf9cde59cffdffbb1b05f97bf.tar.gz
servo-56fbfd46a4e1e31bf9cde59cffdffbb1b05f97bf.zip
Excise SubpageId and use only PipelineIds
SubpageId was originally introduced in 2013 to help iframes keep track of their associated (children) pipelines. However, since each pipeline already has a PipelineId, and those are unique, those are sufficient to keep track of children.
Diffstat (limited to 'components/script/dom/htmliframeelement.rs')
-rw-r--r--components/script/dom/htmliframeelement.rs38
1 files changed, 12 insertions, 26 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index 051f7588687..220eb7d1c7c 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -38,7 +38,7 @@ use dom::window::{ReflowReason, Window};
use ipc_channel::ipc;
use js::jsapi::{JSAutoCompartment, JSContext, MutableHandleValue};
use js::jsval::{NullValue, UndefinedValue};
-use msg::constellation_msg::{FrameType, LoadData, PipelineId, SubpageId, TraversalDirection};
+use msg::constellation_msg::{FrameType, LoadData, PipelineId, TraversalDirection};
use net_traits::response::HttpsState;
use script_layout_interface::message::ReflowQueryType;
use script_traits::{IFrameLoadInfo, MozBrowserEvent, ScriptMsg as ConstellationMsg};
@@ -68,7 +68,6 @@ bitflags! {
pub struct HTMLIFrameElement {
htmlelement: HTMLElement,
pipeline_id: Cell<Option<PipelineId>>,
- subpage_id: Cell<Option<SubpageId>>,
sandbox: MutNullableHeap<JS<DOMTokenList>>,
sandbox_allowance: Cell<Option<SandboxAllowance>>,
load_blocker: DOMRefCell<Option<LoadBlocker>>,
@@ -94,14 +93,11 @@ impl HTMLIFrameElement {
}).unwrap_or_else(|| Url::parse("about:blank").unwrap())
}
- pub fn generate_new_subpage_id(&self) -> (SubpageId, Option<SubpageId>) {
- self.pipeline_id.set(Some(PipelineId::new()));
-
- let old_subpage_id = self.subpage_id.get();
- let win = window_from_node(self);
- let subpage_id = win.get_next_subpage_id();
- self.subpage_id.set(Some(subpage_id));
- (subpage_id, old_subpage_id)
+ pub fn generate_new_pipeline_id(&self) -> (Option<PipelineId>, PipelineId) {
+ let old_pipeline_id = self.pipeline_id.get();
+ let new_pipeline_id = PipelineId::new();
+ self.pipeline_id.set(Some(new_pipeline_id));
+ (old_pipeline_id, new_pipeline_id)
}
pub fn navigate_or_reload_child_browsing_context(&self, load_data: Option<LoadData>) {
@@ -126,16 +122,14 @@ impl HTMLIFrameElement {
}
let window = window_from_node(self);
- let (new_subpage_id, old_subpage_id) = self.generate_new_subpage_id();
- let new_pipeline_id = self.pipeline_id.get().unwrap();
+ let (old_pipeline_id, new_pipeline_id) = self.generate_new_pipeline_id();
let private_iframe = self.privatebrowsing();
let frame_type = if self.Mozbrowser() { FrameType::MozBrowserIFrame } else { FrameType::IFrame };
let load_info = IFrameLoadInfo {
load_data: load_data,
parent_pipeline_id: window.pipeline_id(),
- new_subpage_id: new_subpage_id,
- old_subpage_id: old_subpage_id,
+ old_pipeline_id: old_pipeline_id,
new_pipeline_id: new_pipeline_id,
sandbox: sandboxed,
is_private: private_iframe,
@@ -170,8 +164,7 @@ impl HTMLIFrameElement {
}
}
- pub fn update_subpage_id(&self, new_subpage_id: SubpageId, new_pipeline_id: PipelineId) {
- self.subpage_id.set(Some(new_subpage_id));
+ pub fn update_pipeline_id(&self, new_pipeline_id: PipelineId) {
self.pipeline_id.set(Some(new_pipeline_id));
let mut blocker = self.load_blocker.borrow_mut();
@@ -186,7 +179,6 @@ impl HTMLIFrameElement {
HTMLIFrameElement {
htmlelement: HTMLElement::new_inherited(localName, prefix, document),
pipeline_id: Cell::new(None),
- subpage_id: Cell::new(None),
sandbox: Default::default(),
sandbox_allowance: Cell::new(None),
load_blocker: DOMRefCell::new(None),
@@ -208,11 +200,6 @@ impl HTMLIFrameElement {
self.pipeline_id.get()
}
- #[inline]
- pub fn subpage_id(&self) -> Option<SubpageId> {
- self.subpage_id.get()
- }
-
pub fn change_visibility_status(&self, visibility: bool) {
if self.visibility.get() != visibility {
self.visibility.set(visibility);
@@ -270,11 +257,11 @@ impl HTMLIFrameElement {
}
pub fn get_content_window(&self) -> Option<Root<Window>> {
- self.subpage_id.get().and_then(|subpage_id| {
+ self.pipeline_id.get().and_then(|pipeline_id| {
let window = window_from_node(self);
let window = window.r();
let browsing_context = window.browsing_context();
- browsing_context.find_child_by_subpage(subpage_id)
+ browsing_context.find_child_by_id(pipeline_id)
})
}
@@ -659,12 +646,11 @@ impl VirtualMethods for HTMLIFrameElement {
receiver.recv().unwrap()
}
- // Resetting the subpage id to None is required here so that
+ // Resetting the pipeline_id to None is required here so that
// if this iframe is subsequently re-added to the document
// the load doesn't think that it's a navigation, but instead
// a new iframe. Without this, the constellation gets very
// confused.
- self.subpage_id.set(None);
self.pipeline_id.set(None);
}
}