pub trait WebViewHandle: 'static {
Show 14 methods
// Required methods
fn set_bounds(&self, bounds: Rect, scale_factor: f32);
fn load_url(&self, url: &str);
fn load_html(&self, html: &str, base_url: Option<&str>);
fn eval(&self, script: &str);
fn post_message(&self, msg: &str);
fn reload(&self);
fn go_back(&self);
fn go_forward(&self);
fn stop(&self);
fn set_visible(&self, visible: bool);
fn set_focus(&self);
fn set_input_passthrough(&self, passthrough: bool);
// Provided methods
fn open_devtools(&self) { ... }
fn close_devtools(&self) { ... }
}Expand description
A live native engine subview. Dropping the handle tears the subview down
(RAII, same contract as ExternalDndGuard).
All methods are &self — the handle is cheaply shareable and the engine
state lives behind the platform’s own interior mutability.
Required Methods§
Sourcefn set_bounds(&self, bounds: Rect, scale_factor: f32)
fn set_bounds(&self, bounds: Rect, scale_factor: f32)
Reposition / resize the native subview within its parent window.
bounds is in logical pixels (Teksilo’s coordinate system);
scale_factor is the host window’s HiDPI scale. Most engines position
in logical units, but some need device pixels (bounds × scale_factor)
because their own toolkit runs at a different scale than the wgpu
surface — notably WebKitGTK on X11/XWayland, which uses integer GDK
scaling and ignores fractional factors. Issued whenever the widget’s
layout bounds or the window scale change.
Sourcefn post_message(&self, msg: &str)
fn post_message(&self, msg: &str)
Rust → JS: dispatch a teksilo-message MessageEvent carrying msg.
Sourcefn go_forward(&self)
fn go_forward(&self)
Navigate forward in history.
Sourcefn set_visible(&self, visible: bool)
fn set_visible(&self, visible: bool)
Show / hide the native subview. Load-bearing: a native subview
lives outside the wgpu pass, so framework dormancy (a Switcher
parking the page) does NOT hide it — the WebView widget bridges
its activation signal to this call. See WebView’s rustdoc.
Sourcefn set_input_passthrough(&self, passthrough: bool)
fn set_input_passthrough(&self, passthrough: bool)
Ask the engine to stop taking pointer input over its own rectangle, so
the OS delivers those events to the host window and Teksilo routes them
— the engine half of WebViewInput::Transparent.
Ask the engine to stop taking pointer input over its own rectangle, so
the OS delivers those events to the host window and Teksilo routes them
— the engine half of WebViewInput::Transparent.
Not every engine can do this — the call needs control over the
native surface’s hit region, which the embedding API may simply not
expose — and one that cannot must say so through
WebViewEvent::ConsoleMessage — the channel this crate
already reserves for reporting an unsupported operation — rather than
accept the call and change nothing. There is deliberately no return
value and no default implementation: an answer invented here would be
an answer for an engine nobody asked.
Not every engine can do this, and one that cannot must say so
through WebViewEvent::ConsoleMessage — the channel this crate
already reserves for reporting an unsupported operation — rather than
accept the call and change nothing. There is deliberately no return
value and no default implementation: an answer invented here would be
an answer for an engine nobody asked.
Provided Methods§
Sourcefn open_devtools(&self)
fn open_devtools(&self)
Open the engine’s developer tools (no-op on backends that don’t expose them — Servo’s embedding API has no clean devtools hook today).
Sourcefn close_devtools(&self)
fn close_devtools(&self)
Close the engine’s developer tools (no-op where unsupported).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".