Skip to content

fix(desktop): keep browser panel corner masks aligned - #52461

Merged
Hona merged 4 commits into
v2from
browser-corner-masks
Oct 8, 2026
Merged

Hona merged 4 commits into
v2from
browser-corner-masks

Conversation

@usrnk1

@usrnk1 usrnk1 commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

No linked issue.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The browser page in the side panel is a native WebContentsView, so CSS cannot round it. Two small ImageView masks paint its bottom corners instead. This fixes three ways the masks went wrong.

Problem Cause Fix
Outline cut off at the bottom corners The masks painted the backdrop over the panel's 0.5px ring where it curves The renderer reads the ring from the panel card's box-shadow (theme and zoom aware); the masks redraw it along the arc
Square corner for ~130 ms when a page first appears Masks moved with a 0 ms animated setBounds, which lands a frame after the page's bounds, and only went up once the page showed Masks get their composited layer once at creation (setBackgroundBlur(0)), move with plain setBounds in the same step as the page, and go up as soon as the box is laid out
Right mask trails during a window resize The renderer lays the page out a frame or more behind the resize The renderer sends the viewport it measured against; on resize, main moves box edges within 24 CSS px of the window edge by the delta
sequenceDiagram
  participant W as Window
  participant M as Main (embeds.ts)
  participant R as Renderer (embeds.tsx)
  W->>M: resize
  M->>M: width += contentWidth - viewport.width
  Note over M: page and masks follow the window edge now
  R->>M: embed(bounds, viewport), a frame or more later
  M->>M: apply the measured bounds
Loading

The ring is composited over the backdrop in each mask pixel (premultiplied BGRA), in packages/desktop/src/main/native/corners.ts:

const inside = coverage(size, distance) // page side of the arc
const base = ((1 - inside) * color[3]) / 255 // backdrop outside the arc
const line = border ? ((coverage(size + ring, distance) - inside) * border.color[3]) / 255 : 0 // ring band just past it
  • The edge gutter and the viewport rounding tolerance scale with the window zoom, so the resize follow stays correct at high zoom.
  • BridgeLayout gains documented viewport and border fields; ExtensionLayout validates them.

How did you verify your code works?

  • Dev builds of base 886e236 and this branch on Windows (100% scale, light theme), same session and test pages. The corner was screen-recorded at 60 fps and checked frame by frame.
  • New tab, page first appears: 8 and 9 square-corner frames before; 0 in 3 runs after.
  • Window resize: a scripted resize (SetWindowPos at 60 Hz) shows the same 1–2 frame lag in both builds, so it does not isolate this fix. This case still needs a manual drag recording.

Screenshots / recordings

Outline at the bottom corners (10x zoom, contrast boosted)

Before After
Before: the outline stops where each corner curves After: the outline follows both curves

New tab: first frames of the page (60 fps, 4x zoom)

Before: square corner for 8 frames. After: round from the first frame.

Slow motion, 1/8 speed:

first-show-slowmo.mp4

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@Hona
Hona force-pushed the browser-corner-masks branch from 44a8f3a to 4cb06d2 Compare October 8, 2026 21:23
Document the nested BridgeLayout viewport and border fields so the SDK docs check passes. Read the window zoom in main so the edge gutter and the viewport rounding tolerance stay correct at every zoom level. Clear the lint warnings in the touched files.
@Hona Hona changed the title feat(desktop): fix browser panel corner masks fix(desktop): keep browser panel corner masks aligned Oct 8, 2026
@Hona
Hona merged commit b5c43a4 into v2 Oct 8, 2026
11 checks passed
@Hona
Hona deleted the browser-corner-masks branch October 8, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants