Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

masking: the flow's dots, scan and Live dot stop moving once played (#3185)

yetone4b3bdbe28c68
diff --git a/internal/gui/assets/plugins/redact/page.js b/internal/gui/assets/plugins/redact/page.js
index 3f83a111c..1ad4a863e 100644
--- a/internal/gui/assets/plugins/redact/page.js
+++ b/internal/gui/assets/plugins/redact/page.js
@@ -317,7 +317,9 @@ function maskFlow(sum, move) {
if (q === ks[i] >> 1 && !still) for (let k = 0, dots = 1 + Math.round(2 * r.n / max); k < dots; k++) {
const dur = 1.7 + i * .5, begin = (out ? dur : 0) + k * 2 * dur / dots + "s";
const z = out ? 1.8 : 1.7, dot = add("rect", { x: -z, y: -z, width: 2 * z, height: 2 * z, rx: out ? .6 : z, class: "mo-dot" + (out ? " out" : "") });
- const a = { dur: dur + "s", begin, repeatCount: "indefinite" };
+ // twice round when drawn, not forever: an endless motion lays the
+ // page out each frame, ~16% of a core while it sits open (#3185)
+ const a = { dur: dur + "s", begin, repeatCount: 2 };
add("animateMotion", { path: d, ...a }, dot);
add("animate", { attributeName: "opacity", values: "0;1;1;0", keyTimes: "0;.1;.85;1", ...a }, dot);
}
diff --git a/internal/gui/assets/plugins/redact/redact.css b/internal/gui/assets/plugins/redact/redact.css
index 130187ba2..bf91bc6d6 100644
--- a/internal/gui/assets/plugins/redact/redact.css
+++ b/internal/gui/assets/plugins/redact/redact.css
@@ -65,7 +65,7 @@
.mo-th.one { stroke-width: .9; }
.mo-mem { stroke: var(--accent); stroke-opacity: .55; stroke-width: 1; }
.mo-tick { stroke: var(--accent); stroke-opacity: .35; stroke-width: .6; }
-.mo-scan { fill: var(--accent); opacity: 0; animation: mo-scan 5.5s cubic-bezier(.45, 0, .55, 1) infinite; }
+.mo-scan { fill: var(--accent); opacity: 0; animation: mo-scan 5.5s cubic-bezier(.45, 0, .55, 1) 2; }
@keyframes mo-scan { 0% { transform: translateY(0); opacity: 0; } 15%, 85% { opacity: 1; } 100% { transform: translateY(var(--h)); opacity: 0; } }
.mo-dot { fill: var(--fg); opacity: 0; }
.mo-dot.out { fill: var(--accent); }
@@ -88,7 +88,7 @@
.msk-list { margin-top: 14px; }
.msk-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.msk-live { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
-.msk-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--green, var(--accent)); animation: msk-live 2.4s ease-in-out infinite; }
+.msk-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--green, var(--accent)); animation: msk-live 2.4s ease-in-out; }
@keyframes msk-live { 50% { opacity: .35; } }
.msk-facets { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.msk-facet { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--card); color: var(--fg-2); font: inherit; font-size: 12px; cursor: default; white-space: nowrap; }
diff --git a/internal/gui/tests/masking-records.test.cjs b/internal/gui/tests/masking-records.test.cjs
index 553b364d9..50ec7d377 100644
--- a/internal/gui/tests/masking-records.test.cjs
+++ b/internal/gui/tests/masking-records.test.cjs
@@ -125,7 +125,7 @@ function serve(lang, sum, asked, opts = {}) {
async function open(engine, lang, width, sum, where, opts) {
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
- const page = await (await browser.newContext({ viewport: { width, height: 1000 }, reducedMotion: "reduce" })).newPage();
+ const page = await (await browser.newContext({ viewport: { width, height: 1000 }, reducedMotion: opts?.motion ? "no-preference" : "reduce" })).newPage();
page.setDefaultTimeout(8000);
const errors = [], asked = [];
page.on("pageerror", (e) => errors.push(e.message));
@@ -166,6 +166,38 @@ async function stillClick(page, loc) {
assert.deepEqual(await scrolled(page), before, "no click moved the page");
}
+// The page comes to rest while it sits open (#3185): the flow's dots, its
+// scan mark and the Live dot each play a few times when drawn. Endless,
+// the dots (SMIL) laid the page out ~700 times a second in Chromium, 16%
+// of a core and ~0.5W; in WebKit 180 wakeups a second. SMIL's clock is
+// moved on and each CSS animation's end is read, so nothing waits.
+for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
+ for (const width of [1100, 640]) {
+ test(`${engine} ${width}px: the masking page's motion ends`, async (t) => {
+ const { browser, page, errors } = await open(engine, "en", width, summary, "", { motion: true });
+ t.after(() => browser.close());
+ const card = page.locator("#maskCard");
+ await card.locator(".mo-flow .mo-dot").first().waitFor({ state: "attached" });
+ await page.locator("#maskList .msk-live i").waitFor({ state: "attached" });
+ const rest = await page.evaluate(() => {
+ const smil = [...document.querySelectorAll("#view-masking animate, #view-masking animateMotion")];
+ for (const svg of new Set(smil.map((a) => a.ownerSVGElement))) svg.setCurrentTime(3600);
+ // WebKit keeps an ended one's start time, so only Chromium is asked
+ // the clock; both are asked each one's own timing
+ const on = smil.filter((a) => { try { a.getStartTime(); return true; } catch { return false; } }).length;
+ const forever = smil.filter((a) => ["repeatCount", "repeatDur", "dur", "end"].some((k) => a.getAttribute(k) === "indefinite") || !(+a.getAttribute("repeatCount") > 0)).length;
+ const endless = document.getAnimations().filter((a) => a.effect?.getComputedTiming().endTime === Infinity).map((a) => a.animationName || a.id || "?");
+ return { smil: smil.length, on, forever, endless };
+ });
+ assert(rest.smil > 0, "the flow moves when drawn");
+ assert.equal(rest.forever, 0, "a dot set to go round for good");
+ if (engine === "chromium") assert.equal(rest.on, 0, "an hour on, a dot still goes round");
+ assert.deepEqual(rest.endless, [], "an animation that never ends");
+ assert.deepEqual(errors, []);
+ });
+ }
+}
+
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) {
for (const width of [1100, 640]) {