style: Force to stop computing children if we find the parent has display: none.

This commit is contained in:
Emilio Cobos Álvarez 2016-08-05 11:22:20 -07:00
parent 436c1b3089
commit 544a117911
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
9 changed files with 254 additions and 116 deletions

View file

@ -5,7 +5,7 @@
//! Implements sequential traversal over the DOM tree.
use dom::TNode;
use traversal::DomTraversalContext;
use traversal::{RestyleResult, DomTraversalContext};
pub fn traverse_dom<N, C>(root: N,
shared: &C::SharedContext)
@ -17,12 +17,17 @@ pub fn traverse_dom<N, C>(root: N,
C: DomTraversalContext<N>
{
debug_assert!(context.should_process(node));
context.process_preorder(node);
let should_stop = match context.process_preorder(node) {
RestyleResult::Stop => true,
RestyleResult::Continue => false,
};
for kid in node.children() {
context.pre_process_child_hook(node, kid);
if context.should_process(kid) {
doit::<N, C>(context, kid);
if !should_stop {
for kid in node.children() {
context.pre_process_child_hook(node, kid);
if context.should_process(kid) {
doit::<N, C>(context, kid);
}
}
}