Skip to content

delan/wbe.rs

Repository files navigation

wbe.rs

this project loosely implements the Web Browser Engineering book in rust.

notes

  • enter key does not work in location bar yet, so click “go” or press tab-enter or tab-space
  • no arrow keys or page up/down keys yet, so use the mouse wheel or similar to scroll
  • redirects currently panic! (redirects are common for http → https and trailing slashes)

getting started

  • nix-shell --run 'cargo fmt && cargo run --release -- https://browser.engineering'
  • build environment vars
    • WBE_FONT_PATH (required) = path to your default font
    • WBE_FONT_PATH_B (required) = path to that font in bold
    • WBE_FONT_PATH_I (required) = path to that font in italic
    • WBE_FONT_PATH_BI (required) = path to that font in bold italic
    • WBE_TIMING_MODE (optional) = if present, quit after first layout
    • WBE_DEBUG_RWLOCK (optional) = if present, print backtraces of RwLock acquisitions
  • runtime environment vars
    • RUST_BACKTRACE (optional) = set to 1 or full to print backtraces of panics
    • RUST_LOG (optional) = configure logging in tracing_subscriber::EnvFilter
      • e.g. RUST_LOG=info,wbe=debug,wbe::layout=trace
    • WINIT_X11_SCALE_FACTOR (optional) = set the ratio of real pixels to css px

bonus features

  • location bar with double buffering
  • async load/parse/layout
  • incremental load/parse/layout
  • html parser
    • correct handling of end-tag-with-attributes error
    • correct handling of end-tag-with-trailing-solidus error
    • text inside <style> is RAWTEXT
    • text inside <script> is RAWTEXT (technically should be its own unique thing for <!--)
    • implicit </p> when opening any tag in (p, table, form, h1, h2, h3, h4, h5, h6)
    • implicit </li> when opening <li>
    • implicit </dt> when opening any tag in (dt, dd)
    • implicit </dd> when opening any tag in (dt, dd)
    • implicit </tr> when opening <tr>
    • implicit </td></tr> when opening <tr>
    • implicit </th></tr> when opening <tr>
    • implicit </td> when opening any tag in (td, th)
    • implicit </th> when opening any tag in (td, th)
  • layout
    • simultaneous wrapping of english and chinese via uax #29

completion

  • chapter 1, downloading web pages
    • exercise: http/1.1 and user-agent
    • exercise: file url scheme
    • exercise: data url scheme
    • exercise: body tag filter
    • exercise: entities
    • exercise: view-source
    • exercise: compression
    • exercise: redirects
    • exercise: caching
  • chapter 2, drawing to the screen
    • exercise: line breaks
    • exercise: mouse wheel
    • exercise: emoji
    • exercise: resizing
    • exercise: zoom
  • chapter 3, formatting text
    • word by word
    • styling text
    • text of different sizes
    • exercise: centered text
    • exercise: superscripts
    • exercise: soft hyphens
    • exercise: small caps
    • exercise: preformatted text
  • chapter 4, constructing a document tree
    • handling author errors (implicit <html/head/body>)
    • exercise: comments
    • exercise: paragraphs
    • exercise: scripts
    • exercise: quoted attributes
    • exercise: syntax highlighting
  • chapter 5, laying out pages
    • backgrounds
    • exercise: links bar (hardcoded nav.links style)
    • exercise: hidden head
    • exercise: bullets
    • exercise: scrollbar
    • exercise: table of contents (hardcoded nav#toc style)
    • exercise: anonymous block boxes
    • exercise: run-ins (presentational hints for h6)
  • chapter 6: applying user styles
    • the style attribute
    • applying style sheets
      • <link rel=stylesheet>
    • cascading
    • inherited styles
    • exercise: fonts
    • exercise: width
    • exercise: height
    • exercise: class selectors
    • exercise: display
    • exercise: shorthand properties
    • exercise: fast descendant selectors
    • exercise: selector sequences (compound selectors)
    • exercise: important
    • exercise: ancestor selectors
    • exercise: inline style sheets

About

loosely implementing the Web Browser Engineering book in rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages