Web Browser Engineering

Pavel Panchekha & Chris Harrelson

Twitter · Blog · Patreon · 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 or Twitter for updates. You can also talk about the book with others in our discussion forum.

If you are enjoying the book, consider supporting us on Patreon.

Or just send us an email!

Introduction

  1. Preface
  2. Browsers and the Web
  3. History of the Web

Part 1: Loading Pages

  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

Part 2: Viewing Documents

  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

Part 3: Running Applications

  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

Part 4: Modern Browsers

  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

Conclusion

  1. What Wasn’t Covered
  2. A Changing Landscape

Appendix

  1. Glossary
  2. Bibliography
  3. About the Authors
  4. Contributors
  5. List of courses taught from this book
  6. One-page version