diff options
author | David Raifaizen <d-raif@hotmail.com> | 2016-05-03 23:22:08 -0400 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2016-05-25 09:25:37 +0200 |
commit | 8b3926079374da8cbcdf50383293aad97e268d76 (patch) | |
tree | fdccc0a71e2aab0c201e042199c0c2bb3e517bd0 /components/script/dom/attr.rs | |
parent | f6bbeae67fa5c6db6b69dedaa9a373dbab17759f (diff) | |
download | servo-8b3926079374da8cbcdf50383293aad97e268d76.tar.gz servo-8b3926079374da8cbcdf50383293aad97e268d76.zip |
Removed mutation calls from sync_property_with_attrs_style method in order to avoid reparsing serialized output
Diffstat (limited to 'components/script/dom/attr.rs')
-rw-r--r-- | components/script/dom/attr.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index 95ff73e2cb7..43c1226b295 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -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 } |