Repository navigation
Studio: keep Glass fast on WebKit by giving glass surface contents their own layers - #16921
Merged
Merged
Conversation
…eir own layers WebKit repaints a glass surface's blurred shadows and backdrop whenever anything inside it changes. On CPU painting (Linux desktop, software rendering) that made scrolling Settings run at about 105 ms per frame and typing in the composer 40 ms per key with Glass on, against 27 ms with it off. With Glass on in WebKit only, the direct children of the dialog, sidebar, composer and files panel now get their own layers via will-change: opacity, so a repaint inside stays in that layer. The look is unchanged, containing blocks are untouched, and Chromium and solid are unaffected.
Member
Author
|
@codex review |
Codex Review Summary: ❌ FailedThis 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. |
This was referenced Nov 6, 2026
Member
Author
|
@codex review |
…bKit glass With glass layers on, every dialog child is its own stacking context, so the inline suggestions dropdown in the search toolbar was painted under the following editor grid and clicks landed on the textarea. Stack the toolbar above the grid and document the contract on the layer rule.
Member
Author
|
@codex review |
LeoBorcherding
added a commit
to LeoBorcherding/unsloth
that referenced
this pull request
Nov 6, 2026
Conflicts were the store split against unslothai#16890 and unslothai#16921: elementOutline moves into lib/appearance-customization.ts with a CUSTOMIZATION_FIELDS entry (chat), and the material store starts its new scope from the PR's defaults.
oobabooga
pushed a commit
to oobabooga/unsloth
that referenced
this pull request
Nov 6, 2026
…xcept the sidebar's (unslothai#16957) ## Problem On the Linux desktop app (WebKitGTK, which paints on the CPU), every live `backdrop-filter` is re-run on every frame, so a caret blink or a scrolled line re-blurs every glass surface on screen. With Glass on, typing, scrolling Settings and the Glass controls all pay for it. After unslothai#16921 (child layers), the remaining WebKit Glass cost is the live blur itself. ## Fix Linux desktop app only. `WindowMaterialMount` sets `data-glass-cpu` on `<html>` when `isWebKitGTK(navigator.platform, navigator.userAgent)` holds, with the same conditions as the other Glass flags (not Solid, not Transparent, route in scope). All new rules key on it: - Live blur is turned off everywhere except the sidebar (and the framed titlebar sidebar), which keeps its real blur and looks exactly as before. Toasts, which set their own blur with `!important`, are turned off explicitly. - Dialogs, menus and toasts get fully opaque fills, so nothing behind them shows through; the composer reaches the 96% fill cap at the default strength; Glass strength cannot drop fills below a readable floor. - Every surface that loses its blur on this path is made readable: stuck page headers (Library tabs) get the opaque page background while stuck; menus, selects, popovers and hover cards in light Glass without a wallpaper get the opaque popover colour; tooltips get `var(--tooltip-bg)`; sticky bars inside dialogs, sheets, popovers and the chat settings panel, and the chat settings and browser panels, get opaque fills; light page controls and cards over the image go to 80 to 85% white. - Components' own Tailwind `backdrop-*` blurs (gallery menus, overlays, toolbars) are left alone, as with Glass off. - Liquid Glass 3D's wide blurred inner glows are drawn as gradients and its outer shadows use a smaller blur. macOS (real WebKit with GPU compositing), Windows / Chromium, Glass off and Transparent never get the flag. The change only removes stacking contexts, so no inline dropdown can fall behind a sibling. What Linux Glass users will notice: the composer is a near-opaque light grey (it keeps its rim) instead of frosted, and dialogs and menus are opaque instead of frosted. The sidebar is unchanged. ## Results Playwright WebKit with a WebKitGTK user agent and platform, CPU-painted, Glass Liquid 3D, 3 reps, medians: | | Glass off | Glass on, main | This PR | |---|---|---|---| | Typing, per key | 27 ms | 31 ms | 27 ms | | Settings scroll frames p50 / p90 | n/a | 56 / 68 ms | 31 / 42 ms | | Settings scroll CPU (40 steps) | n/a | 15,080 ms | 12,150 ms | | Tools menu open | 248 ms | 354 ms | 332 ms | | Glass strength step | n/a | 424 ms | 298 ms | | Style menu open | n/a | 955 ms | 874 ms | With a macOS user agent every number and screenshot matches main, and Chromium is unchanged. ## Tests - New `studio/frontend/tests/glass-webkit-blur.test.ts` (8 tests): each readability override, and that each override's selector is the replaced rule's selector plus one attribute so it always wins; the flag is WebKitGTK only and never set for Solid, Transparent or out-of-scope routes; blur is removed except on the sidebar; dialogs and menus are opaque; the shadow replacements; the rules stay at the top level (not inside `@layer base`). Each test was checked to fail when its rule is broken. - 4,397 Glass, backdrop, wallpaper, dialog, WebKit, tooltip, library and menu tests pass; `node scripts/typecheck.mjs --tests` is clean.
danielhanchen
added a commit
that referenced
this pull request
Nov 7, 2026
… why it timed out (#16923) ## Summary `Inline images (windows-latest)` failed twice today on unrelated PRs (#16921, and the `fix/webkitgtk-long-thread-scrolling` branch), both times on the same check and only in Firefox: ``` {"browser": "firefox", "platform": "win32", "failed": 1, ...} {"name": "filename: 日本語.png", "passed": false, "error": "Error: Condition timed out"} ``` Chromium, WebKit, Chrome and Edge passed in the same job, the other 58 Firefox checks passed (`café.png` right before it, `100%.png` right after it), and other runs of the same workflow pass the check. So it is a slow load on that runner rather than a wrong URL, which would fail every run. `loaded()` gives each sandbox image 5 s and the timeout message said nothing about what state the image was in, so the logs cannot tell a missing image from a slow one or a wrong one. ## Change `tests/studio/fixtures/inline-image-client.js`, test only: - `loaded()` keeps its 5 s per load, and a load that runs over may borrow up to 10 s more from a 15 s grace shared by the whole run. One slow load is covered; one browser adds at most 15 s, so the five-browser step (about 90 s when healthy, measured on run `Inline images` today: 72 to 88 s) stays far inside its 5 minute limit. A flat longer timeout would not do: with every load failing, 15 s per load runs past the harness's 180 s wait for the report (measured below), so a real breakage would lose the per-check report entirely. - On a timeout, `until()` now appends the image state: `(no image)`, or `complete`, `naturalWidth` and the start of `currentSrc`. Nothing else in the checks changes, and the other `until()` callers keep the old 5 s and message. ## Testing `tests/studio/playwright_inline_images.py --browsers chromium firefox` on Linux, from a clean `npm ci`: | | result | |---|---| | this branch (15 s grace) | chromium 59 of 59, firefox 59 of 59 | | this branch (30 s grace at the time), every success load expecting a 33 px image (sabotage) | report in 112 s, 14 failed checks, e.g. `Condition timed out (complete=true naturalWidth=32 src=blob:...)` | | the flat 15 s version of this change, same sabotage | no report: the harness gave up at 180 s waiting for it | What this cannot prove here: the Windows Firefox slowness itself, which this machine cannot reproduce. If it persists past 15 s, the next failure will at least name the image state.
danielhanchen
pushed a commit
that referenced
this pull request
Nov 10, 2026
…16960) When WebKit paints on the CPU (the Linux app without GPU rendering, including the AppImage's bundled WebKitGTK 2.50.4), Liquid Glass 3D is several times slower than Glass off. The cost is its decoration, not the glass blur. This PR makes that decoration cheap to paint, with a nearly unchanged look. - **Cause 1, blurred inset shadows:** the Liquid Glass 3D rim (`--glass-rim`) and the light-glass control edge (`--glass-light-inner`, on every field, select and card) are inset box-shadows with a blur. WebKit's CPU painter re-blurs them over the element's whole area on every repaint, whatever the radius. A perf profile of scrolling Settings puts 65% of the web process's time in `BackgroundPainter::paintBoxShadow`, inside Skia's blur filter. - **Cause 2, radial sheens:** on WebKitGTK 2.50.4, the radial gradients of `--glass-sheen` cost most of what remains once the shadows are gone. - **Fix:** rims and edges keep their 1px lines with no blur, the two large soft glows are dropped, the pill under-glow and the plain-glass light menu glow become 1px lines, and every Liquid sheen is one linear gradient. CSS tokens only, on every platform. - **Not covered:** an enabled Glass lens (Magnify or Shrink) keeps its own blurred edge and filtered wallpaper copies. #16921's layer flag does not help here: in WebKitGTK, Settings scrolling with Liquid Glass 3D measured the same with and without it. ## Measurements main `1a4e758e9d` vs this commit, both built. Real Studio UI in WebKitGTK without GPU rendering, 4 cores, light theme, a background image, Glass lens Off, a 100-turn chat open. Typing is keydown to the second following frame. | Liquid Glass 3D | main | this PR | Glass off | |---|---|---|---| | WebKitGTK 2.50.4 (AppImage): Settings scroll, per frame | 218 ms | 53 ms | 49 ms | | WebKitGTK 2.50.4: chat wheel scroll | 17.8 fps | 29.5 fps | 42 fps | | WebKitGTK 2.50.4: typing | 81 ms | 41 ms | 20 ms | | WebKitGTK 2.52.6: Settings scroll, per frame | 66 ms | 26 ms | 25 ms | | WebKitGTK 2.52.6: chat wheel scroll | 26.6 fps | 39.7 fps | 44 fps | | WebKitGTK 2.52.6: typing | 50 ms | 25 ms | 19 ms | Frosted is unchanged; plain Liquid Glass improves slightly. The remaining gap to Glass off is the translucent surfaces themselves. ## Screenshots main vs this PR, Chromium at 2x. Frosted is pixel-identical; the other pairs differ by a mean of 0.25 to 0.85 per channel (of 255) and at most 16, on rims, edges and highlights.   ## Testing - New test in `tests/window-material.test.ts`: the glass rules contain no blurred inset shadow and no radial sheen (main has 20 and 8); the sheen and light-glass edge tests pin the new values. - Window material, composer outline and glass layer tests (49) and typecheck pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With Glass on, WebKit (macOS app, and the Linux app's WebKitGTK) repaints a glass surface's blurred shadows and backdrop whenever anything inside it changes. Measured on Colab CPU (software paint), Glass Liquid 3D, medians of 3 runs:
Chromium (Windows WebView2 engine family) is mostly unaffected.
Fix
On WebKit only, while a frosted Glass material is applied on the current route,
WindowMaterialMountsetsdata-glass-layerson<html>, and the direct children of the dialog, sidebar, composer and files panel getwill-change: opacity. A repaint inside one of them then stays in its own layer instead of re-blurring the whole surface.opacity, nottransform, so absolute and fixed descendants keep their containing block.Results
Same harness and build base, WebKit, Glass Liquid 3D, medians of 3 runs:
Chromium and Glass off are unchanged.
Look: screenshots of the composer and the Settings dialog, Glass on and off, Chromium and WebKit, pixel-diffed against main. WebKit Settings with Glass on is pixel-identical (0 changed pixels). The only differences are on the welcome screen, where the "How can I help?" greeting fades in, and they are the same size in the Glass-off pair where this change does nothing.
Tests
studio/frontend/tests/glass-webkit-layers.test.ts: the flag is WebKit only and never set for solid, Transparent or out-of-scope routes; the rule usesopacity, nottransform, and no:has().tsc -p tsconfig.app.jsonis clean.