#[repr(C)]pub(crate) struct ShadowRoot {Show 18 fields
document_fragment: DocumentFragment,
document_or_shadow_root: DocumentOrShadowRoot,
document: Dom<Document>,
host: MutNullableDom<Element>,
author_styles: DomRefCell<AuthorStyles<ServoStylesheetInDocument>>,
stylesheet_list: MutNullableDom<StyleSheetList>,
window: Dom<Window>,
mode: ShadowRootMode,
slot_assignment_mode: SlotAssignmentMode,
clonable: bool,
available_to_element_internals: Cell<bool>,
slots: DomRefCell<HashMap<DOMString, Vec<Dom<HTMLSlotElement>>>>,
is_user_agent_widget: bool,
declarative: Cell<bool>,
serializable: Cell<bool>,
delegates_focus: Cell<bool>,
adopted_stylesheets: DomRefCell<Vec<Dom<CSSStyleSheet>>>,
adopted_stylesheets_frozen_types: CachedFrozenArray,
}
Expand description
Fields§
§document_fragment: DocumentFragment
§document_or_shadow_root: DocumentOrShadowRoot
§document: Dom<Document>
§host: MutNullableDom<Element>
List of author styles associated with nodes in this shadow tree.
stylesheet_list: MutNullableDom<StyleSheetList>
§window: Dom<Window>
§mode: ShadowRootMode
§slot_assignment_mode: SlotAssignmentMode
§clonable: bool
§available_to_element_internals: Cell<bool>
§slots: DomRefCell<HashMap<DOMString, Vec<Dom<HTMLSlotElement>>>>
§is_user_agent_widget: bool
§declarative: Cell<bool>
§serializable: Cell<bool>
§delegates_focus: Cell<bool>
§adopted_stylesheets: DomRefCell<Vec<Dom<CSSStyleSheet>>>
The constructed stylesheet that is adopted by this ShadowRoot. https://drafts.csswg.org/cssom/#dom-documentorshadowroot-adoptedstylesheets
adopted_stylesheets_frozen_types: CachedFrozenArray
Cached frozen array of Self::adopted_stylesheets
Implementations§
Source§impl ShadowRoot
impl ShadowRoot
fn __assert_parent_type(&self)
Source§impl ShadowRoot
impl ShadowRoot
fn new_inherited( host: &Element, document: &Document, mode: ShadowRootMode, slot_assignment_mode: SlotAssignmentMode, clonable: bool, is_user_agent_widget: IsUserAgentWidget, ) -> ShadowRoot
pub(crate) fn new( host: &Element, document: &Document, mode: ShadowRootMode, slot_assignment_mode: SlotAssignmentMode, clonable: bool, is_user_agent_widget: IsUserAgentWidget, can_gc: CanGc, ) -> DomRoot<ShadowRoot>
pub(crate) fn detach(&self, can_gc: CanGc)
pub(crate) fn owner_doc(&self) -> &Document
pub(crate) fn get_focused_element(&self) -> Option<DomRoot<Element>>
pub(crate) fn stylesheet_count(&self) -> usize
pub(crate) fn stylesheet_at( &self, index: usize, ) -> Option<DomRoot<CSSStyleSheet>>
Sourcepub(crate) fn add_owned_stylesheet(
&self,
owner_node: &Element,
sheet: Arc<Stylesheet>,
)
pub(crate) fn add_owned_stylesheet( &self, owner_node: &Element, sheet: Arc<Stylesheet>, )
Add a stylesheet owned by owner_node
to the list of shadow root sheets, in the
correct tree position. Additionally, ensure that owned stylesheet is inserted before
any constructed stylesheet.
https://drafts.csswg.org/cssom/#documentorshadowroot-final-css-style-sheets
Sourcepub(crate) fn append_constructed_stylesheet(
&self,
cssom_stylesheet: &CSSStyleSheet,
)
pub(crate) fn append_constructed_stylesheet( &self, cssom_stylesheet: &CSSStyleSheet, )
Append a constructed stylesheet to the back of shadow root stylesheet set.
Sourcepub(crate) fn remove_stylesheet(
&self,
owner: StylesheetSource,
s: &Arc<Stylesheet>,
)
pub(crate) fn remove_stylesheet( &self, owner: StylesheetSource, s: &Arc<Stylesheet>, )
Remove a stylesheet owned by owner
from the list of shadow root sheets.
pub(crate) fn invalidate_stylesheets(&self)
Sourcepub(crate) fn unregister_element_id(
&self,
to_unregister: &Element,
id: Atom,
_can_gc: CanGc,
)
pub(crate) fn unregister_element_id( &self, to_unregister: &Element, id: Atom, _can_gc: CanGc, )
Remove any existing association between the provided id and any elements in this shadow tree.
Sourcepub(crate) fn register_element_id(
&self,
element: &Element,
id: Atom,
_can_gc: CanGc,
)
pub(crate) fn register_element_id( &self, element: &Element, id: Atom, _can_gc: CanGc, )
Associate an element present in this shadow tree with the provided id.
pub(crate) fn register_slot(&self, slot: &HTMLSlotElement)
pub(crate) fn unregister_slot(&self, name: DOMString, slot: &HTMLSlotElement)
Sourcepub(crate) fn slot_for_name(
&self,
name: &DOMString,
) -> Option<DomRoot<HTMLSlotElement>>
pub(crate) fn slot_for_name( &self, name: &DOMString, ) -> Option<DomRoot<HTMLSlotElement>>
Find the first slot with the given name among this root’s descendants in tree order
pub(crate) fn has_slot_descendants(&self) -> bool
pub(crate) fn set_available_to_element_internals(&self, value: bool)
Sourcepub(crate) fn is_available_to_element_internals(&self) -> bool
pub(crate) fn is_available_to_element_internals(&self) -> bool
pub(crate) fn is_user_agent_widget(&self) -> bool
pub(crate) fn set_declarative(&self, declarative: bool)
pub(crate) fn is_declarative(&self) -> bool
pub(crate) fn shadow_root_mode(&self) -> ShadowRootMode
pub(crate) fn set_serializable(&self, serializable: bool)
pub(crate) fn set_delegates_focus(&self, delegates_focus: bool)
Trait Implementations§
§impl Castable for ShadowRoot
impl Castable for ShadowRoot
Source§impl DomObject for ShadowRoot
impl DomObject for ShadowRoot
Source§impl DomObjectWrap<DomTypeHolder> for ShadowRoot
impl DomObjectWrap<DomTypeHolder> for ShadowRoot
Source§const WRAP: unsafe fn(SafeJSContext, &GlobalScope, Option<HandleObject<'_>>, Box<Self>, CanGc) -> Root<Dom<Self>> = {script_bindings::codegen::GenericBindings::ShadowRootBinding::Wrap::<dom::bindings::codegen::DomTypeHolder::DomTypeHolder> as for<'a, 'b> unsafe fn(script_bindings::script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'b, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::shadowroot::ShadowRoot>, script_bindings::script_runtime::CanGc) -> script_bindings::root::Root<script_bindings::root::Dom<dom::shadowroot::ShadowRoot>>}
const WRAP: unsafe fn(SafeJSContext, &GlobalScope, Option<HandleObject<'_>>, Box<Self>, CanGc) -> Root<Dom<Self>> = {script_bindings::codegen::GenericBindings::ShadowRootBinding::Wrap::<dom::bindings::codegen::DomTypeHolder::DomTypeHolder> as for<'a, 'b> unsafe fn(script_bindings::script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'b, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::shadowroot::ShadowRoot>, script_bindings::script_runtime::CanGc) -> script_bindings::root::Root<script_bindings::root::Dom<dom::shadowroot::ShadowRoot>>}
Source§impl HasParent for ShadowRoot
impl HasParent for ShadowRoot
Source§fn as_parent(&self) -> &DocumentFragment
fn as_parent(&self) -> &DocumentFragment
This is used in a type assertion to ensure that the source and webidls agree as to what the parent type is
type Parent = DocumentFragment
Source§impl IDLInterface for ShadowRoot
impl IDLInterface for ShadowRoot
Source§impl MallocSizeOf for ShadowRoot
impl MallocSizeOf for ShadowRoot
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Source§impl MutDomObject for ShadowRoot
impl MutDomObject for ShadowRoot
Source§impl PartialEq for ShadowRoot
impl PartialEq for ShadowRoot
Source§impl ShadowRootMethods<DomTypeHolder> for ShadowRoot
impl ShadowRootMethods<DomTypeHolder> for ShadowRoot
Source§fn GetHTML(
&self,
options: &GetHTMLOptions<DomTypeHolder>,
can_gc: CanGc,
) -> DOMString
fn GetHTML( &self, options: &GetHTMLOptions<DomTypeHolder>, can_gc: CanGc, ) -> DOMString
Source§fn GetInnerHTML(
&self,
can_gc: CanGc,
) -> Fallible<TrustedHTMLOrNullIsEmptyString<DomTypeHolder>>
fn GetInnerHTML( &self, can_gc: CanGc, ) -> Fallible<TrustedHTMLOrNullIsEmptyString<DomTypeHolder>>
Source§fn SetInnerHTML(
&self,
value: TrustedHTMLOrNullIsEmptyString<DomTypeHolder>,
can_gc: CanGc,
) -> ErrorResult
fn SetInnerHTML( &self, value: TrustedHTMLOrNullIsEmptyString<DomTypeHolder>, can_gc: CanGc, ) -> ErrorResult
Source§fn SlotAssignment(&self) -> SlotAssignmentMode
fn SlotAssignment(&self) -> SlotAssignmentMode
Source§fn SetHTMLUnsafe(
&self,
value: TrustedHTMLOrString<DomTypeHolder>,
can_gc: CanGc,
) -> ErrorResult
fn SetHTMLUnsafe( &self, value: TrustedHTMLOrString<DomTypeHolder>, can_gc: CanGc, ) -> ErrorResult
Source§fn AdoptedStyleSheets(
&self,
context: JSContext,
can_gc: CanGc,
retval: MutableHandleValue<'_>,
)
fn AdoptedStyleSheets( &self, context: JSContext, can_gc: CanGc, retval: MutableHandleValue<'_>, )
Source§fn SetAdoptedStyleSheets(
&self,
context: JSContext,
val: HandleValue<'_>,
) -> ErrorResult
fn SetAdoptedStyleSheets( &self, context: JSContext, val: HandleValue<'_>, ) -> ErrorResult
fn GetActiveElement(&self) -> Option<DomRoot<Element>>
fn ElementFromPoint( &self, x: Finite<f64>, y: Finite<f64>, ) -> Option<DomRoot<Element>>
fn ElementsFromPoint( &self, x: Finite<f64>, y: Finite<f64>, ) -> Vec<DomRoot<Element>> ⓘ
fn StyleSheets(&self) -> DomRoot<StyleSheetList>
fn GetOnslotchange(&self) -> Option<Rc<EventHandlerNonNull<DomTypeHolder>>>
fn SetOnslotchange( &self, listener: Option<Rc<EventHandlerNonNull<DomTypeHolder>>>, )
Source§impl ToJSValConvertible for ShadowRoot
impl ToJSValConvertible for ShadowRoot
Source§impl VirtualMethods for ShadowRoot
impl VirtualMethods for ShadowRoot
Source§fn super_type(&self) -> Option<&dyn VirtualMethods>
fn super_type(&self) -> Option<&dyn VirtualMethods>
Source§fn bind_to_tree(&self, context: &BindContext, can_gc: CanGc)
fn bind_to_tree(&self, context: &BindContext, can_gc: CanGc)
Source§fn unbind_from_tree(&self, context: &UnbindContext<'_>, can_gc: CanGc)
fn unbind_from_tree(&self, context: &UnbindContext<'_>, can_gc: CanGc)
Source§fn attribute_mutated(
&self,
attr: &Attr,
mutation: AttributeMutation<'_>,
can_gc: CanGc,
)
fn attribute_mutated( &self, attr: &Attr, mutation: AttributeMutation<'_>, can_gc: CanGc, )
Source§fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool
fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool
true
if given attribute attr
affects style of the
given element.Source§fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue
fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue
name
on this element.Source§fn post_connection_steps(&self)
fn post_connection_steps(&self)
Source§fn children_changed(&self, mutation: &ChildrenMutation<'_>)
fn children_changed(&self, mutation: &ChildrenMutation<'_>)
Source§fn handle_event(&self, event: &Event, can_gc: CanGc)
fn handle_event(&self, event: &Event, can_gc: CanGc)
Source§fn adopting_steps(&self, old_doc: &Document, can_gc: CanGc)
fn adopting_steps(&self, old_doc: &Document, can_gc: CanGc)
Source§fn cloning_steps(
&self,
copy: &Node,
maybe_doc: Option<&Document>,
clone_children: CloneChildrenFlag,
can_gc: CanGc,
)
fn cloning_steps( &self, copy: &Node, maybe_doc: Option<&Document>, clone_children: CloneChildrenFlag, can_gc: CanGc, )
impl DerivedFrom<DocumentFragment> for ShadowRoot
impl DerivedFrom<EventTarget> for ShadowRoot
impl DerivedFrom<Node> for ShadowRoot
impl Eq for ShadowRoot
Auto Trait Implementations§
impl !Freeze for ShadowRoot
impl !RefUnwindSafe for ShadowRoot
impl !Send for ShadowRoot
impl !Sync for ShadowRoot
impl Unpin for ShadowRoot
impl !UnwindSafe for ShadowRoot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<D, T> DomGlobalGeneric<D> for T
impl<D, T> DomGlobalGeneric<D> for T
Source§fn global_(&self, realm: InRealm<'_>) -> Root<Dom<<D as DomTypes>::GlobalScope>>where
Self: Sized,
fn global_(&self, realm: InRealm<'_>) -> Root<Dom<<D as DomTypes>::GlobalScope>>where
Self: Sized,
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
Node
s it’s almost always better to use NodeTraits::owning_global
.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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