Removed mutation calls from sync_property_with_attrs_style method in order to avoid reparsing serialized output

This commit is contained in:
David Raifaizen 2016-05-03 23:22:08 -04:00 committed by Simon Sapin
parent f6bbeae67f
commit 8b39260793
2 changed files with 23 additions and 10 deletions

View file

@ -173,13 +173,18 @@ impl Attr {
pub fn set_value(&self, mut value: AttrValue, owner: &Element) {
assert!(Some(owner) == self.owner().r());
owner.will_mutate_attr();
mem::swap(&mut *self.value.borrow_mut(), &mut value);
self.swap_value(&mut value);
if self.identifier.namespace == ns!() {
vtable_for(owner.upcast())
.attribute_mutated(self, AttributeMutation::Set(Some(&value)));
}
}
/// Used to swap the attribute's value without triggering mutation events
pub fn swap_value(&self, value: &mut AttrValue) {
mem::swap(&mut *self.value.borrow_mut(), value);
}
pub fn identifier(&self) -> &AttrIdentifier {
&self.identifier
}