style: Avoid propagating the restyle flag all through the dom when a node gets dirty.

This puts us in pair with stylo.
This commit is contained in:
Emilio Cobos Álvarez 2016-07-22 19:33:53 -07:00
parent 96ea1a335c
commit d81fe27b11
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
4 changed files with 21 additions and 35 deletions

View file

@ -6,7 +6,6 @@ use context::StandaloneStyleContext;
use std::mem;
use style::context::SharedStyleContext;
use style::dom::OpaqueNode;
use style::dom::TNode;
use style::traversal::{DomTraversalContext, recalc_style_at};
use wrapper::GeckoNode;
@ -37,21 +36,4 @@ impl<'lc, 'ln> DomTraversalContext<GeckoNode<'ln>> for RecalcStyleOnly<'lc> {
}
fn process_postorder(&self, _: GeckoNode<'ln>) {}
/// In Gecko we use this traversal just for restyling, so we can stop once
/// we know there aren't more dirty nodes under ourselves.
fn should_process(&self, node: GeckoNode<'ln>) -> bool {
node.is_dirty() || node.has_dirty_descendants()
}
fn pre_process_child_hook(&self, parent: GeckoNode<'ln>, kid: GeckoNode<'ln>) {
// NOTE: At this point is completely safe to modify either the parent or
// the child, since we have exclusive access to them.
if parent.is_dirty() {
unsafe {
kid.set_dirty(true);
parent.set_dirty_descendants(true);
}
}
}
}