diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2014-09-29 03:55:07 +0530 |
---|---|---|
committer | Manish Goregaokar <manishsmail@gmail.com> | 2014-10-05 21:58:59 +0530 |
commit | 4f362ab5e6559a16af98e86d69eb64d0c6e5734c (patch) | |
tree | d37e290f0ae0e01e17d1ccbdd8132950bbe692b5 | |
parent | ad84dd7e4779350d0eb9d7ae170a3cf6e5fe2d00 (diff) | |
download | servo-4f362ab5e6559a16af98e86d69eb64d0c6e5734c.tar.gz servo-4f362ab5e6559a16af98e86d69eb64d0c6e5734c.zip |
Remove Untraceable/Traceable from document.rs
-rw-r--r-- | components/script/dom/bindings/trace.rs | 2 | ||||
-rw-r--r-- | components/script/dom/document.rs | 41 | ||||
-rw-r--r-- | components/script/dom/node.rs | 2 |
3 files changed, 23 insertions, 22 deletions
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index ddf16b9c2ab..fc5f8b6d4a6 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -42,6 +42,7 @@ use std::collections::hashmap::HashMap; use collections::hash::Hash; use style::PropertyDeclarationBlock; use std::comm::{Receiver, Sender}; +use hubbub::hubbub::QuirksMode; use string_cache::{Atom, Namespace}; impl<T: Reflectable> JSTraceable for JS<T> { @@ -231,6 +232,7 @@ untraceable!(PropertyDeclarationBlock) // These three are interdependent, if you plan to put jsmanaged data // in one of these make sure it is propagated properly to containing structs untraceable!(SubpageId, WindowSizeData, PipelineId) +untraceable!(QuirksMode) impl<'a> JSTraceable for &'a str { #[inline] diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index c3a31168cb8..8a7ae10dd7d 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -23,7 +23,6 @@ use dom::bindings::global::GlobalRef; use dom::bindings::global; use dom::bindings::js::{MutNullableJS, JS, JSRef, Temporary, OptionalSettable, TemporaryPushable}; use dom::bindings::js::OptionalRootable; -use dom::bindings::trace::{Traceable, Untraceable}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{xml_name_type, InvalidXMLName, Name, QName}; use dom::comment::Comment; @@ -81,14 +80,14 @@ pub struct Document { pub node: Node, reflector_: Reflector, pub window: JS<Window>, - idmap: Traceable<RefCell<HashMap<Atom, Vec<JS<Element>>>>>, + idmap: RefCell<HashMap<Atom, Vec<JS<Element>>>>, implementation: MutNullableJS<DOMImplementation>, content_type: DOMString, - last_modified: Traceable<RefCell<Option<DOMString>>>, - pub encoding_name: Traceable<RefCell<DOMString>>, + last_modified: RefCell<Option<DOMString>>, + pub encoding_name: RefCell<DOMString>, pub is_html_document: bool, - url: Untraceable<Url>, - quirks_mode: Untraceable<Cell<QuirksMode>>, + url: Url, + quirks_mode: Cell<QuirksMode>, images: MutNullableJS<HTMLCollection>, embeds: MutNullableJS<HTMLCollection>, links: MutNullableJS<HTMLCollection>, @@ -177,23 +176,23 @@ pub trait DocumentHelpers<'a> { impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { fn url(self) -> &'a Url { - &*self.extended_deref().url + &self.extended_deref().url } fn quirks_mode(self) -> QuirksMode { - self.quirks_mode.deref().get() + self.quirks_mode.get() } fn set_quirks_mode(self, mode: QuirksMode) { - self.quirks_mode.deref().set(mode); + self.quirks_mode.set(mode); } fn set_last_modified(self, value: DOMString) { - *self.last_modified.deref().borrow_mut() = Some(value); + *self.last_modified.borrow_mut() = Some(value); } fn set_encoding_name(self, name: DOMString) { - *self.encoding_name.deref().borrow_mut() = name; + *self.encoding_name.borrow_mut() = name; } fn content_changed(self) { @@ -213,7 +212,7 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { fn unregister_named_element(self, to_unregister: JSRef<Element>, id: Atom) { - let mut idmap = self.idmap.deref().borrow_mut(); + let mut idmap = self.idmap.borrow_mut(); let is_empty = match idmap.find_mut(&id) { None => false, Some(elements) => { @@ -240,7 +239,7 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { }); assert!(!id.as_slice().is_empty()); - let mut idmap = self.idmap.deref().borrow_mut(); + let mut idmap = self.idmap.borrow_mut(); // FIXME https://github.com/mozilla/rust/issues/13195 // Use mangle() when it exists again. @@ -309,7 +308,7 @@ impl Document { node: Node::new_without_doc(DocumentNodeTypeId), reflector_: Reflector::new(), window: JS::from_rooted(window), - idmap: Traceable::new(RefCell::new(HashMap::new())), + idmap: RefCell::new(HashMap::new()), implementation: Default::default(), content_type: match content_type { Some(string) => string.clone(), @@ -320,12 +319,12 @@ impl Document { NonHTMLDocument => "application/xml".to_string() } }, - last_modified: Traceable::new(RefCell::new(None)), - url: Untraceable::new(url), + last_modified: RefCell::new(None), + url: url, // http://dom.spec.whatwg.org/#concept-document-quirks - quirks_mode: Untraceable::new(Cell::new(NoQuirks)), + quirks_mode: Cell::new(NoQuirks), // http://dom.spec.whatwg.org/#concept-document-encoding - encoding_name: Traceable::new(RefCell::new("utf-8".to_string())), + encoding_name: RefCell::new("utf-8".to_string()), is_html_document: is_html_document == HTMLDocument, images: Default::default(), embeds: Default::default(), @@ -419,7 +418,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { // http://dom.spec.whatwg.org/#dom-document-compatmode fn CompatMode(self) -> DOMString { - match self.quirks_mode.deref().get() { + match self.quirks_mode.get() { LimitedQuirks | NoQuirks => "CSS1Compat".to_string(), FullQuirks => "BackCompat".to_string() } @@ -427,7 +426,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { // http://dom.spec.whatwg.org/#dom-document-characterset fn CharacterSet(self) -> DOMString { - self.encoding_name.deref().borrow().as_slice().to_ascii_lower() + self.encoding_name.borrow().as_slice().to_ascii_lower() } // http://dom.spec.whatwg.org/#dom-document-content_type @@ -474,7 +473,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { // http://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid fn GetElementById(self, id: DOMString) -> Option<Temporary<Element>> { let id = Atom::from_slice(id.as_slice()); - match self.idmap.deref().borrow().find(&id) { + match self.idmap.borrow().find(&id) { None => None, Some(ref elements) => Some(Temporary::new((*elements)[0].clone())), } diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index ca4a682712b..c86c3215581 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -1412,7 +1412,7 @@ impl Node { DocumentNodeTypeId => { let node_doc: JSRef<Document> = DocumentCast::to_ref(node).unwrap(); let copy_doc: JSRef<Document> = DocumentCast::to_ref(*copy).unwrap(); - copy_doc.set_encoding_name(node_doc.encoding_name.deref().borrow().clone()); + copy_doc.set_encoding_name(node_doc.encoding_name.borrow().clone()); copy_doc.set_quirks_mode(node_doc.quirks_mode()); }, ElementNodeTypeId(..) => { |