servo: Merge #8009 - Remove webdriver use of SubpageId (from glennw:webdriver-subpage); r=jdm

Source-Repo: https://github.com/servo/servo
Source-Revision: ac733746094c2ab1c3e5a3326095032206e5fb86
This commit is contained in:
Glenn Watson 2015-10-14 18:05:17 -06:00
Родитель ce3eeb7bf0
Коммит c019e2993c
5 изменённых файлов: 13 добавлений и 15 удалений

Просмотреть файл

@ -475,9 +475,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
debug!("constellation got get root pipeline message");
self.handle_get_pipeline(frame_id, resp_chan);
}
ConstellationMsg::GetFrame(parent_pipeline_id, subpage_id, resp_chan) => {
ConstellationMsg::GetFrame(pipeline_id, resp_chan) => {
debug!("constellation got get root pipeline message");
self.handle_get_frame(parent_pipeline_id, subpage_id, resp_chan);
self.handle_get_frame(pipeline_id, resp_chan);
}
ConstellationMsg::Focus(pipeline_id) => {
debug!("constellation got focus message");
@ -919,11 +919,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
}
fn handle_get_frame(&mut self,
containing_pipeline_id: PipelineId,
subpage_id: SubpageId,
pipeline_id: PipelineId,
resp_chan: IpcSender<Option<FrameId>>) {
let frame_id = self.subpage_map.get(&(containing_pipeline_id, subpage_id)).and_then(
|x| self.pipeline_to_frame_map.get(&x)).map(|x| *x);
let frame_id = self.pipeline_to_frame_map.get(&pipeline_id).map(|x| *x);
resp_chan.send(frame_id).unwrap();
}

Просмотреть файл

@ -260,8 +260,8 @@ pub enum Msg {
/// id, or for the root frame if this is None, over a provided channel
GetPipeline(Option<FrameId>, IpcSender<Option<PipelineId>>),
/// Request that the constellation send the FrameId corresponding to the document
/// with the provided parent pipeline id and subpage id
GetFrame(PipelineId, SubpageId, IpcSender<Option<FrameId>>),
/// with the provided pipeline id
GetFrame(PipelineId, IpcSender<Option<FrameId>>),
/// Notifies the constellation that this frame has received focus.
Focus(PipelineId),
/// Requests that the constellation retrieve the current contents of the clipboard

Просмотреть файл

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use constellation_msg::{PipelineId, SubpageId};
use constellation_msg::PipelineId;
use ipc_channel::ipc::IpcSender;
use rustc_serialize::json::{Json, ToJson};
use url::Url;
@ -16,7 +16,7 @@ pub enum WebDriverScriptCommand {
GetActiveElement(IpcSender<Option<String>>),
GetElementTagName(String, IpcSender<Result<String, ()>>),
GetElementText(String, IpcSender<Result<String, ()>>),
GetFrameId(WebDriverFrameId, IpcSender<Result<Option<(PipelineId, SubpageId)>, ()>>),
GetFrameId(WebDriverFrameId, IpcSender<Result<Option<PipelineId>, ()>>),
GetUrl(IpcSender<Url>),
GetTitle(IpcSender<String>)
}

Просмотреть файл

@ -17,7 +17,7 @@ use ipc_channel::ipc::IpcSender;
use js::jsapi::JSContext;
use js::jsapi::{HandleValue, RootedValue};
use js::jsval::UndefinedValue;
use msg::constellation_msg::{PipelineId, SubpageId};
use msg::constellation_msg::PipelineId;
use msg::webdriver_msg::{WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverJSValue};
use page::Page;
use script_task::get_page;
@ -85,7 +85,7 @@ pub fn handle_execute_async_script(page: &Rc<Page>,
pub fn handle_get_frame_id(page: &Rc<Page>,
pipeline: PipelineId,
webdriver_frame_id: WebDriverFrameId,
reply: IpcSender<Result<Option<(PipelineId, SubpageId)>, ()>>) {
reply: IpcSender<Result<Option<PipelineId>, ()>>) {
let window = match webdriver_frame_id {
WebDriverFrameId::Short(_) => {
// This isn't supported yet
@ -108,7 +108,7 @@ pub fn handle_get_frame_id(page: &Rc<Page>,
}
};
let frame_id = window.map(|x| x.and_then(|x| x.r().parent_info()));
let frame_id = window.map(|x| x.map(|x| x.r().pipeline()));
reply.send(frame_id).unwrap()
}

Просмотреть файл

@ -451,10 +451,10 @@ impl Handler {
}
let frame = match receiver.recv().unwrap() {
Ok(Some((pipeline_id, subpage_id))) => {
Ok(Some(pipeline_id)) => {
let (sender, receiver) = ipc::channel().unwrap();
let ConstellationChan(ref const_chan) = self.constellation_chan;
const_chan.send(ConstellationMsg::GetFrame(pipeline_id, subpage_id, sender)).unwrap();
const_chan.send(ConstellationMsg::GetFrame(pipeline_id, sender)).unwrap();
receiver.recv().unwrap()
},
Ok(None) => None,