日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

How Browser Works

發(fā)布時(shí)間:2025/3/20 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 How Browser Works 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

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.

?

?

?

?

?

?

?

?

?

?

轉(zhuǎn)載于:https://www.cnblogs.com/zjstar12/archive/2012/01/12/2320408.html

總結(jié)

以上是生活随笔為你收集整理的How Browser Works的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。