Struct style::invalidation::stylesheets::StylesheetInvalidationSet
source · pub struct StylesheetInvalidationSet {
buckets: SimpleBucketsMap<InvalidationKind>,
fully_invalid: bool,
}
Expand description
A set of invalidations due to stylesheet additions.
TODO(emilio): We might be able to do the same analysis for media query changes too (or even selector changes?).
Fields§
§buckets: SimpleBucketsMap<InvalidationKind>
§fully_invalid: bool
Implementations§
source§impl StylesheetInvalidationSet
impl StylesheetInvalidationSet
sourcepub fn invalidate_fully(&mut self)
pub fn invalidate_fully(&mut self)
Mark the DOM tree styles’ as fully invalid.
fn shrink_if_needed(&mut self)
sourcepub fn collect_invalidations_for<S>(
&mut self,
device: &Device,
stylesheet: &S,
guard: &SharedRwLockReadGuard<'_>,
)where
S: StylesheetInDocument,
pub fn collect_invalidations_for<S>(
&mut self,
device: &Device,
stylesheet: &S,
guard: &SharedRwLockReadGuard<'_>,
)where
S: StylesheetInDocument,
Analyze the given stylesheet, and collect invalidations from their rules, in order to avoid doing a full restyle when we style the document next time.
sourcepub fn flush<E>(
&mut self,
document_element: Option<E>,
snapshots: Option<&SnapshotMap>,
) -> boolwhere
E: TElement,
pub fn flush<E>(
&mut self,
document_element: Option<E>,
snapshots: Option<&SnapshotMap>,
) -> boolwhere
E: TElement,
Clears the invalidation set, invalidating elements as needed if
document_element
is provided.
Returns true if any invalidations ocurred.
fn invalidation_kind_for<E>(
&self,
element: E,
snapshot: Option<&Snapshot>,
quirks_mode: QuirksMode,
) -> InvalidationKindwhere
E: TElement,
fn process_invalidations<E>(
&self,
element: E,
snapshots: Option<&SnapshotMap>,
) -> boolwhere
E: TElement,
sourcefn process_invalidations_in_subtree<E>(
&self,
element: E,
snapshots: Option<&SnapshotMap>,
quirks_mode: QuirksMode,
) -> boolwhere
E: TElement,
fn process_invalidations_in_subtree<E>(
&self,
element: E,
snapshots: Option<&SnapshotMap>,
quirks_mode: QuirksMode,
) -> boolwhere
E: TElement,
Process style invalidations in a given subtree. This traverses the subtree looking for elements that match the invalidations in our hash map members.
Returns whether it invalidated at least one element’s style.
sourcefn scan_component(
component: &Component<SelectorImpl>,
invalidation: &mut Option<Invalidation>,
)
fn scan_component( component: &Component<SelectorImpl>, invalidation: &mut Option<Invalidation>, )
TODO(emilio): Reuse the bucket stuff from selectormap? That handles :is() / :where() etc.
sourcefn collect_invalidations(
&mut self,
selector: &Selector<SelectorImpl>,
quirks_mode: QuirksMode,
)
fn collect_invalidations( &mut self, selector: &Selector<SelectorImpl>, quirks_mode: QuirksMode, )
Collect invalidations for a given selector.
We look at the outermost local name, class, or ID selector to the left of an ancestor combinator, in order to restyle only a given subtree.
If the selector has no ancestor combinator, then we do the same for the only sequence it has, but record it as an element invalidation instead of a subtree invalidation.
We prefer IDs to classs, and classes to local names, on the basis that the former should be more specific than the latter. We also prefer to generate subtree invalidations for the outermost part of the selector, to reduce the amount of traversal we need to do when flushing invalidations.
fn insert_invalidation( &mut self, invalidation: Invalidation, kind: InvalidationKind, quirks_mode: QuirksMode, ) -> bool
sourcepub fn rule_changed<S>(
&mut self,
stylesheet: &S,
rule: &CssRule,
guard: &SharedRwLockReadGuard<'_>,
device: &Device,
quirks_mode: QuirksMode,
change_kind: RuleChangeKind,
)where
S: StylesheetInDocument,
pub fn rule_changed<S>(
&mut self,
stylesheet: &S,
rule: &CssRule,
guard: &SharedRwLockReadGuard<'_>,
device: &Device,
quirks_mode: QuirksMode,
change_kind: RuleChangeKind,
)where
S: StylesheetInDocument,
Collects invalidations for a given CSS rule, if not fully invalid already.
TODO(emilio): we can’t check whether the rule is inside a non-effective subtree, we potentially could do that.
sourcefn collect_invalidations_for_rule(
&mut self,
rule: &CssRule,
guard: &SharedRwLockReadGuard<'_>,
device: &Device,
quirks_mode: QuirksMode,
is_generic_change: bool,
)
fn collect_invalidations_for_rule( &mut self, rule: &CssRule, guard: &SharedRwLockReadGuard<'_>, device: &Device, quirks_mode: QuirksMode, is_generic_change: bool, )
Collects invalidations for a given CSS rule.
Trait Implementations§
source§impl Debug for StylesheetInvalidationSet
impl Debug for StylesheetInvalidationSet
source§impl Default for StylesheetInvalidationSet
impl Default for StylesheetInvalidationSet
source§fn default() -> StylesheetInvalidationSet
fn default() -> StylesheetInvalidationSet
source§impl MallocSizeOf for StylesheetInvalidationSet
impl MallocSizeOf for StylesheetInvalidationSet
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Auto Trait Implementations§
impl Freeze for StylesheetInvalidationSet
impl RefUnwindSafe for StylesheetInvalidationSet
impl Send for StylesheetInvalidationSet
impl Sync for StylesheetInvalidationSet
impl Unpin for StylesheetInvalidationSet
impl UnwindSafe for StylesheetInvalidationSet
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> 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