Skip to content

workbench: don't nest rounded clips around modal editors - #350120

Merged
Alexandru Dima (alexdima) merged 1 commit into
mainfrom
alexd/modal-editor-one-clip
Nov 24, 2026
Merged

Alexandru Dima (alexdima) merged 1 commit into
mainfrom
alexd/modal-editor-one-clip

Conversation

@alexdima

@alexdima Alexandru Dima (alexdima) commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Companion to the main editor's single-clip fix (#350107), independently based on main.

Modal editors nested three rounded clips: the shadow wrapper, the bordered part, and (with Modern UI) its content. Chromium supports one rounded clip per draw quad, so Blink gives the outer clips render surfaces (property_tree_manager.cc: "Nested rounded corner clips need to force render surfaces for clips other than the leaf ones"). That sends scrolling content through offscreen render passes instead of handing its layers to Core Animation.

Only the part now clips the modal surface:

  • The shadow wrapper keeps its radius and shadow paint, but no longer clips.
  • Floating-panel rounding excludes modal content, leaving its overflow clip square.
  • The part retains its 8px outer radius and 1px border: overflow clips its header, optional sidebar and content to the 7px padding-edge curve. The extra 8px content curve no longer leaves an inset crescent.

All four part radii remain equal. On macOS, Blink's ShaderBasedRRect also requires this: unequal radii cannot use the CALayerOverlay path and force a render surface even without nesting.

This fixes the two-clip case with Modern UI disabled too. The header's navigation controls keep their own local styling, and resize sashes remain outside both the part and shadow wrapper. Agents-window frame rules already exclude modal parts; no Agents-specific change is needed.

Measurements

Apple M5 Pro, DPR 2, DOM editor, Electron 43.8.10 / Chromium 150. One inactive, transparent VS Code instance per workload alternated the old CSS and this change in rotating order, eight pairs of 60 scroll frames. Times are CPU time (tdur) of the GPU process's traced threads, not wall time.

The main editor underneath the modal still has the nested clips addressed by #350107. For the isolated modal measurements below, that PR's square-content rule was applied equally to both arms. Extension-activation notification toasts were hidden equally as well; their backdrop filter otherwise adds unrelated passes.

Workload / metric, per scroll frame Old modal CSS This PR Paired median difference Pairs improving
Settings: GPU-process CPU 1.49 ms 1.20 ms -0.21 ms 8/8
Settings: render passes 1.45 0 -1.45 8/8
Modal text: GPU-process CPU 1.75 ms 1.21 ms -0.57 ms 8/8
Modal text: render passes 3.83 0 -3.83 8/8

RenderSurfaceReasonCount has four rounded corner surfaces for old Settings and eight for old modal text, and none for either new arm. Renderer-main CPU showed no consistent improvement.

Without neutralizing the underlying main editor, the improvement still holds in eight of eight pairs per workload:

Workload / metric, per scroll frame Old modal CSS This PR Paired median difference
Settings: GPU-process CPU 1.84 ms 1.42 ms -0.32 ms
Settings: render passes 2.23 1.17 -0.96
Modal text: GPU-process CPU 1.91 ms 1.30 ms -0.68 ms
Modal text: render passes 4.57 1.13 -3.48

The two remaining rounded-corner surfaces in that run belong to the main editor behind the modal and are outside this PR.

Pixels

Old/new/old screenshots in the same instance, for Settings and modal text, with Modern UI on and off. Repeated screenshots of the same arm are identical.

Surface Modern UI Differing device pixels out of 3,082,240 Maximum channel difference
Settings On 87, all on the corner arcs 6/255
Text On 83, all on the corner arcs 6/255
Settings Off 5, interior antialiasing only; all four corners identical 1/255
Text Off 6, on the corner arcs 1/255

No geometry, shadow, header or sidebar sizing changes. The modal content no longer imposes an additional inset curve.

Corners at 8× zoom, Modern UI on. Columns: old CSS, this PR, changed pixels in magenta. Rows: top left, top right, bottom left, bottom right.

Settings

settings-modern-corners

Text editor in a modal

text-modern-corners

How to verify

  • Open Settings or Keyboard Shortcuts with the default workbench.editor.useModal: "some". Scroll the Settings list and inspect all four modal corners.
  • Set workbench.editor.useModal: "all" and open a text file after startup. Scroll it, resize and move the modal, and check its header controls.
  • Repeat with Modern UI disabled and in compact density. Check a modal with an optional sidebar and its toggle; the part must still clip the header and sidebar while resize handles stay interactive outside its clip.
  • Trace viz and cc: the scrolling modal no longer creates rounded-corner render surfaces. If workbench: don't nest rounded clips around the editor #350107 is not applied, account for the unrelated main editor behind it as described above.
  • To compare the old modal CSS in the same window, inject:
body .monaco-modal-editor-block .modal-editor-shadow {
	overflow: hidden !important;
}
body .monaco-workbench.floating-panels .part.editor.modal-editor-part > .content {
	border-radius: var(--vscode-cornerRadius-large, 8px) !important;
}

Tests

  • npm run typecheck-client: passed, no compilation errors.
  • pnpm run transpile-client: passed.
  • ./scripts/test.sh --run src/vs/workbench/contrib/modernUI/test/browser/modernUI.contribution.test.ts: 124 passing.
  • node test/unit/browser/index.js --run src/vs/workbench/contrib/modernUI/test/browser/modernUI.contribution.test.ts --browser chromium: 123 passing.
  • Both added tests fail with the old CSS (Modern UI on and off); after restoring the fix, the focused Chromium rerun passes both. They verify the part's four equal padding-edge radii, one rounded clip around header/sidebar/content, a painted but unclipped shadow, square content, and unclipped sashes, with and without a sidebar.
  • node --experimental-strip-types build/hygiene.ts src/vs/workbench/browser/parts/editor/media/modalEditorPart.css src/vs/workbench/browser/media/floatingPanels.css src/vs/workbench/contrib/modernUI/README.md src/vs/workbench/contrib/modernUI/test/browser/modernUI.contribution.test.ts: passed.
  • node build/stylelint.ts src/vs/workbench/browser/parts/editor/media/modalEditorPart.css src/vs/workbench/browser/media/floatingPanels.css: passed (existing design-token suggestions only).
  • git diff --check: passed.

🤖 Authored with GitHub Copilot on behalf of Alexandru Dima (@alexdima).

The modal editor's shadow wrapper, bordered part and (with Modern UI) content
each rounded and clipped the same surface. Chromium supports one rounded clip
per draw quad, so nested clips force offscreen render surfaces while scrolling.
The content's 8px curve also sat inside the part's 7px padding-edge curve.

Let only the part clip the modal surface. Keep the shadow's rounded paint but
remove its overflow clip, and exclude modal content from floating-panel rounding.
The part still clips the header, optional sidebar and content inside its border,
with equal radii on all four corners for Core Animation. Resize handles remain
outside the clip. This also removes the redundant shadow clip without Modern UI.

With the underlying main editor's #350107 clip fix applied equally to both arms,
eight alternating pairs per workload give:
- Settings: GPU-process CPU time 1.49 -> 1.20 ms per scroll frame; paired median
  difference -0.21 ms, 8/8 pairs lower; render passes 1.45 -> 0.
- Modal text: 1.75 -> 1.21 ms; paired median difference -0.57 ms, 8/8 pairs lower;
  render passes 3.83 -> 0.
Rounded-corner render surfaces fall from 4 and 8 respectively to none.

How to verify:
- Open Settings, or set workbench.editor.useModal to all and open a text file.
  Scroll under a trace of viz and cc and compare with the old shadow overflow
  and content radius restored. Keep the main editor behind the modal identical.
- Check all four corners with Modern UI enabled and disabled, the optional
  sidebar, navigation controls and resize handles. The part retains its 8px
  outer radius and 7px inside curve; content adds no second rounded clip.
- npm run typecheck-client: passed.
- ./scripts/test.sh --run src/vs/workbench/contrib/modernUI/test/browser/modernUI.contribution.test.ts:
  124 passing.
- node test/unit/browser/index.js --run src/vs/workbench/contrib/modernUI/test/browser/modernUI.contribution.test.ts --browser chromium:
  123 passing. Both new regressions fail with the original CSS.
- Targeted hygiene and stylelint: passed.
- DPR 2 screenshots are stable on repeat. Modern Settings/text differ only on
  corner arcs (87/83 of 3,082,240 pixels, at most 6/255 per channel); classic
  differs in 5/6 pixels by at most 1/255.

🤖 Authored with GitHub Copilot on behalf of @alexdima.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 24, 2026 11:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the modal-editor clipping changes.

No open issues 🎉

What changed in this PR

This PR removes redundant rounded clipping from modal editors, complementing the main-editor fix in #350107. The modal part remains the single rounded clip, preserving its border and shadow while avoiding unnecessary offscreen render surfaces.

Changes:

  • Removes clipping from the shadow wrapper and excludes modal content from floating-panel rounding.
  • Adds regression tests for Modern UI enabled and disabled, with and without a sidebar.
  • Documents the single-clip behavior and macOS equal-radius requirement.
File Description
src/​vs/​workbench/​contrib/​modernUI/​test/​browser/​modernUI.contribution.test.ts Tests clip boundaries, corner radii, shadow paint, and unclipped resize sashes.
src/​vs/​workbench/​contrib/​modernUI/​README.md Documents modal clipping and rendering constraints.
src/​vs/​workbench/​browser/​parts/​editor/​media/​modalEditorPart.css Removes the shadow wrapper’s overflow clip while retaining its paint.
src/​vs/​workbench/​browser/​media/​floatingPanels.css Excludes modal editor content from rounded-corner styling.

Review effort: Balanced

@alexdima
Alexandru Dima (alexdima) added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit f56cf5c Nov 24, 2026
64 of 66 checks passed
@alexdima
Alexandru Dima (alexdima) deleted the alexd/modal-editor-one-clip branch November 24, 2026 12:25
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.

4 participants