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:

  1. 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

source

fn create_descendant( &self, spatial_id: SpatialId, clip_chain_id: ClipChainId, initializing_fragment_style: ServoArc<ComputedValues>, initializing_fragment_flags: FragmentFlags, context_type: StackingContextType, ) -> Self

source

pub(crate) fn create_root(wr: &DisplayListBuilder, debug: &DebugOptions) -> Self

source

fn add_stacking_context(&mut self, stacking_context: StackingContext)

Add a child stacking context to this stacking context.

source

fn z_index(&self) -> i32

source

pub(crate) fn sort(&mut self)

source

fn push_webrender_stacking_context_if_necessary( &self, builder: &mut DisplayListBuilder<'_>, ) -> bool

source

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

source

pub(crate) fn build_display_list(&self, builder: &mut DisplayListBuilder<'_>)

source

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.

source

pub fn debug_print(&self)

Print the stacking context tree.

source

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§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Downcast<T> for T

source§

fn downcast(&self) -> &T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> MaybeBoxed<Box<T>> for T

source§

fn maybe_boxed(self) -> Box<T>

Convert
source§

impl<T> MaybeBoxed<T> for T

source§

fn maybe_boxed(self) -> T

Convert
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Upcast<T> for T

source§

fn upcast(&self) -> Option<&T>

source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T

source§

impl<T> WasmNotSend for T
where T: Send,