openpencil/tests/engine/render/canvas
Danila Poyarkov 974905289a
fix(canvas): keep image-heavy documents within CanvasKit memory (#963)
* fix(canvas): bound image decoding for large Figma documents

* test(canvas): update lifecycle fixture for image caches

* test(canvas): align image regressions with contribution guides

Use native wheel zoom in the browser regression instead of inline store access. Keep export state restoration in the existing raster suite and explicitly format the new image tests omitted by the root format script.

* fix(harness): pin patched proxy address dependency

Override the transitive proxy-addr dependency with 2.0.8 to fix IPv4-mapped IPv6 trust subnet checks and pass the critical dependency audit (GHSA-jqcg-44mw-7w3h).

* build: drop the proxy-addr override master already resolves

Master's lockfile has proxy-addr 2.0.8 since the advisory was fixed
upstream, so the override this branch added is redundant.

* perf(canvas): encode image previews as WebP

PNG previews of photos ran to several megabytes each, so a page of them
filled the 64 MiB preview cache and evicted itself: page 2 of the #924
reproduction held 48 MB of PNG previews against 7.3 MB as WebP. Browsers
that cannot encode WebP hand back PNG.

Co-authored-by: sableangle <sableangle@gmail.com>

* perf(canvas): decode four image previews at once

The browser decodes previews off the main thread, so one at a time left
a page of photos filling in for seconds: page 2 of the #924 reproduction
took 4.6 s to finish and now takes 2.0 s.

Co-authored-by: sableangle <sableangle@gmail.com>

* refactor(canvas): decide on image previews once per document size

needsImagePreviews replaces useViewportImageRendering, which was not a
Vue composable, names its two thresholds, and keeps its answer per
document and image count instead of summing every image on each frame.
Choosing a preview by zoom carries a lint exception: preview mode draws
the scene uncached.

Co-authored-by: sableangle <sableangle@gmail.com>

* docs: describe the image memory fix in the changelog

Co-authored-by: sableangle <sableangle@gmail.com>

* fix(canvas): let go of a document's image previews when the document changes

Switching to a document that needs no previews left the preview cache
holding the previous graph and its encoded images, often hundreds of
megabytes, until previews were used again. The renderer now releases
them when its document changes, keeping the decoder for the next one.

---------

Co-authored-by: sableangle <sableangle@gmail.com>
2026-10-07 20:30:25 +00:00
..
chunks test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
effects test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
guides test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
labels fix(canvas): show every top-level frame's name and select frames by it (#930) 2026-10-06 11:37:46 +00:00
tiles test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
visual test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
arrow-heads-draw.test.ts test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
blend.test.ts test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
boolean.test.ts test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
cache.test.ts refactor(canvas): draw screen-sized chrome through one outline helper (#947) 2026-10-07 18:37:05 +00:00
component-label-text.test.ts test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
corner-smoothing.test.ts test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
culling.test.ts test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
derived-text.test.ts feat(fig): occurrence-scoped instance interpretation as the single .fig reader 2026-10-01 11:20:27 +04:00
diamond-gradient.test.ts fix(canvas): preserve paint geometry and color fidelity 2026-09-16 02:57:56 +03:00
effect-raster-cache.test.ts refactor(canvas): share bounded resource cache bookkeeping 2026-09-15 21:28:16 +03:00
effect-raster-integration.test.ts test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
font-readiness.test.ts test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
gradient.test.ts
helpers.ts test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
image-fill.test.ts test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
label-cache.test.ts test: align label cache contracts with component members 2026-09-16 16:14:12 +03:00
layout-grids.test.ts test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
line.test.ts feat(scene-graph)!: make a stroke a paint (#864) 2026-10-04 13:38:05 +04:00
masks.test.ts test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
measurement.test.ts feat(canvas): measure distances between layers (#515) 2026-08-14 18:18:55 +03:00
normalize-dash-pattern.test.ts fix(canvas): normalize imported dash patterns 2026-08-31 22:25:48 +03:00
painted-text.test.ts test(canvas): load painted-text font fixtures explicitly 2026-09-16 03:27:10 +03:00
picture-invalidation.test.ts perf(text): measure each text once per shaping and layout width (#959) 2026-10-07 19:48:25 +00:00
raster-export.test.ts fix(canvas): keep image-heavy documents within CanvasKit memory (#963) 2026-10-07 20:30:25 +00:00
renderer-lifecycle.test.ts fix(canvas): keep image-heavy documents within CanvasKit memory (#963) 2026-10-07 20:30:25 +00:00
retained-backing-pixels.test.ts test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
retained-backing.test.ts test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
schema-fill-fallback.test.ts test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
surface-replacement.test.ts test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
text-font-variations.test.ts fix(text): render variable font styles at their named instances (#773) 2026-09-26 11:25:01 +04:00
text-preparation-cache.test.ts perf(text): measure each text once per shaping and layout width (#959) 2026-10-07 19:48:25 +00:00
text.test.ts fix(fig): write text glyphs from the layout the renderer draws (#928) 2026-10-06 11:37:02 +00:00
variable-modes.test.ts test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00