mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Simplify stacking context collection
Simplify the way that stacking contexts are collected. Instead of passing the StackingContextId down the tree, pass the parent StackingContext itself. This will allow future patches to get more information about the parent stacking context (such as location). Also remove the return value of collect_stacking_contexts, which was unused.
This commit is contained in:
parent
ef1b594f48
commit
066775915c
16 changed files with 88 additions and 184 deletions
|
@ -618,7 +618,7 @@ pub struct StackingContext {
|
||||||
pub layer_info: Option<LayerInfo>,
|
pub layer_info: Option<LayerInfo>,
|
||||||
|
|
||||||
/// Children of this StackingContext.
|
/// Children of this StackingContext.
|
||||||
children: Vec<Box<StackingContext>>,
|
pub children: Vec<Box<StackingContext>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StackingContext {
|
impl StackingContext {
|
||||||
|
@ -654,30 +654,9 @@ impl StackingContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_children(&mut self, children: Vec<Box<StackingContext>>) {
|
pub fn add_child(&mut self, mut child: StackingContext) {
|
||||||
debug_assert!(self.children.is_empty());
|
child.update_overflow_for_all_children();
|
||||||
// We need to take into account the possible transformations of the
|
self.children.push(Box::new(child));
|
||||||
// child stacking contexts.
|
|
||||||
for child in &children {
|
|
||||||
self.update_overflow_for_new_child(&child);
|
|
||||||
}
|
|
||||||
|
|
||||||
self.children = children;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn add_child(&mut self, child: Box<StackingContext>) {
|
|
||||||
self.update_overflow_for_new_child(&child);
|
|
||||||
self.children.push(child);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn add_children(&mut self, children: Vec<Box<StackingContext>>) {
|
|
||||||
if self.children.is_empty() {
|
|
||||||
return self.set_children(children);
|
|
||||||
}
|
|
||||||
|
|
||||||
for child in children {
|
|
||||||
self.add_child(child);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn child_at_mut(&mut self, index: usize) -> &mut StackingContext {
|
pub fn child_at_mut(&mut self, index: usize) -> &mut StackingContext {
|
||||||
|
@ -688,16 +667,18 @@ impl StackingContext {
|
||||||
&self.children
|
&self.children
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_overflow_for_new_child(&mut self, child: &StackingContext) {
|
fn update_overflow_for_all_children(&mut self) {
|
||||||
if self.context_type == StackingContextType::Real &&
|
for child in self.children.iter() {
|
||||||
child.context_type == StackingContextType::Real &&
|
if self.context_type == StackingContextType::Real &&
|
||||||
!self.scrolls_overflow_area {
|
child.context_type == StackingContextType::Real &&
|
||||||
// This child might be transformed, so we need to take into account
|
!self.scrolls_overflow_area {
|
||||||
// its transformed overflow rect too, but at the correct position.
|
// This child might be transformed, so we need to take into account
|
||||||
let overflow =
|
// its transformed overflow rect too, but at the correct position.
|
||||||
child.overflow_rect_in_parent_space();
|
let overflow =
|
||||||
|
child.overflow_rect_in_parent_space();
|
||||||
|
|
||||||
self.overflow = self.overflow.union(&overflow);
|
self.overflow = self.overflow.union(&overflow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ use flow_ref::FlowRef;
|
||||||
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, HAS_LAYER, Overflow};
|
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, HAS_LAYER, Overflow};
|
||||||
use fragment::SpecificFragmentInfo;
|
use fragment::SpecificFragmentInfo;
|
||||||
use gfx::display_list::{ClippingRegion, StackingContext};
|
use gfx::display_list::{ClippingRegion, StackingContext};
|
||||||
use gfx_traits::{LayerId, StackingContextId};
|
use gfx_traits::LayerId;
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use layout_debug;
|
use layout_debug;
|
||||||
use model::{self, IntrinsicISizes, MarginCollapseInfo};
|
use model::{self, IntrinsicISizes, MarginCollapseInfo};
|
||||||
|
@ -2172,11 +2172,8 @@ impl Flow for BlockFlow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_stacking_contexts(&mut self,
|
fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
|
||||||
parent_id: StackingContextId,
|
self.collect_stacking_contexts_for_block(parent);
|
||||||
contexts: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId {
|
|
||||||
self.collect_stacking_contexts_for_block(parent_id, contexts)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_display_list(&mut self, state: &mut DisplayListBuildState) {
|
fn build_display_list(&mut self, state: &mut DisplayListBuildState) {
|
||||||
|
|
|
@ -292,7 +292,7 @@ pub trait FragmentDisplayListBuilding {
|
||||||
base_flow: &BaseFlow,
|
base_flow: &BaseFlow,
|
||||||
scroll_policy: ScrollPolicy,
|
scroll_policy: ScrollPolicy,
|
||||||
mode: StackingContextCreationMode)
|
mode: StackingContextCreationMode)
|
||||||
-> Box<StackingContext>;
|
-> StackingContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_overlapping_radii(size: &Size2D<Au>, radii: &BorderRadii<Au>) -> BorderRadii<Au> {
|
fn handle_overlapping_radii(size: &Size2D<Au>, radii: &BorderRadii<Au>) -> BorderRadii<Au> {
|
||||||
|
@ -1369,7 +1369,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
base_flow: &BaseFlow,
|
base_flow: &BaseFlow,
|
||||||
scroll_policy: ScrollPolicy,
|
scroll_policy: ScrollPolicy,
|
||||||
mode: StackingContextCreationMode)
|
mode: StackingContextCreationMode)
|
||||||
-> Box<StackingContext> {
|
-> StackingContext {
|
||||||
let use_webrender = opts::get().use_webrender;
|
let use_webrender = opts::get().use_webrender;
|
||||||
let border_box = match mode {
|
let border_box = match mode {
|
||||||
StackingContextCreationMode::InnerScrollWrapper => {
|
StackingContextCreationMode::InnerScrollWrapper => {
|
||||||
|
@ -1510,18 +1510,18 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
_ => StackingContextType::Real,
|
_ => StackingContextType::Real,
|
||||||
};
|
};
|
||||||
|
|
||||||
Box::new(StackingContext::new(id,
|
StackingContext::new(id,
|
||||||
context_type,
|
context_type,
|
||||||
&border_box,
|
&border_box,
|
||||||
&overflow,
|
&overflow,
|
||||||
self.effective_z_index(),
|
self.effective_z_index(),
|
||||||
filters,
|
filters,
|
||||||
self.style().get_effects().mix_blend_mode,
|
self.style().get_effects().mix_blend_mode,
|
||||||
transform,
|
transform,
|
||||||
perspective,
|
perspective,
|
||||||
establishes_3d_context,
|
establishes_3d_context,
|
||||||
scrolls_overflow_area,
|
scrolls_overflow_area,
|
||||||
layer_info))
|
layer_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn adjust_clipping_region_for_children(&self,
|
fn adjust_clipping_region_for_children(&self,
|
||||||
|
@ -1721,25 +1721,19 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait BlockFlowDisplayListBuilding {
|
pub trait BlockFlowDisplayListBuilding {
|
||||||
fn collect_stacking_contexts_for_block(&mut self,
|
fn collect_stacking_contexts_for_block(&mut self, parent: &mut StackingContext);
|
||||||
parent_id: StackingContextId,
|
|
||||||
contexts: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId;
|
|
||||||
fn build_display_list_for_block(&mut self,
|
fn build_display_list_for_block(&mut self,
|
||||||
state: &mut DisplayListBuildState,
|
state: &mut DisplayListBuildState,
|
||||||
border_painting_mode: BorderPaintingMode);
|
border_painting_mode: BorderPaintingMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BlockFlowDisplayListBuilding for BlockFlow {
|
impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
fn collect_stacking_contexts_for_block(&mut self,
|
fn collect_stacking_contexts_for_block(&mut self, parent: &mut StackingContext) {
|
||||||
parent_id: StackingContextId,
|
|
||||||
contexts: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId {
|
|
||||||
let block_stacking_context_type = self.block_stacking_context_type();
|
let block_stacking_context_type = self.block_stacking_context_type();
|
||||||
if block_stacking_context_type == BlockStackingContextType::NonstackingContext {
|
if block_stacking_context_type == BlockStackingContextType::NonstackingContext {
|
||||||
self.base.stacking_context_id = parent_id;
|
self.base.stacking_context_id = parent.id;
|
||||||
self.base.collect_stacking_contexts_for_children(parent_id, contexts);
|
self.base.collect_stacking_contexts_for_children(parent);
|
||||||
return parent_id;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let has_scrolling_overflow = self.has_scrolling_overflow();
|
let has_scrolling_overflow = self.has_scrolling_overflow();
|
||||||
|
@ -1758,9 +1752,6 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
stacking_context_id
|
stacking_context_id
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut child_contexts = Vec::new();
|
|
||||||
self.base.collect_stacking_contexts_for_children(inner_stacking_context_id,
|
|
||||||
&mut child_contexts);
|
|
||||||
|
|
||||||
if block_stacking_context_type == BlockStackingContextType::PseudoStackingContext {
|
if block_stacking_context_type == BlockStackingContextType::PseudoStackingContext {
|
||||||
let creation_mode = if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) ||
|
let creation_mode = if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) ||
|
||||||
|
@ -1771,25 +1762,25 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
StackingContextCreationMode::PseudoFloat
|
StackingContextCreationMode::PseudoFloat
|
||||||
};
|
};
|
||||||
|
|
||||||
let stacking_context_index = contexts.len();
|
let mut new_context = self.fragment.create_stacking_context(stacking_context_id,
|
||||||
contexts.push(self.fragment.create_stacking_context(stacking_context_id,
|
&self.base,
|
||||||
&self.base,
|
ScrollPolicy::Scrollable,
|
||||||
ScrollPolicy::Scrollable,
|
creation_mode);
|
||||||
creation_mode));
|
self.base.collect_stacking_contexts_for_children(&mut new_context);
|
||||||
|
let new_children: Vec<Box<StackingContext>> = new_context.children.drain(..).collect();
|
||||||
|
|
||||||
let mut floating = vec![];
|
let mut non_floating_children = Vec::new();
|
||||||
for child_context in child_contexts.into_iter() {
|
for child in new_children {
|
||||||
if child_context.context_type == StackingContextType::PseudoFloat {
|
if child.context_type == StackingContextType::PseudoFloat {
|
||||||
// Floating.
|
new_context.children.push(child);
|
||||||
floating.push(child_context)
|
|
||||||
} else {
|
} else {
|
||||||
// Positioned.
|
non_floating_children.push(child);
|
||||||
contexts.push(child_context)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contexts[stacking_context_index].set_children(floating);
|
parent.add_child(new_context);
|
||||||
return stacking_context_id;
|
parent.children.append(&mut non_floating_children);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let scroll_policy = if self.is_fixed() {
|
let scroll_policy = if self.is_fixed() {
|
||||||
|
@ -1804,7 +1795,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
&self.base,
|
&self.base,
|
||||||
scroll_policy,
|
scroll_policy,
|
||||||
StackingContextCreationMode::InnerScrollWrapper);
|
StackingContextCreationMode::InnerScrollWrapper);
|
||||||
inner_stacking_context.set_children(child_contexts);
|
self.base.collect_stacking_contexts_for_children(&mut inner_stacking_context);
|
||||||
|
|
||||||
let mut outer_stacking_context = self.fragment.create_stacking_context(
|
let mut outer_stacking_context = self.fragment.create_stacking_context(
|
||||||
stacking_context_id,
|
stacking_context_id,
|
||||||
|
@ -1819,12 +1810,11 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
&self.base,
|
&self.base,
|
||||||
scroll_policy,
|
scroll_policy,
|
||||||
StackingContextCreationMode::Normal);
|
StackingContextCreationMode::Normal);
|
||||||
stacking_context.set_children(child_contexts);
|
self.base.collect_stacking_contexts_for_children(&mut stacking_context);
|
||||||
stacking_context
|
stacking_context
|
||||||
};
|
};
|
||||||
|
|
||||||
contexts.push(stacking_context);
|
parent.add_child(stacking_context);
|
||||||
stacking_context_id
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_display_list_for_block(&mut self,
|
fn build_display_list_for_block(&mut self,
|
||||||
|
@ -1871,10 +1861,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait InlineFlowDisplayListBuilding {
|
pub trait InlineFlowDisplayListBuilding {
|
||||||
fn collect_stacking_contexts_for_inline(&mut self,
|
fn collect_stacking_contexts_for_inline(&mut self, parent: &mut StackingContext);
|
||||||
parent_id: StackingContextId,
|
|
||||||
contexts: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId;
|
|
||||||
fn build_display_list_for_inline_fragment_at_index(&mut self,
|
fn build_display_list_for_inline_fragment_at_index(&mut self,
|
||||||
state: &mut DisplayListBuildState,
|
state: &mut DisplayListBuildState,
|
||||||
index: usize);
|
index: usize);
|
||||||
|
@ -1882,36 +1869,32 @@ pub trait InlineFlowDisplayListBuilding {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InlineFlowDisplayListBuilding for InlineFlow {
|
impl InlineFlowDisplayListBuilding for InlineFlow {
|
||||||
fn collect_stacking_contexts_for_inline(&mut self,
|
fn collect_stacking_contexts_for_inline(&mut self, parent: &mut StackingContext) {
|
||||||
parent_id: StackingContextId,
|
self.base.stacking_context_id = parent.id;
|
||||||
contexts: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId {
|
|
||||||
self.base.stacking_context_id = parent_id;
|
|
||||||
|
|
||||||
for mut fragment in self.fragments.fragments.iter_mut() {
|
for mut fragment in self.fragments.fragments.iter_mut() {
|
||||||
match fragment.specific {
|
match fragment.specific {
|
||||||
SpecificFragmentInfo::InlineBlock(ref mut block_flow) => {
|
SpecificFragmentInfo::InlineBlock(ref mut block_flow) => {
|
||||||
let block_flow = flow_ref::deref_mut(&mut block_flow.flow_ref);
|
let block_flow = flow_ref::deref_mut(&mut block_flow.flow_ref);
|
||||||
block_flow.collect_stacking_contexts(parent_id, contexts);
|
block_flow.collect_stacking_contexts(parent);
|
||||||
}
|
}
|
||||||
SpecificFragmentInfo::InlineAbsoluteHypothetical(ref mut block_flow) => {
|
SpecificFragmentInfo::InlineAbsoluteHypothetical(ref mut block_flow) => {
|
||||||
let block_flow = flow_ref::deref_mut(&mut block_flow.flow_ref);
|
let block_flow = flow_ref::deref_mut(&mut block_flow.flow_ref);
|
||||||
block_flow.collect_stacking_contexts(parent_id, contexts);
|
block_flow.collect_stacking_contexts(parent);
|
||||||
}
|
}
|
||||||
_ if fragment.establishes_stacking_context() => {
|
_ if fragment.establishes_stacking_context() => {
|
||||||
fragment.stacking_context_id =
|
fragment.stacking_context_id =
|
||||||
StackingContextId::new_of_type(fragment.fragment_id(),
|
StackingContextId::new_of_type(fragment.fragment_id(),
|
||||||
fragment.fragment_type());
|
fragment.fragment_type());
|
||||||
contexts.push(fragment.create_stacking_context(
|
parent.add_child(fragment.create_stacking_context(
|
||||||
fragment.stacking_context_id,
|
fragment.stacking_context_id,
|
||||||
&self.base,
|
&self.base,
|
||||||
ScrollPolicy::Scrollable,
|
ScrollPolicy::Scrollable,
|
||||||
StackingContextCreationMode::Normal));
|
StackingContextCreationMode::Normal));
|
||||||
}
|
}
|
||||||
_ => fragment.stacking_context_id = parent_id,
|
_ => fragment.stacking_context_id = parent.id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
parent_id
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_display_list_for_inline_fragment_at_index(&mut self,
|
fn build_display_list_for_inline_fragment_at_index(&mut self,
|
||||||
|
|
|
@ -18,7 +18,6 @@ use flow::{INLINE_POSITION_IS_STATIC, IS_ABSOLUTELY_POSITIONED};
|
||||||
use flow_ref::{self, FlowRef};
|
use flow_ref::{self, FlowRef};
|
||||||
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||||
use gfx::display_list::StackingContext;
|
use gfx::display_list::StackingContext;
|
||||||
use gfx_traits::StackingContextId;
|
|
||||||
use layout_debug;
|
use layout_debug;
|
||||||
use model::{Direction, IntrinsicISizes, MaybeAuto, MinMaxConstraint};
|
use model::{Direction, IntrinsicISizes, MaybeAuto, MinMaxConstraint};
|
||||||
use model::{specified, specified_or_none};
|
use model::{specified, specified_or_none};
|
||||||
|
@ -940,11 +939,8 @@ impl Flow for FlexFlow {
|
||||||
self.build_display_list_for_flex(state);
|
self.build_display_list_for_flex(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_stacking_contexts(&mut self,
|
fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
|
||||||
parent_id: StackingContextId,
|
self.block_flow.collect_stacking_contexts(parent);
|
||||||
contexts: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId {
|
|
||||||
self.block_flow.collect_stacking_contexts(parent_id, contexts)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
||||||
|
|
|
@ -224,10 +224,7 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_stacking_contexts(&mut self,
|
fn collect_stacking_contexts(&mut self, _parent: &mut StackingContext);
|
||||||
_parent_id: StackingContextId,
|
|
||||||
_: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId;
|
|
||||||
|
|
||||||
/// If this is a float, places it. The default implementation does nothing.
|
/// If this is a float, places it. The default implementation does nothing.
|
||||||
fn place_float_if_applicable<'a>(&mut self) {}
|
fn place_float_if_applicable<'a>(&mut self) {}
|
||||||
|
@ -1160,11 +1157,9 @@ impl BaseFlow {
|
||||||
return self as *const BaseFlow as usize;
|
return self as *const BaseFlow as usize;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn collect_stacking_contexts_for_children(&mut self,
|
pub fn collect_stacking_contexts_for_children(&mut self, parent: &mut StackingContext) {
|
||||||
parent_id: StackingContextId,
|
|
||||||
contexts: &mut Vec<Box<StackingContext>>) {
|
|
||||||
for kid in self.children.iter_mut() {
|
for kid in self.children.iter_mut() {
|
||||||
kid.collect_stacking_contexts(parent_id, contexts);
|
kid.collect_stacking_contexts(parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ use fragment::SpecificFragmentInfo;
|
||||||
use gfx::display_list::{OpaqueNode, StackingContext};
|
use gfx::display_list::{OpaqueNode, StackingContext};
|
||||||
use gfx::font::FontMetrics;
|
use gfx::font::FontMetrics;
|
||||||
use gfx::font_context::FontContext;
|
use gfx::font_context::FontContext;
|
||||||
use gfx_traits::StackingContextId;
|
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use layout_debug;
|
use layout_debug;
|
||||||
use model::IntrinsicISizesContribution;
|
use model::IntrinsicISizesContribution;
|
||||||
|
@ -1658,11 +1657,8 @@ impl Flow for InlineFlow {
|
||||||
|
|
||||||
fn update_late_computed_block_position_if_necessary(&mut self, _: Au) {}
|
fn update_late_computed_block_position_if_necessary(&mut self, _: Au) {}
|
||||||
|
|
||||||
fn collect_stacking_contexts(&mut self,
|
fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
|
||||||
parent_id: StackingContextId,
|
self.collect_stacking_contexts_for_inline(parent);
|
||||||
contexts: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId {
|
|
||||||
self.collect_stacking_contexts_for_inline(parent_id, contexts)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_display_list(&mut self, state: &mut DisplayListBuildState) {
|
fn build_display_list(&mut self, state: &mut DisplayListBuildState) {
|
||||||
|
|
|
@ -18,7 +18,6 @@ use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, GeneratedC
|
||||||
use fragment::Overflow;
|
use fragment::Overflow;
|
||||||
use generated_content;
|
use generated_content;
|
||||||
use gfx::display_list::StackingContext;
|
use gfx::display_list::StackingContext;
|
||||||
use gfx_traits::StackingContextId;
|
|
||||||
use inline::InlineMetrics;
|
use inline::InlineMetrics;
|
||||||
use script_layout_interface::restyle_damage::RESOLVE_GENERATED_CONTENT;
|
use script_layout_interface::restyle_damage::RESOLVE_GENERATED_CONTENT;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -148,11 +147,8 @@ impl Flow for ListItemFlow {
|
||||||
self.build_display_list_for_list_item(state);
|
self.build_display_list_for_list_item(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_stacking_contexts(&mut self,
|
fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
|
||||||
parent_id: StackingContextId,
|
self.block_flow.collect_stacking_contexts(parent);
|
||||||
contexts: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId {
|
|
||||||
self.block_flow.collect_stacking_contexts(parent_id, contexts)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
||||||
|
|
|
@ -17,7 +17,6 @@ use flow::{Flow, FlowClass, OpaqueFlow, mut_base, FragmentationContext};
|
||||||
use flow_ref::{self, FlowRef};
|
use flow_ref::{self, FlowRef};
|
||||||
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||||
use gfx::display_list::StackingContext;
|
use gfx::display_list::StackingContext;
|
||||||
use gfx_traits::StackingContextId;
|
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use std::cmp::{min, max};
|
use std::cmp::{min, max};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
@ -186,11 +185,8 @@ impl Flow for MulticolFlow {
|
||||||
self.block_flow.build_display_list(state);
|
self.block_flow.build_display_list(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_stacking_contexts(&mut self,
|
fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
|
||||||
parent_id: StackingContextId,
|
self.block_flow.collect_stacking_contexts(parent);
|
||||||
contexts: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId {
|
|
||||||
self.block_flow.collect_stacking_contexts(parent_id, contexts)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
||||||
|
@ -271,11 +267,8 @@ impl Flow for MulticolColumnFlow {
|
||||||
self.block_flow.build_display_list(state);
|
self.block_flow.build_display_list(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_stacking_contexts(&mut self,
|
fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
|
||||||
parent_id: StackingContextId,
|
self.block_flow.collect_stacking_contexts(parent);
|
||||||
contexts: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId {
|
|
||||||
self.block_flow.collect_stacking_contexts(parent_id, contexts)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
||||||
|
|
|
@ -78,10 +78,7 @@ pub fn build_display_list_for_subtree(flow_root: &mut Flow,
|
||||||
root_stacking_context: &mut StackingContext,
|
root_stacking_context: &mut StackingContext,
|
||||||
shared_layout_context: &SharedLayoutContext)
|
shared_layout_context: &SharedLayoutContext)
|
||||||
-> Vec<DisplayItem> {
|
-> Vec<DisplayItem> {
|
||||||
let mut children = vec![];
|
flow_root.collect_stacking_contexts(root_stacking_context);
|
||||||
flow_root.collect_stacking_contexts(root_stacking_context.id,
|
|
||||||
&mut children);
|
|
||||||
root_stacking_context.add_children(children);
|
|
||||||
let mut build_display_list = BuildDisplayList {
|
let mut build_display_list = BuildDisplayList {
|
||||||
state: DisplayListBuildState::new(shared_layout_context,
|
state: DisplayListBuildState::new(shared_layout_context,
|
||||||
flow::base(flow_root).stacking_context_id),
|
flow::base(flow_root).stacking_context_id),
|
||||||
|
|
|
@ -17,7 +17,6 @@ use flow::{BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ImmutableFlowUt
|
||||||
use flow_list::MutFlowListIterator;
|
use flow_list::MutFlowListIterator;
|
||||||
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||||
use gfx::display_list::StackingContext;
|
use gfx::display_list::StackingContext;
|
||||||
use gfx_traits::StackingContextId;
|
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use layout_debug;
|
use layout_debug;
|
||||||
use model::{IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto};
|
use model::{IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto};
|
||||||
|
@ -477,11 +476,8 @@ impl Flow for TableFlow {
|
||||||
self.block_flow.build_display_list_for_block(state, border_painting_mode);
|
self.block_flow.build_display_list_for_block(state, border_painting_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_stacking_contexts(&mut self,
|
fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
|
||||||
parent_id: StackingContextId,
|
self.block_flow.collect_stacking_contexts(parent);
|
||||||
contexts: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId {
|
|
||||||
self.block_flow.collect_stacking_contexts(parent_id, contexts)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
||||||
|
|
|
@ -14,7 +14,6 @@ use euclid::Point2D;
|
||||||
use flow::{Flow, FlowClass, OpaqueFlow};
|
use flow::{Flow, FlowClass, OpaqueFlow};
|
||||||
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||||
use gfx::display_list::StackingContext;
|
use gfx::display_list::StackingContext;
|
||||||
use gfx_traits::StackingContextId;
|
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -83,11 +82,8 @@ impl Flow for TableCaptionFlow {
|
||||||
self.block_flow.build_display_list(state);
|
self.block_flow.build_display_list(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_stacking_contexts(&mut self,
|
fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
|
||||||
parent_id: StackingContextId,
|
self.block_flow.collect_stacking_contexts(parent);
|
||||||
contexts: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId {
|
|
||||||
self.block_flow.collect_stacking_contexts(parent_id, contexts)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
||||||
|
|
|
@ -15,7 +15,6 @@ use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||||
use flow::{self, Flow, FlowClass, OpaqueFlow};
|
use flow::{self, Flow, FlowClass, OpaqueFlow};
|
||||||
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||||
use gfx::display_list::StackingContext;
|
use gfx::display_list::StackingContext;
|
||||||
use gfx_traits::StackingContextId;
|
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use layout_debug;
|
use layout_debug;
|
||||||
use model::MaybeAuto;
|
use model::MaybeAuto;
|
||||||
|
@ -237,11 +236,8 @@ impl Flow for TableCellFlow {
|
||||||
self.block_flow.build_display_list_for_block(state, border_painting_mode)
|
self.block_flow.build_display_list_for_block(state, border_painting_mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_stacking_contexts(&mut self,
|
fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
|
||||||
parent_id: StackingContextId,
|
self.block_flow.collect_stacking_contexts(parent);
|
||||||
contexts: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId {
|
|
||||||
self.block_flow.collect_stacking_contexts(parent_id, contexts)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
||||||
|
|
|
@ -13,7 +13,6 @@ use euclid::Point2D;
|
||||||
use flow::{BaseFlow, Flow, FlowClass, ForceNonfloatedFlag, OpaqueFlow};
|
use flow::{BaseFlow, Flow, FlowClass, ForceNonfloatedFlag, OpaqueFlow};
|
||||||
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow, SpecificFragmentInfo};
|
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow, SpecificFragmentInfo};
|
||||||
use gfx::display_list::StackingContext;
|
use gfx::display_list::StackingContext;
|
||||||
use gfx_traits::StackingContextId;
|
|
||||||
use layout_debug;
|
use layout_debug;
|
||||||
use std::cmp::max;
|
use std::cmp::max;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
@ -96,12 +95,7 @@ impl Flow for TableColGroupFlow {
|
||||||
// Table columns are invisible.
|
// Table columns are invisible.
|
||||||
fn build_display_list(&mut self, _: &mut DisplayListBuildState) { }
|
fn build_display_list(&mut self, _: &mut DisplayListBuildState) { }
|
||||||
|
|
||||||
fn collect_stacking_contexts(&mut self,
|
fn collect_stacking_contexts(&mut self, _parent: &mut StackingContext) { }
|
||||||
parent_id: StackingContextId,
|
|
||||||
_: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId {
|
|
||||||
parent_id
|
|
||||||
}
|
|
||||||
|
|
||||||
fn repair_style(&mut self, _: &Arc<ServoComputedValues>) {}
|
fn repair_style(&mut self, _: &Arc<ServoComputedValues>) {}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ use flow::{self, EarlyAbsolutePositionInfo, Flow, FlowClass, ImmutableFlowUtils,
|
||||||
use flow_list::MutFlowListIterator;
|
use flow_list::MutFlowListIterator;
|
||||||
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||||
use gfx::display_list::StackingContext;
|
use gfx::display_list::StackingContext;
|
||||||
use gfx_traits::StackingContextId;
|
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use layout_debug;
|
use layout_debug;
|
||||||
use model::MaybeAuto;
|
use model::MaybeAuto;
|
||||||
|
@ -455,11 +454,8 @@ impl Flow for TableRowFlow {
|
||||||
self.block_flow.build_display_list_for_block(state, border_painting_mode);
|
self.block_flow.build_display_list_for_block(state, border_painting_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_stacking_contexts(&mut self,
|
fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
|
||||||
parent_id: StackingContextId,
|
self.block_flow.collect_stacking_contexts(parent);
|
||||||
contexts: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId {
|
|
||||||
self.block_flow.collect_stacking_contexts(parent_id, contexts)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
||||||
|
|
|
@ -14,7 +14,6 @@ use euclid::Point2D;
|
||||||
use flow::{Flow, FlowClass, OpaqueFlow};
|
use flow::{Flow, FlowClass, OpaqueFlow};
|
||||||
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||||
use gfx::display_list::StackingContext;
|
use gfx::display_list::StackingContext;
|
||||||
use gfx_traits::StackingContextId;
|
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use layout_debug;
|
use layout_debug;
|
||||||
use rustc_serialize::{Encodable, Encoder};
|
use rustc_serialize::{Encodable, Encoder};
|
||||||
|
@ -212,11 +211,8 @@ impl Flow for TableRowGroupFlow {
|
||||||
self.block_flow.build_display_list(state);
|
self.block_flow.build_display_list(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_stacking_contexts(&mut self,
|
fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
|
||||||
parent_id: StackingContextId,
|
self.block_flow.collect_stacking_contexts(parent);
|
||||||
contexts: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId {
|
|
||||||
self.block_flow.collect_stacking_contexts(parent_id, contexts)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
||||||
|
|
|
@ -23,7 +23,6 @@ use floats::FloatKind;
|
||||||
use flow::{Flow, FlowClass, ImmutableFlowUtils, INLINE_POSITION_IS_STATIC, OpaqueFlow};
|
use flow::{Flow, FlowClass, ImmutableFlowUtils, INLINE_POSITION_IS_STATIC, OpaqueFlow};
|
||||||
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
|
||||||
use gfx::display_list::StackingContext;
|
use gfx::display_list::StackingContext;
|
||||||
use gfx_traits::StackingContextId;
|
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use model::MaybeAuto;
|
use model::MaybeAuto;
|
||||||
use std::cmp::{max, min};
|
use std::cmp::{max, min};
|
||||||
|
@ -445,11 +444,8 @@ impl Flow for TableWrapperFlow {
|
||||||
self.block_flow.build_display_list(state);
|
self.block_flow.build_display_list(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_stacking_contexts(&mut self,
|
fn collect_stacking_contexts(&mut self, parent: &mut StackingContext) {
|
||||||
parent_id: StackingContextId,
|
self.block_flow.collect_stacking_contexts(parent);
|
||||||
contexts: &mut Vec<Box<StackingContext>>)
|
|
||||||
-> StackingContextId {
|
|
||||||
self.block_flow.collect_stacking_contexts(parent_id, contexts)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue