aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout
diff options
context:
space:
mode:
authorBobby Holley <bobbyholley@gmail.com>2015-11-04 18:31:17 -0800
committerBobby Holley <bobbyholley@gmail.com>2015-11-04 19:09:58 -0800
commit7dba4447f196bbd75676402dac7858b0f7741cd2 (patch)
tree0d91f8d35b0dcc11396e968b6bfd1e458a4fd6d8 /components/layout
parentd89816bb5fa90421a4dea49ff6387f635ce7b389 (diff)
downloadservo-7dba4447f196bbd75676402dac7858b0f7741cd2.tar.gz
servo-7dba4447f196bbd75676402dac7858b0f7741cd2.zip
Store pristine element state rather than a set of changes.
This is the strategy we'll need to take for attributes, and so this change puts us in a position to handle attributes and state the same way. This does mean that we stop taking care to track the situations where our state has reverted to the original state, with no net change. I think that's probably of negligible value though.
Diffstat (limited to 'components/layout')
-rw-r--r--components/layout/layout_task.rs7
-rw-r--r--components/layout/wrapper.rs6
2 files changed, 6 insertions, 7 deletions
diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs
index 7a615b02f6b..bdf1b613562 100644
--- a/components/layout/layout_task.rs
+++ b/components/layout/layout_task.rs
@@ -1213,13 +1213,12 @@ impl LayoutTask {
}
}
- let state_changes = document.drain_element_state_changes();
+ let modified_elements = document.drain_modified_elements();
if !needs_dirtying {
- for &(el, state_change) in state_changes.iter() {
- debug_assert!(!state_change.is_empty());
+ for &(el, old_state) in modified_elements.iter() {
let hint = rw_data.stylist.restyle_hint_for_state_change(&el,
el.get_state(),
- state_change);
+ old_state);
el.note_restyle_hint(hint);
}
}
diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs
index 04d3470fb64..ae8462426e8 100644
--- a/components/layout/wrapper.rs
+++ b/components/layout/wrapper.rs
@@ -375,10 +375,10 @@ impl<'le> LayoutDocument<'le> {
self.as_node().children().find(LayoutNode::is_element)
}
- pub fn drain_element_state_changes(&self) -> Vec<(LayoutElement, ElementState)> {
+ pub fn drain_modified_elements(&self) -> Vec<(LayoutElement, ElementState)> {
unsafe {
- let changes = self.document.drain_element_state_changes();
- Vec::from_iter(changes.iter().map(|&(el, state)|
+ let elements = self.document.drain_modified_elements();
+ Vec::from_iter(elements.iter().map(|&(el, state)|
(LayoutElement {
element: el,
chain: PhantomData,