Repository navigation
Studio: drop the live Glass blur while anything moves, on software-composited pages - #17007
Conversation
A backdrop-filter is computed again on every frame drawn, and with software compositing every frame redraws the whole window, so a menu fading in, a dialog closing or the chat scrolling re-blurred the moving surface and every still one, the sidebar above all. Glass scrolling, opens and closes cost several times Glass off. While something opens, closes or scrolls, the moving surface and the page's standing glass (sidebar, composer) now carry data-glass-moving and take a near-opaque fill of their own colour instead of the blur; the blur returns in one frame once nothing has moved for 200 ms. Tooltips and hover cards pause only themselves. At rest nothing changes. The flag is set on each surface, never on html or body, and no rule keys a descendant on data-state. Radix content transitions every property (duration-100 with the initial transition-property: all), which would fade the blur out and back in over the frames this saves, so transitions are off on paused, settling and closing Radix content. Liquid 3D's wide rim glows give way to the 1 px rim on moving dialogs and menus. Long-chat gate (Chromium, software compositing): Settings scrolling 7.8-13.6x Glass off -> 1.4-4.5x, thread scrolling 4.6-5.6x -> 1.8-4.0x. Allowances lowered to match: settings_scroll frosted 3.5, blurred 3.5, liquid 4.5, liquid-3d 6 (was 12-15); new thread_scroll 5.
With a GPU the blur is cheap and the pause only changed the look, so it now applies only where compositing is in software: no WebGL context, or a WebGL renderer that is SwiftShader, llvmpipe, softpipe or the Microsoft Basic Render Driver. The check runs once per page and is cached; for testing, window.__UNSLOTH_SOFTWARE_COMPOSITING__ or localStorage unsloth_software_compositing overrides it. WindowMaterialMount sets data-glass-motion on html with the other glass flags and every motion rule requires it, so with a GPU glass looks and moves exactly as before. Headless Chromium renders on SwiftShader, so the long-chat gate still runs the software path its ceilings assume.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…tware compositing (#17237) Follows #17007 (Glass blur paused during scrolls under software compositing). This extends the same pause to bursts of keys, presses and edits. ## Problem Under software compositing (VMs, machines without a usable GPU, CI runners) every frame redraws the whole window and recomputes every `backdrop-filter` on screen. #17007 paused the blur for scrolls, animations and mounts, but a keystroke or a click still paid for the blur on the sidebar, the Windows glass frame and the composer, even though only text changed. On the long-chat gate (Chromium, software compositing) Glass typing cost 4.1x to 4.9x the default look on main's Frontend CI. ## Change - `glass-motion.ts`: `keydown`, `pointerdown` and `input` (paste, IME, autocomplete) hold the standing glass and the surface the event lands in (a dialog or menu) for the same settle window as the motion pause (200 ms after the last event). Listeners are passive and are removed by `stop()`; starting twice is harmless. - Engages only where #17007 does: Glass material on, not WebKitGTK (which has no live blur outside the sidebar already) and software compositing detected. With a GPU nothing changes. - Long-chat gate: Glass typing gets its own ceiling of 6x per Glass mode (was the blanket 10x), and main's pre-fix CI reading (liquid, 4.9x) joins the runner-readings guard. ## Look Software compositing only: while keys or presses arrive, the sidebar, the Windows glass frame, the composer, the files panel and the touched dialog or menu swap their blur for a 96% opaque fill of their own colour, and the blur returns one frame after 200 ms without input. Text, focus, caret, IME, menus and dialogs behave as before. ## Results Local long-chat gate, 40 turns, ratio to the default look, median (range) of 3 interleaved runs per arm, base runs 1 and 2 doubling as an A/A (median per-cell A/A spread 1.20x; the host was heavily loaded). | Area | frosted | blurred | liquid | liquid-3d | | --- | --- | --- | --- | --- | | type | 3.2 -> 1.5 | 3.1 -> 1.7 | 3.6 -> 1.3 | 3.3 -> 1.5 | | message_click | 3.0 -> 1.3 | 3.6 -> 2.2 | 2.9 -> 1.7 | 3.7 -> 2.3 | | code_copy | 2.3 -> 0.7 | 2.3 -> 1.5 | 2.4 -> 0.7 | 2.0 -> 0.8 | | run_settings | 2.5 -> 1.3 | 2.9 -> 1.3 | 2.9 -> 1.4 | 3.0 -> 1.4 | | api_monitor | 4.8 -> 2.6 | 4.9 -> 3.1 | 5.2 -> 3.0 | 5.3 -> 3.0 | | menus (tools, permission, account, composer) | 1.4-1.6 -> 1.0-1.2 | 1.3-1.8 -> 1.1-1.4 | 1.6-2.2 -> 1.2-1.3 | 1.9-2.2 -> 1.3-1.4 | | thread_scroll / settings_scroll | 1.8 / 2.1 -> 2.1 / 2.0 | 2.3 / 2.3 -> 2.4 / 2.2 | 2.7 / 3.4 -> 2.2 / 2.8 | 2.6 / 4.3 -> 2.4 / 3.8 | Scrolls are unchanged, as expected (#17007 already covers them). Absolute Liquid 3D CPU under the same load: typing 480 -> 291 ms, message click 433 -> 307 ms. ## Tests - `tests/glass-motion.test.ts`: a burst of keys and presses holds the glass and releases it after the settle window; `stop()` removes the new listeners (13 pass). - `tests/studio/test_area_matrix.py`: 33 pass. Frontend node suite 15,325 pass, `tsc --noEmit` clean. - Not covered locally: GitHub runners (this PR's Frontend CI gate is the check), real WebKit and GPU paths, where the pause is off by design. ## Screenshots Chromium with software compositing, Liquid 3D, light theme, 30-turn chat. Left: at rest (unchanged from main; base vs head at rest differ only by a 1 px scroll offset). Right: the state held while keys or presses arrive (the same state #17007 shows during a scroll). Chat:  Settings:  Tools menu: 
unslothai#17274) ## Problem The long-chat gate sometimes reports `source_card` as NOT_RUN ("never reached sel in this mode, OK in default"), most often in Liquid 3D at 200 turns. It has failed Frontend CI on unrelated PRs (the Ubuntu composer leg of unslothai#17007, local runs of other branches). ## Cause The thread viewport is `scroll-smooth`. The harness's `scrollIntoView({block: 'nearest'})` therefore animated and returned while the target was still moving: on a freshly loaded 200-turn page the last source chip starts 3,000 to 19,000 px below the viewport, and `scrollTop` kept climbing for about 2 s after the call. `block: 'nearest'` from below also parks the chip at the viewport's bottom edge (y about 836 to 875 of 900), which is under the floating composer, so the trusted Playwright hover landed on the composer and no hover card opened. Both natural failures had the chip at [643, 836, 151, 26] with `button.composer-pill-btn` under its centre. ## Change - The target scroll uses `behavior: 'instant'`. - Before a trusted pointer action (`hover`, `pclick`) only, the harness waits until the target's rect holds for 3 frames (capped at 120) and checks that the target is the element under its own centre; if something covers it, it centres the target instantly and waits again. A target already clear gets no extra scroll. - Measurement, fail rules and areas are unchanged; nothing is skipped. ## Results Liquid 3D, 200 turns, 2 to 4 browsers in parallel on a loaded host: | | before | after | | --- | --- | --- | | full 30-area sweep | 2 of 32 NOT_RUN | 0 of 30 | | chip forced under the composer | 16 of 16 NOT_RUN | 0 of 16 | `source_card` CPU on passing runs is comparable (median 1038 ms, range 796 to 2291, before; 1284 ms, 1037 to 1846, after). `tests/studio/test_area_matrix.py`: 32 pass.
…de pauses its blur (software compositing) (unslothai#17308) ## Problem With Glass under software compositing (no GPU, the case the unslothai#17007 motion pause targets), scrolling the Settings dialog still costs about 3x to 4.5x the default look. The see-through Settings pane is not scrolled by the compositor: every scroll frame re-rasters the whole pane (raster 2 ms on the default look vs 384 ms on Liquid 3D in a trace). Removing blur, shadows, background images or filters, even all together, does not fix it; giving the pane its own scrolling layer does. The API monitor panel also fades in and out through a script animation, which fires no CSS animation events, so the motion pause never saw it and its blur was recomputed on every fade frame. ## Change - `index.css`: `html[data-glass][data-glass-motion] [data-settings-main-scroll] { will-change: scroll-position; }` gives the Settings content pane its own composited scroll layer. Only with Glass under software compositing (`data-glass-motion` is only set when the page has no GPU renderer); GPU users and the default look are untouched. - `settings-dialog.tsx`: `data-settings-main-scroll` on the content pane's scroller. - `glass-motion.ts`: `holdGlassMotion(el, ms)` reaches the running pause controller (a no-op when the pause is not running; stopping the controller clears it). - `api-monitor-overlay.tsx`: the panel's animation start and complete callbacks hold the pause for the fade. Trade-off: under Glass with software compositing, text in the Settings pane may lose subpixel antialiasing (grayscale instead), as text on any composited scroll layer does. Headless Linux already renders grayscale, so the screenshots below cannot show it. ## Results Long-chat gate harness, Chromium software compositing, 40 turns, Glass cost as a multiple of the default look. 3 rotated runs per arm, `main` measured twice (A/A): | Area | Look | main (both arms) | this PR | | --- | --- | --- | --- | | Settings scroll | Liquid | 2.7x to 3.2x | 1.4x to 1.9x | | Settings scroll | Liquid 3D | 3.3x to 4.5x | 1.4x to 2.0x | | API monitor | Liquid / Liquid 3D | 2.0x to 2.9x | 2.0x to 2.8x | | Typing, thread scroll, Settings tabs | all | unchanged (inside the A/A spread) | | The API monitor hold engages (Liquid 3D compositor time 306 to 394 ms -> 190 to 230 ms per open and close), but its gate ratio stays inside the A/A spread. ## Tests - `tests/glass-motion.test.ts`: two new tests for `holdGlassMotion` and the API monitor wiring. - Full long-chat gate passes on this branch. `tsc --noEmit` clean. Frontend node suite: everything passes except `mic-target` (fixed on main by unslothai#17293) and a KaTeX test that only fails with a symlinked `node_modules` (same on main). - Look at rest: Settings differs from main by at most 3/255 (two main runs differ by up to 67/255); the API monitor panel is pixel identical and is never left paused at rest. - Not measured: Windows and real devices. ## Look Left: main. Right: this PR. Liquid 3D, software compositing, at rest.  
…th and the Windows-style title bar) (#17387) Since #16957 and #17327, Glass on the Linux desktop app has no live blur at all: every glass surface is a dense or opaque fill. On a machine with a GPU that trade buys nothing and Glass stops looking like glass: - The sidebar, composer, menus, dialogs and side panes no longer frost what is behind them. Over a wallpaper image the sidebar is a 96% opaque slab. - Glass strength does nothing. Dragging it from 0 to 100 on the chat page changes the computed paint of 0 of 932 elements and 0 pixels, because there is no blur to scale and every fill sits at its cap. This removes the WebKitGTK no-blur rule and every fill that compensated for it, so Linux Glass uses the same blur, fills and strength as macOS and Windows again. **Kept from those PRs**, still under `data-glass-cpu`, because they are paint costs that do not depend on the blur: - Frosted's grain tile (an SVG `feTurbulence` redrawn on every paint) stays off. - Liquid 3D's wide inner glows stay gradients and its lifts keep the smaller blur. **Software compositing.** The pause-blur-while-moving path (#17007) skipped WebKitGTK only because there was no blur left to pause; it no longer does. One limit: WebKitGTK masks the WebGL renderer string ("Apple GPU"), so `softwareCompositing()` only reports true there when WebGL is unavailable or the documented override is set. It does not see llvmpipe. **The composer's blur was never drawn on Linux (second commit).** With the blur back, the sidebar frosted the wallpaper but the composer showed it sharp behind a tint, although both compute the same `backdrop-filter`. The composer and the files panel each hold a "Drop files here" overlay that sits at `opacity: 0` with its own `backdrop-blur-sm` until a file is dragged, and WebKitGTK stops drawing a surface's own backdrop blur while a hidden child of it carries a `backdrop-filter`. The overlays now take their blur only in the states that show them. In the real app, edge detail behind the composer goes from 24.0 to 1.6 (sidebar 0.8, bare wallpaper 35.2), and putting the hidden overlay's blur back on the live element returns it to 24.0. New `tests/glass-hidden-overlay-blur.test.ts` pins it. **The Linux title bar now matches Windows (third commit).** Linux uses the same in-page title bar as Windows, but three parts of its Glass layout were switched on for Windows only: the frame that joins the title bar strip and the pinned sidebar into one frosted surface with a rounded inner corner, the browser pane's single glass layer below the caption, and the wallpaper blur behind non-chat pages. On Linux the strip behind the window buttons was bare wallpaper. All three now key on `shouldUseCustomWindowTitlebar()` instead of a Windows check; the `data-windows-*` attribute names are unchanged. On a rebuilt copy of the Linux page in WebKitGTK 2.54.2 the frame draws as on Windows (its `mask` and `backdrop-filter` on one pseudo-element work there), and that build supports the CSS anchor positioning the page layout uses. The look was checked by eye in the running Linux app against Windows screenshots. Measurements, native Tauri dev build, WebKitGTK 2.54.2, KDE Wayland, Liquid Glass 3D over a wallpaper image, 600-message thread, 238 scripted scroll frames, three alternating runs each: | Rendering | Blur | Frame p50 / p90 | Frames over 25 ms | | --- | --- | --- | --- | | GPU (NVIDIA) | on (this PR) | 16 / 18 ms | 0 to 9 | | GPU (NVIDIA) | off | 16 / 17-18 ms | 0 to 9 | | Software GL (llvmpipe forced) | on (this PR) | 20-22 / 24-28 ms | 18 to 38 | | Software GL (llvmpipe forced) | off | 16 / 17 ms | 2 to 6 | | Software GL, motion pause forced on | paused while scrolling | 16 / 17 ms | 1 | So with a GPU the live blur is free here, and without one this PR costs about 5 ms a frame on a fast desktop CPU, more on a slower one. That cost is the trade-off of this change. With the motion pause on, scrolling is back to 16 ms and the blur returns at rest, so a reliable software-rendering signal for WebKitGTK (for example from the shell) would close the gap as a follow-up. Validation: - Live in the app: the sidebar and composer compute `blur(...) saturate(...)` with translucent fills again, and follow Glass strength. - `tests/glass-webkit-blur.test.ts` rewritten: the flag may only swap paint costs (no rule under it touches a blur, a fill or the strength variables); the grain and glow rules are still pinned. `tests/glass-motion.test.ts` updated for the gating. Full frontend suite (15,608) and the test typecheck pass. Not checked: the title bar change on Windows itself (the condition is still true there, so it should be unchanged), the drop overlays while a file is actually being dragged, light theme, Frosted and Blurred styles, a real host without a GPU (software GL was forced on a GPU machine), and the AppImage build. Relation to #17380: that PR's side-pane fill change edits a rule this PR deletes, so whichever lands second needs a small rebase. Its black tab strip came from the opaque fill removed here. Its sheen fix is still needed, since the stripes do not depend on the blur.
Problem
With software compositing (no usable GPU: WebView2 on the Microsoft Basic Render Driver, Chromium on SwiftShader, Linux on llvmpipe), every frame redraws the whole window and recomputes every
backdrop-filteron screen. A menu fading in, a dialog closing or the chat scrolling therefore re-blurs the moving surface and every still one, the sidebar most of all. Under Glass, scrolling Settings cost 7.2x and scrolling the chat 3.3x the CPU of Glass off (Chromium, 150 turns).Pausing only the surface that moves gains little, because the still sidebar is the largest single cost (Chromium CPU vs Glass off, liquid-3d):
Fix
software-compositing.ts: a one-time, cached probe. No WebGL context, or a WebGL renderer matching SwiftShader, llvmpipe, softpipe or Basic Render, means software. Overridable withwindow.__UNSLOTH_SOFTWARE_COMPOSITING__or localStorageunsloth_software_compositing.glass-motion.ts: only when software is detected, a scroll (not inside text fields), a glass surface's open or close animation, or a menu or dialog appearing marks the moving surface plus the sidebar, Windows frame and composer as in motion. Those swap the blur for a 96% fill of their own colour (Liquid 3D's wide rim glows become the 1 px rim). The blur returns in one frame after 200 ms without motion. Tooltips and hover cards pause only themselves; the native macOS material keeps its sidebar.htmlorbody, with no:has()and no descendant rule keyed ondata-state, so toggling motion does not restyle the thread. Every motion rule requireshtml[data-glass-motion], which is set only on software pages.transition: all, which faded the blur back in over six full blur frames; it is off for these surfaces._area_matrix.py): Glasssettings_scrollandthread_scroll6x (was 12-15x and none), every other area 10x. The gate's headless Chromium is software, so it runs this path.What users see
Apple GPUand keep main's behaviour.Results
150 turns, 3 reps interleaved, CPU time of all browser threads over each interaction plus 800 ms (so the blur's return is counted), ratio vs Glass off. Software path (Chromium; WebKit forced through the override):
Chromium Settings scroll p95 frame time: 72 ms -> 20-22 ms (Glass off: 19 ms). Typing is not treated as motion and is unchanged within noise.
Long-chat gate, highest Glass/default reading across the four Glass modes: Settings scroll 9.5-13.6x on main vs 1.4-4.5x here; thread scroll 4.6-5.6x vs 1.8-4.9x.
Tests
software-compositing.test.ts(software renderer names, no WebGL, GPU names, context release, override both ways, window flag before localStorage, caching) andglass-motion.test.ts(12 tests, including that every motion rule requires[data-glass-motion]and that no motion rule is adata-statedescendant rule).npm test: all pass except the KaTeX stylesheet Vite test, which also fails on main with a symlinked node_modules.node scripts/typecheck.mjs --testsclean.test_area_matrix.py28 passed. Full long-chat gate: PASS.Not covered
Screenshots
Headless Chromium (software compositing), light theme with a colourful wallpaper, 150-turn chat. Left: main at rest. Middle: this PR at rest (identical). Right: this PR mid-scroll or mid-open, where the sidebar, composer and menu take a solid tint instead of the frosted wallpaper until 200 ms after the motion stops. With a GPU the right panel looks like the middle one.
Frosted, chat:
Frosted, Tools menu open:
Liquid 3D, chat: