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.
This commit is contained in:
Bobby Holley 2015-11-04 18:31:17 -08:00
parent d89816bb5f
commit 7dba4447f1
6 changed files with 23 additions and 35 deletions

View file

@ -195,11 +195,10 @@ impl StateDependencySet {
StateDependencySet { deps: Vec::new() }
}
pub fn compute_hint<E>(&self, el: &E, current_state: ElementState, state_changes: ElementState)
pub fn compute_hint<E>(&self, el: &E, current_state: ElementState, old_state: ElementState)
-> RestyleHint where E: Element, E: Clone {
let mut hint = RestyleHint::empty();
let mut old_state = current_state;
old_state.toggle(state_changes);
let state_changes = current_state ^ old_state;
for dep in &self.deps {
if state_changes.intersects(dep.state) {
let old_el: ElementWrapper<E> = ElementWrapper::new_with_override(el.clone(), old_state);