mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Force to stop computing children if we find the parent has display: none.
This commit is contained in:
parent
436c1b3089
commit
544a117911
9 changed files with 254 additions and 116 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue