pub(crate) struct RunningAppState {
servo: Servo,
servoshell_preferences: ServoShellPreferences,
inner: RefCell<RunningAppStateInner>,
}
Fields§
§servo: Servo
A handle to the Servo instance of the RunningAppState
. This is not stored inside
inner
so that we can keep a reference to Servo in order to spin the event loop,
which will in turn call delegates doing a mutable borrow on inner
.
servoshell_preferences: ServoShellPreferences
The preferences for this run of servoshell. This is not mutable, so doesn’t need to
be stored inside the RunningAppStateInner
.
inner: RefCell<RunningAppStateInner>
Implementations§
Source§impl RunningAppState
impl RunningAppState
pub fn new( servo: Servo, window: Rc<dyn WindowPortsMethods>, servoshell_preferences: ServoShellPreferences, ) -> RunningAppState
pub(crate) fn new_toplevel_webview(self: &Rc<Self>, url: Url)
pub(crate) fn inner(&self) -> Ref<'_, RunningAppStateInner>
pub(crate) fn inner_mut(&self) -> RefMut<'_, RunningAppStateInner>
pub(crate) fn servo(&self) -> &Servo
pub(crate) fn hidpi_scale_factor_changed(&self)
pub(crate) fn save_output_image_if_necessary(&self)
Sourcepub(crate) fn repaint_servo_if_necessary(&self)
pub(crate) fn repaint_servo_if_necessary(&self)
Repaint the Servo view is necessary, returning true if anything was actually painted or false otherwise. Something may not be painted if Servo is waiting for a stable image to paint.
Sourcepub(crate) fn pump_event_loop(&self) -> PumpResult
pub(crate) fn pump_event_loop(&self) -> PumpResult
Spins the internal application event loop.
- Notifies Servo about incoming gamepad events
- Spin the Servo event loop, which will run the compositor and trigger delegate methods.
pub(crate) fn add(&self, webview: WebView)
pub(crate) fn shutdown(&self)
pub(crate) fn for_each_active_dialog( &self, callback: impl Fn(&mut Dialog) -> bool, )
pub fn close_webview(&self, webview_id: WebViewId)
pub fn focused_webview(&self) -> Option<WebView>
pub fn webviews(&self) -> Vec<(WebViewId, WebView)>
pub fn handle_gamepad_events(&self)
pub(crate) fn focus_webview_by_index(&self, index: usize)
fn add_dialog(&self, webview: WebView, dialog: Dialog)
pub(crate) fn has_active_dialog(&self) -> bool
pub(crate) fn get_focused_webview_index(&self) -> Option<usize>
Sourcefn handle_overridable_key_bindings(
&self,
webview: WebView,
event: KeyboardEvent,
)
fn handle_overridable_key_bindings( &self, webview: WebView, event: KeyboardEvent, )
Handle servoshell key bindings that may have been prevented by the page in the focused webview.
Trait Implementations§
Source§impl Drop for RunningAppState
impl Drop for RunningAppState
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>
Get the
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>)
The status text of the currently loaded page in this
WebView
has changed. The new
status text can accessed via WebView::status_text
.Source§fn notify_page_title_changed(&self, webview: WebView, title: Option<String>)
fn notify_page_title_changed(&self, webview: WebView, title: Option<String>)
The page title of the currently loaded page in this
WebView
has changed. The new
title can accessed via WebView::page_title
.Source§fn request_move_to(&self, _: WebView, new_position: DeviceIntPoint)
fn request_move_to(&self, _: WebView, new_position: DeviceIntPoint)
Move the window to a point
Source§fn request_resize_to(&self, webview: WebView, new_size: DeviceIntSize)
fn request_resize_to(&self, webview: WebView, new_size: DeviceIntSize)
Resize the window to size
Source§fn show_simple_dialog(&self, webview: WebView, dialog: SimpleDialog)
fn show_simple_dialog(&self, webview: WebView, dialog: SimpleDialog)
Show the user a simple dialog (
alert()
, confirm()
,
or prompt()
). Since their messages are controlled by web content, they should be presented to the user in a
way that makes them impossible to mistake for browser UI.
TODO: This API needs to be reworked to match the new model of how responses are sent.fn request_authentication( &self, webview: WebView, authentication_request: AuthenticationRequest, )
Source§fn request_open_auxiliary_webview(
&self,
parent_webview: WebView,
) -> Option<WebView>
fn request_open_auxiliary_webview( &self, parent_webview: WebView, ) -> Option<WebView>
Whether or not to allow script to open a new
WebView
. If not handled by the
embedder, these requests are automatically denied.Source§fn notify_closed(&self, webview: WebView)
fn notify_closed(&self, webview: WebView)
Source§fn notify_focus_changed(&self, webview: WebView, focused: bool)
fn notify_focus_changed(&self, webview: WebView, focused: bool)
This
WebView
has either become focused or lost focus. Whether or not the
WebView
is focused can be accessed via WebView::focused
.Source§fn notify_keyboard_event(&self, webview: WebView, keyboard_event: KeyboardEvent)
fn notify_keyboard_event(&self, webview: WebView, keyboard_event: KeyboardEvent)
A keyboard event has been sent to Servo, but remains unprocessed. This allows the
embedding application to handle key events while first letting the
WebView
have an opportunity to handle it first. Apart from builtin keybindings, page
content may expose custom keybindings as well.Source§fn notify_cursor_changed(&self, _webview: WebView, cursor: Cursor)
fn notify_cursor_changed(&self, _webview: WebView, cursor: Cursor)
The
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)
The
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, )
A notification that the
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,
devices: Vec<String>,
response_sender: IpcSender<Option<String>>,
)
fn show_bluetooth_device_dialog( &self, webview: WebView, devices: Vec<String>, response_sender: IpcSender<Option<String>>, )
Open dialog to select bluetooth device.
TODO: This API needs to be reworked to match the new model of how responses are sent.
Source§fn show_file_selection_dialog(
&self,
webview: WebView,
filter_pattern: Vec<FilterPattern>,
allow_select_mutiple: bool,
response_sender: IpcSender<Option<Vec<PathBuf>>>,
)
fn show_file_selection_dialog( &self, webview: WebView, filter_pattern: Vec<FilterPattern>, allow_select_mutiple: bool, response_sender: IpcSender<Option<Vec<PathBuf>>>, )
Open file dialog to select files. Set boolean flag to true allows to select multiple files.
Source§fn request_permission(
&self,
webview: WebView,
permission_request: PermissionRequest,
)
fn request_permission( &self, webview: WebView, permission_request: PermissionRequest, )
Content in a
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)
Notify the embedder that it needs to present a new frame.
Source§fn play_gamepad_haptic_effect(
&self,
_webview: WebView,
index: usize,
effect_type: GamepadHapticEffectType,
effect_complete_sender: IpcSender<bool>,
)
fn play_gamepad_haptic_effect( &self, _webview: WebView, index: usize, effect_type: GamepadHapticEffectType, effect_complete_sender: IpcSender<bool>, )
Request to play a haptic effect on a connected gamepad.
Source§fn stop_gamepad_haptic_effect(
&self,
_webview: WebView,
index: usize,
haptic_stop_sender: IpcSender<bool>,
)
fn stop_gamepad_haptic_effect( &self, _webview: WebView, index: usize, haptic_stop_sender: IpcSender<bool>, )
Request to stop a haptic effect on a connected gamepad.
Source§fn show_ime(
&self,
_webview: WebView,
input_type: InputMethodType,
text: Option<(String, i32)>,
multiline: bool,
position: DeviceIntRect,
)
fn show_ime( &self, _webview: WebView, input_type: InputMethodType, text: Option<(String, i32)>, multiline: bool, position: DeviceIntRect, )
Request to present an IME to the user when an editable element is focused.
If
type
is InputMethodType::Text
, then the text
parameter specifies
the pre-existing text content and the zero-based index into the string
of the insertion point.Source§fn hide_ime(&self, _webview: WebView)
fn hide_ime(&self, _webview: WebView)
Request to hide the IME when the editable element is blurred.
Source§fn show_form_control(&self, webview: WebView, form_control: FormControl)
fn show_form_control(&self, webview: WebView, form_control: FormControl)
Request that the embedder show UI elements for form controls that are not integrated
into page content, such as dropdowns for
<select>
elements.Source§fn notify_url_changed(&self, _webview: WebView, _url: Url)
fn notify_url_changed(&self, _webview: WebView, _url: Url)
The URL of the currently loaded page in this
WebView
has changed. The new
URL can accessed via WebView::url
.Source§fn notify_animating_changed(&self, _webview: WebView, _animating: bool)
fn notify_animating_changed(&self, _webview: WebView, _animating: bool)
Source§fn notify_favicon_url_changed(&self, _webview: WebView, _: Url)
fn notify_favicon_url_changed(&self, _webview: WebView, _: Url)
The favicon
Url
of the currently loaded page in this WebView
has changed. The new
favicon Url
can accessed via WebView::favicon_url
.Source§fn notify_history_changed(&self, _webview: WebView, _: Vec<Url>, _: usize)
fn notify_history_changed(&self, _webview: WebView, _: Vec<Url>, _: usize)
The history state has changed.
Source§fn notify_crashed(
&self,
_webview: WebView,
_reason: String,
_backtrace: Option<String>,
)
fn notify_crashed( &self, _webview: WebView, _reason: String, _backtrace: Option<String>, )
A pipeline in the webview panicked. First string is the reason, second one is the backtrace.
Source§fn notify_media_session_event(
&self,
_webview: WebView,
_event: MediaSessionEvent,
)
fn notify_media_session_event( &self, _webview: WebView, _event: MediaSessionEvent, )
Notifies the embedder about media session events
(i.e. when there is metadata for the active media session, playback state changes…).
Whether or not to allow a
WebView
to load a URL in its main frame or one of its
nested <iframe>
s. NavigationRequest
s are accepted by default.Source§fn request_unload(&self, _webview: WebView, _unload_request: AllowOrDenyRequest)
fn request_unload(&self, _webview: WebView, _unload_request: AllowOrDenyRequest)
Whether or not to allow a
WebView
to unload a Document
in its main frame or one
of its nested <iframe>
s. By default, unloads are allowed.Show a context menu to the user
Source§fn load_web_resource(&self, _webview: WebView, _load: WebResourceLoad)
fn load_web_resource(&self, _webview: WebView, _load: WebResourceLoad)
Triggered when this
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)
Request to display a 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 !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
Mutably borrows from an owned value. Read more
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&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>
Creates a filterable data provider with the given name for debugging. Read more
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>
Converts
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>
Converts
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert