Web浏览器工程
Web Browser Engineering (2021)

原始链接: https://browser.engineering/

《Web Browser Engineering》(Pavel Panchekha 与 Chris Harrelson 著)通过用几千行 Python 构建一个基本但完整的浏览器,解释 Web 浏览器的工作原理。它涵盖完整的浏览器流水线,包括网络与 HTTP、屏幕绘制、文本格式化、HTML 解析、页面布局、CSS 样式、链接与表单、脚本、Cookie 与安全、视觉效果、渲染与动画、无障碍性、嵌入内容以及性能优化。本书还通过博客、社交媒体、GitHub 论坛和电子邮件提供更新与讨论。

关于《Web Browser Engineering》(browser.engineering)的 Hacker News 讨论,该书获得 115 点赞和 20 条评论。作者 pavpanchekha 指出该书写于 2019–2024 年,出版于 2025 年,未使用 AI。读者表达感谢,其中一人分享了完成该书的博客文章,另一人称赞其分层解释了浏览器的复杂性。一位正在构建自己的基于 C 语言浏览器(约 30 个库、78 万行代码)的评论者分享了进展。关于附录中一句暗示 WebAssembly 或许有朝一日与 JavaScript 平起平坐的表述,引发了争议;作者澄清这不是观点,而是对不确定性的承认。作者还解释说,.engineering 域名是通过扫描顶级域名寻找合适的 URL 而选定的。另一位用户祝贺作者避免了 LLM 生成内容。
相关文章

原文
Web Browser Engineering

Pavel Panchekha & Chris Harrelson

Twitter · Blog · Discussions

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.

  1. Preface
  2. Browsers and the Web
  3. History of the Web
  1. Downloading Web Pages
    URLs and HTTP requests
  2. Drawing to the Screen
    Creating windows and drawing to a canvas
  3. Formatting Text
    Word wrapping and line spacing
  1. Constructing an HTML Tree
    Parsing and fixing HTML
  2. Laying Out Pages
    Inline and block layout
  3. Applying Author Styles
    Parsing and applying CSS
  4. Handling Buttons and Links
    Hyperlinks and browser chrome
  1. Sending Information to Servers
    Form submission and web servers
  2. Running Interactive Scripts
    Changing the DOM and reacting to events
  3. Keeping Data Private
    Cookies and logins, XSS and CSRF
  1. Adding Visual Effects
    Blending, clipping, and compositing
  2. Scheduling Tasks and Threads
    The event loop and the rendering pipeline
  3. Animating and Compositing
    Smooth animations using the GPU
  4. Making Content Accessible
    Keyboard input, zooming, and the accessibility tree
  5. Supporting Embedded Content
    Images, iframes, and scripting
  6. Reusing Previous Computation
    Invalidation, editing, and correctness
联系我们 contact @ memedata.com