M
Matt Brubeck
limpet.net · Personal blog · on HN since 2009
Matt Brubeck, a Mozilla engineer, writes about Rust, browser internals, and Firefox for Android, including a toy browser engine series.
What HN saysHN commenters recommend his toy layout engine series for anyone curious about browsers and cite his posts on Rust borrowing and Fennec's architecture.
28HN people shared it
13linked it in comments
37stories submitted
1.3Kstory points
1 year agolast shared
2009people per year2026
Most-shared posts
- 1Let’s build a browser engine (2014)21 people · 259 points · first shared 2014 · 47 comments on HN
- 2Rust: A unique perspective5 people · 10 points · first shared 2019 · discussion on HN
- 3What's different about Firefox for Android2 people · 3 points · first shared 2010 · discussion on HN
- 4Congratulations on IE10: from Mozilla with cake1 people · 246 points · first shared 2012 · 51 comments on HN
- 5Let's build a browser engine Part 3: CSS1 people · 147 points · first shared 2014 · 17 comments on HN
- 6Build a browser engine part 5: Box model and layout tree1 people · 127 points · first shared 2014 · discussion on HN
- 7Let's build a browser engine, Part 6: Block layout1 people · 120 points · first shared 2014 · 22 comments on HN
- 8Let's build a browser engine, part 7: Intro to Painting1 people · 90 points · first shared 2014 · 9 comments on HN
- 9Mobile web developers: Your users hate it when you do this1 people · 70 points · first shared 2010 · 23 comments on HN
- 10Let's build a browser engine, Part 4: Style1 people · 66 points · first shared 2014 · 2 comments on HN
- 11Compleat: Programmable bash completion for human beings1 people · 52 points · first shared 2009 · 7 comments on HN
- 12Android 2.0 ships with the V8 JavaScript engine and ARM JIT1 people · 31 points · first shared 2009 · discussion on HN
- 13Let's build a browser engine, part 2: Parsing HTML1 people · 16 points · first shared 2014 · discussion on HN
- 14Show HN: A little randomness for the Hacker News front page1 people · 10 points · first shared 2014 · discussion on HN
- 15Headless Web Workers: Does the web need background apps?1 people · 5 points · first shared 2010 · discussion on HN
What HN people wrote when they linked it
zozbot234 · 2020-01-04
It's not a hack, although I can't really fault you for thinking otherwise. The borrow notations are & (shared) and &mut (exclusive, guarantees mutability regardless of type). 'Interior mutability' is a way of enabling shared data to be mutable. See https://limpet.net/mbrubeck/2019/02/07/rust-a-unique-perspective.html for a more principled explanation, which even improves on Rust's official docs - this is probably best read in combination w/ OP's series.
stijlist · 2016-07-25
There's this great series by mbrubeck which sounds like it might be right up your alley: https://limpet.net/mbrubeck/2014/08/08/toy-layout-engine-1.html
nkurz · 2010-11-05
I was going to ask for a brief overview of the architectural differences between Fennec, Webkit and Opera, but then I found your informative article here:
http://limpet.net/mbrubeck/2010/10/04/why-fennec-is-different.html
That hit most of my questions. Thanks! Are there any other Android browsers that have cropped up since then that might be worth mentioning? I saw an announcement for Opera Mobile -- does that change the landscape?
I'm currently using Dolphin HD, and am mostly satisfied with it. It's recent 4.0 upgrade helped a lot and took care of almost all my irritations with it. If only it were open source so the last remaining few could get fixed. But I'll check out Firefox Mobile soon and see how it compares.
chinesempire · 2020-05-25
> If you watch the talk I linked below
I've watched it several times over the past 2 years
And I've read the posts about writing and HTML engine in Rust when they first came out in 2014
https://limpet.net/mbrubeck/2014/08/08/toy-layout-engine-1.html
and ported them to Elixir and still use them in my programming lessons
> Rust was key to the success.
For them
It's important to specify that Rust, built by Firefox, lead to a Firefox success.
Just like Dart, created by Google, is the language of choice for Flutter, also created by Google.
I know you've been working at Mozilla to work on Rust and I believe Rust is very good, but I also think Mozilla could have used other languages, there were a few that could led them to success, but they understood this are times where the "means of production" aren't the machines but engineers tools, and creating a programming language is the best way to control part of that world.
bArray · 2025-10-02
See the other comment for a MITM large browser server: https://news.ycombinator.com/item?id=45446991
To do everything onboard, maybe, just maybe, you could parse basic HTML/CSS and images. But the majority of pages would of course fail anyway without full support for every modern feature.
This seems like it could be useful: https://limpet.net/mbrubeck/2014/08/08/toy-layout-engine-1.html
rockwotj · 2022-10-11
I recently implemented a similar concept to this for HTML emails at shortwave.com, it only works for the subset of non table emails (which we assume are marketing emails and you want to see the full HTML). It allows us to render stuff wayyy faster (especially on mobile where webviews are not cheap). We don't go all the way to pixel layout because we want to have some responsiveness, but it allows for heavily normalized emails (no more neon yellow on a green background with comic-sans font) and some other neat optimizations.
Didn't use yoga but a from scratch implementation. A good starting point is let's build a browser engine [1]. I hope to blog about it at somepoint.
[1]: https://limpet.net/mbrubeck/2014/08/08/toy-layout-engine-1.html
kaycebasques · 2021-09-10
I never worked through this, and it may be outdated now, but Let's build a browser engine! seems to fit the bill: https://limpet.net/mbrubeck/2014/08/08/toy-layout-engine-1.html
wernsey · 2020-08-18
Let's build a browser engine! [1] by Matt Brubeck is a good place to start. I see Kosmonaut cites it in its README
I once took a stab at rewriting it in C99 using reference counting for memory management [2], so I recognised the screenshot in Kosmonaut immediately.
Unfortunately the article series stops before explaining inline layouts and I never got around to doing anything further with my implementation.
[1] https://limpet.net/mbrubeck/2014/08/08/toy-layout-engine-1.html
[2] https://github.com/wernsey/robinson-c
thedirt0115 · 2020-02-18
If you're still interested in writing your own browser from scratch, this series of posts (in Rust instead of C#, sorry!) is a good introduction: https://limpet.net/mbrubeck/2014/08/08/toy-layout-engine-1.html
stevekemp · 2017-08-13
I found this article pretty interesting, a few months ago:
https://limpet.net/mbrubeck/2014/08/08/toy-layout-engine-1.html
It walks through the basics of writing a layout engine which is extended over a series of posts to be quite flexible and interesting.
max_ · 2016-08-30
Browser Engine https://limpet.net/mbrubeck/2014/08/08/toy-layout-engine-1.html
How to Create your Own Internet Browser in 5 Minutes! - https://www.youtube.com/watch?v=Bn22JBRC1UI
Chrome's Engine http://www.chromium.org/blink
ruraljuror · 2016-08-29
This series of blog posts might be a good place to start:
https://limpet.net/mbrubeck/2014/08/08/toy-layout-engine-1.html
mbrubeck · 2010-11-05
Yes, we support the viewport meta tag: http://limpet.net/mbrubeck/2010/05/10/fennec-meta-viewport.html
We don't yet support touch events. We're working on it, but it will probably not be reading until the next release after 4.0: https://bugzilla.mozilla.org/show_bug.cgi?id=544614
The newly formed W3C Web Events working group will be coming up with a standardized version of the various non-standard touch events invented by Apple, Google, and Mozilla: http://www.w3.org/2010/webevents/