Live data from Hacker News

Google Docs will now use canvas based rendering

workspaceupdates.googleblog.com

511–520 of 953 posts

Re: Google Docs will now use canvas based rendering

#511

Maybe because I am out of loop with web development, but this sounds like a huge change to me. So instead of HTML elements, there will be just one big element, and everything will be rendered there? How will text selection work for example? Will Google Docs basically implement a GUI library like GTK, which renders everything itself, but for the web?

Yup, afaik Flutter web is already rendering its components in canvas instead of DOM [1]. Text selection works, but kinda jarring and opt-in instead of opt-out. If the developer forgot to enable text selection in an element then the user can't select and copy the text in that element at all. It might be an indicator that google will continue with this approach going forward. [1] https://flutter.dev/web

so the bigger story is... is Google Docs switching to Flutter Web? is that what's going on here?

Re: Google Docs will now use canvas based rendering

#512
post #485
post #433

Earlier quoted context omitted.

Thank you for articulating this. For the last decade we have had frontend developers trying to force the web to be an app delivery platform. We have bent over backwards to accommodate this. We have turned browsers into a giant pile of hacks essentially emulating their own operating systems. And for what? As soon as they're able, they say oh, the browser is a giant bundle of hacks now, let's implement our own app deli…

So, because you don't want binary blobs to be deployed over the web, you would like users to download and install binary blob native applications... And that makes things better in what way, for whom, exactly?

Let's start with accessibility, because this is a field I am forced to be an expert in. Native "binary blobs" have access to the operating system accessibility APIs, and consequently any native app is a lot more likely to be accessible out of the box than something rendered to a canvas. People have spent literally decades building out APIs for the native platforms [0] [1] [2].

To think that a native app is equivalent to a canvas-rendered app is to not understand either.

[0] https://en.wikipedia.org/wiki/Microsoft_Active_Accessibility

[1] https://en.wikipedia.org/wiki/IAccessible2

[2] https://en.wikipedia.org/wiki/Assistive_Technology_Service_P...

Re: Google Docs will now use canvas based rendering

#513
post #86

(googler, opinions are my own. I know nothing about this project). I really hope this fixes the large-document problem. As someone that has to deal with large specs (1000+ page MS Word documents), Google Docs does a not-so-great job of handling them. I also understand this is why many writers don't like Google Docs to write the entire book in, as things start slowing down when you get into the hundreds-of-pages. I do…

Switching to canvas sounds like a very roundabout way to handle an issue related to the dom growing out of hand. Surely unmounting pages that you you're not currently looking at should work? Of course there could be many reasons but we're left to speculate...

You can ditch the off-screen rendered pages but you are still stuck with the entire 1000-page data structure. Should your current line be on page 997 or 998? You have to calculate the size of every line of every page to answer that.

Re: Google Docs will now use canvas based rendering

#514
post #99

Ever since WebAssembly was first introduced, I thought it was obvious[1][2] that the end game for those that want to control the web is sending opaque binary blobs of code that only use the browser for the canvas tag's framebuffer. Font rendering and layout can all easily be accomplished by embedding libraries like freetype. This breaks all forms of user control - like ad blockers - and turns the web back into cable…

> Font rendering and layout can all easily be accomplished by embedding libraries like freetype.

Perhaps it's not so simple if you want the GPU to do the rendering.

Re: Google Docs will now use canvas based rendering

#515
post #367

So we're building binaries, to run them in WASM, that's running in JavaScript, which is running in browser, that is written in C++ .. is that what we're doing now?

Obligatory reference to The Birth and Death of Javascript: https://www.destroyallsoftware.com/talks/the-birth-and-death...

Re: Google Docs will now use canvas based rendering

#516
post #86

(googler, opinions are my own. I know nothing about this project). I really hope this fixes the large-document problem. As someone that has to deal with large specs (1000+ page MS Word documents), Google Docs does a not-so-great job of handling them. I also understand this is why many writers don't like Google Docs to write the entire book in, as things start slowing down when you get into the hundreds-of-pages. I do…

Virtual DOM is already a thing. I'm sure canvas has a ton of advantages, but memory management isn't one of them.

Re: Google Docs will now use canvas based rendering

#517
post #366

Earlier quoted context omitted.

Here's an article that talks about the switch to canvas for VS Code. The "5 to 45" times faster part really sticks out to me. Kind of surprised it took Google this long to do this with Docs. https://code.visualstudio.com/blogs/2017/10/03/terminal-rend...

I personally didn't even bother checking out VS code because it was based on electron, and so I figured the performance just wouldn't be there because it's doing all of this awkward web stuff while trying to be an IDE. I was completely wrong though. Using it, it really doesn't feel like a web app at all. It's really shocking and impressive. It feels like a text editor. Perhaps I should learn more about what they're d…

The major problem I have with electron apps is that they eat memory for breakfast, lunch, and dinner.

This happens with jvm applications as well, but you can limit the max heap size and force the garbage collector to work more, trading off speed for the ability to run more apps side by side.

AFAIK, you can't limit the memory used in electron apps, and they don't respond by sharing heap with their child processes. With enough extensions to make it usable, vscode easily eats GB of memory.

I like lsp. But I don't need vscode to do the rendering.

Re: Google Docs will now use canvas based rendering

#518

Earlier quoted context omitted.

Treating the web browser like a VNC terminal, a way to push pixels, is just a vile degredation of the web. The web is not applications. People view the web via a user-agent, a tool that let's them navigate & view hypertext as they want. Breaking away from hypertext, pushing images in people's faces: it's not the web. It's an assault, a great step backwards. It's an attack on the internet. Absolutely people are defini…

> The web is not applications Unfortunately, all the people who work on the web disagree. They need what could be a simple, text based site into a full blown "application" to justify their own job.

The web can do programmatic, interactive systems very well. In my opinion, it does it much much better than applications. And it should be doing it. (Alas, a huge huge huge amount of web applications don't espouse the virtues of the web, don't use url based routing, don't have good service worker caching, & countless other horrific faults. I continue to see that as not the web's fault but I think there's a lot of room for opinions on this, at least.)

But interactive web systems shouldn't regress to the hostile, anti-user, anti-extensibility stance of an application. It should continue to offer the upsides of being the web.

Re: Google Docs will now use canvas based rendering

#520
post #385

Earlier quoted context omitted.

Many developers work on removing the user's choice (not) to see ads. But the pesky open nature of the web gets in the way.

I don’t think the open nature of the web gets in the way. Those developers could quite easily generate a screenshot of the website they’re building and ship the screenshot instead of the HTML/CSS/JS.

They could... except:

a) It would be completely inaccessible to blind users;

b) Sometimes devs want to be able to give users some choice, like copying text, and this is impossible with your proposed method.

These two reasons alone mean it's undesirable for devs to use these, and they're problems that Canvas addresses - albeit by letting the devs have that choice, but not the users.

Post reply on HN