@callmesiddhant
siddhantm1998@gmail.com
Frontend at Nirvana Tech
Who renders the pixels on the screen?
HTML/CSS
GPU
Rendering
Content
BLINK ENGINE
CHROMIUM
COMPOSITER
HTML/CSS
OPEN GL
GPU
OS
OUR GOAL IS TO CONVERT "CONTENT" TO OPEN GL CALLS
CONVERT CONTENT TO PIXELS
CREATE DATA STRUCTURES FOR EFFECIENT UPDATIONS
Converting HTML to DOM
<div>
<p>Hello World</p>
</div>HTML DOCUMENT PARSER
HTML TREE BUILDER
DOCUMENT
HTML
BODY
DIV
P
HELLO WORLD
DOM acts as internal representation for blink
API in JavaScript to work with DOM
⚡️ Shadow DOM
DOCUMENT
HTML
BODY
DIV
P
HELLO WORLD
V8
JS QUERIES
BINDINGS
p {
color: pink
}DOCUMENT
HTML
BODY
DIV
P
HELLO WORLD
This process is done for every stylesheet active and creates an object model called CSSOM
div.foo{
background: blue;
color: red !important;
}
p{
color: pink
}StyleSheet Contents
Style Rule
Style Rule
CSS PARSER
Property()
Text
Value()
* CHECK COMPUTED TAB IN DEV TOOLS
DOCUMENT
HTML
BODY
DIV
P
HELLO WORLD
+
+
Style Resolver
Style Sheet Contents
Computed Style has style info for each and every node
x : 10
y : 10
height : 30px
width:30px
- BLOCK FLOW ( TOP TO BOTTOM)
- INLINE FLOW (LEFT TO RIGHT)
Calculate How Text Flows (HarfBuzz)
⚡️ Shadow Roots and LayoutNGMixins
DOCUMENT
HTML
BODY
DIV
P
HELLO WORLD
Layout View
LayoutBlockFlow
LayoutBlockFlow
LayoutBlockFlow
LayoutText
LayoutBlockFlow
Layout View
LayoutBlockFlow
LayoutBlockFlow
LayoutBlockFlow
LayoutText
LayoutBlockFlow
Physical Fragement Tree
(includes line and content breaks
Layout View
LayoutBlockFlow
LayoutBlockFlow
LayoutBlockFlow
LayoutText
LayoutBlockFlow
Next we create Paint OPS
These are just operations and not executed yet!
LayoutObject
paint()
Paint Artifact
DisplayItem
DisplayItem
DrawRectangleWithCoords(coords)
DrawTextBlockWithCoords(coords)
Paint uses stacking order and happens in phases
BACKGROUNDS
FLOATS
FOREGROUND
OUTLINES
PaintOP example
Rasterization turns PaintOps into Bitmaps in memory (GPU memory , Read Hardware Accelerated Rasterization)
Raster also converts images into bitmaps
But wait, there's a problem
You can't issue OS calls from inside a sandbox
BITMAP
RASTER
PAINT OP
OPEN GL Commands
Transfer Paint Ops from sandbox to GPU process via IPC
PaintOPs are wrapped inside command buffer
For Windows
OPEN GL COMMANDS
Angle
DirectX
DOM
Style
Layout
Paint
Raster
GPU
⚡️ How dynamic rendering works!
https://github.com/Rishabhpawar1409
Looking for Frontend Intern roles
@Rishsome1409
https://github.com/bablysingh2409
@BablyRajput
@CallMeSiddhant