mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Add a way to skip the "invalidation on eager pseudo invalidates self" bit.
This commit is contained in:
parent
ecdb10ef5c
commit
9034e6a732
2 changed files with 12 additions and 1 deletions
|
@ -57,6 +57,11 @@ impl<E> InvalidationProcessor<E> for StateAndAttrInvalidationProcessor
|
|||
where
|
||||
E: TElement,
|
||||
{
|
||||
/// We need to invalidate style on an eager pseudo-element, in order to
|
||||
/// process changes that could otherwise end up in ::before or ::after
|
||||
/// content being generated.
|
||||
fn invalidates_on_eager_pseudo_element(&self) -> bool { true }
|
||||
|
||||
fn collect_invalidations(
|
||||
&self,
|
||||
element: E,
|
||||
|
|
|
@ -25,6 +25,11 @@ pub trait InvalidationProcessor<E>
|
|||
where
|
||||
E: TElement,
|
||||
{
|
||||
/// Whether an invalidation that contains only an eager pseudo-element
|
||||
/// selector like ::before or ::after triggers invalidation of the element
|
||||
/// that would originate it.
|
||||
fn invalidates_on_eager_pseudo_element(&self) -> bool { false }
|
||||
|
||||
/// Collect invalidations for a given element's descendants and siblings.
|
||||
///
|
||||
/// Returns whether the element itself was invalidated.
|
||||
|
@ -670,7 +675,8 @@ where
|
|||
//
|
||||
// Note that we'll also restyle the pseudo-element because
|
||||
// it would match this invalidation.
|
||||
if pseudo.is_eager() {
|
||||
if self.processor.invalidates_on_eager_pseudo_element() &&
|
||||
pseudo.is_eager() {
|
||||
invalidated_self = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue