diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-09-14 01:45:56 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-14 01:45:56 -0500 |
commit | 161e0741cd4942d337b8d0fca2e0eaa86482ad9a (patch) | |
tree | fdfd2b2e51d840b451ef01a65a4398e1030bb596 /components/script/dom/window.rs | |
parent | bb53da69578887befae195b18255967cc7f3fc59 (diff) | |
parent | 56fbfd46a4e1e31bf9cde59cffdffbb1b05f97bf (diff) | |
download | servo-161e0741cd4942d337b8d0fca2e0eaa86482ad9a.tar.gz servo-161e0741cd4942d337b8d0fca2e0eaa86482ad9a.zip |
Auto merge of #11698 - aneeshusa:remove-subpage-id, r=notriddle
Excise SubpageId and use only PipelineIds
<!-- Please describe your changes on the following line: -->
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.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #11694 (github issue number if applicable).
<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because refactoring
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11698)
<!-- Reviewable:end -->
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), |