diff --git a/components/style/sequential.rs b/components/style/sequential.rs index 4b92c52f80d..0e5253b2073 100644 --- a/components/style/sequential.rs +++ b/components/style/sequential.rs @@ -24,8 +24,9 @@ pub fn traverse_dom(root: N, C::traverse_children(el, |kid| doit::(context, kid, data)); - // NB: Data is unused now, but we can always decrement the count - // here if we need it for the post-order one :) + if let Some(ref mut depth) = data.current_dom_depth { + *depth -= 1; + } } if context.needs_postorder_traversal() {