From 501b8b6bd286dacf0ca030e79f5e75c2fe73b5a4 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 6 Aug 2014 09:56:40 +0200 Subject: [PATCH] Make Attr::owner immutable. Nobody needs to change the element it's associated with, so there's no reason to use a Cell here. --- src/components/script/dom/attr.rs | 10 +++++----- 1 file 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, /// the element that owns this attribute. - owner: Cell>, + owner: JS, } 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 = 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);