mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
style: Restyle pseudo-elements as well on part attribute changes
Refactor a bit the code to unify how we deal with this conditional restyling (we had similar code for MustCascadeChildrenIfInheritResetStyle). Differential Revision: https://phabricator.services.mozilla.com/D172890
This commit is contained in:
parent
398df68d38
commit
78c1c53ccd
6 changed files with 132 additions and 180 deletions
|
@ -17,7 +17,6 @@ use crate::properties::{AnimationDeclarations, ComputedValues, PropertyDeclarati
|
|||
use crate::selector_parser::{AttrValue, Lang, PseudoElement, SelectorImpl};
|
||||
use crate::shared_lock::{Locked, SharedRwLock};
|
||||
use crate::stylist::CascadeData;
|
||||
use crate::traversal_flags::TraversalFlags;
|
||||
use crate::values::AtomIdent;
|
||||
use crate::values::computed::Display;
|
||||
use crate::{LocalName, Namespace, WeakAtom};
|
||||
|
@ -587,51 +586,6 @@ pub trait TElement:
|
|||
/// Flags this element as having handled already its snapshot.
|
||||
unsafe fn set_handled_snapshot(&self);
|
||||
|
||||
/// Returns whether the element's styles are up-to-date for |traversal_flags|.
|
||||
fn has_current_styles_for_traversal(
|
||||
&self,
|
||||
data: &ElementData,
|
||||
traversal_flags: TraversalFlags,
|
||||
) -> bool {
|
||||
if traversal_flags.for_animation_only() {
|
||||
// In animation-only restyle we never touch snapshots and don't care
|
||||
// about them. But we can't assert '!self.handled_snapshot()'
|
||||
// here since there are some cases that a second animation-only
|
||||
// restyle which is a result of normal restyle (e.g. setting
|
||||
// animation-name in normal restyle and creating a new CSS
|
||||
// animation in a SequentialTask) is processed after the normal
|
||||
// traversal in that we had elements that handled snapshot.
|
||||
if !data.has_styles() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if !data.hint.has_animation_hint_or_recascade() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// FIXME: This should ideally always return false, but it is a hack
|
||||
// to work around our weird animation-only traversal
|
||||
// stuff: If we're display: none and the rules we could match could
|
||||
// change, we consider our style up-to-date. This is because
|
||||
// re-cascading with and old style doesn't guarantee returning the
|
||||
// correct animation style (that's bug 1393323). So if our display
|
||||
// changed, and it changed from display: none, we would incorrectly
|
||||
// forget about it and wouldn't be able to correctly style our
|
||||
// descendants later.
|
||||
if data.styles.is_display_none() && data.hint.match_self() {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if self.has_snapshot() && !self.handled_snapshot() {
|
||||
return false;
|
||||
}
|
||||
|
||||
data.has_styles() && !data.hint.has_non_animation_invalidations()
|
||||
}
|
||||
|
||||
/// Returns whether the element's styles are up-to-date after traversal
|
||||
/// (i.e. in post traversal).
|
||||
fn has_current_styles(&self, data: &ElementData) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue