diff options
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r-- | components/script/dom/window.rs | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index e8006123360..f4efcd8dd76 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -51,7 +51,7 @@ use js::jsval::UndefinedValue; use js::rust::CompileOptionsWrapper; use js::rust::Runtime; use libc; -use msg::constellation_msg::{FrameType, LoadData, PipelineId, SubpageId, WindowSizeType}; +use msg::constellation_msg::{FrameType, LoadData, PipelineId, WindowSizeType}; use net_traits::ResourceThreads; use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread}; @@ -200,16 +200,14 @@ pub struct Window { /// page changes. devtools_wants_updates: Cell<bool>, - next_subpage_id: Cell<SubpageId>, - /// Pending resize event, if any. resize_event: Cell<Option<(WindowSizeData, WindowSizeType)>>, /// Pipeline id associated with this page. id: PipelineId, - /// Subpage id associated with this page, if any. - parent_info: Option<(PipelineId, SubpageId, FrameType)>, + /// Parent id associated with this page, if any. + parent_info: Option<(PipelineId, FrameType)>, /// Global static data related to the DOM. dom_static: GlobalStaticData, @@ -331,15 +329,11 @@ impl Window { worker_id } - pub fn pipeline(&self) -> PipelineId { + pub fn pipeline_id(&self) -> PipelineId { self.id } - pub fn subpage(&self) -> Option<SubpageId> { - self.parent_info.map(|p| p.1) - } - - pub fn parent_info(&self) -> Option<(PipelineId, SubpageId, FrameType)> { + pub fn parent_info(&self) -> Option<(PipelineId, FrameType)> { self.parent_info } @@ -472,7 +466,7 @@ impl WindowMethods for Window { } let (sender, receiver) = ipc::channel().unwrap(); - self.constellation_chan().send(ConstellationMsg::Alert(self.pipeline(), s.to_string(), sender)).unwrap(); + self.constellation_chan().send(ConstellationMsg::Alert(self.pipeline_id(), s.to_string(), sender)).unwrap(); let should_display_alert_dialog = receiver.recv().unwrap(); if should_display_alert_dialog { @@ -1058,7 +1052,7 @@ impl Window { // TODO (farodin91): Raise an event to stop the current_viewport self.update_viewport_for_scroll(x, y); - let message = ConstellationMsg::ScrollFragmentPoint(self.pipeline(), layer_id, point, smooth); + let message = ConstellationMsg::ScrollFragmentPoint(self.pipeline_id(), layer_id, point, smooth); self.constellation_chan.send(message).unwrap(); } @@ -1492,13 +1486,6 @@ impl Window { WindowProxyHandler(self.dom_static.windowproxy_handler.0) } - pub fn get_next_subpage_id(&self) -> SubpageId { - let subpage_id = self.next_subpage_id.get(); - let SubpageId(id_num) = subpage_id; - self.next_subpage_id.set(SubpageId(id_num + 1)); - subpage_id - } - pub fn get_pending_reflow_count(&self) -> u32 { self.pending_reflow_count.get() } @@ -1612,7 +1599,7 @@ impl Window { // https://html.spec.whatwg.org/multipage/#top-level-browsing-context pub fn is_top_level(&self) -> bool { match self.parent_info { - Some((_, _, FrameType::IFrame)) => false, + Some((_, FrameType::IFrame)) => false, _ => true, } } @@ -1676,7 +1663,7 @@ impl Window { timer_event_chan: IpcSender<TimerEvent>, layout_chan: Sender<Msg>, id: PipelineId, - parent_info: Option<(PipelineId, SubpageId, FrameType)>, + parent_info: Option<(PipelineId, FrameType)>, window_size: Option<WindowSizeData>) -> Root<Window> { let layout_rpc: Box<LayoutRPC> = { @@ -1726,7 +1713,6 @@ impl Window { page_clip_rect: Cell::new(max_rect()), fragment_name: DOMRefCell::new(None), resize_event: Cell::new(None), - next_subpage_id: Cell::new(SubpageId(0)), layout_chan: layout_chan, layout_rpc: layout_rpc, window_size: Cell::new(window_size), |