Serval is an experimental web browser engine written in Rust. The author (@hayatoito) is using Serval as a playground when designing and implementing a new idea or concept into the Web Platform, before starting to implement it actually in Chromium Blink engine in C++.
I'd love to have a small rendering engine which has only essential parts so I can experiment something new, and get insights from there quickly. Rust would be better than C++ for this kind of prototyping.
Given the following HTML (in an s-expression)
(div class=a
(div class=b
(div class=c
(div class=d
(div class=e
(div class=f
(div class=g))))))))
and CSS,
css
* {
display: block;
padding: 12px;
}
.a {
background: #ff0000;
}
.b {
background: #ffa500;
}
.c {
background: #ffff00;
}
.d {
background: #008000;
}
.e {
background: #0000ff;
}
.f {
background: #4b0082;
}
.g {
background: #800080;
}
Serval can output png as follows:
```shellsession
serval paint ./example.html ./example.css ./example.png png ```
example.png: