• Stars
    star
    1,422
  • Rank 33,090 (Top 0.7 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A toy web rendering engine

Robinson

A toy web rendering engine written in the Rust language, by Matt Brubeck ([email protected]).

I'm writing this code purely for educational purposes. My goal is to create an incomplete but extremely simple engine as a way to learn more about basic implementation techniques, without worrying about complications like:

  • Real-world usability
  • Standards compliance
  • Performance and efficiency
  • Interoperability

These are all important goals, but there are other projects working on them. By ignoring them completely, this project can focus on being as simple and easy-to-understand as possible.

Why create a simple—but useless—toy rendering engine? Mostly because I personally want to learn how to do it. If I succeed, I also hope that other people can learn from my code by reading or modifying it, or learn from my experience as they set out to build their own toy browser engines.

For more details see Let's build a browser engine!, a series of how-to articles based on this project.

Status

Currently implemented:

  • Parse a small subset of HTML and build a DOM tree.
  • Parse a small subset of CSS.
  • Perform selector matching to apply styles to elements.
  • Basic block layout.

Coming soon, I hope:

  • Inline layout.
  • Paint text and boxes.
  • Load resources from network or filesystem.

Instructions

  1. Install Rust 1.0 beta or newer.

  2. Clone the robinson source code from https://github.com/mbrubeck/robinson

  3. Run cargo build to build robinson, and cargo run to run it.

To build and run with optimizations enabled, use cargo build --release and cargo run --release.

By default, robinson will load test.html and test.css from the examples directory. You can use the --html and --css arguments to the robinson executable to change the input files:

./target/debug/robinson --html examples/test.html --css examples/test.css

The rendered page will be saved to a file named output.png. To change the output filename, use the -o option. To switch to PDF output, use add --format pdf.

More Repositories

1

agate

Very simple server for the Gemini hypertext protocol
Rust
580
star
2

compleat

Generate command-line completions using a simple DSL.
Haskell
458
star
3

android-completion

Bash completion for "adb" from the Google Android SDK
Shell
240
star
4

fast-rust

A book about performance optimization in the Rust programming language
69
star
5

by_address

Rust wrapper type that implements hashing and comparison by pointer address
Rust
33
star
6

mnemonic.js

Mnemonic encoding of binary data, based on Oren Tirosh's mnemonic.c
JavaScript
30
star
7

outline-grep

Search through indentation-structured text files
Haskell
20
star
8

unicode-reverse

Unicode-aware in-place string reverse function in Rust
Rust
18
star
9

mediumvec

Rust collections optimized for size
Rust
10
star
10

telegraphy

web application for editing text files in a git repository
Ruby
6
star
11

wf-recs

Tim Bray's Wide Finder implemented with Make and RecordStream
5
star
12

mynock

Interpreter for the Nock language, written in Haskell
Haskell
5
star
13

rust-mnemonic

Encode any data into a sequence of English words
Rust
4
star
14

smallbigint

Size-optimized arbitrary-precision int library for Rust
Rust
3
star
15

cargo-vendor-example

Rust
2
star
16

bugwd

Readable, memorable URLs to replace long bug numbers
JavaScript
2
star
17

oni-map

An experiment in async/parallel array functions for JavaScript
JavaScript
2
star
18

open-link-ffext

This tiny add-on for Fennec simply adds a "Open Link" context menu item to the menu that appears when you press and hold for a moment on a link. This is a built-in feature on mobile Safari and Android's default browser.
JavaScript
2
star
19

gopher-rs

Rust
1
star
20

mar

Rust library for reading and writing Mozilla Archive (MAR) files
Rust
1
star
21

copy-link-ffext

JavaScript
1
star
22

gravity

A simple 2D gravity simulator in a web page
JavaScript
1
star