openpencil/tests/engine/render/canvas
Danila Poyarkov cb075b3e1a
perf: speed up opening large pages (#953)
* perf(canvas): find guide owners from an index instead of walking the page

Drawing and hit-testing guides visited every layer of the page on each frame to find the few that carry guides; on a large page that took about 1.2s of a load's rendering. The graph now keeps the set of layers with guides current from its node events, and both read it.

* perf(layout): write only changed geometry and request one render per layout pass

Layout wrote every laid-out layer's geometry whether or not it changed, so each pass over a large page notified every graph listener for every layer; a page load spent about 1s handling those updates. Layout now writes only the fields that changed, and the updates a layout pass makes ask for a single render, queued for before the next frame, instead of bumping the editor's reactive versions once per layer.

* test(canvas): drop the graph double the guide tests no longer use

* perf(fig): copy an opened file once on the main thread instead of three times

Opening a .fig in the browser copied the file for a main-thread fallback the caller's buffer already served, then copied it twice more for the worker, which parses from one and keeps the other as the original archive. A 109MB file briefly took over 400MB on the main thread. The fallback now reuses the caller's buffer, and the worker receives one copy and makes its archive copy itself.

* docs(changelog): note faster large-page loads

* fix(app): run recovery and autosave after edits, not redraws

Recovery and autosave watched sceneVersion, a render counter that every
requestRender bumps: opening a file, layout passes, fonts, and each layer a
page loads. Safari has no File System Access API, so its opened files have
no writable source and always get recovery snapshots. Loading a page also
invalidated the original archive, so a snapshot encoded the whole document
again; on the Preline UI kit's CMS page that ran about 100 s on the main
thread in WebKit before failing.

Recovery, autosave, and saved versions now follow the content revision of
createDocumentChanges. A page's layers loading from the opened file, which
runs inside applyImportedStateDuring on both the worker and main-thread
paths, no longer counts as an edit for that revision or for the original
archive, and asks for one render rather than one per layer.

In WebKit the CMS page switch drops from 105-133 s to 21 s, and its longest
main-thread stall from 90-117 s to 1.4 s.

* refactor(app): stop storing a version with recovery snapshots

Adopting a snapshot now protects the document's current content revision,
so nothing reads the version a snapshot was taken at. Snapshots saved by
earlier versions carry a sceneVersion field instead; dropping the field
keeps the metadata type true for both. Tests tell snapshots apart by the
bytes they were built with.
2026-10-07 20:57:57 +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 perf: speed up opening large pages (#953) 2026-10-07 20:57:57 +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 fix(canvas): orient linear gradients like Figma 2026-05-18 03:21:16 +03:00
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