LeonOS Documentation

Browser and litehtml Porting Notes

LeonOS now ships browser.elf, a classic IE-style browser shell. Upstream litehtml is present as a Git submodule under third_party/litehtml; the browser currently links a freestanding C litehtml_core adapter while the full C++ litehtml runtime prerequisites are still being built.

Current Browser

userland/apps/browser/main.c is a freestanding C application that uses the existing GUI, libc, launch, filesystem, and network ABIs.

Current features:

Current limits:

The repository owns the font build inputs: system/fonts/times.ttf is copied to /usr/share/fonts/leonos/times-new-roman.ttf, and system/fonts/simsun.ttc is packaged as /usr/share/fonts/leonos/simsun.ttc. Local and GitHub Actions builds use these same repository files.

litehtml Status

Upstream litehtml is checked out as:

The current upstream tree is C++ and depends heavily on STL types and library facilities such as strings, vectors, maps, smart pointers, variants, algorithms, and bundled Gumbo parser support. LeonOS userland is still freestanding C with a small libc and no C++ runtime or STL build path.

Because of that, the browser app currently owns a small C core with a deliberately narrow surface. The replacement point is the document layout layer: URL loading, navigation history, window chrome, status reporting, and launch integration should remain useful when the full C++ litehtml container becomes available.

Next Porting Steps

To integrate real litehtml, do these in order:

  1. Add a userland C++ build mode to the GNU Make build system (mk/userland.mk and the component graph).
  2. Provide a minimal C++ runtime surface for constructors, destructors, allocation, exceptions-disabled builds, and required ABI helpers.
  3. Port or provide an STL subset/libc++ profile that satisfies litehtml.
  4. Build Gumbo and upstream litehtml as userland libraries from third_party/litehtml.
  5. Replace litehtml_core.c with a LeonOS litehtml container that maps text measurement, drawing, colors, clipping, mouse hit testing, and file/network resource fetches to the existing GUI and network APIs.
  6. Keep the browser shell, navigation, address bar, history, and app-launch integration stable while swapping the document engine.

User Integration

The browser is registered as:

Download and image companion apps are registered as:

The generated icon is /usr/lib/leonos/apps/browser/browser.bmp, following the existing same-directory/same-basename application icon convention.