mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
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:
parent
d89816bb5f
commit
7dba4447f1
6 changed files with 23 additions and 35 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue