pub(crate) trait PlatformWindow {
Show 30 methods
// Required methods
fn id(&self) -> ServoShellWindowId;
fn screen_geometry(&self) -> ScreenGeometry;
fn device_hidpi_scale_factor(
&self,
) -> Scale<f32, DeviceIndependentPixel, DevicePixel>;
fn hidpi_scale_factor(
&self,
) -> Scale<f32, DeviceIndependentPixel, DevicePixel>;
fn get_fullscreen(&self) -> bool;
fn request_repaint(&self, _: &ServoShellWindow);
fn request_resize(
&self,
webview: &WebView,
outer_size: DeviceIntSize,
) -> Option<DeviceIntSize>;
fn new_glwindow(&self, event_loop: &ActiveEventLoop) -> Rc<dyn GlWindow>;
fn rendering_context(&self) -> Rc<dyn RenderingContext>;
fn window_rect(&self) -> DeviceIndependentIntRect;
fn focused(&self) -> bool;
// Provided methods
fn rebuild_user_interface(&self, _: &RunningAppState, _: &ServoShellWindow) { ... }
fn update_user_interface_state(
&self,
_: &RunningAppState,
_: &ServoShellWindow,
) -> bool { ... }
fn handle_winit_window_event(
&self,
_: Rc<RunningAppState>,
_: &ServoShellWindow,
_: WindowEvent,
) { ... }
fn handle_winit_app_event(&self, _: AppEvent) { ... }
fn take_user_interface_commands(&self) -> Vec<UserInterfaceCommand> { ... }
fn set_position(&self, _point: DeviceIntPoint) { ... }
fn set_fullscreen(&self, _state: bool) { ... }
fn set_cursor(&self, _cursor: Cursor) { ... }
fn theme(&self) -> Theme { ... }
fn maximize(&self, _: &WebView) { ... }
fn show_embedder_control(&self, _: WebViewId, _: EmbedderControl) { ... }
fn hide_embedder_control(&self, _: WebViewId, _: EmbedderControlId) { ... }
fn dismiss_embedder_controls_for_webview(&self, _: WebViewId) { ... }
fn show_bluetooth_device_dialog(
&self,
_: WebViewId,
_devices: Vec<String>,
_: GenericSender<Option<String>>,
) { ... }
fn show_permission_dialog(&self, _: WebViewId, _: PermissionRequest) { ... }
fn show_http_authentication_dialog(
&self,
_: WebViewId,
_: AuthenticationRequest,
) { ... }
fn notify_input_event_handled(
&self,
_webview: &WebView,
_id: InputEventId,
_result: InputEventResult,
) { ... }
fn notify_media_session_event(&self, _: MediaSessionEvent) { ... }
fn notify_crashed(
&self,
_: WebView,
_reason: String,
_backtrace: Option<String>,
) { ... }
}Expand description
A PlatformWindow abstracts away the differents kinds of platform windows that might
be used in a servoshell execution. This currently includes headed (winit) and headless
windows.
Required Methods§
fn id(&self) -> ServoShellWindowId
fn screen_geometry(&self) -> ScreenGeometry
fn device_hidpi_scale_factor( &self, ) -> Scale<f32, DeviceIndependentPixel, DevicePixel>
fn hidpi_scale_factor(&self) -> Scale<f32, DeviceIndependentPixel, DevicePixel>
fn get_fullscreen(&self) -> bool
Sourcefn request_repaint(&self, _: &ServoShellWindow)
fn request_repaint(&self, _: &ServoShellWindow)
Request that the window redraw itself. It is up to the window to do this once the windowing system is ready. If this is a headless window, the redraw will happen immediately.
Sourcefn request_resize(
&self,
webview: &WebView,
outer_size: DeviceIntSize,
) -> Option<DeviceIntSize>
fn request_resize( &self, webview: &WebView, outer_size: DeviceIntSize, ) -> Option<DeviceIntSize>
Request a new outer size for the window, including external decorations.
This should be the same as window.outerWidth and `window.outerHeight``
fn new_glwindow(&self, event_loop: &ActiveEventLoop) -> Rc<dyn GlWindow>
Sourcefn rendering_context(&self) -> Rc<dyn RenderingContext>
fn rendering_context(&self) -> Rc<dyn RenderingContext>
This returns RenderingContext matching the viewport.
fn window_rect(&self) -> DeviceIndependentIntRect
fn focused(&self) -> bool
Provided Methods§
Sourcefn rebuild_user_interface(&self, _: &RunningAppState, _: &ServoShellWindow)
fn rebuild_user_interface(&self, _: &RunningAppState, _: &ServoShellWindow)
Request that the Window rebuild its user interface, if it has one. This should
not repaint, but should prepare the user interface for painting when it is
actually requested.
Sourcefn update_user_interface_state(
&self,
_: &RunningAppState,
_: &ServoShellWindow,
) -> bool
fn update_user_interface_state( &self, _: &RunningAppState, _: &ServoShellWindow, ) -> bool
Inform the Window that the state of a WebView has changed and that it should
do an incremental update of user interface state. Returns true if the user
interface actually changed and a rebuild and repaint is needed, false otherwise.
Sourcefn handle_winit_window_event(
&self,
_: Rc<RunningAppState>,
_: &ServoShellWindow,
_: WindowEvent,
)
fn handle_winit_window_event( &self, _: Rc<RunningAppState>, _: &ServoShellWindow, _: WindowEvent, )
Handle a winit [WindowEvent]. Returns true if the event loop should continue
and false otherwise.
TODO: This should be handled internally in the winit window if possible so that it makes more sense when we are mixing headed and headless windows.
Sourcefn handle_winit_app_event(&self, _: AppEvent)
fn handle_winit_app_event(&self, _: AppEvent)
Handle a winit [AppEvent]. Returns true if the event loop should continue and
false otherwise.
TODO: This should be handled internally in the winit window if possible so that it makes more sense when we are mixing headed and headless windows.