Skip to main content

Crate iced_servo

Crate iced_servo 

Source
Expand description

Embeds a Servo webview inside an Iced application.

Servo renders into a SoftwareRenderingContext, the result is read back via read_to_image, and a custom Widget uploads the pixels to a persistent wgpu::Texture and draws it as a regular iced widget. Input flows the other way: iced’s native event loop delivers mouse, keyboard, touch, and IME events to the widget, which translates and forwards them to Servo via WebView::notify_input_event.

Structs§

FrameWidget
Generic iced widget that renders any FrameSource through a wgpu textured quad.
ServoRuntime
Shared Servo engine + rendering context. Build one of these at app startup and pass it into each ServoWebViewController::new call. Cheap to clone (Rc inside) — passing one to multiple tabs does not duplicate the underlying engine.
ServoWebViewController
Embedder handle for a single Servo webview. Cheap to clone — it’s just an Rc internally. Each tab/view in an app owns one controller; they all share the same ServoRuntime.
WebViewConfig
Construction-time configuration for a Servo webview.

Enums§

Content
What a webview should load on startup.
JSValue
JavaScript value returned from ServoWebViewController::evaluate_javascript and the Task-based variant. Covers primitives, arrays, objects, and opaque DOM-handle tokens (Element, Window, ShadowRoot, Frame). The DOM handles are WebDriver-style ID strings and cannot currently be round-tripped back into a later script — treat them as diagnostic.
JavaScriptEvaluationError
Error variant returned when a JavaScript evaluation fails. Covers both compile-time and runtime failures plus a few “the webview wasn’t ready” cases; the Task variant also uses InternalError for the case where the controller is dropped mid-evaluation. An error that happens when trying to evaluate JavaScript on a WebView.
LoadStatus
Page load lifecycle status. The status of the load in this WebView.
PrefValue

Traits§

FrameSource
Trait that a frame source must implement to be rendered by FrameWidget.

Functions§

frame
Build a FrameWidget with default settings (Fill, Center, Linear).