Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Data Storage
Browser Engine
Rendering Engine
JavaScript Display
Networking XML Parser
Interpreter Backend
Source: “A Reference Architecture for Web Browsers” by Alan Grosskurth and Michael Godfrey
Main Browser Components
User Interface
Data Storage
Browser Engine
Rendering Engine
JavaScript Display
Networking XML Parser
Interpreter Backend
Source: “A Reference Architecture for Web Browsers” by Alan Grosskurth and Michael Godfrey
Rendering Engines
Browser Rendering Engine
Safari WebKit
Chrome Blink
Opera Blink
Firefox Gecko
Edge EdgeHTML
Rendering Engine:
The Main Flow
DOM
CSSOM
Rendering Engine:
The Main Flow
DOM
CSSOM
Example Markup
HTML Parser
3C 68 74 6D 6C 3E 3C 68 61 64 3E
3C 6D 65 74 61 6E 61 6D 65 3D 22
76 69 65 77 70 6F 72 74 22 …
3C 2F 68 74 6D 6C 3E
HTML Parser: Characters
Bytes Characters Tokens Nodes DOM
<html><head>…</head><body><h1>DOM
Example</h1><p>…</p></body></html>
HTML Parser: Tokens
Bytes Characters Tokens Nodes DOM
AttributeName: AttributeValue:
class “outer”
Text
Tokenisation: Output
StartTag: html StartTag: head StartTag: meta StartTag: link
AttributeName: AttributeValue:
StartTag: img EndTag: body EndTag: html
src example.jpg
HTML Parser: Syntax Analysis
Bytes Characters Tokens Nodes DOM
html
head body
span
DOM
CSSOM
Example CSS
CSS Parser
body h1 p
font-size: 12px
h1 p img
color: red
DOM
CSSOM
Render tree construction
DOM CSSOM
Render tree
=
Render tree construction: DOM
html
head body
span
html
head body
span
font-size: 12px
color: red
DOM
CSSOM
Box Model
margin
border
padding
width x height
Box types
block
block
inline
Positioning
• Normal flow
• box formatting context (block and inline)
• relative positioning
• Floats
• first: lay out box according to normal flow
• then: push as far left/right as possible
• Absolute and fixed positioning
• box is taken out of normal flow
• positioned dependent on the box’s containing
DOM
CSSOM
Painting
Reflow vs. Repaint
• reflow and repaint
• repaint
• no reflow/repaint
DOM
CSSOM
JavaScript Execution
<script>
<script defer>
<script async>
[2] How browsers work: Behind the scenes of modern web browsers by Tali Garsiel
[3] W3C: HTML 5 - A vocabulary and associated APIs for HTML and XHTML
[4] W3C: Cascading Style Sheet Level 2 Revision 1 (CSS 2.1) Specification
[5] A Reference Architecture for Web Browsers by Alan Grosskurth and Michael W. Godfrey
[6] Understanding the critical rendering path, rendering pages in 1 second by Luis Vieira