style: Remove "reconstructed ancestor" checks.

This is only useful to avoid restyling NAC subtrees, but _not_ for ::before or
::after, in most cases. These subrees are small, and reframing is also not too
common, so I don't think it warrants the complexity.
This commit is contained in:
Emilio Cobos Álvarez 2017-11-09 15:37:54 +01:00
parent 333c6ef7fa
commit 49fe3d1c9f
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 11 additions and 88 deletions

View file

@ -38,15 +38,16 @@ bitflags! {
/// traversed, so each traversal simply updates it with the appropriate
/// value.
const TRAVERSED_WITHOUT_STYLING = 1 << 1;
/// Whether we reframed/reconstructed any ancestor or self.
const ANCESTOR_WAS_RECONSTRUCTED = 1 << 2;
/// Whether the primary style of this element data was reused from another
/// element via a rule node comparison. This allows us to differentiate
/// between elements that shared styles because they met all the criteria
/// of the style sharing cache, compared to elements that reused style
/// structs via rule node identity. The former gives us stronger transitive
/// guarantees that allows us to apply the style sharing cache to cousins.
const PRIMARY_STYLE_REUSED_VIA_RULE_NODE = 1 << 3;
/// Whether the primary style of this element data was reused from
/// another element via a rule node comparison. This allows us to
/// differentiate between elements that shared styles because they met
/// all the criteria of the style sharing cache, compared to elements
/// that reused style structs via rule node identity.
///
/// The former gives us stronger transitive guarantees that allows us to
/// apply the style sharing cache to cousins.
const PRIMARY_STYLE_REUSED_VIA_RULE_NODE = 1 << 2;
}
}
@ -405,13 +406,7 @@ impl ElementData {
#[inline]
pub fn clear_restyle_flags_and_damage(&mut self) {
self.damage = RestyleDamage::empty();
self.flags.remove(ElementDataFlags::WAS_RESTYLED | ElementDataFlags::ANCESTOR_WAS_RECONSTRUCTED)
}
/// Returns whether this element or any ancestor is going to be
/// reconstructed.
pub fn reconstructed_self_or_ancestor(&self) -> bool {
self.reconstructed_ancestor() || self.reconstructed_self()
self.flags.remove(ElementDataFlags::WAS_RESTYLED);
}
/// Returns whether this element is going to be reconstructed.
@ -419,23 +414,6 @@ impl ElementData {
self.damage.contains(RestyleDamage::reconstruct())
}
/// Returns whether any ancestor of this element is going to be
/// reconstructed.
fn reconstructed_ancestor(&self) -> bool {
self.flags.contains(ElementDataFlags::ANCESTOR_WAS_RECONSTRUCTED)
}
/// Sets the flag that tells us whether we've reconstructed an ancestor.
pub fn set_reconstructed_ancestor(&mut self, reconstructed: bool) {
if reconstructed {
// If it weren't for animation-only traversals, we could assert
// `!self.reconstructed_ancestor()` here.
self.flags.insert(ElementDataFlags::ANCESTOR_WAS_RECONSTRUCTED);
} else {
self.flags.remove(ElementDataFlags::ANCESTOR_WAS_RECONSTRUCTED);
}
}
/// Mark this element as restyled, which is useful to know whether we need
/// to do a post-traversal.
pub fn set_restyled(&mut self) {