Skip to main content

WebView

Struct WebView 

Source
pub struct WebView { /* private fields */ }

Implementations§

Source§

impl WebView

Source

pub fn new(system_color_scheme: ColorScheme, js_policy: JsPolicy) -> Self

Source

pub fn set_css_strategy(&mut self, strategy: CssApplicationStrategy)

Set the CSS application strategy.

Default is Incremental.

Source

pub fn set_js_policy(&mut self, policy: JsPolicy)

Sets the JavaScript execution policy.

The policy is applied to <noscript> parsing on the next document load and takes effect immediately for execution: disabling it drops the JS runtime, cancels pending script work, and stops running scripts.

Source

pub fn js_policy(&self) -> JsPolicy

Returns the current JavaScript execution policy.

Source

pub fn tick(&mut self) -> Vec<WebViewTask>

Source

pub fn on_html_fetched(&mut self, html: String, document_url: Url)

Source

pub fn on_css_fetched(&mut self, css: String)

Source

pub fn on_css_fetched_from(&mut self, css: String, stylesheet_url: &Url)

Source

pub fn on_image_fetched(&mut self, source: String, bytes: &[u8]) -> Result<()>

Decodes a fetched image and rebuilds layout using its intrinsic size.

Source

pub fn on_audio_fetched(&mut self, source: String, bytes: &[u8])

Stores fetched audio bytes for the matching <audio> control.

Source

pub fn on_script_fetched(&mut self, index: usize, source: String)

Executes or queues a fetched external classic script by scheduling mode.

Source

pub fn on_script_fetch_failed(&mut self, index: usize)

Records a failed external classic script without aborting page loading.

Source

pub fn on_dynamic_script_fetched(&mut self, node_id: u64, source: String)

Executes a fetched dynamically inserted script and dispatches load.

Source

pub fn on_dynamic_script_fetch_failed(&mut self, node_id: u64)

Dispatches error for a dynamically inserted script that failed to load.

Source

pub fn on_dynamic_style_fetched(&mut self, node_id: u64, source: String)

Source

pub fn on_dynamic_style_fetch_failed(&mut self, node_id: u64)

Source

pub fn on_js_fetch_succeeded( &mut self, request_id: u64, response: JsFetchResponse, )

Resolves a JavaScript fetch() request with a network response.

Source

pub fn on_js_fetch_failed(&mut self, request_id: u64, reason: String)

Rejects a JavaScript fetch() request after a network failure.

Source

pub fn on_iframe_fetched(&mut self, dom_id: u64, html: String)

Installs parsed iframe HTML as the host element’s contentDocument and fires its load event.

Source

pub fn on_iframe_fetch_failed(&mut self, dom_id: u64)

Marks an iframe load as failed so later contentDocument accesses do not keep re-queuing a fetch.

Source

pub fn on_devtools_response(&mut self, id: u64, result: String)

Settles a DevTools inspection request with its JSON envelope.

Source

pub fn update_page(&mut self)

Update page (e.g. DOM changed)

This is a stub method for now.

Source

pub fn on_js_click(&mut self, dom_id: u32) -> bool

Dispatches a click on the given DOM snapshot node id to the page’s JS.

Resolves the live DOM node behind the snapshot id, translates it to the JS-facing dom id and hands the click to the JS thread. Returns whether a redraw is needed; the JS result triggers the relayout once applied.

Source

pub fn on_js_scroll(&mut self, dom_id: u32) -> bool

Dispatches a scroll event on the given DOM snapshot node id to the page’s JS.

Resolves the live DOM node behind the snapshot id, translates it to the JS-facing dom id and hands the scroll to the JS thread. Returns whether a redraw is needed; the JS result triggers the relayout once applied.

Source

pub fn navigate(&mut self)

Source

pub fn set_system_color_scheme(&mut self, scheme: ColorScheme)

Source

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

Source

pub fn relayout(&mut self, viewport: (f32, f32))

Source

pub fn layout_and_info(&self) -> Option<(&LayoutNode, &InfoNode)>

現在描画可能な Layout / Info を返す(なければ None)

Source

pub fn layout_and_info_mut(&mut self) -> Option<(&LayoutNode, &mut InfoNode)>

Source

pub fn document_info(&self) -> Option<&DocumentInfo>

Returns document info

Source

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

Source

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

Source

pub fn needs_redraw(&self) -> bool

Source

pub fn clear_redraw_flag(&mut self)

Trait Implementations§

Source§

impl Default for WebView

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> Instrument for T

§

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

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

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
§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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