OpenProgram Docs

Native page bounds in the built-in browser

The Electron shell's DOM and each native WebContentsView keep the same page bounds at any shell zoom. setBounds takes DIP; the renderer measures CSS px.

Unit conversion

PartBehaviour
RendererSends fractional CSS px from getBoundingClientRect()
IPC boundaryMain reads event.sender.getZoomFactor() on every call, converts to DIP, then rounds to integers and keeps sizes nonnegative. An invalid or nonpositive zoom counts as 1.
Entry pointswebtab:sync-visible and the compatibility webtab:set-bounds convert alike. Internal show, hide and transfer paths already use DIP and are not scaled again.
Zoom changeThe renderer's resize listener remeasures and sends current bounds
Example, zoom about 1.095x=812.63, width=518.64 CSS px becomes about x=890, width=568 DIP. Unconverted, the page covers the chat pane and leaves a blank strip on the right.
Left aloneUser zoom, split ratios, DOM layout, preload APIs, site zoom, Browser Agent, dependencies, configuration

Overlays

A DOM overlay hides a native page only when its visible rectangle intersects that page's body. Each WebTabPane tests its own body against the current overlays; there is no shared visible flag.

OverlayDetected byNative page
Popover, dropdown, listbox, tab and split menusrole=dialog/menu/listboxOnly intersecting panes hide. Working-directory, project and permission menus inside the chat pane hide nothing next door.
Full-screen modals, confirmation backdrops, attachment previewsdata-native-view-occluder=true or the merge backdropEvery covered pane hides
Tooltips, toasts, drag cues, ordinary portaled contentExcluded from the selectorStays visible
Desktop main, context and bookmark native menusOwn overlay owner in mainNative-menu lifecycle, not renderer DOM

Zero area or edge-only contact hides nothing. MutationObserver, ResizeObserver and scroll and resize listeners republish bounds when an overlay closes, moves or resizes; global flush batches microtasks in one tick.

Floating preview

Agent picture-in-picture previews use the same registerVisibleWebTabBounds / syncVisible path and publish only the small window's body, so toolbar buttons and the lower-right resize handle stay outside the native view. Two layers: a still picture below, the live native page on top. The page shows only with no hold active (PipHoldReason, apps/web/components/center-tabs/pip/web-tab-pip-surface.tsx).

HoldWhile
gestureDragged or resized
clipThe scrolled dock column hides part of it
coverA menu, dialog or popover overlaps it; the page goes down at once under its last picture
motionIt folds into or unfolds from the composer's web page chip
Timing and layout
AspectBehaviour
First holdCaptures a frame and shows it. A capture slower than 150 ms (PIP_PICTURE_WAIT_MS) shows the last cached picture until it arrives. Native bounds are withdrawn within those 150 ms either way.
Last releaseFinal bounds are published; the picture goes once the page has painted there
LayoutsetPipZoom lays the page out 1920 wide and as tall as the preview's shape makes it, scaled to fill edge to edge
First show or new sizeLaid out out of sight, then waits for a paint, 250 ms (PIP_RELAYOUT_MS) and another paint for script-driven pages. Never shows at standard size or half laid out.
FoldedKeeps that layout, so it unfolds as it went. A pane that shows the page resets the user's zoom.
PicturesCached per tab; the next unfold starts from one
MotionClosing from the chip or ✕ folds over 240 ms, showing unfolds over 280 ms (apps/web/lib/browser/web-tab/web-tab-pip-motion.ts). With Reduce Motion it appears and goes at once.
Background pagesUntouched: the native view stays alive, only its bounds are withheld

Residual: a split page ahead of its frame

The native page and the App's DOM reach the display as two compositor clients, so a split pane's page can show away from its frame during a move. The floating preview covers this with a hold; a split pane has none.

Measured
Dev App, 24 split-sidebar moves at load 4.6 to 6.2: 112 of 979 draws away, by up to 13 px
Why per-frame reports cannot fix it

The renderer measures while laying out a frame and sends bounds in a microtask; main moves the view at once, and its frame reaches the display compositor about 1 ms later. The App's own frame still needs main frame, commit and raster.

Both land together only while the App's frame meets the deadline: at 120 Hz good rounds have no slack, and a bad round arrives 0.3 to 0.7 ms late.

Every frame of a move costs about the same, so one late frame leaves the page ahead for the whole move (16 to 18 draws, up to 14 px), in one move in twelve to one in four at load 4 to 8.

AttemptWhy not
RendererCannot know its frame will be late
Main replays the move on its own scheduleLate against a late DOM frame in the same way
beginFrameSubscriptionArrives after the draw, leaving the page a frame behind every time

The display compositor keeps surfaces in step only when one compositor frame embeds the other, as for a <webview> guest or an out-of-process iframe.

Why pages are not guests of the App's frame

A <webview> guest moves, clips and folds with the DOM and takes no bounds. In 48 split-panel moves at load 6 to 12 on the Dev App and Electron 45, no draw showed it away from its frame, and move frames were slightly cheaper (median 3.2 to 3.4 ms against 3.7 to 3.9). Agent input decides against it:

Agent inputGuestNative view
Typed text and keys over CDPGo to the App window's focused frame: into the composer, where Enter could send the user's messageReach the page, App focus untouched
webContents.insertTextReaches the focused element without touching App focusNot needed
sendInputEvent keysArrive only after the widget has held focus once; no editing commands, so Command+A does nothingShortcut commands work over CDP
ClicksMove the App's keyboard focus into the guest every time. Giving it back runs on the renderer thread; with it busy for 150 ms, the user's next keystroke landed in the page.Never touch App focus

The floating preview is where the Agent's page shows while the user types, so guests are no safer there. Switching a page between native and guest also reloads it: history, scroll and form values can be restored (navigationHistory.restore), script state, connections, sessionStorage and editors outside form fields cannot.

Code and verification
ItemDetail
Codeapps/desktop/main.js, apps/web/components/center-tabs/browser/web-tab-pane.tsx, apps/web/lib/browser/web-tab/web-tab-bounds.ts
apps/desktop/tests/web-views/check-webtab-zoom-bounds.js100% and about 109.5% zoom, invalid zoom, both IPC entries, desktop regressions
check:web-splitRectangle intersection per Web body: a left menu leaves a right page visible; dialog, menu, listbox and full-screen backdrops judged per pane; zero area and edge contact hide nothing. General DialogOverlay, permission confirmations, context click-catchers and scoped drop overlays enter through data-native-view-occluder.
Installed App, about 109.5% zoomDOM body and native viewport both 568×763 DIP; after resizing the window to 1350×800, both 526×712 DIP. Also check splits and split-ratio changes.

Implementation status

StatusItems
ImplementedUnit conversion, overlay rules, preview holds, automated gates
Not builtGuests: no switch, <webview> wiring, adoption, preview surface or Agent relay exists
Known residualSplit panes can show a page ahead of its frame

Built-in browser

Last updated · 2026-11-25