A picture is worth a thousand words. So, let’s have a high-level view of how a browser works!
hmm… what’s “browser engine” and “rendering engine”?
The primary job of a browser engine is to transform HTML documents and other resources of a web page into an interactive visual representation on a user’s device.
Besides “browser engine”, two other terms are in common use regarding related concepts: “layout engine” and “rendering engine”. In theory, layout and rendering (or “painting”) could be handled by separate engines. In practice, however, they are tightly coupled and rarely considered separately.
When you hit enter on some link or URL browser make an HTTP request to that page and the corresponding server provides (often) HTML document in response. (a hell lot of things happen in between)
Step by step processing
styleattributes of the HTML tags
display: none, it won’t be represented in the render tree. Same for the other invisible elements, like
headand everything in it. On the other hand, there might be DOM elements that are represented with more than one node in the render tree-like text nodes for example where every line in a
<p>needs a render node. A node in the render tree is called a frame, or a box (as in a CSS box, according to the box model). Each of these nodes has the CSS box properties - width, height, border, margin, etc
Here is a snapshot of how browser draws user interface on the screen.
It happens in the fraction of seconds that we don’t even notice that all this happened.
How browser drawing the layout and trying to detect root element, siblings and it’s child element as a node comes and rearranging it’s layout accordingly.
Let’s take one example
<html> <head> <title>Repaint And Reflow</title> </head> <body> <p> <strong>How's The Josh?</strong> <strong><b> High Sir...</b></strong> </p> <div style="display: none"> Nothing to display </div> <div><img src="..." /></div> ... </body> </html>
The DOM tree that represents this HTML document basically has one node for each tag and one text node for each piece of text between nodes (for simplicity let’s ignore the fact that whitespace is text nodes too) :
documentElement (html) head title body p strong [text node] p strong b [text node] div [text node] div img ...
The render tree would be the visual part of the DOM tree. It is missing some stuff — the head and the hidden div, but it has additional nodes (aka frames, aka boxes) for the lines of text.
root (RenderView) body p line 1 line 2 line 3 ... div img ...
The root node of the render tree is the frame (the box) that contains all other elements. You can think of it as being the inner part of the browser window, as this is the restricted area where the page could spread. Technically WebKit calls the root node
RenderView and it corresponds to the CSS initial containing block, which is basically the viewport rectangle from the top of the page (
0) to (
Figuring out what and how exactly to display on the screen involves a recursive walk down (a flow) through the render tree.
Does your business need an interactive website or app?
The technology used to develop the overall app by the developers from WebClues Infotech is at par with the latest available technology.
For more inquiry click here https://bit.ly/31eZyDZ
Book Free Interview: https://bit.ly/3dDShFg
With 15+ years of domain expertise, we have successfully delivered 13800+ projects and have successfully garnered 6800+ happy customers with 97%+ client retention rate.
The callback now receives an accumulator (it accumulates all the return values. Its value is the accumulation of a previously returned accumulations), a current value, a current index, and finally, the whole array.