Auto merge of #6529 - dwins:master, r=Manishearth

Refactor #[jstraceable] to #[derive(JSTraceable)]

fixes #6524.  I had to make an additional change not mentioned in the ticket - adding the `#[feature]` to enable deriving custom traits but I assume that's expected at this time.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6529)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-07-01 18:27:40 -06:00
commit bbb39082e0
51 changed files with 97 additions and 137 deletions

View file

@ -22,7 +22,7 @@ pub trait CollectionFilter : JSTraceable {
fn filter<'a>(&self, elem: &'a Element, root: &'a Node) -> bool;
}
#[jstraceable]
#[derive(JSTraceable)]
#[must_root]
pub enum CollectionTypeId {
Static(Vec<JS<Element>>),
@ -57,7 +57,7 @@ impl HTMLCollection {
fn all_elements(window: &Window, root: &Node,
namespace_filter: Option<Namespace>) -> Root<HTMLCollection> {
#[jstraceable]
#[derive(JSTraceable)]
struct AllElementFilter {
namespace_filter: Option<Namespace>
}
@ -79,7 +79,7 @@ impl HTMLCollection {
return HTMLCollection::all_elements(window, root, None);
}
#[jstraceable]
#[derive(JSTraceable)]
struct TagNameFilter {
tag: Atom,
ascii_lower_tag: Atom,
@ -110,7 +110,7 @@ impl HTMLCollection {
if tag == "*" {
return HTMLCollection::all_elements(window, root, namespace_filter);
}
#[jstraceable]
#[derive(JSTraceable)]
struct TagNameNSFilter {
tag: Atom,
namespace_filter: Option<Namespace>
@ -135,7 +135,7 @@ impl HTMLCollection {
pub fn by_class_name(window: &Window, root: &Node, classes: DOMString)
-> Root<HTMLCollection> {
#[jstraceable]
#[derive(JSTraceable)]
struct ClassNameFilter {
classes: Vec<Atom>
}
@ -153,7 +153,7 @@ impl HTMLCollection {
}
pub fn children(window: &Window, root: &Node) -> Root<HTMLCollection> {
#[jstraceable]
#[derive(JSTraceable)]
struct ElementChildFilter;
impl CollectionFilter for ElementChildFilter {
fn filter(&self, elem: &Element, root: &Node) -> bool {