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§
Sourcefn content_rect(&self, width: f32, height: f32) -> Rect
fn content_rect(&self, width: f32, height: f32) -> Rect
Sourcefn draw(&mut self, cmd_buf: &mut Vec<DrawCommand>, width: f32, height: f32)
fn draw(&mut self, cmd_buf: &mut Vec<DrawCommand>, width: f32, height: f32)
Draws the chrome into cmd_buf in window coordinates.
Sourcefn tick(
&mut self,
actions_buf: &mut Vec<ChromeAction>,
) -> (Vec<FetchRequest>, bool)
fn tick( &mut self, actions_buf: &mut Vec<ChromeAction>, ) -> (Vec<FetchRequest>, bool)
Advances chrome-owned tabs and returns their fetch and browser actions.
Sourcefn deliver_fetch(
&mut self,
kind: FetchKind,
url: Url,
response: Result<BrowserResponse, BrowserNetworkError>,
)
fn deliver_fetch( &mut self, kind: FetchKind, url: Url, response: Result<BrowserResponse, BrowserNetworkError>, )
Delivers a resource fetch result requested by the chrome itself.
Sourcefn sync_url(&mut self, url: Option<&str>)
fn sync_url(&mut self, url: Option<&str>)
Reflects the active tab’s URL, if the chrome shows one.
Sourcefn pointer_event(
&mut self,
width: f32,
height: f32,
event: PointerEvent,
state: ElementState,
) -> ChromeEventResult
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.
fn handle_scroll( &mut self, width: f32, height: f32, mouse_x: f32, mouse_y: f32, scroll_x: f32, scroll_y: f32, )
Sourcefn accepts_text_input(&self) -> bool
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.
Sourcefn key_event(&mut self, event: &KeyEvent, ctrl: bool) -> ChromeAction
fn key_event(&mut self, event: &KeyEvent, ctrl: bool) -> ChromeAction
Dispatches a key event while the chrome owns text input.
Sourcefn ime_event(&mut self, event: &Ime) -> ChromeAction
fn ime_event(&mut self, event: &Ime) -> ChromeAction
Dispatches an IME event while the chrome owns text input.
fn on_devtools_response(&mut self, id: u64, result: String)
Sourcefn blur(&mut self)
fn blur(&mut self)
Drops any text-input focus held by the chrome (e.g. the user clicked the page).
Sourcefn needs_repaint(&self) -> bool
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".