views:

36

answers:

1

Is native code of browsers considered to be part of "Layout engine (Rendering engine)" or it is separate from that? In another words, let's say, if we take Mozilla Firefox, does the creation of DOM object is a process of GECKO or not?

+1  A: 

The DOM is created by the DOM parser as the HTML is being processed. This step is completely independent of the layout. When the DOM is complete, the layout process (always implemented as native code for performance reasons) will add information to the existing DOM tree (like the position of every element, the colors it used, etc).

So the parts of Firefox which read/parse the HTML, and which render it, are separate (they are located in their own subtrees in the source code and they end). Both are implemented natively.

Aaron Digulla
Thanks! So, you mean first the DOM is created. And then by using the DOM, the layout is "painted" by rendering engine. Do I get it correct?
burak ozdogan
Yes. The second step is quite complex: Looking up the CSS styles, determining the sizes of everything, placing it on the screen according to the rules of the W3C, ...
Aaron Digulla