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

View file

@ -166,7 +166,9 @@ pub struct NewLayoutInfo {
pub parent_pipeline_id: PipelineId,
/// Id of the newly-created pipeline.
pub new_pipeline_id: PipelineId,
/// Type of the new frame associated with this pipeline.
/// Id of the frame associated with this pipeline.
pub frame_id: FrameId,
/// Type of the frame associated with this pipeline.
pub frame_type: FrameType,
/// Network request data which will be initiated by the script thread.
pub load_data: LoadData,
@ -206,22 +208,20 @@ pub enum ConstellationControlMsg {
/// Notifies script thread whether frame is visible
ChangeFrameVisibilityStatus(PipelineId, bool),
/// Notifies script thread that frame visibility change is complete
/// First PipelineId is for the parent, second PipelineId is for the actual pipeline.
NotifyVisibilityChange(PipelineId, PipelineId, bool),
/// PipelineId is for the parent, FrameId is for the actual frame.
NotifyVisibilityChange(PipelineId, FrameId, bool),
/// Notifies script thread that a url should be loaded in this iframe.
/// First PipelineId is for the parent, second PipelineId is for the actual pipeline.
Navigate(PipelineId, PipelineId, LoadData, bool),
/// PipelineId is for the parent, FrameId is for the actual frame.
Navigate(PipelineId, FrameId, LoadData, bool),
/// Requests the script thread forward a mozbrowser event to an iframe it owns,
/// or to the window if no child pipeline id is provided.
/// First PipelineId is for the parent, second PipelineId is for the actual pipeline.
MozBrowserEvent(PipelineId, Option<PipelineId>, MozBrowserEvent),
/// or to the window if no child frame id is provided.
MozBrowserEvent(PipelineId, Option<FrameId>, MozBrowserEvent),
/// Updates the current pipeline ID of a given iframe.
/// First PipelineId is for the parent, second is the old PipelineId for the frame,
/// third is the new PipelineId for the frame.
UpdatePipelineId(PipelineId, PipelineId, PipelineId),
/// First PipelineId is for the parent, second is the new PipelineId for the frame.
UpdatePipelineId(PipelineId, FrameId, PipelineId),
/// Set an iframe to be focused. Used when an element in an iframe gains focus.
/// First PipelineId is for the parent, second PipelineId is for the actual pipeline.
FocusIFrame(PipelineId, PipelineId),
/// PipelineId is for the parent, FrameId is for the actual frame.
FocusIFrame(PipelineId, FrameId),
/// Passes a webdriver command to the script thread for execution
WebDriverScriptCommand(PipelineId, WebDriverScriptCommand),
/// Notifies script thread that all animations are done
@ -233,14 +233,14 @@ pub enum ConstellationControlMsg {
WebFontLoaded(PipelineId),
/// Cause a `load` event to be dispatched at the appropriate frame element.
DispatchFrameLoadEvent {
/// The pipeline that has been marked as loaded.
target: PipelineId,
/// The frame that has been marked as loaded.
target: FrameId,
/// The pipeline that contains a frame loading the target pipeline.
parent: PipelineId,
},
/// Notifies a parent frame that one of its child frames is now active.
/// First PipelineId is for the parent, second PipelineId is for the actual pipeline.
FramedContentChanged(PipelineId, PipelineId),
/// Notifies a parent pipeline that one of its child frames is now active.
/// PipelineId is for the parent, FrameId is the child frame.
FramedContentChanged(PipelineId, FrameId),
/// Report an error from a CSS parser for the given pipeline
ReportCSSError(PipelineId, String, usize, usize, String),
/// Reload the given page.
@ -428,6 +428,8 @@ pub struct InitialScriptState {
/// The subpage ID of this pipeline to create in its pipeline parent.
/// If `None`, this is the root.
pub parent_info: Option<(PipelineId, FrameType)>,
/// The ID of the frame this script is part of.
pub frame_id: FrameId,
/// A channel with which messages can be sent to us (the script thread).
pub control_chan: IpcSender<ConstellationControlMsg>,
/// A port on which messages sent by the constellation to script can be received.