Skip to content

Wuelle/Stormlicht

Repository files navigation

rustfmt

The outline of a hurricane lamp.

1. Stormlicht

Stormlicht is an experimental browser engine written from scratch.
If you want to follow the development, you can visit #stormlicht:matrix.org

1.1. Design goals

I strive for Correctness, Performance and Safety, in that order.

This is also a "for fun" project, so I do try and implement as much of the functionality as possible without relying on third party crates. The engine implements its own font rendering, http stack and image parsing, among other things.

Despite being a "hobby project", Stormlicht is making good progress and has already helped fix bugs in web specifications and implemented WPT tests.

Rendering the Acid1 test Reference Rendering (Mozilla Firefox 122.0)
image image

1.2. Build Instructions

Stormlicht uses the latest nightly compiler version. First, install the rust compiler1 , then switch to nightly using

rustup default nightly

After installing rust, run the following commands to start the python build script

pip install -r requirements.txt

./stormlicht.py run

1.3. Development

1.3.1 Logging

During debugging, you can use the RUST_LOG environment variable to set the log level. Refer to the documentation of env-logger for more complex log syntax.

For example:

# Log "debug" and above
RUST_LOG=debug ./stormlicht.py run

Available levels are trace, debug, info, warn and error, in ascending order.

The default log level is info

1.3.2 Backtraces

Set RUST_BACKTRACE=1 to enable backtraces in case of a panic.

1.3.3 Running with Miri

Testing the browser inside Miri can help detect instances of undefined behaviour. To use miri, execute the following:

rustup toolchain install nightly --component miri
rustup override set nightly

./stormlicht.py run --miri
./stormlicht.py test --miri

1.4. Why is there no GUI?

I would love to have a GUI! But actually writing one in rust is hard2, mostly due to the lack of OOP and the borrowchecker. There are currently very smart people working to solve these issues3, but I am not one of them. If you want to try implementing a GUI, please do!

But there is another reason: A browser engine is really just a highly complex framework for implementing user interfaces. If I procrastinate on implementing a GUI library long enough, i can just write it in HTML!

1.5. Credits

This project is inspired by Andreas Kling/the Ladybird Browser

Mozilla's Servo and WebKit provided some good ideas.

Footnotes

  1. https://www.rust-lang.org/tools/install

  2. https://www.areweguiyet.com/

  3. https://raphlinus.github.io/rust/gui/2022/05/07/ui-architecture.html

About

The Stormlicht browser engine.

Topics

Resources

License

Stars

Watchers

Forks

Languages