getting width/height conditionally on passed in canvas element