Skip to main content

Chrome

Trait Chrome 

Source
pub trait Chrome: Debug {
Show 13 methods // Required methods fn content_rect(&self, width: f32, height: f32) -> Rect; fn draw(&mut self, cmd_buf: &mut Vec<DrawCommand>, width: f32, height: f32); fn tick( &mut self, actions_buf: &mut Vec<ChromeAction>, ) -> (Vec<FetchRequest>, bool); fn deliver_fetch( &mut self, kind: FetchKind, url: Url, response: Result<BrowserResponse, BrowserNetworkError>, ); fn sync_url(&mut self, url: Option<&str>); fn pointer_event( &mut self, width: f32, height: f32, event: PointerEvent, state: ElementState, ) -> ChromeEventResult; fn handle_scroll( &mut self, width: f32, height: f32, mouse_x: f32, mouse_y: f32, scroll_x: f32, scroll_y: f32, ); fn accepts_text_input(&self) -> bool; fn key_event(&mut self, event: &KeyEvent, ctrl: bool) -> ChromeAction; fn ime_event(&mut self, event: &Ime) -> ChromeAction; fn on_devtools_response(&mut self, id: u64, result: String); fn blur(&mut self); fn needs_repaint(&self) -> bool;
}
Expand description

The window chrome surrounding the web content.

The core lays out the page area below the chrome, draws the chrome on top of it, and routes user input through the chrome. Pointer events are delivered in window coordinates; the chrome answers whether it consumed them and which ChromeAction they produced.

Required Methods§

Source

fn content_rect(&self, width: f32, height: f32) -> Rect

Rect of the content (web view).

§Return:
  • (width, height)
Source

fn draw(&mut self, cmd_buf: &mut Vec<DrawCommand>, width: f32, height: f32)

Draws the chrome into cmd_buf in window coordinates.

Source

fn tick( &mut self, actions_buf: &mut Vec<ChromeAction>, ) -> (Vec<FetchRequest>, bool)

Advances chrome-owned tabs and returns their fetch and browser actions.

Source

fn deliver_fetch( &mut self, kind: FetchKind, url: Url, response: Result<BrowserResponse, BrowserNetworkError>, )

Delivers a resource fetch result requested by the chrome itself.

Source

fn sync_url(&mut self, url: Option<&str>)

Reflects the active tab’s URL, if the chrome shows one.

Source

fn pointer_event( &mut self, width: f32, height: f32, event: PointerEvent, state: ElementState, ) -> ChromeEventResult

Dispatches a pointer event to the chrome.

The chrome receives every pointer event, including moves over the page area, so it can track its own hover state.

Source

fn handle_scroll( &mut self, width: f32, height: f32, mouse_x: f32, mouse_y: f32, scroll_x: f32, scroll_y: f32, )

Source

fn accepts_text_input(&self) -> bool

Whether the chrome currently owns keyboard/IME input (e.g. a focused address bar). While true, key and IME events are routed to the chrome instead of the page.

Source

fn key_event(&mut self, event: &KeyEvent, ctrl: bool) -> ChromeAction

Dispatches a key event while the chrome owns text input.

Source

fn ime_event(&mut self, event: &Ime) -> ChromeAction

Dispatches an IME event while the chrome owns text input.

Source

fn on_devtools_response(&mut self, id: u64, result: String)

Source

fn blur(&mut self)

Drops any text-input focus held by the chrome (e.g. the user clicked the page).

Source

fn needs_repaint(&self) -> bool

Whether the chrome changed its visual state since the last check.

Consumes the flag, like crate::engine::ui::custom_node::CustomNode::needs_repaint.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§