From efd779f173788eea371f608c8729491957c20491 Mon Sep 17 00:00:00 2001 From: Universe Date: Wed, 22 Apr 2026 21:49:23 +0900 Subject: [PATCH 1/6] refbrowser: cg-reftest skill section + Playwright producer + suites MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New HTML/CSS reftest harness. Pairs the existing @grida/reftest diff tool with a Playwright-Chromium producer for expecteds and the cg `golden_htmlcss` example for actuals, driven by suite JSONs under `fixtures/test-html/suites/`. What landed: - `.agents/skills/cg-reftest/scripts/refbrowser_render.ts` — new Playwright producer. Reads a `--suite ` JSON, iterates fixtures, renders each under a fixed viewport with optional extra-CSS injection. - `crates/grida-canvas/src/htmlcss/mod.rs` — new public helper `htmlcss::with_extra_stylesheets(html, &[css])` that injects a `"); + + // HTML tag names are ASCII, so lowercasing the haystack is safe. + // One pass, correct for any casing of ``. + if let Some(idx) = html.to_ascii_lowercase().find("") { + let mut out = String::with_capacity(html.len() + combined.len()); + out.push_str(&html[..idx]); + out.push_str(&combined); + out.push_str(&html[idx..]); + return out; + } + format!("{combined}{html}") +} + /// Render HTML+CSS to a Skia Picture. /// /// Images referenced by `` or `background-image: url()` are diff --git a/fixtures/test-html/L0/paint-background-solid.html b/fixtures/test-html/L0/paint-background-solid.html index 8cbc4d3ba..e63bd3f7c 100644 --- a/fixtures/test-html/L0/paint-background-solid.html +++ b/fixtures/test-html/L0/paint-background-solid.html @@ -4,6 +4,11 @@ Paint: Solid Background