Skip to main content

FontFaceSet

Struct FontFaceSet 

Source
#[repr(C)]
pub(crate) struct FontFaceSet { target: EventTarget, promise: DomRefCell<TracedPromise>, set_entries: DomRefCell<Vec<Dom<FontFace>>>, status: Cell<FontFaceSetLoadStatus>, }
Expand description

Fields§

§target: EventTarget§promise: DomRefCell<TracedPromise>§set_entries: DomRefCell<Vec<Dom<FontFace>>>§status: Cell<FontFaceSetLoadStatus>

Implementations§

Source§

impl FontFaceSet

Source§

impl FontFaceSet

Source

fn new_inherited(promise: &RootedPromise) -> Self

Source

pub(crate) fn new( cx: &mut JSContext, global: &GlobalScope, proto: Option<HandleObject<'_>>, ) -> DomRoot<Self>

Source

pub(super) fn handle_font_face_status_changed( &self, cx: &mut JSContext, font_face: &FontFace, )

Source

pub(crate) fn maybe_switch_worker_set_to_loaded(&self, cx: &mut JSContext)

Workers are never pending on the environment, so their font face set switches to loaded as soon as none of its fonts are loading. For documents this is done by Document::maybe_fulfill_font_ready_promise.

https://drafts.csswg.org/css-font-loading/#switch-the-fontfaceset-to-loaded

Source

pub(crate) fn fulfill_ready_promise_if_needed(&self, cx: &mut JSContext) -> bool

Fulfill the font ready promise, returning true if it was not already fulfilled beforehand.

Source

pub(crate) fn waiting_to_fullfill_promise(&self) -> bool

Source

fn contains_face(&self, target: &FontFace) -> bool

Source

fn delete_face(&self, target: &FontFace) -> bool

Removes a face from the set’s set entries.

Source

pub(crate) fn switch_to_loading(&self, cx: &mut JSContext)

Source

fn fire_font_load_event( &self, cx: &mut JSContext, event_name: Atom, font_faces: &[DomRoot<FontFace>], )

Source

fn flush_author_font_set(&self, cx: &mut JSContext)

Runs the CSS cascade to ensure that new @font-face rules have an entry in this set.

Source

pub(crate) fn notify_font_face_rules_removed( &self, removed_font_face_rules: &[ServoArc<FontFaceRuleInfo>], )

Marks the entries corresponding to removed @font-face rules as not css-connected.

Source

fn query_fonts( &self, target_family: &FamilyName, sample_text: &str, ) -> Vec<DomRoot<FontFace>> ⓘ

Uses the font matching rules to select font faces within self that can be used to render the provided text.

This is used to implement Step 6 of https://drafts.csswg.org/css-font-loading/#find-the-matching-font-faces.

Source

fn find_the_matching_font_faces( &self, global: &GlobalScope, font: &str, sample_text: &str, ) -> Result<Vec<DomRoot<FontFace>>, FontQuerySyntaxError>

Trait Implementations§

§

impl Castable for FontFaceSet

Source§

fn is<T>(&self) -> bool
where T: DerivedFrom<Self>,

Check whether a DOM object implements one of its deriving interfaces.
Source§

fn upcast<T>(&self) -> &T
where T: Castable, Self: DerivedFrom<T>,

Cast a DOM object upwards to one of the interfaces it derives from.
Source§

fn downcast<T>(&self) -> Option<&T>
where T: DerivedFrom<Self>,

Cast a DOM object downwards to one of the interfaces it might implement.
§

impl DerivedFrom<EventTarget> for FontFaceSet

Source§

impl DomObject for FontFaceSet

Source§

type ReflectorType = <EventTarget as DomObject>::ReflectorType

Source§

fn reflector(&self) -> &Reflector<Self::ReflectorType>

Returns the receiver’s reflector.
Source§

impl DomObjectIteratorWrap<DomTypeHolder> for FontFaceSet

Source§

const ITER_WRAP: unsafe fn(&mut JSContext, &GlobalScope, Option<HandleObject<'_>>, Box<IterableIterator<DomTypeHolder, Self>>) -> Root<Dom<IterableIterator<DomTypeHolder, Self>>>

Function pointer to the wrap function for IterableIterator<T>
Source§

impl DomObjectWrap<DomTypeHolder> for FontFaceSet

Source§

const WRAP: unsafe fn(&mut JSContext, &GlobalScope, Option<HandleObject<'_>>, Box<Self>) -> Root<Dom<Self>>

Function pointer to the general wrap function type
Source§

impl Drop for FontFaceSet

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Eq for FontFaceSet

Source§

impl FontFaceSetMethods<DomTypeHolder> for FontFaceSet

Source§

fn Ready(&self, cx: &mut JSContext) -> RootedPromise

Source§

fn Status(&self) -> FontFaceSetLoadStatus

Source§

fn Add( &self, cx: &mut JSContext, font_face: &FontFace, ) -> Fallible<DomRoot<FontFaceSet>>

Source§

fn Delete(&self, to_delete: &FontFace) -> bool

Source§

fn Clear(&self, cx: &mut JSContext)

Source§

fn Load( &self, cx: &mut JSContext, font: DOMString, text: DOMString, ) -> RootedPromise

Source§

fn Size(&self, cx: &mut JSContext) -> u32

Source§

fn GetOnloading( &self, cx: &mut JSContext, ) -> Option<RootedCallback<EventHandlerNonNull<DomTypeHolder>>>

Source§

fn SetOnloading( &self, cx: &mut JSContext, listener: Option<RootedCallback<EventHandlerNonNull<DomTypeHolder>>>, )

Source§

fn GetOnloadingdone( &self, cx: &mut JSContext, ) -> Option<RootedCallback<EventHandlerNonNull<DomTypeHolder>>>

Source§

fn SetOnloadingdone( &self, cx: &mut JSContext, listener: Option<RootedCallback<EventHandlerNonNull<DomTypeHolder>>>, )

Source§

fn GetOnloadingerror( &self, cx: &mut JSContext, ) -> Option<RootedCallback<EventHandlerNonNull<DomTypeHolder>>>

Source§

fn SetOnloadingerror( &self, cx: &mut JSContext, listener: Option<RootedCallback<EventHandlerNonNull<DomTypeHolder>>>, )

Source§

impl HasParent for FontFaceSet

Source§

fn as_parent(&self) -> &EventTarget

This is used in a type assertion to ensure that the source and webidls agree as to what the parent type is

Source§

type Parent = EventTarget

Source§

impl HasPrototype for FontFaceSet

Source§

const PROTOTYPE_ID: ID = script_bindings::codegen::PrototypeList::ID::FontFaceSet

Source§

impl IDLInterface for FontFaceSet

Source§

const PROTO_ID: ID = PrototypeList::ID::FontFaceSet

The concrete type represented by this interface instance.
Source§

const PROTO_FIRST: u16 = 193

First prototype ID in the DFS-ordered range for this interface and its descendants.
Source§

const PROTO_LAST: u16 = 193

Last prototype ID in the DFS-ordered range for this interface and its descendants.
Source§

fn derives(class: &'static DOMClass) -> bool

Returns whether the given DOM class derives that interface.
Source§

impl IteratorDerives for FontFaceSet

Source§

fn derives(class: &'static DOMClass) -> bool

Source§

impl MallocSizeOf for FontFaceSet

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

impl MutDomObject for FontFaceSet

Source§

unsafe fn init_reflector<Actual>(&self, obj: *mut JSObject)

Initializes the Reflector Read more
Source§

unsafe fn init_reflector_without_associated_memory(&self, obj: *mut JSObject)

Initializes the Reflector without recording any associated memory usage. Read more
Source§

impl PartialEq for FontFaceSet

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PrototypeInitializer for FontFaceSet

Source§

fn set_proto_id(&mut self, id: ID)

Source§

impl Setlike for FontFaceSet

Source§

type Key = Root<Dom<FontFace>>

The type of the key of the set.
Source§

fn get_index(&self, cx: &mut JSContext, index: u32) -> Option<Self::Key>

Source§

fn size(&self, cx: &mut JSContext) -> u32

Source§

fn add(&self, cx: &mut JSContext, face: Self::Key)

Source§

fn has(&self, cx: &mut JSContext, target: Self::Key) -> bool

Source§

fn clear(&self, cx: &mut JSContext)

Source§

fn delete(&self, cx: &mut JSContext, to_delete: Self::Key) -> bool

Source§

impl ToJSValConvertible for FontFaceSet

Source§

fn to_jsval(&self, cx: &mut JSContext, rval: MutableHandleValue<'_>)

Convert self to a JSVal. JSAPI failure causes a panic.
Source§

impl Traceable for FontFaceSet

Source§

unsafe fn trace(&self, tracer: *mut JSTracer)

Trace self.

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<D, T> DomGlobalGeneric<D> for T
where D: DomTypes, T: DomObject,

Source§

fn global_from_reflector(&self) -> Root<Dom<<D as DomTypes>::GlobalScope>>
where Self: Sized,

Returns the [GlobalScope] of the realm that the DomObject was created in. If this object is a Node, this will be different from it’s owning Document if adopted by. For Nodes it’s almost always better to use NodeTraits::owning_global.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
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> Iterable for T
where T: Maplike,

Source§

type Key = <T as Maplike>::Key

The type of the key of the iterator pair.
Source§

type Value = <T as Maplike>::Value

The type of the value of the iterator pair.
Source§

fn get_iterable_length(&self, cx: &mut JSContext) -> u32

Return the number of entries that can be iterated over.
Source§

fn get_value_at_index( &self, cx: &mut JSContext, index: u32, ) -> <T as Maplike>::Value

Return the value at the provided index.
Source§

fn get_key_at_index( &self, cx: &mut JSContext, index: u32, ) -> <T as Maplike>::Key

Return the key at the provided index.
Source§

impl<T> Maplike for T
where T: Setlike,

Source§

type Key = <T as Setlike>::Key

The type of the key of the map.
Source§

type Value = <T as Setlike>::Key

The type of the value of the map.
Source§

fn get_index( &self, cx: &mut JSContext, index: u32, ) -> Option<(<T as Maplike>::Key, <T as Maplike>::Value)>

Source§

fn get( &self, _cx: &mut JSContext, _key: <T as Maplike>::Key, ) -> Option<<T as Maplike>::Value>

Source§

fn size(&self, cx: &mut JSContext) -> u32

Source§

fn set( &self, _cx: &mut JSContext, _key: <T as Maplike>::Key, _value: <T as Maplike>::Value, )

Source§

fn has(&self, _cx: &mut JSContext, _key: <T as Maplike>::Key) -> bool

Source§

fn clear(&self, _cx: &mut JSContext)

Source§

fn delete(&self, _cx: &mut JSContext, _key: <T as Maplike>::Key) -> bool

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> ThisReflector for T
where T: DomObject,

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