feat(wasm-dom): Phase 2 — real DOM controls; seed DOM-port screenshot baselines

tests/apps/Makefile.wasm: pre-js shims are link dependencies (editing
wx.js/wx-dom.js now relinks apps); $^ link rules filter to %.o/%.a so
the new deps stay out of wasm-ld inputs. Seed baseline-screenshots-dom
(251 screenshots) from the green WX_PORT=dom full-suite run (251/0).
Cross-port visual comparison notes in docs/features/wx-dom-port/
(10 bugs found by the protocol, all fixed in wxwidgets).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Viktor Vaczi 2026-06-10 20:55:18 +02:00
commit a6ce7fbc11
254 changed files with 126 additions and 61 deletions

View file

@ -0,0 +1,61 @@
# Cross-port visual comparison notes (canvas baseline vs DOM port)
Protocol: per feature, view `tests/baseline-screenshots/<name>.png` (canvas)
next to `tests/test-results/dom/<name>.png` (DOM). Expectation: same widget
geometry (within a few px), same text/content/state; only widget styling
(native control chrome, fonts antialiasing) may differ.
## Phase 2 (2026-06-10) — layout suite
`layout-01-loaded` and siblings, after the geometry-propagation and frame-bar
fixes:
- **Matches canvas:** splitter pane split position, left/right item placement
and vertical rhythm, event-log textarea geometry and content ("Layout test
app started / Splitter position: 300" as real selectable text), status bar
text at the bottom, window title at top-left.
- **Expected styling deltas:** native `<textarea>` chrome vs univ-drawn text
area; statusbar/panel grey backgrounds not painted yet (canvas islands do
not erase-paint panel backgrounds in DOM mode — Phase 4); `wxStaticBox`
"Event Log" caption+border missing (statbox DOM node lands in Phase 3 B1);
text baseline within spans sits ~2px higher than canvas text.
- **Bugs found & fixed by this comparison:**
1. DOM rects are TLW-relative, so ancestor moves must recursively refresh
descendants' DOM geometry (children's wx rects don't change when a
parent moves). Fixed in `wxWindowWasm::UpdateDomGeometry`.
2. `WriteText`/`AppendText` mutate the wxTextEntry cache without
`DoSetValue`, so the DOM `value` must be pushed there too. Fixed in
`wxTextCtrl::WriteText`.
3. Stub `wxFrame` didn't position bars — status bar text rendered at
(0,0) over the title. Fixed by porting the univ bar geometry
(`framuniv.cpp`) into `src/wasm/frame.cpp`.
## Phase 2 (2026-06-10) — dialog/timer apps, second round
`dialog-02-info-clicked` vs canvas baseline after the second fix round:
- **Matches canvas:** button rows centered with correct sizes/labels, modal
Information dialog as near-twin (title bar + close button, two message
lines, OK button bottom-right with stock label), grey window chrome,
event-log textarea with content.
- **Expected deltas:** info icon missing (wxStaticBitmap is Phase 3), dialog
border/shadow chrome thinner (Phase 5), native button styling.
- **Bugs found & fixed by this comparison round:**
4. `wxSystemSettingsNative::GetColour` returned black for nearly all
colours (univ theme used to mask it) — black dialog bodies/canvas
islands. Fixed with a classic light palette (native mode only).
5. DOM children of hidden ancestors (unselected notebook pages) stayed
visible — visibility now syncs the whole subtree via IsShownOnScreen.
6. Unhandled wxEraseEvent left canvas islands black in native mode —
default background fill added (native only).
7. DoGetBestSize measured 0x0 while elements/ancestors were display:none
(sizers run before Show) — measurement now uses a clone in an
offscreen always-rendered host.
8. `white-space: nowrap` discarded multiline wxStaticText newlines →
'pre'. wxDomSetShown also restored display:'' wiping flex → remembers
the preferred display.
9. Stock-id buttons with empty labels (msgdlg OK) rendered tiny — stock
label resolution added to wxButton::Create like other ports;
wxButtonBase::GetDefaultSize implemented.
10. Shim-only edits didn't relink test apps — JS pre-js files are now
Makefile dependencies of every app link rule.