aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/traversal.rs
diff options
context:
space:
mode:
authorBobby Holley <bobbyholley@gmail.com>2016-11-14 15:32:35 -0800
committerBobby Holley <bobbyholley@gmail.com>2016-11-16 12:09:49 -0800
commitb31ed2298c240fc364cb69ac3003048d7244e4b1 (patch)
treee60e44b0ba93ac0a3f8b9e88758cd0c9fe101b79 /components/layout/traversal.rs
parentf1043f630563a7c4a4f3fcff11f6f63b3e9afaa2 (diff)
downloadservo-b31ed2298c240fc364cb69ac3003048d7244e4b1.tar.gz
servo-b31ed2298c240fc364cb69ac3003048d7244e4b1.zip
Eliminate HAS_CHANGED in favor of explicit RestyleDamage.
Diffstat (limited to 'components/layout/traversal.rs')
-rw-r--r--components/layout/traversal.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs
index 3ec1f2f85a5..849e7b2087a 100644
--- a/components/layout/traversal.rs
+++ b/components/layout/traversal.rs
@@ -118,16 +118,13 @@ impl<'lc, N> DomTraversalContext<N> for RecalcStyleAndConstructFlows<'lc>
return false;
}
- // If this node has been marked as damaged in some way, we need to
- // traverse it for layout.
- if child.has_changed() {
- return true;
- }
-
match child.as_element() {
- Some(el) => el.styling_mode() != StylingMode::Stop,
- // Aside from the has_changed case above, we want to traverse non-element children
- // in two additional cases:
+ // Elements should be traversed if they need styling or flow construction.
+ Some(el) => el.styling_mode() != StylingMode::Stop ||
+ el.as_node().to_threadsafe().restyle_damage() != RestyleDamage::empty(),
+
+ // Text nodes never need styling. However, there are two cases they may need
+ // flow construction:
// (1) They child doesn't yet have layout data (preorder traversal initializes it).
// (2) The parent element has restyle damage (so the text flow also needs fixup).
None => child.get_raw_data().is_none() ||