Make the traits for the IDL interfaces take &self

This commit is contained in:
Anthony Ramine 2015-08-27 22:15:54 +02:00
parent 856fda7f2e
commit 709d347872
99 changed files with 1192 additions and 1192 deletions

View file

@ -59,9 +59,9 @@ impl DOMTokenList {
}
// https://dom.spec.whatwg.org/#domtokenlist
impl<'a> DOMTokenListMethods for &'a DOMTokenList {
impl DOMTokenListMethods for DOMTokenList {
// https://dom.spec.whatwg.org/#dom-domtokenlist-length
fn Length(self) -> u32 {
fn Length(&self) -> u32 {
self.attribute().map(|attr| {
let attr = attr.r();
attr.value().tokens().map(|tokens| tokens.len()).unwrap_or(0)
@ -69,7 +69,7 @@ impl<'a> DOMTokenListMethods for &'a DOMTokenList {
}
// https://dom.spec.whatwg.org/#dom-domtokenlist-item
fn Item(self, index: u32) -> Option<DOMString> {
fn Item(&self, index: u32) -> Option<DOMString> {
self.attribute().and_then(|attr| {
let attr = attr.r();
attr.value().tokens().and_then(|tokens| {
@ -79,7 +79,7 @@ impl<'a> DOMTokenListMethods for &'a DOMTokenList {
}
// https://dom.spec.whatwg.org/#dom-domtokenlist-contains
fn Contains(self, token: DOMString) -> Fallible<bool> {
fn Contains(&self, token: DOMString) -> Fallible<bool> {
self.check_token_exceptions(&token).map(|token| {
self.attribute().map(|attr| {
let attr = attr.r();
@ -93,7 +93,7 @@ impl<'a> DOMTokenListMethods for &'a DOMTokenList {
}
// https://dom.spec.whatwg.org/#dom-domtokenlist-add
fn Add(self, tokens: Vec<DOMString>) -> ErrorResult {
fn Add(&self, tokens: Vec<DOMString>) -> ErrorResult {
let element = self.element.root();
let mut atoms = element.r().get_tokenlist_attribute(&self.local_name);
for token in &tokens {
@ -107,7 +107,7 @@ impl<'a> DOMTokenListMethods for &'a DOMTokenList {
}
// https://dom.spec.whatwg.org/#dom-domtokenlist-remove
fn Remove(self, tokens: Vec<DOMString>) -> ErrorResult {
fn Remove(&self, tokens: Vec<DOMString>) -> ErrorResult {
let element = self.element.root();
let mut atoms = element.r().get_tokenlist_attribute(&self.local_name);
for token in &tokens {
@ -121,7 +121,7 @@ impl<'a> DOMTokenListMethods for &'a DOMTokenList {
}
// https://dom.spec.whatwg.org/#dom-domtokenlist-toggle
fn Toggle(self, token: DOMString, force: Option<bool>) -> Fallible<bool> {
fn Toggle(&self, token: DOMString, force: Option<bool>) -> Fallible<bool> {
let element = self.element.root();
let mut atoms = element.r().get_tokenlist_attribute(&self.local_name);
let token = try!(self.check_token_exceptions(&token));
@ -146,13 +146,13 @@ impl<'a> DOMTokenListMethods for &'a DOMTokenList {
}
// https://dom.spec.whatwg.org/#stringification-behavior
fn Stringifier(self) -> DOMString {
fn Stringifier(&self) -> DOMString {
let tokenlist = self.element.root().r().get_tokenlist_attribute(&self.local_name);
str_join(&tokenlist, "\x20")
}
// check-tidy: no specs after this line
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<DOMString> {
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<DOMString> {
let item = self.Item(index);
*found = item.is_some();
item