# hylmithecoder/win32-x11-browser architecture

> Architecture diagram of the GitHub repository hylmithecoder/win32-x11-browser, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hylmithecoder/win32-x11-browser
- Repository: https://github.com/hylmithecoder/win32-x11-browser

## Overview

DesktopWebview is a C++ desktop browser engine. Its main workflow is navigation from the browser UI: Browser fetches a URL or file, parses HTML, computes styles and layout, then paints a page for the native window. The README also documents JavaScript/DOM integration, lazy PDF rendering, media playback, form controls, and accelerated rendering. The graph follows documented capabilities where source excerpts were unavailable; arrows are limited to documented flow and sampled calls.

Main entry points: [`src/core/Browser.cpp`](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/core/Browser.cpp) (Browser and navigation), [`src/css/Paint.cpp`](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/css/Paint.cpp) (Paint and canvas), [`src/core/BaseWindow.cpp`](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/core/BaseWindow.cpp) (Native window), [`src/main.cpp`](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/main.cpp) (Application wiring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Browser app"]
  node_main["Application wiring<br/>[main.cpp]"]
  node_window["Native window<br/>[BaseWindow.cpp]"]
  node_browser["Browser and navigation<br/>[Browser.cpp]"]
  node_network["Network and files<br/>[Net.cpp]"]
  node_cache[("Resource cache<br/>[Cache.cpp]")]
  node_vulkan["Vulkan surface<br/>[BaseWindow.cpp]"]
end

subgraph group_page["Page rendering"]
  node_dom["HTML DOM parser<br/>[Wrapper.cpp]"]
  node_css["CSS cascade<br/>[Css.cpp]"]
  node_cssvars["CSS variables"]
  node_layout["Layout engine<br/>[Layout.cpp]"]
  node_paint["Paint and canvas<br/>[Paint.cpp]"]
  node_image["Image resources<br/>[Image.cpp]"]
  node_forms["Form controls<br/>[Input.cpp]"]
  node_opencl["OpenCL acceleration<br/>[Optimizer.cpp]"]
end

subgraph group_runtime["Execution"]
  node_javascript["JavaScript engine<br/>[JsEngine.cpp]"]
end

subgraph group_media["Media and documents"]
  node_pdf["Lazy PDF engine<br/>[Pdf.cpp]"]
  node_video["Video decoding<br/>[Video.cpp]"]
  node_audio["Audio playback<br/>[AudioPlayer.cpp]"]
end

node_user(("User"))

node_user -->|"launches"| node_main
node_main -->|"creates and navigates"| node_browser
node_main -->|"wires callbacks"| node_window
node_window -->|"dispatches input"| node_browser
node_browser -->|"fetches resources"| node_network
node_browser -->|"parses HTML"| node_dom
node_browser -->|"computes styles"| node_css
node_browser -->|"computes layout"| node_layout
node_browser -->|"renders page"| node_paint
node_cssvars -->|"resolves variables"| node_css
node_layout -->|"resolves custom properties"| node_cssvars
node_browser -->|"executes scripts"| node_javascript
node_javascript -->|"DOM bridge"| node_dom
node_layout -->|"renders controls"| node_forms
node_paint -->|"composites images"| node_image
node_browser -->|"loads PDF pages"| node_pdf
node_pdf -->|"renders page content"| node_paint
node_browser -->|"loads video"| node_video
node_video -->|"provides frames"| node_paint
node_video -->|"outputs audio"| node_audio
node_browser -.->|"caches resources"| node_cache
node_paint -->|"presents canvas"| node_window
node_window -.->|"presents via GPU"| node_vulkan
node_paint -.->|"accelerates processing"| node_opencl

click node_main "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/main.cpp"
click node_window "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/core/BaseWindow.cpp"
click node_browser "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/core/Browser.cpp"
click node_network "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/network/Net.cpp"
click node_dom "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/core/Wrapper.cpp"
click node_css "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/css/Css.cpp"
click node_cssvars "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/css/HandlerCssVariable.cpp"
click node_layout "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/layout/Layout.cpp"
click node_paint "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/css/Paint.cpp"
click node_image "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/layout/Image.cpp"
click node_forms "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/elements/Input.cpp"
click node_javascript "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/js/JsEngine.cpp"
click node_pdf "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/documents/Pdf.cpp"
click node_video "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/multimedia/Video.cpp"
click node_audio "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/multimedia/AudioPlayer.cpp"
click node_cache "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/storage/Cache.cpp"
click node_vulkan "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/core/BaseWindow.cpp"
click node_opencl "https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/core/Optimizer.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_window,node_browser,node_network,node_cache,node_vulkan,node_user toneBlue
class node_dom,node_css,node_cssvars,node_layout,node_paint,node_image,node_forms,node_opencl toneAmber
class node_javascript toneMint
class node_pdf,node_video,node_audio toneRose
```

## Components

### Browser app

- [Application wiring](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/main.cpp): `src/main.cpp`
- [Native window](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/core/BaseWindow.cpp): `src/core/BaseWindow.cpp`
- [Browser and navigation](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/core/Browser.cpp): `src/core/Browser.cpp`
- [Network and files](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/network/Net.cpp): `src/network/Net.cpp`
- [Resource cache](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/storage/Cache.cpp): `src/storage/Cache.cpp`
- [Vulkan surface](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/core/BaseWindow.cpp): `src/core/BaseWindow.cpp`

### Page rendering

- [HTML DOM parser](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/core/Wrapper.cpp): `src/core/Wrapper.cpp`
- [CSS cascade](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/css/Css.cpp): `src/css/Css.cpp`
- [CSS variables](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/css/HandlerCssVariable.cpp): `src/css/HandlerCssVariable.cpp`
- [Layout engine](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/layout/Layout.cpp): `src/layout/Layout.cpp`
- [Paint and canvas](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/css/Paint.cpp): `src/css/Paint.cpp`
- [Image resources](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/layout/Image.cpp): `src/layout/Image.cpp`
- [Form controls](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/elements/Input.cpp): `src/elements/Input.cpp`
- [OpenCL acceleration](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/core/Optimizer.cpp): `src/core/Optimizer.cpp`

### Execution

- [JavaScript engine](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/js/JsEngine.cpp): `src/js/JsEngine.cpp`

### Media and documents

- [Lazy PDF engine](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/documents/Pdf.cpp): `src/documents/Pdf.cpp`
- [Video decoding](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/multimedia/Video.cpp): `src/multimedia/Video.cpp`
- [Audio playback](https://github.com/hylmithecoder/win32-x11-browser/blob/master/src/multimedia/AudioPlayer.cpp): `src/multimedia/AudioPlayer.cpp`

### Other components

- **User**

## Connections

- User → Application wiring: launches
- Application wiring → Browser and navigation: creates and navigates
- Application wiring → Native window: wires callbacks
- Native window → Browser and navigation: dispatches input
- Browser and navigation → Network and files: fetches resources
- Browser and navigation → HTML DOM parser: parses HTML
- Browser and navigation → CSS cascade: computes styles
- Browser and navigation → Layout engine: computes layout
- Browser and navigation → Paint and canvas: renders page
- CSS variables → CSS cascade: resolves variables
- Layout engine → CSS variables: resolves custom properties
- Browser and navigation → JavaScript engine: executes scripts
- JavaScript engine → HTML DOM parser: DOM bridge
- Layout engine → Form controls: renders controls
- Paint and canvas → Image resources: composites images
- Browser and navigation → Lazy PDF engine: loads PDF pages
- Lazy PDF engine → Paint and canvas: renders page content
- Browser and navigation → Video decoding: loads video
- Video decoding → Paint and canvas: provides frames
- Video decoding → Audio playback: outputs audio
- Browser and navigation → Resource cache: caches resources
- Paint and canvas → Native window: presents canvas
- Native window → Vulkan surface: presents via GPU
- Paint and canvas → OpenCL acceleration: accelerates processing
