Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub fn new_inherited(height: u64, width: u64, placeholder: Option<&HTMLCanvasElement>) -> OffscreenCanvas {
- OffscreenCanvas {
- reflector_: Reflector::new(),
- height: height,
- width: width,
- context: DomRefCell::new(None),
- placeholder: placeholder,
- }
- }
- pub fn new(global: &GlobalScope, height: u64, width: u64, placeholder: Option<&HTMLCanvasElement>) -> DomRoot<OffscreenCanvas> {
- reflect_dom_object(Box::OffscreenCanvas::new_inherited(), global, OffscreenCanvas::Bindings::Wrap)
- }
- pub fn Constructor (global: &GlobalScope, height: u64, width: u64) -> Fallible<DomRoot<OffscreenCanvas>> {
- //step 1
- let offscreencanvas = OffscreenCanvas::new(global,height,width);
- //step 2
- if(offscreencanvas.context.is_some()){
- return Err(Error::InvalidState);
- }
- //offscreencanvas.height = height;
- //offscreencanvas.width = width;
- if(offscreencanvas.placeholder.is_null()) {
- offscreencanvas.placeholder = ptr::null();
- }
- else {
- //offscreencanvas.placeholder = &self.placeholder;
- }
- //step 3
- Ok(offscreencanvas);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement