Struct layout_2020::display_list::StackingContext
source · pub struct StackingContext {
spatial_id: SpatialId,
clip_chain_id: Option<ClipChainId>,
initializing_fragment_style: Option<Arc<ComputedValues>>,
initializing_fragment_flags: FragmentFlags,
context_type: StackingContextType,
contents: Vec<StackingContextContent>,
real_stacking_contexts_and_positioned_stacking_containers: Vec<StackingContext>,
float_stacking_containers: Vec<StackingContext>,
atomic_inline_stacking_containers: Vec<StackingContext>,
debug_print_items: Option<RefCell<Vec<DebugPrintItem>>>,
}
Expand description
Either a stacking context or a stacking container, per the definitions in https://drafts.csswg.org/css-position-4/#painting-order.
We use the term “real stacking context” in situations that call for a stacking context but not a stacking container.
Fields§
§spatial_id: SpatialId
The spatial id of this fragment. This is used to properly handle things like preserve-3d.
clip_chain_id: Option<ClipChainId>
The clip chain id of this stacking context if it has one. Used for filter clipping.
initializing_fragment_style: Option<Arc<ComputedValues>>
The style of the fragment that established this stacking context.
initializing_fragment_flags: FragmentFlags
The FragmentFlags
of the Fragment
that established this stacking context.
context_type: StackingContextType
The type of this stacking context. Used for collecting and sorting.
contents: Vec<StackingContextContent>
The contents that need to be painted in fragment order.
real_stacking_contexts_and_positioned_stacking_containers: Vec<StackingContext>
Stacking contexts that need to be stolen by the parent stacking context if this is a stacking container, that is, real stacking contexts and positioned stacking containers (where ‘z-index’ is auto). https://drafts.csswg.org/css-position-4/#paint-a-stacking-container
To paint a stacking container, given a box root and a canvas canvas:
- Paint a stacking context given root and canvas, treating root as if it created a new stacking context, but omitting any positioned descendants or descendants that actually create a stacking context (letting the parent stacking context paint them, instead).
float_stacking_containers: Vec<StackingContext>
Float stacking containers. Separate from real_stacking_contexts_or_positioned_stacking_containers because they should never be stolen by the parent stacking context. https://drafts.csswg.org/css-position-4/#paint-a-stacking-container
atomic_inline_stacking_containers: Vec<StackingContext>
Atomic inline stacking containers. Separate from real_stacking_contexts_or_positioned_stacking_containers because they should never be stolen by the parent stacking context, and separate from float_stacking_containers so that StackingContextContent can index into this vec to paint them in fragment order. https://drafts.csswg.org/css-position-4/#paint-a-stacking-container https://drafts.csswg.org/css-position-4/#paint-a-box-in-a-line-box
debug_print_items: Option<RefCell<Vec<DebugPrintItem>>>
Information gathered about the painting order, for Self::debug_print.
Implementations§
source§impl StackingContext
impl StackingContext
fn create_descendant( &self, spatial_id: SpatialId, clip_chain_id: ClipChainId, initializing_fragment_style: ServoArc<ComputedValues>, initializing_fragment_flags: FragmentFlags, context_type: StackingContextType, ) -> Self
pub(crate) fn create_root(wr: &DisplayListBuilder, debug: &DebugOptions) -> Self
sourcefn add_stacking_context(&mut self, stacking_context: StackingContext)
fn add_stacking_context(&mut self, stacking_context: StackingContext)
Add a child stacking context to this stacking context.
fn z_index(&self) -> i32
pub(crate) fn sort(&mut self)
fn push_webrender_stacking_context_if_necessary( &self, builder: &mut DisplayListBuilder<'_>, ) -> bool
sourcepub(crate) fn build_canvas_background_display_list(
&self,
builder: &mut DisplayListBuilder<'_>,
fragment_tree: &FragmentTree,
containing_block_rect: &PhysicalRect<Au>,
)
pub(crate) fn build_canvas_background_display_list( &self, builder: &mut DisplayListBuilder<'_>, fragment_tree: &FragmentTree, containing_block_rect: &PhysicalRect<Au>, )
https://drafts.csswg.org/css-backgrounds/#special-backgrounds
This is only called for the root StackingContext
pub(crate) fn build_display_list(&self, builder: &mut DisplayListBuilder<'_>)
sourcefn debug_push_print_item(&self, field: DebugPrintField, index: usize)
fn debug_push_print_item(&self, field: DebugPrintField, index: usize)
Store the fact that something was painted, if Self::debug_print_items is not None.
This is used to help reconstruct the original painting order in Self::debug_print without duplicating our painting order logic, since that could fall out of sync with the real logic.
sourcepub fn debug_print(&self)
pub fn debug_print(&self)
Print the stacking context tree.
sourcefn debug_print_with_tree(&self, tree: &mut PrintTree)
fn debug_print_with_tree(&self, tree: &mut PrintTree)
Print a subtree with the given PrintTree, or panic if Self::debug_print_items is None.
Auto Trait Implementations§
impl !Freeze for StackingContext
impl !RefUnwindSafe for StackingContext
impl Send for StackingContext
impl !Sync for StackingContext
impl Unpin for StackingContext
impl !UnwindSafe for StackingContext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more