Skip to content

Linux CEF: nested electrobun-webview bounds are not scaled on HiDPI displays #510

Description

@Ferrb9579

Description

On Linux with bundled CEF, a nested <electrobun-webview> is positioned and sized incorrectly when the display scale is greater than 100%. At 200% scaling, the child appears at half the expected physical offset and occupies half the expected width and height. The host DOM element itself has the correct layout.

This prevents the documented “super iframe” behavior: the native child does not fill its CSS Grid/Flexbox cell even though the custom element does.

Reproduction

  1. Run an Electrobun app with Linux bundleCEF: true on a HiDPI display (reproduced at 200%).
  2. Put <electrobun-webview> inside a normal CSS Grid or Flexbox workspace next to a sidebar.
  3. Size it with ordinary CSS (width: 100%; height: 100%).
  4. Compare the element bounding box with the native CEF child window.

The DOM getBoundingClientRect() is correct in CSS/DIP pixels, but the native child is visibly smaller and offset toward the top-left.

Root cause

The preload overlay contract correctly sends CSS/DIP coordinates. On Linux, CEF windowed children are X11 windows, but the initial CefWindowInfo::SetAsChild bounds and later XMoveResizeWindow calls use those DIP values directly as physical X11 pixels. Mask rectangles follow the same incorrect coordinate path.

Full-size BrowserViews are different: their resize path already receives raw physical dimensions from X11 ConfigureNotify events and must not be scaled again.

Expected behavior

At every supported display scale, a nested <electrobun-webview> should exactly match its host element. Fixed child bounds and masks should be converted from DIPs to physical pixels exactly once at the Linux native boundary, using the CEF scale factor for the parent window monitor. Full-size BrowserViews should retain their current physical resize path.

Environment

  • Electrobun: current main (1.18.4-beta.12)
  • OS: Ubuntu 26.04 LTS
  • Session: GNOME Wayland; Electrobun CEF uses its X11/XWayland path
  • Display scale: 200%

Duplicate check

I searched open and closed issues and pull requests for Linux CEF, HiDPI, nested webview, scaling, bounds, devicePixelRatio, and X11 resize terms. The nearest items address different paths:

None converts Linux nested child-view bounds from DIPs to X11 pixels.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions