diff options
author | Ms2ger <ms2ger@gmail.com> | 2014-08-06 09:56:40 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2014-08-06 09:57:07 +0200 |
commit | 501b8b6bd286dacf0ca030e79f5e75c2fe73b5a4 (patch) | |
tree | 7b459b7b494ec5ed1b63aec30b2afe168a74187f /src/components/script/dom/attr.rs | |
parent | e942cd901ef6b01635f40c7650216af65ecaf57f (diff) | |
download | servo-501b8b6bd286dacf0ca030e79f5e75c2fe73b5a4.tar.gz servo-501b8b6bd286dacf0ca030e79f5e75c2fe73b5a4.zip |
Make Attr::owner immutable.
Nobody needs to change the element it's associated with, so there's no reason
to use a Cell here.
Diffstat (limited to 'src/components/script/dom/attr.rs')
-rw-r--r-- | src/components/script/dom/attr.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/components/script/dom/attr.rs b/src/components/script/dom/attr.rs index 0e499ebf477..dce5df0f009 100644 --- a/src/components/script/dom/attr.rs +++ b/src/components/script/dom/attr.rs @@ -17,7 +17,7 @@ use servo_util::atom::Atom; use servo_util::namespace; use servo_util::namespace::Namespace; use servo_util::str::{DOMString, HTML_SPACE_CHARACTERS}; -use std::cell::{Ref, Cell, RefCell}; +use std::cell::{Ref, RefCell}; use std::mem; pub enum AttrSettingType { @@ -76,7 +76,7 @@ pub struct Attr { pub prefix: Option<DOMString>, /// the element that owns this attribute. - owner: Cell<JS<Element>>, + owner: JS<Element>, } impl Reflectable for Attr { @@ -96,7 +96,7 @@ impl Attr { name: name, namespace: namespace, prefix: prefix, - owner: Cell::new(JS::from_rooted(owner)), + owner: JS::from_rooted(owner), } } @@ -108,7 +108,7 @@ impl Attr { } pub fn set_value(&self, set_type: AttrSettingType, value: AttrValue) { - let owner = self.owner.get().root(); + let owner = self.owner.root(); let node: &JSRef<Node> = NodeCast::from_ref(&*owner); let namespace_is_null = self.namespace == namespace::Null; @@ -143,7 +143,7 @@ impl<'a> AttrMethods for JSRef<'a, Attr> { } fn SetValue(&self, value: DOMString) { - let owner = self.owner.get().root(); + let owner = self.owner.root(); let value = owner.deref().parse_attribute( &self.namespace, self.deref().local_name.as_slice(), value); self.set_value(ReplacedAttr, value); |