Skip to content

feat: embeded webview panel for rerun#24

Open
TomCC7 wants to merge 9 commits into
mainfrom
cc/feat/embed-webview
Open

feat: embeded webview panel for rerun#24
TomCC7 wants to merge 9 commits into
mainfrom
cc/feat/embed-webview

Conversation

@TomCC7

@TomCC7 TomCC7 commented Jun 13, 2026

Copy link
Copy Markdown
Member

Summary

Adds an experimental native Web Page View to the DimOS/Rerun viewer.

The view lets users embed live http(s) pages inside the native viewer layout. It can be configured through the normal Rerun blueprint API or through a DimOS-only websocket command.
image
image

What changed

  • Added a new WebPage view type with blueprint config:
    • url
    • show_navigation_controls
  • Added generated Rust/Python/C++ blueprint types.
  • Added a native wry backend behind the native_webview feature.
  • Added navigation controls:
    • Back
    • Forward
    • Reload
    • Home
    • Address bar / Go
  • Added URL validation:
    • accepts http:// and https://
    • rejects file:, data:, javascript:, and custom schemes
  • Added DimOS websocket command:
    • open_web_page_view
    • idempotent by caller-owned panel_id
    • translates into normal Web Page View blueprint state
  • Added lifecycle handling:
    • one native webview per view
    • hidden views keep their webview alive
    • removed views destroy their native webview
  • Added Linux WebKitGTK integration:
    • GTK init
    • GTK event pumping
    • X11 child-window embedding
    • visibility tracking to avoid stale webviews covering inactive tabs
  • Improved video playback responsiveness:
    • visible webviews request ~60Hz repaint
    • GTK/WebKit event pumping uses a short time budget per frame

Limitation

Current implementation will hide our custom keypad overlay behind the webpage (check image). Seems like it's not an easy fix.

Python blueprint example

import rerun as rr
import rerun.blueprint as rrb

rr.init("web_page_demo", spawn=True)

rr.send_blueprint(
    rrb.Blueprint(
        rrb.Horizontal(
            rrb.WebPageView(
                name="Rerun",
                config=rrb.WebPageViewConfig(
                    url="https://rerun.io",
                    show_navigation_controls=True,
                ),
            ),
            rrb.WebPageView(
                name="Example",
                config=rrb.WebPageViewConfig(
                    url="https://example.com",
                    show_navigation_controls=False,
                ),
            ),
        ),
        collapse_panels=True,
    )
)

DimOS websocket command example

{
  "type": "open_web_page_view",
  "panel_id": "viser",
  "title": "Viser",
  "url": "http://127.0.0.1:8095/",
  "show_navigation_controls": true
}

This command is DimOS-only and experimental. It is a convenience wrapper around normal Web Page View blueprint state, not a separate native-webview control API.

Platform notes

  • Native viewer only.
  • Web viewer intentionally reports unsupported/unavailable behavior.
  • Windows/macOS use the direct native child-webview path.
  • Linux currently uses the wry/WebKitGTK X11 child-window path.
  • Linux Wayland support likely needs a GTK-container host path (WebViewBuilderExtUnix::build_gtk) rather than the current eframe/winit raw-window-handle path.
  • Linux video playback depends on system WebKitGTK/GStreamer codecs.
  • Native webviews are OS child surfaces, so they can still interact imperfectly with egui overlays.

Validation

# Launch native DimOS viewer with native webview enabled:
scripts/web_page_view_smoke/launch_viewer.sh

# Send two Web Page Views:
# - Rerun with controls
# - Example.com with controls hidden
scripts/web_page_view_smoke/show_two_pages.sh

# Optional YouTube/video smoke:
scripts/web_page_view_smoke/show_youtube.sh
# DimOS websocket command path:
# Terminal 1: start one-shot websocket command server
python3 scripts/web_page_view_smoke/serve_dimos_ws_command.py

# Terminal 2: launch viewer connected to websocket command server
scripts/web_page_view_smoke/launch_viewer.sh --ws-url ws://127.0.0.1:3032/ws

Reviewer file map

Use this map to review the PR in layers instead of reading the full generated diff top-to-bottom.

  1. Start here: runtime Web Page View implementation

    • crates/viewer/re_view_web_page/src/view_class.rs — egui UI, URL/config loading, optional controls, address bar, repaint behavior.
    • crates/viewer/re_view_web_page/src/backend.rs — backend-neutral instance abstraction, fake/native dispatch, session handling.
    • crates/viewer/re_view_web_page/src/lifecycle.rs — per-view create/update/navigation/drop lifecycle.
    • crates/viewer/re_view_web_page/src/native_backend.rswry integration, native child webview storage, bounds, visibility, GTK init/event pump on Linux.
    • crates/viewer/re_view_web_page/src/url_policy.rs — allowed URL schemes.
    • crates/viewer/re_view_web_page/tests/* — behavior coverage for config, URL policy, lifecycle, controls, fake backend, and native smoke boundary.
  2. Viewer integration points

    • crates/viewer/re_viewer/src/default_views.rs — registers the new view class.
    • crates/viewer/re_viewer/src/app.rs — exposes the scoped native parent-window hook and the small DimOS-facing request API.
    • crates/viewer/re_viewer/src/app_state.rs — applies queued Web Page View requests into blueprint state.
    • crates/viewer/re_viewer_context/src/view/view_states.rs and crates/viewer/re_viewport/src/viewport_ui.rs — prune removed view state so native webviews are destroyed when views are removed.
    • crates/viewer/re_viewer/Cargo.toml, crates/top/rerun*/Cargo.toml — feature plumbing for native_webview.
  3. Schema and generated API surface

    • crates/store/re_sdk_types/definitions/rerun/blueprint/views/web_page.fbs — new WebPage view definition.
    • crates/store/re_sdk_types/definitions/rerun/blueprint/archetypes/web_page_view_config.fbsurl and show_navigation_controls blueprint config.
    • crates/store/re_sdk_types/definitions/rerun/blueprint/components/{web_page_url,show_navigation_controls}.fbs — typed config components.
    • Generated outputs under crates/store/re_sdk_types/src/blueprint/**, rerun_py/rerun_sdk/rerun/blueprint/**, rerun_cpp/src/rerun/blueprint/**, and docs/content/reference/types/views/** come from those .fbs files.
  4. DimOS websocket command path

    • dimos/src/interaction/ws.rs — parses inbound open_web_page_view commands and keeps existing outbound click/twist/stop events.
    • dimos/src/viewer.rs — drains websocket commands, validates them, and forwards them to the small re_viewer::App API.
    • dimos/src/interaction/mod.rs, dimos/Cargo.toml, dimos/pyproject.toml, docs/websockets.md — exports, deps, metadata, and docs for the DimOS path.
  5. Manual smoke-test helpers

    • scripts/web_page_view_smoke/launch_viewer.sh — launches DimOS viewer with native webview enabled on Linux X11.
    • scripts/web_page_view_smoke/show_two_pages.sh — sends two blueprint-created Web Page Views.
    • scripts/web_page_view_smoke/show_youtube.sh — sends a video page for media playback smoke testing.
    • scripts/web_page_view_smoke/serve_dimos_ws_command.py — one-shot websocket server for the DimOS command path.
  6. Process/spec/docs files

    • openspec/changes/add-dimos-web-page-command/**, openspec/changes/archive/2026-06-12-add-native-web-page-view/**, and openspec/specs/native-web-page-view/spec.md document the implementation plan and archived spec state.
    • ARCHITECTURE.md and CONTEXT.md add the crate/glossary entries needed by repo linting and reviewer context.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi! Thanks for opening this pull request.

Because this is your first time contributing to this repository, make sure you've read our Contributor Guide and Code of Conduct.

@TomCC7 TomCC7 changed the title Cc/feat/embed webview feat: embeded webview panel for rerun Jun 13, 2026
@TomCC7 TomCC7 marked this pull request as ready for review June 16, 2026 17:35

@aclauer aclauer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Some minor structure things (non-blocking), but looks good

Comment thread crates/viewer/re_view_web_page/src/backend.rs Outdated
Comment thread crates/viewer/re_view_web_page/src/lib.rs
Comment thread dimos/src/interaction/ws.rs Outdated
Comment thread crates/viewer/re_view_web_page/src/lifecycle.rs
Comment thread crates/viewer/re_view_web_page/src/lifecycle.rs
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.

2 participants