getMaximumSize(element, width, height, aspectRatio) {
    width = Math.max(0, width || element.width);
    height = height || element.height;
    return {
      width,
      height: Math.max(0, aspectRatio ? Math.floor(width / aspectRatio) : height)
    };
  }
Returns the maximum size in pixels of given canvas element.
@param {HTMLCanvasElement} element
@param {number} [width] - content width of parent element
@param {number} [height] - content height of parent element
@param {number} [aspectRatio] - aspect ratio to maintain