290 likes | 569 Views
Browser internals. Ivan & Bastiaan. Major browsers. Firefox Chrome Safari IE Opera. Firefox- open source Chrome is based on Chromium which is open source Safari - partly open source. Statistics. Main functionality. Presentation of data(HTML documents, images etc.)
E N D
Browser internals Ivan & Bastiaan
Major browsers • Firefox • Chrome • Safari • IE • Opera Firefox- open source Chrome is based on Chromium which is open source Safari - partly open source
Main functionality • Presentation of data(HTML documents, images etc.) • Resource location specified by URI(Uniform Resource Identifier) • W3C • Compatibility issues
User Interface • Address bar • Back/forward buttons • Home button • Menu • Every part of the browser except the main window where you see the requested page.
Engines Browser Engine • Handles actions between UI and Rendering Engine Rendering Engine • Parsing HTML,CSS • Displaying parsed content • Displaying requested content(PDF, Images etc.)
Other main components • Networking • Using for network calls (HTTP request) • UI backend • Painting the render tree • JS interpreter • Parses and executes JS code
Data storage • Persistence • Saving data on hard disk(cookies) Html 5 defines ‘web database’
Structure Chrome holds multiple instances of the rendering engine - one for each tab
Rendering Engine Gecko - Firefox WebKit – Chrome,Safari WebKit started as engine for Linux platform and was modified by Apple to support Mac and Windows
The main flow • Content in 8K chunks Syntax analyze of HTML Turn the tags into DOM nodes(“content tree”) Parsing the style data(external CSS and style tags) Render tree Giving each node coordinates Painting the render tree Rendering engine will try to display content as soon as possible
Differences • Gecko • Frame tree • Reflow • Frame constructor • Content sink to form DOM elements • WebKit • Render tree • Layout • Attachment
Parsing • Result of parsing is nodes tree • Example-parsing expression 2+3-1 returns this tree Parsing a document means translating it to some structure.
Parsing rules • Based on syntax rules that document obeys(language or format) • Context free grammar • Syntax analysis and lexical analysis
Analysis Lexical breaking input into tokens(lexer) Syntax applying syntax rules(parser)
Analysis • Parser asks for a new token • Trying to match • Token added
Compilation example • Source code will be parsed first • Translation into machine code
Rendering • Single threaded • Main thread is an event loop(infinite) • Except network operations • Number of parallel connections is limited(2-6 connections) Event loop waits for events (like layout and paint events) and processes them
With thanks to TaliGarsiel & Paul Irish autors of this article: http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/