implement browsing context group and set

This commit is contained in:
Gregory Terzian 2019-06-04 15:39:35 +08:00
parent d544c186b9
commit 8c28852e90
3 changed files with 235 additions and 28 deletions

View file

@ -4,7 +4,9 @@
use crate::pipeline::Pipeline;
use euclid::TypedSize2D;
use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId};
use msg::constellation_msg::{
BrowsingContextGroupId, BrowsingContextId, PipelineId, TopLevelBrowsingContextId,
};
use std::collections::{HashMap, HashSet};
use style_traits::CSSPixel;
@ -34,6 +36,9 @@ pub struct NewBrowsingContextInfo {
/// sorted reverse chronologically: in particular prev.pop() is the latest
/// past entry, and next.pop() is the earliest future entry.
pub struct BrowsingContext {
/// The browsing context group id where the top-level of this bc is found.
pub bc_group_id: BrowsingContextGroupId,
/// The browsing context id.
pub id: BrowsingContextId,
@ -66,6 +71,7 @@ impl BrowsingContext {
/// Create a new browsing context.
/// Note this just creates the browsing context, it doesn't add it to the constellation's set of browsing contexts.
pub fn new(
bc_group_id: BrowsingContextGroupId,
id: BrowsingContextId,
top_level_id: TopLevelBrowsingContextId,
pipeline_id: PipelineId,
@ -77,14 +83,15 @@ impl BrowsingContext {
let mut pipelines = HashSet::new();
pipelines.insert(pipeline_id);
BrowsingContext {
id: id,
top_level_id: top_level_id,
size: size,
is_private: is_private,
is_visible: is_visible,
pipeline_id: pipeline_id,
parent_pipeline_id: parent_pipeline_id,
pipelines: pipelines,
bc_group_id,
id,
top_level_id,
size,
is_private,
is_visible,
pipeline_id,
parent_pipeline_id,
pipelines,
}
}