Commit Graph
16 Commits
Author SHA1 Message Date
Karl Seguin 79376d00fa xml: validate xml declaration
And now, because we do this, we no longer have to have the parser skip anything
that looks like a ProcessingInstruction.
2026-09-23 17:34:10 +08:00
Karl Seguin 4647dbeee9 deps: upgrade html5ever
Specifically for https://github.com/servo/html5ever/commit/a7588d1a94c7f56c7d6e52a4d32c1d330240e809
which addresses an index overflow we saw in prod.
2026-09-12 07:23:16 +08:00
Adrià Arrufat 585cfb06dd build: compile dependencies in ReleaseFast regardless of -Doptimize
Debug and release builds each compiled their own copy of every C
dependency and of the Rust staticlib, because build.zig threaded the
top-level optimize mode into all of them. Under dev_fast the deps also
picked up the bundled-CRT target query, so even the same mode could not
share objects with a plain build.

Dependencies now build in ReleaseFast for the requested target, the way
the prebuilt V8 archive already works. Debug and release builds share
one set of cached dependency objects, and debug binaries run TLS, HTML
parsing, regex and sqlite optimized. -Ddebug_deps restores the old
behaviour for stepping into a dependency.

The Rust staticlib can only be shared by dropping the Debug-only memstats
feature: its single export, html5ever_get_memory_usage, was declared on
the Zig side but never called, and it pulled a jemalloc build into every
cold debug build. The Makefile override that existed for jemalloc's
nested make goes with it.
2026-09-11 05:40:17 +08:00
Merge_Conflict - Pasi 04e2584f7a fix: pop drive-letter lookalike segment for non-file schemes (#2794)
rust-url treats a trailing 'C:'/'C|' path segment as a Windows drive
letter when shortening a path with '..', for every scheme. Per the URL
Standard that exemption only applies to file:. Work around it in the
Rust binding (fix pending upstream in servo/rust-url#1138) so that
new URL('..', 'abc://x/y/z/C:/') resolves to 'abc://x/y/z/'.
2026-09-04 18:05:13 +03:00
Karl Seguin 67927b9bde Add PDF support
adds --dump screen.pdf and CDP's Page.printToPDF (along with IO.read and
IO.read). Builds ontop of https://github.com/lightpanda-io/browser/pull/3231

This generates a text-based PDF, not just our PNG placed into a PDF. The biggest
change to the existing (isolated) code was adding href information so that links
are actually clickable.

Like 3231 the hard parts are all Claude but isolated. The one place it diverged
from the plan was NOT using the subsetter rust crate for trimming the size of
the embedded font. It felt that the dependencies were too much (e.g. a second
version of skrifa, ...). One subsetter was removed, the pdf rendering, while
still a blackbox, was moved from Rust to Zig (pdf.zig), which is kind of nice.
2026-08-28 12:53:36 +08:00
Karl Seguin a0e21b9aeb tweak: improve screenshot code
Remove singleton and give each Browser a screenshot.Renderer.

Also, add tests to make sure the Rust and Zig structures/constants match (this
has proven useful with zig-v8-fork).
2026-08-27 19:22:04 +08:00
Karl Seguin 0c24db4a00 mem: try lto=thin
Try lto=thin in rust so that the html5ever code sits together and triggers less
misses which result in more memory being used.
2026-08-25 17:02:56 +08:00
Karl Seguin de422a72f5 Embed DejaVuSansMono-Bold.ttf for bold headings
fix slant direction for italics
2026-08-25 16:02:51 +08:00
Karl Seguin 1c9971252a small tweak to the build
auto-discover .rs files in src/rust for the build (rather than maintaining the
list by hand).
2026-08-20 17:26:23 +08:00
Karl Seguin 49d473d845 cargo fmt 2026-08-19 21:49:02 +08:00
Karl Seguin ed75e929ba improve glyph cache 2026-08-19 21:49:02 +08:00
Karl Seguin 03b05e8ed2 convert rust panics into errors 2026-08-19 21:49:02 +08:00
Karl Seguin e2c16be63a Always honor screenshot clip
Extend the clip if necessary, but never past the content.
2026-08-19 21:49:02 +08:00
Karl Seguin b6960ab5ca Improve screenshot error mapping
Return (height, rc) rather than just height, so that we can correctly detect
a failed raster (which still produced a height). Also add constants for error
codes rather than magic numbers sprinkled here and there.
2026-08-19 21:49:02 +08:00
Karl Seguin 2c7237f259 cap PNG size
The final size is client-driven (for CDP) and a large width/height/scale will
OOM the process.
2026-08-19 21:49:02 +08:00
Karl Seguin ff5b791b7e wip: screenshot 2026-08-19 21:49:02 +08:00