Enum style::rule_tree::level::CascadeLevel
source · #[repr(u8)]pub enum CascadeLevel {
UANormal,
UserNormal,
PresHints,
AuthorNormal {
shadow_cascade_order: ShadowCascadeOrder,
},
SMILOverride,
Animations,
AuthorImportant {
shadow_cascade_order: ShadowCascadeOrder,
},
UserImportant,
UAImportant,
Transitions,
}
Expand description
The cascade level these rules are relevant at, as per13.
Presentational hints for SVG and HTML are in the “author-level zero-specificity” level, that is, right after user rules, and before author rules.
The order of variants declared here is significant, and must be in ascending order of precedence.
See also 4 for the Shadow DOM bits. We rely on the invariant that rules from outside the tree the element is in can’t affect the element.
The opposite is not true (i.e., :host and ::slotted) from an “inner” shadow tree may affect an element connected to the document or an “outer” shadow tree.
Variants§
UANormal
Normal User-Agent rules.
UserNormal
User normal rules.
PresHints
Presentational hints.
AuthorNormal
Shadow DOM styles from author styles.
Fields
shadow_cascade_order: ShadowCascadeOrder
The order in the shadow tree hierarchy. This number is relative to the tree of the element, and thus the only invariants that need to be preserved is:
-
Zero is the same tree as the element that matched the rule. This is important so that we can optimize style attribute insertions.
-
The levels are ordered in accordance with https://drafts.csswg.org/css-scoping/#shadow-cascading
SMILOverride
SVG SMIL animations.
Animations
CSS animations and script-generated animations.
AuthorImportant
Author-supplied important rules.
Fields
shadow_cascade_order: ShadowCascadeOrder
The order in the shadow tree hierarchy, inverted, so that PartialOrd does the right thing.
UserImportant
User important rules.
UAImportant
User-agent important rules.
Transitions
Transitions
Implementations§
source§impl CascadeLevel
impl CascadeLevel
sourcepub fn unimportant(&self) -> Self
pub fn unimportant(&self) -> Self
Convert this level from “important” to “non-important”.
sourcepub fn guard<'a>(
&self,
guards: &'a StylesheetGuards<'a>,
) -> &'a SharedRwLockReadGuard<'a>
pub fn guard<'a>( &self, guards: &'a StylesheetGuards<'a>, ) -> &'a SharedRwLockReadGuard<'a>
Select a lock guard for this level
Returns the cascade level for author important declarations from the same tree as the element.
Returns the cascade level for author normal declarations from the same tree as the element.
sourcepub fn is_important(&self) -> bool
pub fn is_important(&self) -> bool
Returns whether this cascade level represents important rules of some sort.
sourcepub fn importance(&self) -> Importance
pub fn importance(&self) -> Importance
Returns the importance relevant for this rule. Pretty similar to
is_important
.
sourcepub fn is_animation(&self) -> bool
pub fn is_animation(&self) -> bool
Returns whether this cascade level represents an animation rules.
Trait Implementations§
source§impl Clone for CascadeLevel
impl Clone for CascadeLevel
source§fn clone(&self) -> CascadeLevel
fn clone(&self) -> CascadeLevel
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CascadeLevel
impl Debug for CascadeLevel
source§impl Hash for CascadeLevel
impl Hash for CascadeLevel
source§impl MallocSizeOf for CascadeLevel
impl MallocSizeOf for CascadeLevel
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl Ord for CascadeLevel
impl Ord for CascadeLevel
source§fn cmp(&self, other: &CascadeLevel) -> Ordering
fn cmp(&self, other: &CascadeLevel) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for CascadeLevel
impl PartialEq for CascadeLevel
source§impl PartialOrd for CascadeLevel
impl PartialOrd for CascadeLevel
impl Copy for CascadeLevel
impl Eq for CascadeLevel
impl StructuralPartialEq for CascadeLevel
Auto Trait Implementations§
impl Freeze for CascadeLevel
impl RefUnwindSafe for CascadeLevel
impl Send for CascadeLevel
impl Sync for CascadeLevel
impl Unpin for CascadeLevel
impl UnwindSafe for CascadeLevel
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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<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