pub struct WebView(Rc<RefCell<WebViewInner>>);
Expand description
A handle to a Servo webview. If you clone this handle, it does not create a new webview, but instead creates a new handle to the webview. Once the last handle is dropped, Servo considers that the webview has closed and will clean up all associated resources related to this webview.
§Rendering Model
Every WebView
has a RenderingContext
. The embedder manages when
the contents of the WebView
paint to the RenderingContext
. When
a WebView
needs to be painted, for instance, because its contents have changed, Servo will
call WebViewDelegate::notify_new_frame_ready
in order to signal that it is time to repaint
the WebView
using WebView::paint
.
An example of how this flow might work is:
WebViewDelegate::notify_new_frame_ready
is called. The applications triggers a request to repaint the window that contains thisWebView
.- During window repainting, the application calls
WebView::paint
and the contents of theRenderingContext
are updated. - If the
RenderingContext
is double-buffered, the application then callscrate::RenderingContext::present()
in order to swap the back buffer to the front, finally displaying the updatedWebView
contents.
In cases where the WebView
contents have not been updated, but a repaint is necessary, for
instance when repainting a window due to damage, an application may simply perform the final two
steps and Servo will repaint even without first calling the
WebViewDelegate::notify_new_frame_ready
method.
Tuple Fields§
§0: Rc<RefCell<WebViewInner>>
Implementations§
Source§impl WebView
impl WebView
pub(crate) fn new( constellation_proxy: &ConstellationProxy, compositor: Rc<RefCell<IOCompositor>>, ) -> Self
fn inner(&self) -> Ref<'_, WebViewInner>
fn inner_mut(&self) -> RefMut<'_, WebViewInner>
pub(crate) fn from_weak_handle( inner: &Weak<RefCell<WebViewInner>>, ) -> Option<Self>
pub(crate) fn weak_handle(&self) -> Weak<RefCell<WebViewInner>>
pub fn delegate(&self) -> Rc<dyn WebViewDelegate>
pub fn set_delegate(&self, delegate: Rc<dyn WebViewDelegate>)
pub fn clipboard_delegate(&self) -> Rc<dyn ClipboardDelegate>
pub fn set_clipboard_delegate(&self, delegate: Rc<dyn ClipboardDelegate>)
pub fn id(&self) -> WebViewId
pub fn load_status(&self) -> LoadStatus
pub(crate) fn set_load_status(self, new_value: LoadStatus)
pub fn url(&self) -> Option<Url>
pub(crate) fn set_url(self, new_value: Url)
pub fn status_text(&self) -> Option<String>
pub(crate) fn set_status_text(self, new_value: Option<String>)
pub fn page_title(&self) -> Option<String>
pub(crate) fn set_page_title(self, new_value: Option<String>)
pub fn favicon_url(&self) -> Option<Url>
pub(crate) fn set_favicon_url(self, new_value: Url)
pub fn focused(&self) -> bool
pub(crate) fn set_focused(self, new_value: bool)
pub fn cursor(&self) -> Cursor
pub(crate) fn set_cursor(self, new_value: Cursor)
pub fn focus(&self)
pub fn blur(&self)
pub fn rect(&self) -> DeviceRect
pub fn move_resize(&self, rect: DeviceRect)
pub fn show(&self, hide_others: bool)
pub fn hide(&self)
pub fn raise_to_top(&self, hide_others: bool)
pub fn notify_theme_change(&self, theme: Theme)
pub fn load(&self, url: Url)
pub fn reload(&self)
pub fn go_back(&self, amount: usize)
pub fn go_forward(&self, amount: usize)
pub fn notify_scroll_event( &self, location: ScrollLocation, point: DeviceIntPoint, touch_event_action: TouchEventType, )
pub fn notify_input_event(&self, event: InputEvent)
pub fn notify_media_session_action_event(&self, event: MediaSessionActionType)
pub fn notify_vsync(&self)
pub fn resize(&self, new_size: PhysicalSize<u32>)
pub fn set_zoom(&self, new_zoom: f32)
pub fn reset_zoom(&self)
pub fn set_pinch_zoom(&self, new_pinch_zoom: f32)
pub fn exit_fullscreen(&self)
pub fn set_throttled(&self, throttled: bool)
pub fn toggle_webrender_debugging(&self, debugging: WebRenderDebugOption)
pub fn capture_webrender(&self)
pub fn toggle_sampling_profiler(&self, rate: Duration, max_duration: Duration)
pub fn send_error(&self, message: String)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WebView
impl !RefUnwindSafe for WebView
impl !Send for WebView
impl !Sync for WebView
impl Unpin for WebView
impl !UnwindSafe for WebView
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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