HTML canvas grows with each redraw with resize:false if there is no CSS styling
It seems that if there is no CSS styling applied to the given canvas element, Vgr_htmlc can cause the canvas to grow with every redraw when ~resize:false. I'm not sure how much of a real-world problem this is considering users would be expected to always have styling, but I noticed this while developing on a minimalist web page. Adding CSS height and width styles fixed it for me.
I think an additional warning in the docs would probably be sufficient if there is not a better fix available.
I just did some additional testing, and this issue seems to be also related to the device pixel ratio. If the DPR is 1 then the canvas does not grow on each redraw, but if the DPR is 2 or higher then it does.
Yeah this stuff is brittle, I can't remember the number of times I had problems with auto growing canvases. I don't have the stuff in my head but the only thing that this influences is here.
Perhaps the bound_h and bound_w need to be divided by Brr.Window.device_pixel_ratio? I haven't tested that but it seems to make sense based on my observations.
Note if you have a simple repro using the blueprint https://github.com/dbuenzli/vg/blob/master/test/min_htmlc.ml it will increase the chances that I look into it at some point.