I am REALLY curious how a web page is parsed into a DOM tree, then how the tree is rendered in a web browser. Namely,how does layout engine work?

I guess whether reading source code of a simple web browser (Webkit is too hard for me now. ) is a feasible choice? Thanks

share|improve this question

53% accept rate
Reading the source code for anything that implements current web standards is going to be a daunting task, no matter how simple the browser seems. Even CSS1 defines some rather complex rules for layout. – Matti Virkkunen Mar 5 '11 at 15:47
As Matti said, reading the source code is "a daunting task". I want to know if there are other choices to achieve the goal. thanks – Matt Elson Mar 6 '11 at 2:55
feedback

1 Answer

Parsing a web page into a DOM tree isn't terribly difficult to understand since (well-formed) HTML is already in a tree structure. So I don't think there's much to it except when you want to also annotate things like CSS, conditional code, and scripts into your tree.

Layout and rendering is a much more challenging problem to work out. If you're not ready to dive directly in the code, you can read their docs:

WebKit Layout and Rendering

share|improve this answer
feedback

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.