diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2016-09-27 15:30:55 +0200 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2016-10-04 13:45:58 +0200 |
commit | aeb3efda1ff7a386b49ef341d321cc93c3980a6b (patch) | |
tree | 3d81f89ed374f2270ca43b18e3bfc66ffc26e213 /components/script/dom/document.rs | |
parent | 29c72d15a943386ee2f3130fbe741b0457cb52e5 (diff) | |
download | servo-aeb3efda1ff7a386b49ef341d321cc93c3980a6b.tar.gz servo-aeb3efda1ff7a386b49ef341d321cc93c3980a6b.zip |
Make script build without `impl<T: HeapSizeOf> HeapSizeOf for Arc<T>`.
The removal of this impl is not included in this commit.
CC https://github.com/servo/heapsize/issues/37#issuecomment-249861171
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r-- | components/script/dom/document.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 1b91e743a78..31c4267f915 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -146,6 +146,14 @@ enum ParserBlockedByScript { Unblocked, } +#[derive(JSTraceable, HeapSizeOf)] +#[must_root] +struct StylesheetInDocument { + node: JS<Node>, + #[ignore_heap_size_of = "Arc"] + stylesheet: Arc<Stylesheet>, +} + // https://dom.spec.whatwg.org/#document #[dom_struct] pub struct Document { @@ -174,7 +182,7 @@ pub struct Document { anchors: MutNullableHeap<JS<HTMLCollection>>, applets: MutNullableHeap<JS<HTMLCollection>>, /// List of stylesheets associated with nodes in this document. |None| if the list needs to be refreshed. - stylesheets: DOMRefCell<Option<Vec<(JS<Node>, Arc<Stylesheet>)>>>, + stylesheets: DOMRefCell<Option<Vec<StylesheetInDocument>>>, /// Whether the list of stylesheets has changed since the last reflow was triggered. stylesheets_changed_since_reflow: Cell<bool>, ready_state: Cell<DocumentReadyState>, @@ -1891,13 +1899,16 @@ impl Document { node.get_stylesheet() } else { None - }.map(|stylesheet| (JS::from_ref(&*node), stylesheet)) + }.map(|stylesheet| StylesheetInDocument { + node: JS::from_ref(&*node), + stylesheet: stylesheet + }) }) .collect()); }; } self.stylesheets.borrow().as_ref().unwrap().iter() - .map(|&(_, ref stylesheet)| stylesheet.clone()) + .map(|s| s.stylesheet.clone()) .collect() } |