News for hackers. Stuff that matters.
Re:Google Docs will now use canvas based rendering by dmitriid on Wednesday May 12, 2021 @10:28AM (#27130730)
No, it can't be done in HTML+CSS in a performant way.
Re:Google Docs will now use canvas based rendering by strogonoff on Wednesday May 12, 2021 @11:06AM (#27131221)
VS Code feels performant enough, with its complex functionality IMO exceeding Google Docs, and yet I don't think it is using canvas. I believe it comes down to strategic design that avoids unnecessary layout and reflow events in the UI.

That said, the UI of VS Code (the desktop app) only needs to run in Chromium. And generally Google Docs could be a different enough beast that it can’t take advantage of the same tricks—hard to say from the outside.

Re:Google Docs will now use canvas based rendering by dmitriid on Wednesday May 12, 2021 @03:13PM (#27134041)
> VS Code feels performant enough, with its complex functionality

VS Code has an entire dedicated team that only works on VS Code. They can spend resources on trying any trick in the book to make something performant. Whenever actual performance is required, well, they ditch DOM and go for canvas: https://code.visualstudio.com/blogs/2017/10/03/terminal-rend...

And while sufficiently complex, it actually displays significantly less complex information than required by a regular document that will have any number of fonts, layouts, inline images and tables, references to other documents, etc.

> I believe it comes down to strategic design that avoids unnecessary layout and reflow events in the UI.

Yup. And it's nearly impossible to do any amount of "strategic design" because if you as much as glance at a document, it will repaint and reflow: https://csstriggers.com

Re:Google Docs will now use canvas based rendering by d-yakovlev on Wednesday May 12, 2021 @11:47AM (#27131681)
some of VS Code has been canvas-based since 2017 - https://code.visualstudio.com/blogs/2017/10/03/terminal-rend...
Re:Google Docs will now use canvas based rendering by strogonoff on Wednesday May 12, 2021 @11:53AM (#27131752)
I stand corrected, seems like they’re using canvas for at least the integrated terminal and maybe (?) the editor. Makes all the more sense for Google Docs to follow suit. I’m not against apps moving entirely to canvas by the way, as long as the regular non-webapp sites don’t start doing this just because they can.
Re:Google Docs will now use canvas based rendering by Tyriar on Wednesday May 12, 2021 @01:24PM (#27132822)
The editor is all DOM based apart from the minimap. More pixels could definitely be pushed faster by re-writing it in canvas but it would be quite the undertaking when you consider accessibility, backwards compatibility, monaco extensibility, etc. with the end result just being a improved scrolling experience.
Re:Google Docs will now use canvas based rendering by mvolfik on Wednesday May 12, 2021 @12:09PM (#27131936)
but VS code still only has to support monospaced code + some popups and sidebars, not mix-and-match of font and all its variants in all complex layouts, line heights, paragraph spaces, column layouts, images including float etc etc