Implement CanvasRenderingContext2D.canvas.

This commit is contained in:
Tetsuharu OHZEKI 2014-08-06 22:02:47 +09:00
parent e942cd901e
commit 58d5438670
3 changed files with 13 additions and 6 deletions

View file

@ -85,7 +85,7 @@ impl<'a> HTMLCanvasElementMethods for JSRef<'a, HTMLCanvasElement> {
if self.context.get().is_none() {
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), 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))