style: Remove damage_handled, and use a reconstructed_ancestor bit instead.

Reviewed-By: bholley
Bug: 1368236
MozReview-Commit-ID: 8KK0YfhiS2
This commit is contained in:
Emilio Cobos Álvarez 2017-06-13 14:13:24 +02:00
parent f9c268922d
commit dc521b2799
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
4 changed files with 30 additions and 58 deletions

View file

@ -297,8 +297,8 @@ pub trait DomTraversal<E: TElement> : Sync {
if let Some(parent) = el.traversal_parent() {
let parent_data = parent.borrow_data().unwrap();
let going_to_reframe = parent_data.get_restyle().map_or(false, |r| {
(r.damage | r.damage_handled())
.contains(RestyleDamage::reconstruct())
r.reconstructed_ancestor ||
r.damage.contains(RestyleDamage::reconstruct())
});
let mut is_before_or_after_pseudo = false;
@ -730,14 +730,16 @@ pub fn recalc_style_at<E, D>(traversal: &D,
DontLog) &&
(has_dirty_descendants_for_this_restyle ||
!propagated_hint.is_empty()) {
let damage_handled = data.get_restyle().map_or(RestyleDamage::empty(), |r| {
r.damage_handled() | r.damage.handled_for_descendants()
let reconstructed_ancestor = data.get_restyle().map_or(false, |r| {
r.reconstructed_ancestor ||
r.damage.contains(RestyleDamage::reconstruct())
});
preprocess_children::<E, D>(context,
element,
propagated_hint,
damage_handled);
preprocess_children::<E, D>(
context,
element,
propagated_hint,
reconstructed_ancestor,
)
}
// If we are in a restyle for reconstruction, drop the existing restyle
@ -840,12 +842,15 @@ fn compute_style<E, D>(_traversal: &D,
}
}
fn preprocess_children<E, D>(context: &mut StyleContext<E>,
element: E,
propagated_hint: RestyleHint,
damage_handled: RestyleDamage)
where E: TElement,
D: DomTraversal<E>,
fn preprocess_children<E, D>(
context: &mut StyleContext<E>,
element: E,
propagated_hint: RestyleHint,
reconstructed_ancestor: bool,
)
where
E: TElement,
D: DomTraversal<E>,
{
trace!("preprocess_children: {:?}", element);
@ -880,9 +885,7 @@ fn preprocess_children<E, D>(context: &mut StyleContext<E>,
// If the child doesn't have pre-existing RestyleData and we don't have
// any reason to create one, avoid the useless allocation and move on to
// the next child.
if propagated_hint.is_empty() &&
damage_handled.is_empty() &&
!child_data.has_restyle() {
if !reconstructed_ancestor && propagated_hint.is_empty() && !child_data.has_restyle() {
continue;
}
@ -890,10 +893,8 @@ fn preprocess_children<E, D>(context: &mut StyleContext<E>,
// Propagate the parent restyle hint, that may make us restyle the whole
// subtree.
restyle_data.reconstructed_ancestor = reconstructed_ancestor;
restyle_data.hint.insert(propagated_hint);
// Store the damage already handled by ancestors.
restyle_data.set_damage_handled(damage_handled);
}
}