diff options
author | Bobby Holley <bobbyholley@gmail.com> | 2015-10-09 21:38:24 -0700 |
---|---|---|
committer | Bobby Holley <bobbyholley@gmail.com> | 2015-10-27 12:48:48 -0700 |
commit | 069c40f788ef69ee5523c1f88c898c849080c594 (patch) | |
tree | 13f211661cbb5a12905e13c781a09c6c2b02dbf4 /components/script/dom/element.rs | |
parent | 441c84d75d412d24281b67821662ee50e8b1152b (diff) | |
download | servo-069c40f788ef69ee5523c1f88c898c849080c594.tar.gz servo-069c40f788ef69ee5523c1f88c898c849080c594.zip |
Check modified event state from layout and dirty it there.
This adds some overhead, but also provides the small performance benefit of
avoiding dirtying in the case where an event state is toggled an even
number of times between reflows.
The main benefit here though is that it sets us up to be smarter about
what we mark as dirty using restyle hints.
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r-- | components/script/dom/element.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 1be58932305..0bdca0714a7 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -1836,6 +1836,9 @@ impl Element { fn set_state(&self, which: EventState, value: bool) { let mut state = self.event_state.get(); + if state.contains(which) == value { + return + } match value { true => state.insert(which), false => state.remove(which), @@ -1843,7 +1846,7 @@ impl Element { self.event_state.set(state); let node = self.upcast::<Node>(); - node.dirty(NodeDamage::NodeStyleDamaged); + node.owner_doc().record_event_state_change(self, which); } pub fn get_active_state(&self) -> bool { |