Trait WebViewEngine
pub trait WebViewEngine: Send + Sync {
Show 21 methods
// Required methods
fn send(&self, cmd: WebViewCommand);
fn frames(&self) -> Arc<Mutex<Option<Frame>>> ⓘ;
fn drain_events(&self) -> Vec<WebViewEvent>;
// Provided methods
fn supports_text_input(&self) -> bool { ... }
fn supports_guarded_edit_history(&self) -> bool { ... }
fn handle_undo_request(&self, request: UndoRequest) -> bool { ... }
fn text_input(&self, request: Request) -> Option<Receipt> { ... }
fn create_tab(&self) -> Result<Arc<dyn WebViewEngine>, String> { ... }
fn set_visible(&self, _visible: bool) { ... }
fn set_modifiers(&self, modifiers: KeyModifiers) { ... }
fn take_new_tab_requests(&self) -> Vec<(String, bool)> { ... }
fn supports_native_filtering(&self) -> bool { ... }
fn navigate_owned(
&self,
request_id: u32,
command: NavigationCommand,
) -> Result<(), String> { ... }
fn request_close(&self) -> bool { ... }
fn drain_download_events(&self) -> Vec<WebViewEvent> { ... }
fn set_waker(&self, _waker: Box<dyn Fn() + Send + Sync>) { ... }
fn presented(&self) { ... }
fn wrapped(&self) -> Option<&Arc<dyn WebViewEngine>> { ... }
fn paint_frame(&self) -> Option<Arc<Frame>> { ... }
fn paint_blob(&self, _hash: &[u8; 32]) -> Option<Arc<Vec<u8>>> { ... }
fn take_paint_stream(&self, _keyframe: bool) -> Vec<Payload> { ... }
}Expand description
A running web engine instance. Implementations are Send + Sync so
the widget, the host app, and the engine’s own thread can share one
handle.
Required Methods§
fn send(&self, cmd: WebViewCommand)
fn send(&self, cmd: WebViewCommand)
Enqueue a command. Must never block on engine work.
fn frames(&self) -> Arc<Mutex<Option<Frame>>> ⓘ
fn drain_events(&self) -> Vec<WebViewEvent>
fn drain_events(&self) -> Vec<WebViewEvent>
Take all pending events, oldest first.
Provided Methods§
fn supports_text_input(&self) -> bool
fn supports_guarded_edit_history(&self) -> bool
fn supports_guarded_edit_history(&self) -> bool
Whether original-field acknowledged Undo/Redo is supported.
fn handle_undo_request(&self, request: UndoRequest) -> bool
fn handle_undo_request(&self, request: UndoRequest) -> bool
Offer system Undo/Redo to this page’s native editing history. True means the backend consumed the request, not that a history entry existed or that an asynchronous edit has already completed.
fn text_input(&self, request: Request) -> Option<Receipt>
fn text_input(&self, request: Request) -> Option<Receipt>
Private text transactions never enter the app event or page-agent stream.
fn create_tab(&self) -> Result<Arc<dyn WebViewEngine>, String>
fn create_tab(&self) -> Result<Arc<dyn WebViewEngine>, String>
Create an independent document in the same runtime/profile.
§Errors
Returns an error when tabs are unsupported, capacity is exhausted, or the engine cannot create another document.
fn set_visible(&self, _visible: bool)
fn set_visible(&self, _visible: bool)
Suspend painting without discarding the document or its session history.
fn set_modifiers(&self, modifiers: KeyModifiers)
fn set_modifiers(&self, modifiers: KeyModifiers)
Keep pointer modifiers current even when no key event reaches the page.
fn take_new_tab_requests(&self) -> Vec<(String, bool)>
fn take_new_tab_requests(&self) -> Vec<(String, bool)>
Native new-window intents, delivered to browser chrome as tab requests.
fn supports_native_filtering(&self) -> bool
fn supports_native_filtering(&self) -> bool
Whether this backend accepts source rules instead of WebKit JSON.
Admit a navigation and reserve its terminal outcome. IDs must increase strictly within this engine’s lifetime and fit a positive CEF signed integer.
§Errors
Returns an error without admission if the backend, request or capacity
cannot support the operation. A successful admission completes only with
the matching NavigationOutcome, or is invalidated by cancellation.
fn request_close(&self) -> bool
fn request_close(&self) -> bool
Request native close admission. True allows immediate local close; false
completes asynchronously through TabClosed, TabDetached or TabCloseBlocked.
fn drain_download_events(&self) -> Vec<WebViewEvent>
fn drain_download_events(&self) -> Vec<WebViewEvent>
Runtime-owned download events, independent of a tab lifetime.
fn set_waker(&self, _waker: Box<dyn Fn() + Send + Sync>)
fn set_waker(&self, _waker: Box<dyn Fn() + Send + Sync>)
Invoked (from any thread) whenever a new frame or event is ready — typically wired to the winit event loop proxy so idle apps repaint on engine activity. Synchronous engines don’t need one.
fn presented(&self)
fn presented(&self)
A view drew this engine’s page just now. Engines that stop painting
pages nobody draws (see paint::PaintEngine) resume here.
fn wrapped(&self) -> Option<&Arc<dyn WebViewEngine>>
fn wrapped(&self) -> Option<&Arc<dyn WebViewEngine>>
The engine this one wraps, for what only a backend can answer.
fn paint_frame(&self) -> Option<Arc<Frame>>
fn paint_frame(&self) -> Option<Arc<Frame>>
fn paint_blob(&self, _hash: &[u8; 32]) -> Option<Arc<Vec<u8>>>
fn paint_blob(&self, _hash: &[u8; 32]) -> Option<Arc<Vec<u8>>>
Encoded bytes of an image a paint_frame references.
fn take_paint_stream(&self, _keyframe: bool) -> Vec<Payload>
fn take_paint_stream(&self, _keyframe: bool) -> Vec<Payload>
The page as a stream for a session to share: a whole frame when
keyframe (or when the consumer must start over), else the patches
since the last call, followed by images not sent yet. Empty for an
engine without a display list.