layout: Make box building thread safe by pushing down styles into

non-element children during the cascade.

Fetching them from the parent isn't thread-safe.

Adds a test for anonymous block box inheritance.
This commit is contained in:
Patrick Walton 2014-01-29 15:24:42 -08:00
parent 6c2e48f04d
commit 0e20ec02c5
6 changed files with 37 additions and 39 deletions

View file

@ -134,16 +134,16 @@ fn match_and_cascade_node(unsafe_layout_node: UnsafeLayoutNode,
// Perform the CSS selector matching.
let stylist: &Stylist = cast::transmute(layout_context.stylist);
node.match_node(stylist);
// Perform the CSS cascade.
let parent_opt = if OpaqueNode::from_layout_node(&node) == layout_context.reflow_root {
None
} else {
node.parent_node()
};
node.cascade_node(parent_opt);
}
// Perform the CSS cascade.
let parent_opt = if OpaqueNode::from_layout_node(&node) == layout_context.reflow_root {
None
} else {
node.parent_node()
};
node.cascade_node(parent_opt);
// Enqueue kids.
let mut child_count = 0;
for kid in node.children() {