pub(crate) struct RunningAppState {Show 14 fields
gamepad_delegate: Option<Rc<ServoshellGamepadDelegate>>,
pub(crate) webdriver_senders: RefCell<WebDriverSenders>,
pub(crate) webdriver_embedder_controls: WebDriverEmbedderControls,
pub(crate) pending_webdriver_events: RefCell<HashMap<InputEventId, Sender<()>>>,
pub(crate) webdriver_receiver: Option<Receiver<WebDriverCommandMsg>>,
pub(crate) servoshell_preferences: ServoShellPreferences,
pub(crate) servo: Servo,
pub(crate) achieved_stable_image: Rc<Cell<bool>>,
pub(crate) user_content_manager: Rc<UserContentManager>,
exit_scheduled: Cell<bool>,
experimental_preferences_enabled: Cell<bool>,
windows: RefCell<HashMap<ServoShellWindowId, Rc<ServoShellWindow>>>,
focused_window: RefCell<Option<Rc<ServoShellWindow>>>,
accessibility_active: Cell<bool>,
}Fields§
§gamepad_delegate: Option<Rc<ServoshellGamepadDelegate>>The gamepad provider, used for handling gamepad events and set on each WebView.
May be None if gamepad support is disabled or failed to initialize.
webdriver_senders: RefCell<WebDriverSenders>The WebDriverSenders used to reply to pending WebDriver requests.
webdriver_embedder_controls: WebDriverEmbedderControlsWhen running in WebDriver mode, WebDriverEmbedderControls is a virtual container
for all embedder controls. This overrides the normal behavior where these controls
are shown in the GUI or not processed at all in headless mode.
pending_webdriver_events: RefCell<HashMap<InputEventId, Sender<()>>>A HashMap of pending WebDriver events. It is the WebDriver embedder’s responsibility
to inform the WebDriver server when the event has been fully handled. This map is used
to report back to WebDriver when that happens.
webdriver_receiver: Option<Receiver<WebDriverCommandMsg>>A Receiver for receiving commands from a running WebDriver server, if WebDriver
was enabled.
servoshell_preferences: ServoShellPreferencesservoshell specific preferences created during startup of the application.
servo: ServoA handle to the Servo instance.
achieved_stable_image: Rc<Cell<bool>>Whether or not the application has achieved stable image output. This is used
for the exit_after_stable_image option.
user_content_manager: Rc<UserContentManager>The UserContentManager for all WebViews created.
exit_scheduled: Cell<bool>Whether or not program exit has been triggered. This means that all windows will be destroyed and shutdown will start at the end of the current event loop.
experimental_preferences_enabled: Cell<bool>Whether the user has enabled experimental preferences.
windows: RefCell<HashMap<ServoShellWindowId, Rc<ServoShellWindow>>>The set of ServoShellWindows that currently exist for this instance of servoshell.
focused_window: RefCell<Option<Rc<ServoShellWindow>>>The currently focused ServoShellWindow, if one is focused.
accessibility_active: Cell<bool>Whether accessibility is active in servoshell.
Set by the platform via AccessKit, and forwarded to existing and new WebViews via
WebView::set_accessibility_active(), in Self::set_accessibility_active() and
and ServoShellWindow::create_toplevel_webview().
Implementations§
Source§impl RunningAppState
impl RunningAppState
pub(crate) fn new( servo: Servo, servoshell_preferences: ServoShellPreferences, event_loop_waker: Box<dyn EventLoopWaker>, user_content_manager: Rc<UserContentManager>, default_preferences: Preferences, gamepad_delegate: Option<Rc<ServoshellGamepadDelegate>>, ) -> Self
pub(crate) fn open_window( self: &Rc<Self>, platform_window: Rc<dyn PlatformWindow>, initial_url: Url, ) -> Rc<ServoShellWindow>
pub(crate) fn windows<'a>( &'a self, ) -> Ref<'a, HashMap<ServoShellWindowId, Rc<ServoShellWindow>>>
pub(crate) fn focused_window(&self) -> Option<Rc<ServoShellWindow>>
pub(crate) fn focus_window(&self, window: Rc<ServoShellWindow>)
pub(crate) fn window( &self, id: ServoShellWindowId, ) -> Option<Rc<ServoShellWindow>>
pub(crate) fn webview_by_id(&self, webview_id: WebViewId) -> Option<WebView>
pub(crate) fn webdriver_receiver( &self, ) -> Option<&Receiver<WebDriverCommandMsg>>
pub(crate) fn servo(&self) -> &Servo
pub(crate) fn gamepad_delegate(&self) -> Option<Rc<ServoshellGamepadDelegate>>
pub(crate) fn schedule_exit(&self)
pub(crate) fn experimental_preferences_enabled(&self) -> bool
pub(crate) fn set_experimental_preferences_enabled(&self, new_value: bool)
Sourcefn close_empty_windows(&self)
fn close_empty_windows(&self)
Close any ServoShellWindow that doesn’t have an open WebView.
Sourcepub(crate) fn spin_event_loop(
self: &Rc<Self>,
create_platform_window: Option<&dyn Fn(Url) -> Rc<dyn PlatformWindow>>,
) -> bool
pub(crate) fn spin_event_loop( self: &Rc<Self>, create_platform_window: Option<&dyn Fn(Url) -> Rc<dyn PlatformWindow>>, ) -> bool
Spins the internal application event loop.
- Notifies Servo about incoming gamepad events
- Spin the Servo event loop, which will update Servo’s embedding layer and trigger delegate methods.
Returns true if the event loop should continue spinning and false if it should exit.
pub(crate) fn maybe_window_for_webview_id( &self, webview_id: WebViewId, ) -> Option<Rc<ServoShellWindow>>
pub(crate) fn window_for_webview_id( &self, webview_id: WebViewId, ) -> Rc<ServoShellWindow>
pub(crate) fn platform_window_for_webview_id( &self, webview_id: WebViewId, ) -> Rc<dyn PlatformWindow>
Sourcefn maybe_request_screenshot(&self, webview: WebView)
fn maybe_request_screenshot(&self, webview: WebView)
pub(crate) fn set_pending_traversal( &self, traversal_id: TraversalId, sender: GenericSender<WebDriverLoadStatus>, )
pub(crate) fn set_load_status_sender( &self, webview_id: WebViewId, sender: GenericSender<WebDriverLoadStatus>, )
fn remove_load_status_sender(&self, webview_id: WebViewId)
fn set_script_command_interrupt_sender( &self, sender: Option<GenericSender<WebDriverJSResult>>, )
pub(crate) fn handle_webdriver_input_event( &self, webview_id: WebViewId, input_event: InputEvent, response_sender: Option<Sender<()>>, )
pub(crate) fn handle_webdriver_screenshot( &self, webview_id: WebViewId, rect: Option<Rect<f32, CSSPixel>>, result_sender: Sender<Result<RgbaImage, ScreenshotCaptureError>>, )
pub(crate) fn handle_webdriver_script_command( &self, script_command: &WebDriverScriptCommand, )
pub(crate) fn handle_webdriver_load_url( &self, webview_id: WebViewId, url: Url, load_status_sender: GenericSender<WebDriverLoadStatus>, )
pub(crate) fn handle_gamepad_events(&self)
pub(crate) fn handle_focused(&self, window: Rc<ServoShellWindow>)
Sourcefn interrupt_webdriver_script_evaluation(&self)
fn interrupt_webdriver_script_evaluation(&self)
Interrupt any ongoing WebDriver-based script evaluation.
From https://w3c.github.io/webdriver/#dfn-execute-a-function-body:
The rules to execute a function body are as follows. The algorithm returns an ECMAScript completion record.
If at any point during the algorithm a user prompt appears, immediately return Completion { Type: normal, Value: null, Target: empty }, but continue to run the other steps of this algorithm in parallel.
pub(crate) fn set_accessibility_active(&self, active: bool)
pub(crate) fn accessibility_active(&self) -> bool
Source§impl RunningAppState
impl RunningAppState
pub(crate) fn handle_webdriver_messages( self: &Rc<Self>, create_platform_window: Option<&dyn Fn(Url) -> Rc<dyn PlatformWindow>>, )
Trait Implementations§
Source§impl WebViewDelegate for RunningAppState
impl WebViewDelegate for RunningAppState
Source§fn screen_geometry(&self, webview: WebView) -> Option<ScreenGeometry>
fn screen_geometry(&self, webview: WebView) -> Option<ScreenGeometry>
ScreenGeometry for this WebView. If this is unimplemented or returns None
the screen will have the size of the WebView’s RenderingContext and WebView will be
considered to be positioned at the screen’s origin.Source§fn notify_status_text_changed(&self, webview: WebView, _status: Option<String>)
fn notify_status_text_changed(&self, webview: WebView, _status: Option<String>)
WebView has changed. The new
status text can accessed via WebView::status_text.Source§fn notify_history_changed(
&self,
webview: WebView,
_entries: Vec<Url>,
_current: usize,
)
fn notify_history_changed( &self, webview: WebView, _entries: Vec<Url>, _current: usize, )
WebView has changed. The navigation history is represented
as a Vec<Url> and _current denotes the current index in the history. New navigations,
back navigation, and forward navigation modify this index.Source§fn notify_page_title_changed(&self, webview: WebView, _: Option<String>)
fn notify_page_title_changed(&self, webview: WebView, _: Option<String>)
WebView has changed. The new
title can accessed via WebView::page_title.Source§fn notify_traversal_complete(
&self,
_webview: WebView,
traversal_id: TraversalId,
)
fn notify_traversal_complete( &self, _webview: WebView, traversal_id: TraversalId, )
Source§fn request_move_to(&self, webview: WebView, new_position: DeviceIntPoint)
fn request_move_to(&self, webview: WebView, new_position: DeviceIntPoint)
Source§fn request_resize_to(
&self,
webview: WebView,
requested_outer_size: DeviceIntSize,
)
fn request_resize_to( &self, webview: WebView, requested_outer_size: DeviceIntSize, )
WebView to the provided outer
size. These resize requests can come from page content. Servo will ensure that the
values are greater than zero, but it is up to the embedder to limit the maximum
size. For instance, a reasonable limitation might be that the final size is no
larger than the screen size.fn request_authentication( &self, webview: WebView, authentication_request: AuthenticationRequest, )
Source§fn request_create_new(
&self,
parent_webview: WebView,
request: CreateNewWebViewRequest,
)
fn request_create_new( &self, parent_webview: WebView, request: CreateNewWebViewRequest, )
WebView, such as via the window.open DOM API. If this request is
ignored, no new WebView will be opened. Embedders can handle this method by
using the provided CreateNewWebViewRequest to build a new WebView. Read moreSource§fn notify_closed(&self, webview: WebView)
fn notify_closed(&self, webview: WebView)
Source§fn notify_input_event_handled(
&self,
webview: WebView,
id: InputEventId,
result: InputEventResult,
)
fn notify_input_event_handled( &self, webview: WebView, id: InputEventId, result: InputEventResult, )
WebView via WebView::notify_input_event has been handled
by Servo. This allows post-procesing of input events, such as chaining up unhandled events
to parent UI elements.Source§fn notify_cursor_changed(&self, webview: WebView, cursor: Cursor)
fn notify_cursor_changed(&self, webview: WebView, cursor: Cursor)
Cursor of the currently loaded page in this WebView has changed. The new
cursor can accessed via WebView::cursor.Source§fn notify_load_status_changed(&self, webview: WebView, status: LoadStatus)
fn notify_load_status_changed(&self, webview: WebView, status: LoadStatus)
LoadStatus of the currently loading or loaded page in this WebView has changed. The new
status can accessed via WebView::load_status.Source§fn notify_fullscreen_state_changed(
&self,
webview: WebView,
fullscreen_state: bool,
)
fn notify_fullscreen_state_changed( &self, webview: WebView, fullscreen_state: bool, )
WebView has entered or exited fullscreen mode. This is an
opportunity for the embedder to transition the containing window into or out of fullscreen
mode and to show or hide extra UI elements. Regardless of how the notification is handled,
the page will enter or leave fullscreen state internally according to the Fullscreen
API.Source§fn show_bluetooth_device_dialog(
&self,
webview: WebView,
request: BluetoothDeviceSelectionRequest,
)
fn show_bluetooth_device_dialog( &self, webview: WebView, request: BluetoothDeviceSelectionRequest, )
Source§fn request_permission(
&self,
webview: WebView,
permission_request: PermissionRequest,
)
fn request_permission( &self, webview: WebView, permission_request: PermissionRequest, )
WebView is requesting permission to access a feature requiring
permission from the user. The embedder should allow or deny the request, either by
reading a cached value or querying the user for permission via the user interface.Source§fn notify_new_frame_ready(&self, webview: WebView)
fn notify_new_frame_ready(&self, webview: WebView)
Source§fn show_embedder_control(
&self,
webview: WebView,
embedder_control: EmbedderControl,
)
fn show_embedder_control( &self, webview: WebView, embedder_control: EmbedderControl, )
<select> elements.Source§fn hide_embedder_control(
&self,
webview: WebView,
embedder_control_id: EmbedderControlId,
)
fn hide_embedder_control( &self, webview: WebView, embedder_control_id: EmbedderControlId, )
EmbedderControl request, if it hasn’t
already responded to it. Read moreSource§fn notify_favicon_changed(&self, webview: WebView)
fn notify_favicon_changed(&self, webview: WebView)
WebView has changed. The new
favicon Image can accessed via WebView::favicon.Source§fn notify_media_session_event(&self, webview: WebView, event: MediaSessionEvent)
fn notify_media_session_event(&self, webview: WebView, event: MediaSessionEvent)
Source§fn notify_crashed(
&self,
webview: WebView,
reason: String,
backtrace: Option<String>,
)
fn notify_crashed( &self, webview: WebView, reason: String, backtrace: Option<String>, )
Source§fn show_console_message(
&self,
webview: WebView,
level: ConsoleLogLevel,
message: String,
)
fn show_console_message( &self, webview: WebView, level: ConsoleLogLevel, message: String, )
WebView.
https://developer.mozilla.org/en-US/docs/Web/API/Console_APISource§fn notify_accessibility_tree_update(
&self,
webview: WebView,
tree_update: TreeUpdate,
)
fn notify_accessibility_tree_update( &self, webview: WebView, tree_update: TreeUpdate, )
Source§fn notify_url_changed(&self, _webview: WebView, _url: Url)
fn notify_url_changed(&self, _webview: WebView, _url: Url)
WebView has changed. The new
URL can accessed via WebView::url.Source§fn notify_focus_changed(&self, _webview: WebView, _focused: bool)
fn notify_focus_changed(&self, _webview: WebView, _focused: bool)
WebView has either become focused or lost focus. Whether or not the
WebView is focused can be accessed via WebView::focused.Source§fn notify_animating_changed(&self, _webview: WebView, _animating: bool)
fn notify_animating_changed(&self, _webview: WebView, _animating: bool)
WebView to load a URL in its main frame or one of its
nested <iframe>s. NavigationRequests are accepted by default.Source§fn request_unload(&self, _webview: WebView, _unload_request: AllowOrDenyRequest)
fn request_unload(&self, _webview: WebView, _unload_request: AllowOrDenyRequest)
WebView to unload a Document in its main frame or one
of its nested <iframe>s. By default, unloads are allowed.Source§fn request_protocol_handler(
&self,
_webview: WebView,
_protocol_handler_registration: ProtocolHandlerRegistration,
_allow_deny_request: AllowOrDenyRequest,
)
fn request_protocol_handler( &self, _webview: WebView, _protocol_handler_registration: ProtocolHandlerRegistration, _allow_deny_request: AllowOrDenyRequest, )
WebView to (un)register a protocol handler (e.g. mailto:).
Typically an embedder application will show a permissions prompt when this happens
to confirm a protocol handler is allowed. By default, requests are denied.
For more information, see the specification:
https://html.spec.whatwg.org/multipage/#custom-handlersSource§fn load_web_resource(&self, _webview: WebView, _load: WebResourceLoad)
fn load_web_resource(&self, _webview: WebView, _load: WebResourceLoad)
WebView will load a web (HTTP/HTTPS) resource. The load may be
intercepted and alternate contents can be loaded by the client by calling
WebResourceLoad::intercept. If not handled, the load will continue as normal. Read moreSource§fn show_notification(&self, _webview: WebView, _notification: Notification)
fn show_notification(&self, _webview: WebView, _notification: Notification)
Auto Trait Implementations§
impl !Freeze for RunningAppState
impl !RefUnwindSafe for RunningAppState
impl !Send for RunningAppState
impl !Sync for RunningAppState
impl Unpin for RunningAppState
impl UnsafeUnpin for RunningAppState
impl !UnwindSafe for RunningAppState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more