Moon
A hobby web browser developed from scratch
What is this?
This is a web browser developed from scratch using Rust. I created this project to practice my Rust skills as well as to learn how the browser works.
To fit with the "make from scratch" spirit, I'll limit the use of external libraries as much as possible.
Current status
Currently, the browser is able to render block layout! I'm working on supporting other types of layout & text-rendering. Here's a comparison with Firefox rendering. (Moon is on the left, Firefox is on the right).
Wanna try it out?
Here are the steps to try it out if you are interested:
- Clone the repository.
- Run
cargo make example
and wait for the code to compile & execute. - Open
image.png
to see the output.
Refer to the Makefile.toml file for more info.
Requirement: Please refer to the proper Dockerfile in /docker
for more information.
Tested on: Ubuntu 18.04
Features
Bold text is what I'm working on
-
๐ DOM API -
๐ HTML Parsing- HTML tokenizer
- HTML dom tree builder (85% specs)
-
๐ CSSOM API -
๐ CSS Parsing- CSS tokenizer
- CSSOM parser/tree builder
-
๐ Style- CSS cascade
- Style computation
- Render tree
- Selector matching
-
๐ด Layout process- Box model
- Box tree generation
- Line fragmentation
- Layouts
- Flow (Block and inline)
- Flex
- Grid
-
๐จ Rendering- Display list
- GPU rendering
- Text rendering
-
๐ Networking- URL parsing
- DNS resolving
- DNS caching
- HTTP/HTTPS
-
๐ผ๏ธ Media-
๐ผ๏ธ Image rendering- JPG
- PNG
- GIF
-
๐ฌ Video playing- MP4
- WebM
-
๐ Audio playing- MP3
- WAV
-
- JavaScript
Blog posts
I write about what I learn from this journey on my blog (order by latest):
Browser from Scratch: Layout
A quick look into how the browser layout process works. - Read more
Browser from Scratch: CSS parsing & processing
A brief history of CSS & how browser process CSS values - Read more
Browser from Scratch: HTML parsing
Since I have foolishly made a promise with the first three words in the name of this series, let's build an HTML parser from scratch. - Read more
Browser from Scratch: DOM API
One of the main building blocks of the HTML rendering process is the DOM API. Before a browser can render the HTML document, it needs to parse the document content into a tree structure called the DOM tree. In this post, I'll break down my experimentation in building a DOM API with Rust. - Read more
Browser from Scratch: Introduction
This is the start of Browser from Scratch series, created to help me (and probably you too) to learn more about how a browser works by building one! - Read more