pub struct WebView { /* private fields */ }Implementations§
Source§impl WebView
impl WebView
pub fn new(system_color_scheme: ColorScheme, js_policy: JsPolicy) -> Self
Sourcepub fn set_css_strategy(&mut self, strategy: CssApplicationStrategy)
pub fn set_css_strategy(&mut self, strategy: CssApplicationStrategy)
Set the CSS application strategy.
Default is Incremental.
Sourcepub fn set_js_policy(&mut self, policy: JsPolicy)
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.
pub fn tick(&mut self) -> Vec<WebViewTask>
pub fn on_html_fetched(&mut self, html: String, document_url: Url)
pub fn on_css_fetched(&mut self, css: String)
pub fn on_css_fetched_from(&mut self, css: String, stylesheet_url: &Url)
Sourcepub fn on_image_fetched(&mut self, source: String, bytes: &[u8]) -> Result<()>
pub fn on_image_fetched(&mut self, source: String, bytes: &[u8]) -> Result<()>
Decodes a fetched image and rebuilds layout using its intrinsic size.
Sourcepub fn on_audio_fetched(&mut self, source: String, bytes: &[u8])
pub fn on_audio_fetched(&mut self, source: String, bytes: &[u8])
Stores fetched audio bytes for the matching <audio> control.
Sourcepub fn on_script_fetched(&mut self, index: usize, source: String)
pub fn on_script_fetched(&mut self, index: usize, source: String)
Executes or queues a fetched external classic script by scheduling mode.
Sourcepub fn on_script_fetch_failed(&mut self, index: usize)
pub fn on_script_fetch_failed(&mut self, index: usize)
Records a failed external classic script without aborting page loading.
Sourcepub fn on_dynamic_script_fetched(&mut self, node_id: u64, source: String)
pub fn on_dynamic_script_fetched(&mut self, node_id: u64, source: String)
Executes a fetched dynamically inserted script and dispatches load.
Sourcepub fn on_dynamic_script_fetch_failed(&mut self, node_id: u64)
pub fn on_dynamic_script_fetch_failed(&mut self, node_id: u64)
Dispatches error for a dynamically inserted script that failed to load.
pub fn on_dynamic_style_fetched(&mut self, node_id: u64, source: String)
pub fn on_dynamic_style_fetch_failed(&mut self, node_id: u64)
Sourcepub fn on_js_fetch_succeeded(
&mut self,
request_id: u64,
response: JsFetchResponse,
)
pub fn on_js_fetch_succeeded( &mut self, request_id: u64, response: JsFetchResponse, )
Resolves a JavaScript fetch() request with a network response.
Sourcepub fn on_js_fetch_failed(&mut self, request_id: u64, reason: String)
pub fn on_js_fetch_failed(&mut self, request_id: u64, reason: String)
Rejects a JavaScript fetch() request after a network failure.
Sourcepub fn on_iframe_fetched(&mut self, dom_id: u64, html: String)
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.
Sourcepub fn on_iframe_fetch_failed(&mut self, dom_id: u64)
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.
Sourcepub fn on_devtools_response(&mut self, id: u64, result: String)
pub fn on_devtools_response(&mut self, id: u64, result: String)
Settles a DevTools inspection request with its JSON envelope.
Sourcepub fn update_page(&mut self)
pub fn update_page(&mut self)
Update page (e.g. DOM changed)
This is a stub method for now.
Sourcepub fn on_js_click(&mut self, dom_id: u32) -> bool
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.
Sourcepub fn on_js_scroll(&mut self, dom_id: u32) -> bool
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.
pub fn set_system_color_scheme(&mut self, scheme: ColorScheme)
pub fn title(&self) -> Option<&String>
pub fn relayout(&mut self, viewport: (f32, f32))
Sourcepub fn layout_and_info(&self) -> Option<(&LayoutNode, &InfoNode)>
pub fn layout_and_info(&self) -> Option<(&LayoutNode, &InfoNode)>
現在描画可能な Layout / Info を返す(なければ None)
pub fn layout_and_info_mut(&mut self) -> Option<(&LayoutNode, &mut InfoNode)>
Sourcepub fn document_info(&self) -> Option<&DocumentInfo>
pub fn document_info(&self) -> Option<&DocumentInfo>
Returns document info
pub fn document_url(&self) -> Option<&Url>
pub fn base_url(&self) -> Option<&Url>
pub fn needs_redraw(&self) -> bool
pub fn clear_redraw_flag(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for WebView
impl !RefUnwindSafe for WebView
impl !Send for WebView
impl !Sync for WebView
impl !UnwindSafe for WebView
impl Unpin for WebView
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().