Skip to content

[Tracking] macOS xwidget-internal: remaining gaps after #297 #300

Description

@tag-und-nacht

Long-term tracking issue for the macOS half of #22. It stays open until the
boxes below are checked; update the list rather than closing it when one lands.

Follow-up to #297, which lands the native WKWebView overlay and flips
xwidget-internal to provided on macOS. That PR is deliberately partial, and
the items below are the gaps the review agreed to track rather than block on.
They are listed roughly in the order a user notices them.

Linux is unaffected by all of this. Its inline browser is the WPE/dma-buf
path, xwidget-internal still answers NotBuilt there, and ledger 190's
missing subrs are still open. Nothing here changes that.

What works today on macOS

xwidget-webkit-browse-url on the primary frame: creation, navigation,
placement, clipping, hiding, resize, mouse input through the responder chain,
and xwidget-webkit-execute-script without a callback. Verified against a real
configuration rendering MathJax and Mermaid.

Remaining gaps

  • Secondary top-level frames. sync_inline_web_views runs only for the
    primary frame (render_thread/render_pass.rs, guarded by
    if is_primary_frame), and WkWebViewHost binds to one content view
    (backend/wkwebview/mod.rs, host: Option<Retained<NSView>>). An xwidget
    displayed in a second frame gets no view at all. GNU keys the view off
    s->f and has one xwidget_view per (model, frame) pair
    (src/xwidget.c), which is the shape to port.

  • Real WKNavigationDelegate / KVO events, and measured load progress.
    Nothing produces InputEvent::WebKitLoadFinished — the variant exists and
    has neither producer nor consumer — so
    xwidget-webkit-estimated-load-progress is 0.0 before a navigation and
    1.0 the moment one is dispatched, rather than measured. GNU reads
    WebKitGTK's continuous estimated-load-progress property. WKWebView
    exposes the same thing through KVO on estimatedProgress, plus
    didFinishNavigation: / didFailNavigation: on a WKNavigationDelegate.
    Title and URL changes (WebKitTitleChanged, WebKitUrlChanged) are in
    the same position: #[cfg(feature = "wpe-webkit")] only.

    The user-visible consequence: a script run immediately after enabling a
    preview is a no-op, because the page has not loaded and nothing says so.
    
  • JavaScript result callbacks. xwidget-webkit-execute-script's
    optional FUN currently signals rather than being silently dropped —
    a caller that passed it would otherwise wait forever for a call that never
    comes. Delivering a result needs a channel from the render thread back to
    the Lisp thread. Both backends pass a nil completion handler today, so
    this is not macOS-specific. Two in-tree callers are affected:
    xwidget-webkit-get-selection (lisp/xwidget.el, behind
    copy-selection-as-kill) and xwidget-webkit-insert-string.

  • Keyboard focus handoff. Not implemented in either direction. Mouse
    input works because the view is a real subview in the responder chain;
    keys are not routed to or reclaimed from the web view.

  • Frame-aware lifecycle ownership. WkWebViewHost currently owns every
    view for one window and is reached from two places
    (render_thread/asset_commands.rs and render_pass.rs). Consolidating
    creation, attachment, replay and teardown into one frame-aware runtime
    module is a prerequisite for the secondary-frame item above, not just a
    tidy-up.

  • The per-frame glyph scan and its temporary allocation.
    sync_inline_web_views filters FrameGlyph::Xwidget out of the whole
    presented glyph buffer and builds a Vec of placements on every presented
    frame, including frames with no xwidget in them at all. It is guarded by
    host.is_empty(), so a session with no web views pays nothing, but a
    session with one pays on every frame.

  • A nested AssetCommand::WebKit(WebKitViewCommand). The native
    backend's conversion in backend/wkwebview/command.rs matches the five
    WebKit* variants and hands everything else back, so a future
    AssetCommand::WebKit* variant compiles without reaching the native
    backend and the enumerated conversion test still passes. Nesting the
    shared command inside AssetCommand would make the conversion itself
    compiler-checked. Touches the producers in neomacs-bin/src/main.rs
    and the WPE arms in render_thread/asset_commands.rs, which is why it
    is a follow-up rather than part of feat(macos): inline xwidget web views via native WKWebView #297. (From the round-three review.)

Documentation

docs/building.md states these limits in the macOS section, so a user meets
them before filing. Please keep the two in step.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions