Module webview
Expand description
Engine-agnostic embedded web view plumbing.
The crate::widget::WebView widget displays frames produced by a
WebViewEngine backend and forwards input back into it. The engine
runs on its own thread (or entirely synchronously, for tests): commands
flow in through WebViewEngine::send, rendered pixels come out
through a shared FrameSlot, and navigation/UI state changes come
out as WebViewEvents drained by the host app during sync.
Backends:
test_engine::TestEngine— deterministic, dependency-free engine used by unit tests and--shotsheadless renders.chromium::ChromiumEngine— the Tilo system engine: a Chromium (CEF) host process rendering real pages offscreen, delivered as its own signed runtime (seechromium::runtime).
Coordinates in commands are physical pixels relative to the web view’s top-left corner — the widget does the logical→physical translation so engines never see toolkit layout space.
Modules§
- chromium
- Chromium helper transport, independent of native CEF build dependencies.
- key_
code - A key’s place on the keyboard, named as the DOM names it
(
KeyboardEvent.code), for the keys whose meaning a layout changes: the letters, digits and punctuation. Named keys (Enter, the arrows) mean the same on every layout and travel by name alone. - page
- Typed requests against a live page’s content.
- paint
- The paint stream: a page as a display list instead of pixels.
- profile
- Lightweight instrumentation for the
WebViewpipeline. Off by default; enabled by settingTILO_WEBVIEW_PROFILEin the environment. - test_
engine - Deterministic in-process engine used by unit tests and
--shotsheadless renders. It loads no network content: every “page” is a flat colour derived from a stable hash of the URL, with a darker header band, so different URLs render visibly different frames and pixel assertions stay byte-stable across runs. - text_
input - Private, acknowledged edits. Neither replies nor transcripts are app events.
Structs§
- Address
Fields - Credential
Account - Credential
Form - Credential
Reply - Credential
Request - Extension
Action Change - What an extension changed of its toolbar button (
chrome.action). Each field isNonewhen it did not change;Some(None)takes back what it set for one tab, so that tab shows what every tab shows. - Extension
Notice - What an extension’s notification (
chrome.notifications) shows. - Extension
Permission Set - API permissions and site patterns, as
chrome.permissionsnames a set of them. - Extension
Shortcut - A key one of extensions’ commands holds (
commandsin a manifest), as Chrome names it (“Y”, “9”, “Comma”, “Up”), with its modifiers:metais Command on macOS. - Frame
- One rendered frame from the engine: tightly-packed RGBA8 at physical pixel resolution. The buffer is shared, never copied per draw — the widget detects staleness via the allocation pointer.
- Frame
Damage - Where a frame differs from the ones its engine made before it: a view that drew one of those repaints, and uploads, only there.
- FrameId
- A frame’s place in the page: the id its parent’s outline printed, a dot
between the numbers of nested frames (
2, then2.1), at most eight deep. - KeyModifiers
- Forwarded into the page so editing shortcuts (Ctrl+Backspace, Shift+Arrow, …) reach the web content.
- Media
Element Info - A visible media element expressed relative to the web viewport. Keeping this normalised makes it independent of physical display scale and lets browser chrome map it onto the current app surface after a resize.
- Navigation
Entry - An actual session entry; ids are engine-owned and valid for its snapshot.
- Omnibox
Suggestion - One suggestion an extension made for what follows its keyword: what
choosing it enters, and what it says, in Chrome’s markup (
<match>,<dim>,<url>). - Page
Dialog - A question the page waits on until it is answered with
WebViewCommand::AnswerPageDialog, or the engine says it no longer waits (WebViewEvent::PageDialogClosed). Everything butidandkindis the page’s own text. - Page
Failure - Why a page request did nothing.
codeis stable, such asstale_element,obscuredorunavailable. - PageKey
- One key plus modifiers, written as a chord such as
Enter,Shift+TaborControl+a. - Page
Reply - What a completed page request observed.
- Pixel
Rect - A rect of a frame, in its pixels.
- Pointer
Step - One step of a
PageRequest::Pointergesture. - Popup
- A popup window a page opened, with the size it asked for (0 when it named none), in CSS pixels.
- Service
Session Reply - Import completion proves storage writes, never provider authentication.
- Service
Session Request - Site
Status - Bounded snapshot for one committed top-level origin and document generation.
- Text
Field - The page’s focused editable field, as an engine reports it for the platform input method: what it takes, and where on the page it and the text being composed in it are, so the input method’s candidates appear where the person types.
Enums§
- Context
Menu Item - A row of a page’s context menu, as the engine offers it.
- Credential
Action - Extension
Action Icon - An icon an extension gave its toolbar button.
- Extension
Menu Item - A row of an extension’s toolbar button menu (
chrome.contextMenusitems made for its button), chosen bykey(WebViewCommand::ExtensionMenuChoice). - Extension
Side Panel Change - What an extension asks of its side panel beside a tab’s page; each address is among the extension’s own pages.
- KeyInput
- Winit-independent so engines don’t take a winit dependency.
- Mouse
Button - Named
Key - Navigation
Command - An owned main-frame navigation. Its final URL may differ after redirects.
- Navigation
Direction - Omnibox
Input - What the person did in the Browser’s address after an extension’s
keyword (the manifest’s
omnibox), which the extension hears of as in Chrome (chrome.omnibox). - Page
Dialog Kind - What a page asks with a dialog of its own.
- Page
Navigation - Whether a page request led the page to another document, as far as the engine can tell when it answers.
- Page
Request - Pointer
Button - Pointer
Point - Where a step happens: inside an element’s box or at a viewport point.
- Pointer
Step Kind - Scroll
Target - Where a
PageRequest::Scrollgoes instead of a distance. - WebView
Command - WebView
Event - Navigation / UI state changes from the engine to the host app, folded
into its own state (address bar text, title, progress) during
sync.
Constants§
- BROWSER_
APP_ ID - The Browser’s app id: the app the desktop opens a web address in when nothing else is chosen for it.
- MAX_
PAGE_ DIALOG_ ANSWER - The longest answer to a page’s prompt an engine takes, in bytes.
- MAX_
POINTER_ STEPS - Upper bound on the steps of one pointer gesture.
- VISITOR_
WINDOW_ FLAG - The switch a Browser window is launched with when it is opened for an
agent ([
runtime_portal::windows::VISITOR_WINDOW_FLAG]). Reading such a page takes no authority beyond a visitor’s. A launch switch is part of the local window door, so the portable toolkit, which no launcher starts, has none.
Traits§
- WebView
Engine - A running web engine instance. Implementations are
Send + Syncso the widget, the host app, and the engine’s own thread can share one handle.
Type Aliases§
- Frame
Slot - Latest-frame mailbox between an engine and the widget. Engines overwrite the slot on every paint; the widget reads it on every draw.
- Shared
Engine - Shared engine handle, as stored by the widget and the host app.