servo

Struct WebView

Source
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:

  1. WebViewDelegate::notify_new_frame_ready is called. The applications triggers a request to repaint the window that contains this WebView.
  2. During window repainting, the application calls WebView::paint and the contents of the RenderingContext are updated.
  3. If the RenderingContext is double-buffered, the application then calls crate::RenderingContext::present() in order to swap the back buffer to the front, finally displaying the updated WebView 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

Source

pub(crate) fn new( constellation_proxy: &ConstellationProxy, compositor: Rc<RefCell<IOCompositor>>, ) -> Self

Source

fn inner(&self) -> Ref<'_, WebViewInner>

Source

fn inner_mut(&self) -> RefMut<'_, WebViewInner>

Source

pub(crate) fn from_weak_handle( inner: &Weak<RefCell<WebViewInner>>, ) -> Option<Self>

Source

pub(crate) fn weak_handle(&self) -> Weak<RefCell<WebViewInner>>

Source

pub fn delegate(&self) -> Rc<dyn WebViewDelegate>

Source

pub fn set_delegate(&self, delegate: Rc<dyn WebViewDelegate>)

Source

pub fn clipboard_delegate(&self) -> Rc<dyn ClipboardDelegate>

Source

pub fn set_clipboard_delegate(&self, delegate: Rc<dyn ClipboardDelegate>)

Source

pub fn id(&self) -> WebViewId

Source

pub fn load_status(&self) -> LoadStatus

Source

pub(crate) fn set_load_status(self, new_value: LoadStatus)

Source

pub fn url(&self) -> Option<Url>

Source

pub(crate) fn set_url(self, new_value: Url)

Source

pub fn status_text(&self) -> Option<String>

Source

pub(crate) fn set_status_text(self, new_value: Option<String>)

Source

pub fn page_title(&self) -> Option<String>

Source

pub(crate) fn set_page_title(self, new_value: Option<String>)

Source

pub fn favicon_url(&self) -> Option<Url>

Source

pub(crate) fn set_favicon_url(self, new_value: Url)

Source

pub fn focused(&self) -> bool

Source

pub(crate) fn set_focused(self, new_value: bool)

Source

pub fn cursor(&self) -> Cursor

Source

pub(crate) fn set_cursor(self, new_value: Cursor)

Source

pub fn focus(&self)

Source

pub fn blur(&self)

Source

pub fn rect(&self) -> DeviceRect

Source

pub fn move_resize(&self, rect: DeviceRect)

Source

pub fn show(&self, hide_others: bool)

Source

pub fn hide(&self)

Source

pub fn raise_to_top(&self, hide_others: bool)

Source

pub fn notify_theme_change(&self, theme: Theme)

Source

pub fn load(&self, url: Url)

Source

pub fn reload(&self)

Source

pub fn go_back(&self, amount: usize)

Source

pub fn go_forward(&self, amount: usize)

Source

pub fn notify_scroll_event( &self, location: ScrollLocation, point: DeviceIntPoint, touch_event_action: TouchEventType, )

Source

pub fn notify_input_event(&self, event: InputEvent)

Source

pub fn notify_media_session_action_event(&self, event: MediaSessionActionType)

Source

pub fn notify_vsync(&self)

Source

pub fn resize(&self, new_size: PhysicalSize<u32>)

Source

pub fn set_zoom(&self, new_zoom: f32)

Source

pub fn reset_zoom(&self)

Source

pub fn set_pinch_zoom(&self, new_pinch_zoom: f32)

Source

pub fn exit_fullscreen(&self)

Source

pub fn set_throttled(&self, throttled: bool)

Source

pub fn toggle_webrender_debugging(&self, debugging: WebRenderDebugOption)

Source

pub fn capture_webrender(&self)

Source

pub fn toggle_sampling_profiler(&self, rate: Duration, max_duration: Duration)

Source

pub fn send_error(&self, message: String)

Source

pub fn paint(&self) -> bool

Paint the contents of this WebView into its RenderingContext. This will always paint, unless the Opts::wait_for_stable_image option is enabled. In that case, this might do nothing. Returns true if a paint was actually performed.

Trait Implementations§

Source§

impl Clone for WebView

Source§

fn clone(&self) -> WebView

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Hash for WebView

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for WebView

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsVoidPtr for T

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Filterable for T

Source§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> MaybeBoxed<Box<T>> for T

Source§

fn maybe_boxed(self) -> Box<T>

Convert
Source§

impl<T> MaybeBoxed<T> for T

Source§

fn maybe_boxed(self) -> T

Convert
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T