Skip to content

Studio: blur the glass Settings dialog on its own layer so scrolling it stays cheap - #16942

Merged
danielhanchen merged 3 commits into
mainfrom
studio-glass-dialog-blur-layer
Nov 6, 2026
Merged

danielhanchen merged 3 commits into
mainfrom
studio-glass-dialog-blur-layer

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Problem

With Glass on, scrolling inside the Settings dialog is expensive in Chromium (the engine behind the Windows app's WebView2): the dialog's own backdrop-filter is re-run for every frame its content scrolls. The long-chat gate measured Glass Settings scrolling at 10 to 22x the CPU of the solid window.

Fix

The glass Settings dialog no longer carries the backdrop-filter itself. A ::before layer underneath it (position: absolute; inset: 0; z-index: -1, inside isolation: isolate on the dialog) carries the same blur. While the panes above it scroll, the layer's backdrop is left alone. This is the pattern glass dialogs with sticky content already use (:has(.sticky, [data-glass-float])::before).

It applies only to Settings ([data-settings-dialog]), whose shell is overflow-hidden and never scrolls. Dialogs that scroll their own box (the shared DialogContent default is overflow-y-auto, for example Connections) keep the direct blur: an absolute layer there would scroll away with the content and leave the lower part unblurred. It also does not apply on WebKit (data-glass-layers, macOS and Linux apps), where the layer costs about 9% more scroll CPU; WebKit keeps the direct blur exactly as on main. The layer has no will-change, which added nothing measurable. Solid, Transparent and Glass menus off are untouched.

Results

Browser CPU for 40 wheel steps scrolling Settings, Glass Liquid 3D, same build base, 3 reps each:

Chromium, Glass Liquid 3D (3 reps, medians) main This PR
Settings scroll CPU (40 wheel steps) 5,290 ms 3,240 ms
Settings scroll frames p50 / p90 17 / 50 ms 17 / 50 to 67 ms
Style dropdown inside Settings, open 80 ms 110 ms
Typing / Tools menu 16 / 68 ms 16 / 71 to 87 ms

About 39% less CPU while scrolling Settings in Chromium, close to having no blur on the page at all (2,990 ms). The trade-off: opening the Style dropdown inside Settings is about 30 ms slower with the layer, with or without will-change, and the p90 scroll frame rose to 67 ms in one of two runs (headless software compositing). Scrolling Settings is the frequent, sustained cost; the dropdown open is a single short one. WebKit is unchanged (the rule does not apply there; in WebKit the layer would cost 5 to 6% more scroll CPU). Glass off is unchanged in both engines.

Tests

  • New studio/frontend/tests/glass-dialog-blur-layer.test.ts: other dialogs keep the direct blur; Settings drops it and isolates; its ::before layer sits at z-index: -1, covers the dialog, ignores pointers and carries the blur; the Settings shell stays overflow-hidden.
  • 113 dialog and backdrop related tests pass; node scripts/typecheck.mjs --tests is clean.

… cheap

With Glass menus on, the dialog surface carried its own backdrop-filter, and Chromium re-ran that
24px blur for every frame the dialog's content scrolled. Scrolling Settings cost about 5.3 s of
browser CPU per 40 wheel steps against 3.1 s with no dialog blur at all. The blur now sits on a
::before layer under the dialog (isolated, will-change: transform), whose backdrop does not change
while only the content above it moves: 3.1 s, the same as dropping the blur, with the look unchanged
to the eye (Settings screenshot: 3k pixels differ by more than 8 levels out of 2M). Applies on every
engine; WebKit's no-blur glass already drops this layer's blur too.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-06T18:59:09.786505Z
We couldn’t complete this review. Comment @codex review to try again.
636d1b8 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen danielhanchen changed the title Studio: blur glass dialogs on their own layer so scrolling them stays cheap Studio: blur the glass Settings dialog on its own layer so scrolling it stays cheap Nov 6, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 6, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 6, 2026
@danielhanchen
danielhanchen merged commit 4c52726 into main Nov 6, 2026
@danielhanchen
danielhanchen deleted the studio-glass-dialog-blur-layer branch November 6, 2026 21:01
imaderaya pushed a commit to pub-forks/unsloth that referenced this pull request Nov 7, 2026
…unslothai#16978)

Follow-up to unslothai#16931. The long-chat gate carried allowances for costs
main had when it landed. unslothai#16938 (the `:has()` rewrite), unslothai#16942 and
unslothai#16957 removed most of those costs, so this lowers the allowances to
today's readings so they cannot creep back.

## Changes

- `tests/studio/has_subject_allowlist.txt`: regenerated. 57 selectors
are still allowed, 61 are gone. Lint on main: 197 `:has()` rules, 57
non-subject, 0 new, 0 stale.
- `tests/studio/_area_matrix.py`:
- All 9 per-area element-count ceilings are removed, so those areas get
the normal 2x growth check. unslothai#16938 fixed every one of them; none
restyles the whole thread on open any more.
- Glass ceilings lowered to about 1.2-1.3x the highest reading on
current main.
- A recheck page that fails to load or measure now keeps the first
verdict instead of crashing the gate with a traceback. A recheck can
only lower a reading, so this never hides a failure.

## Count ceilings removed (elements restyled at 200 turns)

| Area | Old ceiling | Now | 200 vs 40 turns |
|---|---|---|---|
| model_picker | 44000 | 459 | 0.99x |
| chat_options | 17000 | 2091 | 1.45x |
| browser_pane | 45000 | 1259 | up to 2.55x |
| account_menu | 30000 | 346 | 1.0x |
| organize_chats | 30000 | 226 | 1.0x |
| chat_row_menu | 32000 | 1817 | 1.55x |
| sidebar_sections | 45000 | 163 | up to 1.18x |
| sidebar_toggle | 30000 | 365 | 1.06x |
| run_settings | 45000 | 1214 | 2.13x |

browser_pane and run_settings grow a little faster than 2x but stay
under the 3000-element floor (about 4 elements per turn, not a
whole-thread restyle).

## Glass ceilings (ratio vs the default look)

Highest reading over 3 runs pinned to 4 CPUs and 7 runs on a loaded
36-core host.

| Mode | Old | Highest | New |
|---|---|---|---|
| frosted, other areas | 10 | 5.79 | 7 |
| blurred, other areas | 10 | 5.50 | 7 |
| liquid, other areas | 10 | 5.65 | 7 |
| liquid-3d, other areas | 12 | 5.41 | 7 |
| frosted, Settings scroll | 28 | 9.69 | 12 |
| blurred, Settings scroll | 28 | 12.18 | 15 |
| liquid, Settings scroll | 28 | 10.08 | 13 |
| liquid-3d, Settings scroll | 28 | 9.60 | 12 |

## Testing

- Full gate on main: PASS 4 times (270-310 s).
- Still fails when it should:
- a planted subject-after-`:has()` rule is reported by name ("57
allowlisted, 1 new");
- a synthetic Glass material with a 40px backdrop blur fails 8 cells at
4.0-15.7x, with no real mode failing.
- `test_area_matrix.py`, `test_has_lint.py`, `test_css_culprit.py`: 58
passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant