mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Renamed constellation::Frame to constellation::BrowsingContext.
This commit is contained in:
parent
5403c2fff0
commit
607e011b05
24 changed files with 778 additions and 721 deletions
|
@ -40,7 +40,7 @@ use html5ever::{LocalName, Prefix};
|
|||
use ipc_channel::ipc;
|
||||
use js::jsapi::{JSAutoCompartment, JSContext, MutableHandleValue};
|
||||
use js::jsval::{NullValue, UndefinedValue};
|
||||
use msg::constellation_msg::{FrameType, FrameId, PipelineId, TraversalDirection};
|
||||
use msg::constellation_msg::{FrameType, BrowsingContextId, PipelineId, TraversalDirection};
|
||||
use net_traits::response::HttpsState;
|
||||
use script_layout_interface::message::ReflowQueryType;
|
||||
use script_thread::{ScriptThread, Runnable};
|
||||
|
@ -84,7 +84,7 @@ enum ProcessingMode {
|
|||
#[dom_struct]
|
||||
pub struct HTMLIFrameElement {
|
||||
htmlelement: HTMLElement,
|
||||
frame_id: FrameId,
|
||||
browsing_context_id: BrowsingContextId,
|
||||
pipeline_id: Cell<Option<PipelineId>>,
|
||||
pending_pipeline_id: Cell<Option<PipelineId>>,
|
||||
sandbox: MutNullableJS<DOMTokenList>,
|
||||
|
@ -115,7 +115,7 @@ impl HTMLIFrameElement {
|
|||
pub fn generate_new_pipeline_id(&self) -> (Option<PipelineId>, PipelineId) {
|
||||
let old_pipeline_id = self.pipeline_id.get();
|
||||
let new_pipeline_id = PipelineId::new();
|
||||
debug!("Frame {} created pipeline {}.", self.frame_id, new_pipeline_id);
|
||||
debug!("Frame {} created pipeline {}.", self.browsing_context_id, new_pipeline_id);
|
||||
(old_pipeline_id, new_pipeline_id)
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ impl HTMLIFrameElement {
|
|||
let global_scope = window.upcast::<GlobalScope>();
|
||||
let load_info = IFrameLoadInfo {
|
||||
parent_pipeline_id: global_scope.pipeline_id(),
|
||||
frame_id: self.frame_id,
|
||||
browsing_context_id: self.browsing_context_id,
|
||||
new_pipeline_id: new_pipeline_id,
|
||||
is_private: private_iframe,
|
||||
frame_type: frame_type,
|
||||
|
@ -171,7 +171,7 @@ impl HTMLIFrameElement {
|
|||
let new_layout_info = NewLayoutInfo {
|
||||
parent_info: Some((global_scope.pipeline_id(), frame_type)),
|
||||
new_pipeline_id: new_pipeline_id,
|
||||
frame_id: self.frame_id,
|
||||
browsing_context_id: self.browsing_context_id,
|
||||
load_data: load_data.unwrap(),
|
||||
pipeline_port: pipeline_receiver,
|
||||
content_process_shutdown_chan: None,
|
||||
|
@ -277,7 +277,7 @@ impl HTMLIFrameElement {
|
|||
document: &Document) -> HTMLIFrameElement {
|
||||
HTMLIFrameElement {
|
||||
htmlelement: HTMLElement::new_inherited(local_name, prefix, document),
|
||||
frame_id: FrameId::new(),
|
||||
browsing_context_id: BrowsingContextId::new(),
|
||||
pipeline_id: Cell::new(None),
|
||||
pending_pipeline_id: Cell::new(None),
|
||||
sandbox: Default::default(),
|
||||
|
@ -302,8 +302,8 @@ impl HTMLIFrameElement {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn frame_id(&self) -> FrameId {
|
||||
self.frame_id
|
||||
pub fn browsing_context_id(&self) -> BrowsingContextId {
|
||||
self.browsing_context_id
|
||||
}
|
||||
|
||||
pub fn change_visibility_status(&self, visibility: bool) {
|
||||
|
@ -364,7 +364,7 @@ impl HTMLIFrameElement {
|
|||
|
||||
pub trait HTMLIFrameElementLayoutMethods {
|
||||
fn pipeline_id(&self) -> Option<PipelineId>;
|
||||
fn frame_id(&self) -> FrameId;
|
||||
fn browsing_context_id(&self) -> BrowsingContextId;
|
||||
fn get_width(&self) -> LengthOrPercentageOrAuto;
|
||||
fn get_height(&self) -> LengthOrPercentageOrAuto;
|
||||
}
|
||||
|
@ -380,9 +380,9 @@ impl HTMLIFrameElementLayoutMethods for LayoutJS<HTMLIFrameElement> {
|
|||
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
fn frame_id(&self) -> FrameId {
|
||||
fn browsing_context_id(&self) -> BrowsingContextId {
|
||||
unsafe {
|
||||
(*self.unsafe_get()).frame_id
|
||||
(*self.unsafe_get()).browsing_context_id
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -541,7 +541,7 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-iframe-contentwindow
|
||||
fn GetContentWindow(&self) -> Option<Root<WindowProxy>> {
|
||||
self.pipeline_id.get().and_then(|_| ScriptThread::find_window_proxy(self.frame_id))
|
||||
self.pipeline_id.get().and_then(|_| ScriptThread::find_window_proxy(self.browsing_context_id))
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-iframe-contentdocument
|
||||
|
@ -711,7 +711,7 @@ impl VirtualMethods for HTMLIFrameElement {
|
|||
// is in a document tree and has a browsing context, which is what causes
|
||||
// the child browsing context to be created.
|
||||
if self.upcast::<Node>().is_in_doc_with_browsing_context() {
|
||||
debug!("iframe {} src set while in browsing context.", self.frame_id);
|
||||
debug!("iframe {} src set while in browsing context.", self.browsing_context_id);
|
||||
self.process_the_iframe_attributes(ProcessingMode::NotFirstTime);
|
||||
}
|
||||
},
|
||||
|
@ -740,7 +740,7 @@ impl VirtualMethods for HTMLIFrameElement {
|
|||
// to the newly-created browsing context, and then process the
|
||||
// iframe attributes for the "first time"."
|
||||
if self.upcast::<Node>().is_in_doc_with_browsing_context() {
|
||||
debug!("iframe {} bound to browsing context.", self.frame_id);
|
||||
debug!("iframe {} bound to browsing context.", self.browsing_context_id);
|
||||
debug_assert!(tree_in_doc, "is_in_doc_with_bc, but not tree_in_doc");
|
||||
self.create_nested_browsing_context();
|
||||
self.process_the_iframe_attributes(ProcessingMode::FirstTime);
|
||||
|
@ -754,13 +754,13 @@ impl VirtualMethods for HTMLIFrameElement {
|
|||
LoadBlocker::terminate(&mut blocker);
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#a-browsing-context-is-discarded
|
||||
debug!("Unbinding frame {}.", self.frame_id);
|
||||
debug!("Unbinding frame {}.", self.browsing_context_id);
|
||||
let window = window_from_node(self);
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
|
||||
// Ask the constellation to remove the iframe, and tell us the
|
||||
// pipeline ids of the closed pipelines.
|
||||
let msg = ConstellationMsg::RemoveIFrame(self.frame_id, sender);
|
||||
let msg = ConstellationMsg::RemoveIFrame(self.browsing_context_id, sender);
|
||||
window.upcast::<GlobalScope>().constellation_chan().send(msg).unwrap();
|
||||
let exited_pipeline_ids = receiver.recv().unwrap();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue