How to put the border inside the canvas, so it is not expanded by the border:
<canvas width="50" height="50" style="border: 10px solid black"></canvas>
is much bigger than
<canvas width="50" height="50" style="border: 1px solid black"></canvas>
box-sizing: border-box;
doesn't help in this case
Please not that the canvas I am using is rectangular and its shape is not controlled via JavaScript.