0

I recently started a project for an experimental web browser built in Rust, but I didn't want to build the renderer, so I wanted to use webrender.

I wanted to ask if anybody can explain to me how to use webrender to render an HTML document and how to render it onto a window (the window is managed by winit and the OpenGL APIs are used via glutin)

genpfault
  • 51,148
  • 11
  • 85
  • 139
dj_tech
  • 13
  • 1

1 Answers1

1

Rendering web pages requires first parsing HTML, CSS, and even javascript loading and execution, while WebRender is only a rendering engine, it is a component of Servo Browser, so it needs to be used in conjunction with Servo Browser.

If you need a more streamlined browser, you can trim down the Servo source code.

Jinlei Li
  • 240
  • 6
  • Thanks for the response; I already wrote the majority of the part of the browser that runs JavaScript (it embeds JavaScriptCore, so now the missing parts are how to load the js code from the page and DOM APIs). I tried analyzing the code of `Servo`, but I finded it too hard for my current skillset. If you can give me any tips on how to trim down the source code of `Servo`, you would help me out magiorly. – dj_tech Jan 01 '23 at 20:26
  • I'm sorry, I just know what webrender is, and not familiar with the servo code – Jinlei Li Jan 02 '23 at 03:17
  • @dj_tech I think webrender is a system for rendering a bunch of rectangles in a really efficient way. If you look at the examples they are all about rectangles and a few other things like shadows. So your browser has to calculate the rectangles that make up the web page. That is 98% of the work. Then webrender does the last 2% which is to render them really efficiently and render some things like shadows and gradients. I don't know why you insist on using it when it only does 2% of what you want. – user253751 Jan 03 '23 at 01:58
  • @dj_tech I don't know why you think javascript is the majority of a browser. It's not. HTML and CSS is the main part of a browser. – user253751 Jan 03 '23 at 02:01