《Web Browser Engineering》帶你用 Python 從頭打造網頁瀏覽器
Web Browser Engineering (2021)
重點導讀
網頁瀏覽器每天都在用,但從載入網頁到執行 JavaScript,中間要做哪些事不容易看懂。
- Pavel Panchekha 和 Chris Harrelson 寫了這本書,帶讀者用幾千行 Python 做出一個基本但完整的瀏覽器。
- 內容從下載網頁、排版文字和處理 HTML、CSS,延伸到表單、JavaScript、動畫、GPU 和無障礙功能,讓人能一步步看懂瀏覽器如何把網頁顯示出來並回應操作。
AI 伴隨問答
針對這篇報導有疑問?可直接點選快捷問題或向 AI 追問背景脈絡與技術細節:
推薦理由
內容從下載網頁一路講到 JavaScript、無障礙功能與 GPU 動畫,適合用來瞭解瀏覽器各部分如何串在一起。
正文 · 原文
Pavel Panchekha & Chris Harrelson
Twitter · Blog · Discussions
- Introduction
- Part 1: Loading Pages
- Part 2: Viewing Documents
- Part 3: Running Applications
- Part 4: Modern Browsers
Web browsers are ubiquitous, but how do they work? This book explains, building a basic but complete web browser, from networking to JavaScript, in a couple thousand lines of Python.
Follow this book’s blog, Mastodon, or Twitter for updates. There’s a discussion forum for the book on Github, or you can email us directly.
Introduction
Part 1: Loading Pages
- Downloading Web Pages
URLs and HTTP requests - Drawing to the Screen
Creating windows and drawing to a canvas - Formatting Text
Word wrapping and line spacing
Part 2: Viewing Documents
- Constructing an HTML Tree
Parsing and fixing HTML - Laying Out Pages
Inline and block layout - Applying Author Styles
Parsing and applying CSS - Handling Buttons and Links
Hyperlinks and browser chrome
Part 3: Running Applications
- Sending Information to Servers
Form submission and web servers - Running Interactive Scripts
Changing the DOM and reacting to events - Keeping Data Private
Cookies and logins, XSS and CSRF
Part 4: Modern Browsers
- Adding Visual Effects
Blending, clipping, and compositing - Scheduling Tasks and Threads
The event loop and the rendering pipeline - Animating and Compositing
Smooth animations using the GPU - Making Content Accessible
Keyboard input, zooming, and the accessibility tree - Supporting Embedded Content
Images, iframes, and scripting - Reusing Previous Computation
Invalidation, editing, and correctness
來源: Hacker News (official RSS) (browser.engineering)
開啟原文