can3p → Serenity

Thu, 17 Aug 2023 00:12

Some hints in the first video on ladybird browser - https://www.youtube.com/watch?v=X38MTKHt3_I

What web engine does is it generates a bitmap given the html it loaded and parsed given the view port dimensions and that's all to it. The rendering engine uses a layout tree that was built during the parsing phase to actually render content in the image.

Now, the rendered content has to be put in the window somehow and that has to be hooked up with QT. That works with Webview class inheriting from QAbstractScrollArea and that one in turn allows to right the behavior for all kinds of nice events including paintEvent which is used to take the bitmap from the engine and render it on the window. How qt does that? No idea, most probably it has it's own render tree for all the widgets and this is where paintEvent stems from. Inside of it Andreas uses QPainter class and that one probably knows how to actually put stuff into graphics memory

Dabdab.org (c) 2022 — 2023, hi@dabdab.org / Contact us / Twitter