More progress in the &JSRef -> JSRef conversion

Change all of the <Class>Methods traits to take `self` instead of
`&self`.
This commit is contained in:
Cameron Zwarich 2014-09-19 01:32:30 -07:00
parent 2adc594e5d
commit 2c8d51a37c
66 changed files with 812 additions and 815 deletions

View file

@ -61,33 +61,33 @@ impl HTMLCanvasElement {
}
impl<'a> HTMLCanvasElementMethods for JSRef<'a, HTMLCanvasElement> {
fn Width(&self) -> u32 {
fn Width(self) -> u32 {
self.width.get()
}
fn SetWidth(&self, width: u32) {
let elem: JSRef<Element> = ElementCast::from_ref(*self);
fn SetWidth(self, width: u32) {
let elem: JSRef<Element> = ElementCast::from_ref(self);
elem.set_uint_attribute("width", width)
}
fn Height(&self) -> u32 {
fn Height(self) -> u32 {
self.height.get()
}
fn SetHeight(&self, height: u32) {
let elem: JSRef<Element> = ElementCast::from_ref(*self);
fn SetHeight(self, height: u32) {
let elem: JSRef<Element> = ElementCast::from_ref(self);
elem.set_uint_attribute("height", height)
}
fn GetContext(&self, id: DOMString) -> Option<Temporary<CanvasRenderingContext2D>> {
fn GetContext(self, id: DOMString) -> Option<Temporary<CanvasRenderingContext2D>> {
if id.as_slice() != "2d" {
return None;
}
if self.context.get().is_none() {
let window = window_from_node(*self).root();
let window = window_from_node(self).root();
let (w, h) = (self.width.get() as i32, self.height.get() as i32);
let context = CanvasRenderingContext2D::new(&Window(*window), *self, Size2D(w, h));
let context = CanvasRenderingContext2D::new(&Window(*window), self, Size2D(w, h));
self.context.assign(Some(context));
}
self.context.get().map(|context| Temporary::new(context))