Extract from:
  http://taligarsiel.com/Projects/howbrowserswork1.htm

lexer:词法分析器

Catalog:
1. Introduction
2. The rendering engine
  2.1 Rendering engines
  2.2 The main flow
  2.3 Main flow examples
  2.4 Parsing and DOM tree construction
    2.4.1 Parsing - general
    2.4.2 HTML parser
    2.4.3 CSS parsing
    2.4.4 Parsing scripts
    2.4.5 The order of processing scripts and style sheets
  2.5 Render tree construction
  2.6 Layout
  2.7 Painting
  2.8 Dynamic changes
  2.9 The rendering engine's threads
  2.10 CSS2 visual model
  2.11 Resources

###############
Introduction
###############

Five major browsers used today
  - Internet Explorer
  - Firefox
  - Safari
  - Chrome
  - Opera

Main functionality is
  to present the web resource you choose,
  by requesting it from the server
  and displaying it on the browser window.

The resource format is
  usually HTML but also PDF, image and more.

The location of the resource is
  specified by the user using a URI (Uniform resource Identifier).

The way the browser interprets and displays HTML files is
  specified in the HTML and CSS specifications.

These specifications are maintained by the W3C (World Wide Web Consortium) organization,  which is the standards organization for the web.

The browser's main components are:
  1. The user interface
  2. The browser engine
  3. The rendering engine
  4. Networking
  5. UI backend
  6. Javascript interpreter
  7. Data storage

###################
The rendering engine
###################

By default the rendering engine can display HTML and XML documents and images.

It can display other types through a plug-in (a browser extension).
An example is displaying PDF using a PDF viewer plug-in.

Our reference browsers - Firefox, Chrome and Safari are built upon two rendering engines.

Firefox uses Gecko - a "home made" Mozilla rendering engine.
Both Safari and Chrome use Webkit.

Webkit is an open source rendering engine which started as an engine for the Linux platform and was modified by Apple to support Mac and Windows.

Basic flow of the rendering engine:
  1. Parsing HTML to construct the DOM tree
  2. Render tree construction
  3. Layout of the render tree
  4. Painting the render tree

Parsing can be separated into two sub processes
  - lexical analysis
  - syntax analysis.

Lexical analysis is the process of breaking the input into tokens.
Tokens are the language vocabulary - the collection of valid building blocks.
In human language it will consist of all the words that appear in the dictionary for that language.

Syntax analysis is the applying of the language syntax rules.

Parsers usually divide the work between two components
  - the lexer(sometimes called tokenizer) that is responsible for breaking the input into valid tokens,
  and the parser that is responsible for constructing the parse tree by analyzing the document structure according to the language syntax rules.

The lexer knows how to strip irrelevant characters like white spaces and line breaks.

BNF: Backus–Naur Form
In computer science, BNF (Backus Normal Form or Backus–Naur Form) is a notation technique for context-free grammars, often used to describe the syntax of languages used in computing, such as computer programming languages, document formats, instruction sets and communication protocols.
It is applied wherever exact descriptions of languages are needed, for instance, in official language specifications, in manuals, and in textbooks on programming language theory.

转载于:https://www.cnblogs.com/zjstar12/archive/2012/01/12/2320408.html

How Browser Works相关推荐

  1. 浏览器是如何工作的 - How Browser works

    原文:http://taligarsiel.com/Projects/howbrowserswork1.htm 有点长,前面介绍的比较细,但是到后面就越写越糊了,两年了 都没有继续写下去,据说是没有时 ...

  2. Web性能优化系列(1):Web性能优化分析

    本文由 伯乐在线 - 鸭梨山大 翻译,sunbiaobiao 校稿.未经许可,禁止转载! 英文出处:gokulkrishh.github.io.欢迎加入翻译小组. 如果你的网站在1000ms内加载完成 ...

  3. Node.js Web 开发框架大全《中间件篇》

    这篇文章与大家分享优秀的 Node.js 中间件模块.Node 是一个服务器端 JavaScript 解释器,它将改变服务器应该如何工作的概念.它的目标是帮助程序员构建高度可伸缩的应用程序,编写能够处 ...

  4. win10任务栏和开始菜单_如何将网站固定到Windows 10任务栏或开始菜单

    win10任务栏和开始菜单 Having quick access to frequently-used or hard to remember websites can save you time ...

  5. 我从参加#PerfMatters会议中学到的东西

    by Stacey Tay 通过史黛西泰 我从参加#PerfMatters会议中学到的东西 (What I learned from attending the #PerfMatters confer ...

  6. 如何在Telegram机器人中设置推送通知

    by Nikita Kholin 通过尼基塔·霍林(Nikita Kholin) 如何在Telegram机器人中设置推送通知 (How to set up push notifications in ...

  7. qt构建浏览器_如何为组织构建安全的浏览器

    qt构建浏览器 The most vulnerable part of most organization's network infrastructure is their browser. Thi ...

  8. Summernote文字编辑器添加代码插入功能

    经过两天的改造,目前Summernote终于可以支持代码插入了. summernote.js文件奉上 /*** Super simple wysiwyg editor v0.8.10* https:/ ...

  9. 网站推荐 | 那些小众却精美的网站

    目录 前言 Windows 10 OOBE(Windows 升级恶搞) Windows 8 OOBE(Windows 升级恶搞) WebGL Fluid Simulation(流体模拟器) Mesh ...

最新文章

  1. thinkphp mysql 密码加密_thinkphp框架实现mysql读写分离
  2. eclipse: Program g++ not found in PATH
  3. 职场中怎样评估系统架构师的成绩?
  4. AjaxPro2在Asp.net中的基本用法
  5. 专家:教育等领域将成为人工智能“用武之地”
  6. JUnit 3一个例子就懂
  7. Django获取当前页面的URL——小记
  8. .NET中方法的注意事项 明细
  9. 创建ORACLE定时任务 任务日志记录
  10. 蓝桥杯单片机数码管技巧
  11. c语言汇率兑换小程序,不懂算汇率?推荐你3个计算汇率的小程序,让你轻松算汇率...
  12. python大于号怎么写_大于号怎么写
  13. 项目总结:快餐店POS收银系统
  14. linux查看操作系统版本的命令
  15. Ubuntu/Deepin下Python3.8出现SSL错误的解决方案
  16. 2018华为云区块链全球开发者大赛——小链接 大未来
  17. 秦雅:IT女生对未来职业的一点思考
  18. luaPanda 调试
  19. Nervos 双周报第 9 期:CKB Testnet 要上线?
  20. 阿里云产品经理刘宇:Serverless 的前世今生

热门文章

  1. docker 导入镜像_官方下一代Docker镜像构建神器 -- BuildKit
  2. 小米6通话音量补丁_智能手机的音量键有很多功能,你用过吗?
  3. 【干货】网络中常用的9个命令,超级实用
  4. 小半计算机谱子,小半 _桃李醉春风个人制谱园地_中国曲谱网
  5. 如何无缝迁移 SpringCloud/Dubbo 应用到 Serverless 架构
  6. 用 Arthas “庖丁解牛”
  7. jsp到java xml配置,JSP中web配置:web.xml
  8. 计算机进位计数制实训课教案,《计算机应用基础》职高2010修订版 教案.doc
  9. ros2_object_analytics安装过程全记录
  10. 【杂谈】什么是我心目中深度学习算法工程师的标准