pub struct ReferenceFrameMapper {
    frames: Vec<ReferenceFrameState>,
}
Expand description

Maps from stacking context layout coordinates into reference frame relative coordinates.

Fields§

§frames: Vec<ReferenceFrameState>

A stack of reference frame scopes.

Implementations§

source§

impl ReferenceFrameMapper

source

pub fn new() -> Self

source

pub fn push_scope(&mut self)

Push a new scope. This resets the current offset to zero, and is used when a new reference frame or iframe is pushed.

source

pub fn pop_scope(&mut self)

Pop a reference frame scope off the stack.

source

pub fn push_offset(&mut self, offset: LayoutVector2D)

Push a new offset for the current scope. This is used when a new stacking context is pushed.

source

pub fn pop_offset(&mut self)

Pop a local stacking context offset from the current scope.

source

pub fn current_offset(&self) -> LayoutVector2D

Retrieve the current offset to allow converting a stacking context relative coordinate to be relative to the owing reference frame. TODO(gw): We could perhaps have separate coordinate spaces for this, however that’s going to either mean a lot of changes to public API code, or a lot of changes to internal code. Before doing that, we should revisit how Gecko would prefer to provide coordinates. TODO(gw): For now, this includes only the reference frame relative offset. Soon, we will expand this to include the initial scroll offsets that are now available on scroll nodes. This will allow normalizing the coordinates even between display lists where APZ has scrolled the content.

Trait Implementations§

source§

impl Clone for ReferenceFrameMapper

source§

fn clone(&self) -> ReferenceFrameMapper

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.