Reflow is the process by which the geometry of the layout engine’s formatting objects are computed. Last week, I was searching around and stumbled on these really cool visuals of what a reflow looks like. If you’re a visual person, you will dig these:
Reflow of Mozilla.org:
Reflow of Google.co.jp:
Reflow of Wikipedia:
If you produced these, kudos! If you know how to produce such things, please drop a note!
Update:
Satoshi Ueyama is the author of this cool demo. He sent Gen a note on how he did it:
First, he builds Mozilla so that the layout portions (nsIFrame::SetRect, nsIFrame::SetSize, nsIFrame;;SetPosition, PresShell::DoReflow, etc) are set to output to the log file.
He then gives an example of the log of each of the frame movements from Reflow:
{"event": "MoveFrame", "frame": {"address": "0x04FE41A8", "type": "TextFrame", "content": {"address": "0x05014150", "type": "other"}, "rect": {"x": 0, "y": 0, "w": 0, "h": 0}}}, {"event": "MoveFrame", "frame": {"address": "0x04FE41A8", "type": "TextFrame", "content": {"address": "0x05014150", "type": "other"}, "rect": {"x": 0, "y": 0, "w": 0, "h": 0}}},Here is an example of dump from the termination of the tree structure.
{"event": "FinishReflow", frame: {"address": "0x04FE3E28", "type": "ViewportFrame", "content": null, "children":[ {"address": "0x04FE4000", "type": "ScrollFrame", "content": {"address": "0x04FD4858", "type": "element", "tagName": "HTML"}, "children":[ {"address": "0x04FE43EC", "type": "ScrollbarFrame", "content": {"address": "0x04FFEFF8", "type": "element", "tagName": "scrollbar"}, "children":[ {"address": "0x04FE4578", "type": "BoxFrame", "content": {"address": "0x04FFE0F8", "type": "element", "tagName": "xul:scrollbarbutton"} } , {"address": "0x04FE47BC", "type": "sliderFrame", "content": {"address": "0x04FFE278", "type": "element", "tagName": "xul:slider"}, "children":[ {"address": "0x05004E6C", "type": "BoxFrame", "content": {"address": "0x050030E8", "type": "element", "tagName": "xul:thumb"}, "children":[ {"address": "0x05004FDC", "type": "BoxFrame", "content": {"address": "0x050013F0", "type": "element", "tagName": "xul:gripper"} } ] }He then makes the video animation (for Google Video he suggests Ruby+Ruby/SDL, for the video from Mozilla 24 he used C+++Direct3d.) As memory address is outputted to the log each frame can be distinct.
The behavior of each frame in chronological order is reproducible as the log has each frame’s memory. (For instance, in tracking the frame “address”:”0×04FE41A8″, you can reproduce that frame’s behavior chronologically.
May 24, 2008 at 7:33 pm
Someone totally needs to make that into a Firefox extension.
May 24, 2008 at 8:28 pm
Wow. That’s awesome.
May 24, 2008 at 10:01 pm
That’s awesome. I second post #1
May 24, 2008 at 10:57 pm
Interesting that it’s reflowing the whole thing twice for mozilla.org and wikipedia, but *not* google.
May 24, 2008 at 11:31 pm
Woah, it’s awesome, seriously. Who made these? Any chance for higher resolution ones? Or even better an interactive thingie (1st post, further seconded.)
May 25, 2008 at 1:33 am
That is just spectacular. I am dying to find out who was responsible.
May 25, 2008 at 1:58 am
Wow, someone please add that to Firebug or WebDeveloper extension! I’d love to see how the reflow unfolds on my website and if there’d be anyway I could then optimise it for faster rendering.
May 25, 2008 at 3:06 am
glandium: I think that is because Mozilla and Wikipedia becomes larger then fit on screen so the scrollbar needs to be placed on the right. And therefor there is a second reflow.
May 25, 2008 at 3:07 am
Maybe that is because google doesn’t use CSS?
May 25, 2008 at 4:17 am
f this s, Opera draws pages as soon as data comes in, does not hide the layout until it’s fully generated.
May 25, 2008 at 4:26 am
[...] Layout Engine Geometry You may also want to browse: A Fascinating Constellation, Candy, Pervasive Visualisation, [...]
May 25, 2008 at 4:34 am
I think it’s animations related to this talk at Shibuya.js:
http://video.google.com/videoplay?docid=4146973749385284875
This seems to be the guy who made it:
http://gyu.que.jp/sjs2007/
Guessing it’s done in Processing, since he has some other stuff done in that too.
May 25, 2008 at 5:58 am
Those are cool. A firefox extension would be pretty cool!
May 25, 2008 at 6:28 am
Interesting. I completely agree with Dan above… it’d be great if this were a Firefox extension.
May 25, 2008 at 6:33 am
[...] were found by DougT somewhere on Google Video. There are others (such as Wikipedia) that he shows on his blog.. He (and [...]
May 25, 2008 at 7:45 am
It looks like this animation captures all calls to SetRect/SetPosition/SetSize on frames or something along those lines. At least that’s what it looks like to me given how it’s handling the floats and the inline layout. Doing that from an extension would be quite difficult, actually, and any setup that _did_ do it would have a pretty hefty impact on layout performance.
May 25, 2008 at 7:50 am
Awesome visual demos. Thank you!
May 25, 2008 at 7:51 am
This is awesome, seeing the process slowed down and outlined like this. A firefox extension would be great!
May 25, 2008 at 9:20 am
@16:
You wouldn’t need to do it real time; you would just need to log the calls to those functions somewhere so that you can parse them and create an animation (that said it would still be difficult from an extension I think; you may want a custom build of the browser instead).
May 25, 2008 at 12:12 pm
Seeing as almost all pages have vertical scrolling, it seems like a sensible optimisation to render assuming a scrollbar first, and then if it isn’t required, to reflow.
In fact I remember that Opera 6 or so always rendered with a scrollbar visible. At the time I assumed it was to avoid the content jumping around on sites where some pages have scrollbars and some don’t. But maybe it was an optimisation. Opera has always focused on speed more than the other browsers.
May 25, 2008 at 1:50 pm
I like it.
That is all.
(Apologies I’m not very tech savvy and there cannot make this comment more interesting)
May 25, 2008 at 3:58 pm
[...] What is a reflow? Reflow is the process by which the geometry of the layout engine’s formatting objects are computed. Last week, [...] [...]
May 25, 2008 at 5:27 pm
Looks cool!
May 25, 2008 at 9:26 pm
[...] El vídeo muestra el modo en que gecko procesa la información del DOM y las hojas de estilo al montar una página tal y como la vemos. Las animaciones muestran como el motor renderiza la información de la página a visualizar conforme le va llegando y como cambios en la estructura de la misma (nuevas tablas o cambios en el CSS) afectan a determinadas partes de la visualización. Además de la wikipedia en japo, existen visualizaciones para google.co.jp y la página principal de mozilla. [...]
May 25, 2008 at 9:53 pm
I like the pretty colors… Just kidding. Seriously, I AM a visual person, and I LOVE watching technical things like this unfold visually before me. Great videos, thanks a lot for sharing!
May 25, 2008 at 10:44 pm
Thanks. I don’t know much about computers but I really thought that was so cool.
May 26, 2008 at 11:38 am
[...] keiner Polnisch, aber dafr ist dies fr denjenigen interessant, der sich mit mir fragt, was ein Reflow in Gecko ist. __________________ Ingo Chao :: satzansatz :: dolphins [...]
May 26, 2008 at 1:13 pm
Check out Timelapse CSS by Mattew Buchanan:
http://matthewbuchanan.name/post/33504871/timelapse-css
May 26, 2008 at 1:20 pm
[...] una pagina web a partire dai suoi componenti fondamentali, i frames. DougT ha raccolto sul suo blog tre video che mostrano in dettaglio i reflow di google.co.jp, mozilla.org e ja.wikipedia.org, ed è [...]
May 26, 2008 at 3:20 pm
[...] across an article on “reflow”: the process by which the geometry of the layout engine’s formatting objects are [...]
May 26, 2008 at 5:16 pm
[...] um processo chamado reflow, da página do Google. Investiguei mais a fundo e achei um artigo no DougT’s Blog, com mais alguns [...]
May 26, 2008 at 9:38 pm
[...] ne sais pas comment on arrive à produire ce genre de vidéo, ni la source sur laquelle j’ai trouvé ces exemple d’ailleurs. A priori c’est une histoire de [...]
May 27, 2008 at 12:09 am
[...] (via: dougt.wordpress.com) [...]
May 27, 2008 at 1:02 am
> Which makes you wonder why the entire mozilla
> page needs to be reflown for that since it has
> fixed margins.
Wow, from 3 small, lo rez videos we already have a possible bug.
Interesting how information presented in a new way helps us all understand a complex process.
monk.e.boy
May 27, 2008 at 2:25 am
[...] Via: Google Blogoscoped e Dougt [...]
May 27, 2008 at 3:20 am
Doug- that was at our Mozilla 24 event, albeit in the Tokyo part of the event.
May 27, 2008 at 2:11 pm
That was a lot of good info.
dave, http://www.thehistorybluff.com
May 27, 2008 at 2:22 pm
[...] de la Wikipedia elemento a elemento. Dos vídeos más con reflows de Google y de Mozilla.org en dougt.wordpress.com/2008/05/24/what-is-a-reflow sin comentarios en: tecnología, software karma: 6 etiquetas: firefox, navegador, reflow votos [...]
May 27, 2008 at 9:02 pm
I can’t see anything? Sorry!
May 27, 2008 at 10:40 pm
[...] In any case, a couple of good examples cropped up on the net including this one below. Check out this post for a couple [...]
May 28, 2008 at 1:36 am
[...] dougT 的 Blog 裡面的回應裡有討論到,似乎是日本的 Gecko 所弄出來的 [...]
May 28, 2008 at 2:52 am
I want the tool that makes these animations, it would be SOOO helpfull when developing websites!
May 28, 2008 at 8:18 am
I might finally understand floats if that was an extension.
May 28, 2008 at 8:50 am
[...] 现在,我们能形象地看到这个reflow是怎样的一个过程了(via:What is a reflow?),先看一下Mozilla的首页; 看不到点这里看,再看不到就用代理来看,再再看不了的话就邮件给我发文件给你。。 [...]
May 28, 2008 at 12:35 pm
awesome posts
thanks dear
May 28, 2008 at 2:00 pm
[...] What is a reflow? 2008 May 28, Wednesday, 18:00 — monado On Doug T.’s blog, you can learn about reflows: what is a reflow and how are they calculated? [...]
May 29, 2008 at 8:02 am
Fantastic rendering demonstration. Its only a matter of time before something like this gets pushed out into the open source domain.
May 29, 2008 at 8:27 pm
[...] more appropriately what is it? [...]
May 30, 2008 at 3:31 pm
[...] Have you ever heard of reflows in terms of browser rendering? I hadn’t but this short blog post has some neat videos of them in action. Check it out, let me know what you think. This entry [...]
June 1, 2008 at 9:29 pm
Bill, you’d definitely need a custom build (not possible to hook into those layout guts from an extension). And I wasn’t talking about doing anything in realtime: just logging those function calls might be expensive enough to noticeably affect layout performance. Those functions are called a _lot_.
June 2, 2008 at 12:39 pm
[...] What is a reflow? [...]