Skip to main content

StackingContext

Struct StackingContext 

Source
pub struct StackingContext {
    pub(crate) fragment: StackingContextFragments,
    pub(crate) context_type: StackingContextType,
    pub(crate) children: Vec<StackingContext>,
    pub(crate) containing_block_origin: PhysicalPoint<Au>,
    pub(crate) scroll_tree_node_id: ScrollTreeNodeId,
    pub(crate) clip_id: ClipId,
    pub(crate) z_index: i32,
    pub(crate) text_decorations: Rc<Vec<FragmentTextDecoration>>,
    pub(crate) container_timing_roots: Option<Rc<ContainerTimingRootChain>>,
    pub(crate) reference_frame_info: Option<StackingContextReferenceFrameInfo>,
    pub(crate) participates_in_a_3d_rendering_context: bool,
}
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. Only positioned stacking containers every get a StackingContext. The rest are handled inline during the PaintTraversal.

Fields§

§fragment: StackingContextFragments

The BoxFragment that established this stacking context. This is used to paint this StackingContext and traverse its descendants for painting.

This is None for the root stacking context.

§context_type: StackingContextType

The StackingContextType of this [StackingContet], which determines if it a stacking context or a stacking container.

§children: Vec<StackingContext>§containing_block_origin: PhysicalPoint<Au>

The offset of the containing block, used to properly paint child fragments of this stacking context or stacking container.

§scroll_tree_node_id: ScrollTreeNodeId

The spatial id of this StackingContext.

§clip_id: ClipId

The clip id of this StackingContext if it has one.

§z_index: i32

The z-index of this StackingContext. Note that auto is represented as 0.

§text_decorations: Rc<Vec<FragmentTextDecoration>>

The text decorations that apply to this StackingContext propagated via the box tree.

§container_timing_roots: Option<Rc<ContainerTimingRootChain>>

The Container Timing roots that enclose this StackingContext in tree order, not including its own root fragment. Stacking contexts are painted out of tree order, so these are captured while building the stacking context tree.

§reference_frame_info: Option<StackingContextReferenceFrameInfo>

If this StackingContext also created a WebRender reference frame, this field holds information about that reference frame.

§participates_in_a_3d_rendering_context: bool

Whether or not this StackingContext participates in a 3D rendering context. See https://www.w3.org/TR/css-transforms-2/#3d-rendering-contexts

Implementations§

Source§

impl StackingContext

Source

fn root(scroll_tree_node_id: ScrollTreeNodeId) -> Self

Source

fn create_descendant( &self, context_type: StackingContextType, containing_block_offset: PhysicalPoint<Au>, spatial_id: ScrollTreeNodeId, clip_id: ClipId, initializing_fragment: Arc<BoxFragment>, reference_frame_info: Option<StackingContextReferenceFrameInfo>, parent_info: &StackingContextParentInfo, ) -> Self

Source

pub(crate) fn fragment(&self) -> Option<&Arc<BoxFragment>>

Source

fn sort(&mut self)

Source

fn print(&self, tree: &mut PrintTree)

Trait Implementations§

Source§

impl MallocSizeOf for StackingContext

Source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

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

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.
Source§

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

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

Source§

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>,

Source§

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