Skip to main content

Range

Struct Range 

Source
#[repr(C)]
pub(crate) struct Range { abstract_range: AbstractRange, associated_selections: DomRefCell<Vec<Dom<Selection>>>, }

Fields§

§abstract_range: AbstractRange§associated_selections: DomRefCell<Vec<Dom<Selection>>>

Implementations§

Source§

impl Range

Source§

impl Range

Source

fn is_effectively_contained_node(&self, node: &Node) -> bool

Source

fn ancestor_for_effectively_contained(&self) -> DomRoot<Node>

The definition of “effectively contained” contains the recursion of ancestors of a single fully selected text node. That is to say, that if the selection is a fully selected text node

[foobar]
, then the div would also be considered effectively contained. As such, we can’t use the common ancestor container, since that would be the text node only.

Instead, we traverse all the way up to the editing host, which we know is sufficient to know to include all contained nodes. That way, we also would traverse ancestors such as the parent div.

Source

pub(crate) fn first_formattable_contained_node(&self) -> Option<DomRoot<Node>>

Source

pub(crate) fn for_each_effectively_contained_child<Callback: FnMut(&Node)>( &self, callback: Callback, )

Source

pub(crate) fn block_extend( &self, cx: &mut JSContext, document: &Document, ) -> DomRoot<Range>

Source

pub(crate) fn record_current_states_and_values( &self, cx: &mut JSContext, ) -> Vec<RecordedStateOfCommand>

Source

pub(crate) fn restore_states_and_values( &self, cx: &mut JSContext, selection: &Selection, context_object: &Document, overrides: Vec<RecordedStateOfCommand>, )

Source§

impl Range

Source

fn new_inherited( start_container: &Node, start_offset: u32, end_container: &Node, end_offset: u32, ) -> Range

Source

pub(crate) fn new_with_doc( document: &Document, proto: Option<HandleObject<'_>>, can_gc: CanGc, ) -> DomRoot<Range>

Source

pub(crate) fn new( document: &Document, start_container: &Node, start_offset: u32, end_container: &Node, end_offset: u32, can_gc: CanGc, ) -> DomRoot<Range>

Source

fn new_with_proto( document: &Document, proto: Option<HandleObject<'_>>, start_container: &Node, start_offset: u32, end_container: &Node, end_offset: u32, can_gc: CanGc, ) -> DomRoot<Range>

Source

pub(crate) fn contains(&self, node: &Node) -> bool

Source

fn partially_contains(&self, node: &Node) -> bool

Source

pub(crate) fn contained_children(&self) -> Fallible<ContainedChildren>

Source

pub(crate) fn set_start(&self, node: &Node, offset: u32)

Source

pub(crate) fn set_end(&self, node: &Node, offset: u32)

Source

fn compare_point(&self, node: &Node, offset: u32) -> Fallible<Ordering>

Source

pub(crate) fn associate_selection(&self, selection: &Selection)

Source

pub(crate) fn disassociate_selection(&self, selection: &Selection)

Source

fn report_change(&self)

Source

fn abstract_range(&self) -> &AbstractRange

Source

fn start(&self) -> &BoundaryPoint

Source

fn end(&self) -> &BoundaryPoint

Source

pub(crate) fn start_container(&self) -> DomRoot<Node>

Source

pub(crate) fn start_offset(&self) -> u32

Source

pub(crate) fn end_container(&self) -> DomRoot<Node>

Source

pub(crate) fn end_offset(&self) -> u32

Source

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

Source

fn client_rects(&self) -> impl Iterator<Item = Rect<Au, CSSPixel>>

Source

fn set_the_start_or_end( &self, node: &Node, offset: u32, start_or_end: StartOrEnd, ) -> ErrorResult

Trait Implementations§

§

impl Castable for Range

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

impl Debug for Range

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DomObject for Range

Source§

type ReflectorType = ()

Source§

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

Returns the receiver’s reflector.
Source§

impl DomObjectWrap<DomTypeHolder> for Range

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 Range

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl HasParent for Range

Source§

fn as_parent(&self) -> &AbstractRange

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

Source§

impl IDLInterface for Range

Source§

const PROTO_FIRST: u16 = 3

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

const PROTO_LAST: u16 = 3

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 MallocSizeOf for Range

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 Range

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 Range

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl RangeMethods<DomTypeHolder> for Range

Source§

fn Constructor( window: &Window, proto: Option<HandleObject<'_>>, can_gc: CanGc, ) -> Fallible<DomRoot<Range>>

Source§

fn CommonAncestorContainer(&self) -> DomRoot<Node>

Source§

fn SetStart(&self, node: &Node, offset: u32) -> ErrorResult

Source§

fn SetEnd(&self, node: &Node, offset: u32) -> ErrorResult

Source§

fn SetStartBefore(&self, node: &Node) -> ErrorResult

Source§

fn SetStartAfter(&self, node: &Node) -> ErrorResult

Source§

fn SetEndBefore(&self, node: &Node) -> ErrorResult

Source§

fn SetEndAfter(&self, node: &Node) -> ErrorResult

Source§

fn Collapse(&self, to_start: bool)

Source§

fn SelectNode(&self, node: &Node) -> ErrorResult

Source§

fn SelectNodeContents(&self, node: &Node) -> ErrorResult

Source§

fn CompareBoundaryPoints(&self, how: u16, other: &Range) -> Fallible<i16>

Source§

fn CloneRange(&self, cx: &mut JSContext) -> DomRoot<Range>

Source§

fn IsPointInRange(&self, node: &Node, offset: u32) -> Fallible<bool>

Source§

fn ComparePoint(&self, node: &Node, offset: u32) -> Fallible<i16>

Source§

fn IntersectsNode(&self, node: &Node) -> bool

Source§

fn CloneContents( &self, cx: &mut JSContext, ) -> Fallible<DomRoot<DocumentFragment>>

Source§

fn ExtractContents( &self, cx: &mut JSContext, ) -> Fallible<DomRoot<DocumentFragment>>

Source§

fn Detach(&self)

Source§

fn InsertNode(&self, cx: &mut JSContext, node: &Node) -> ErrorResult

Source§

fn DeleteContents(&self, cx: &mut JSContext) -> ErrorResult

Source§

fn SurroundContents(&self, cx: &mut JSContext, new_parent: &Node) -> ErrorResult

Source§

fn Stringifier(&self) -> DOMString

Source§

fn CreateContextualFragment( &self, cx: &mut JSContext, fragment: TrustedHTMLOrString<DomTypeHolder>, ) -> Fallible<DomRoot<DocumentFragment>>

Source§

fn GetClientRects(&self, cx: &mut JSContext) -> DomRoot<DOMRectList>

Source§

fn GetBoundingClientRect(&self, cx: &mut JSContext) -> DomRoot<DOMRect>

Source§

impl ToJSValConvertible for Range

Source§

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

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

fn safe_to_jsval(&self, cx: &mut JSContext, rval: MutableHandle<'_, Value>)

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

impl Traceable for Range

Source§

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

Trace self.
Source§

impl WeakReferenceable for Range

Source§

fn downgrade(&self) -> WeakRef<Self>

Downgrade a DOM object reference to a weak one.
§

impl DerivedFrom<AbstractRange> for Range

Source§

impl Eq for Range

Auto Trait Implementations§

§

impl !Freeze for Range

§

impl !RefUnwindSafe for Range

§

impl !Send for Range

§

impl !Sync for Range

§

impl Unpin for Range

§

impl UnsafeUnpin for Range

§

impl !UnwindSafe for Range

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

Source§

fn global_(&self, realm: InRealm<'_>) -> 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

Checks if this value is equivalent to the given key. Read more
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

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

impl<T> Filterable for T

Source§

fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
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> SafeToJSValConvertible for T

Source§

fn safe_to_jsval( &self, cx: JSContext, rval: MutableHandle<'_, Value>, _can_gc: CanGc, )

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<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