Revert restyled_previous_sibling_element tracking, and separate child preprocessing.

I realized that I fixed this issue incorrectly when the test failed before. Our design
document specifies that restyle hints must be expanded by the parent before traversing
children, so that we can properly apply LaterSiblings restyle hints. This includes
parents that do not themselves need processing (StylingMode::Traverse).

So we need to preprocess children even in the case where we don't restyle the parent.
On the flip side, we do in fact know whether a child needs processing before enqueuing
it, so we can skip the conservative visit I added before.

MozReview-Commit-ID: AEiRzdsN0h5
This commit is contained in:
Bobby Holley 2016-11-24 14:12:31 -08:00
parent 992f7dddf4
commit e65b1be07b
3 changed files with 43 additions and 39 deletions

View file

@ -112,11 +112,10 @@ impl<'lc, N> DomTraversalContext<N> for RecalcStyleAndConstructFlows<'lc>
construct_flows_at(&self.context, self.root, node);
}
fn should_traverse_child(child: N, restyled_previous_sibling_element: bool) -> bool {
fn should_traverse_child(child: N) -> bool {
match child.as_element() {
// Elements should be traversed if they need styling or flow construction.
Some(el) => restyled_previous_sibling_element ||
el.styling_mode() != StylingMode::Stop ||
Some(el) => el.styling_mode() != StylingMode::Stop ||
el.as_node().to_threadsafe().restyle_damage() != RestyleDamage::empty(),
// Text nodes never need styling. However, there are two cases they may need