diff --git a/docs/src/verso/webview.rs.html b/docs/src/verso/webview.rs.html index 48b09e5..51f3cc8 100644 --- a/docs/src/verso/webview.rs.html +++ b/docs/src/verso/webview.rs.html @@ -63,6 +63,9 @@

Files

61 62 63 +64 +65 +66
use std::cell::Cell;
 
 use servo::{base::id::WebViewId, url::ServoUrl};
@@ -104,6 +107,9 @@ 

Files

/// - Navigate to previous page: `window.prompt('PREV')` /// - Navigate to next page: `window.prompt('FORWARD')` /// - Refresh the page: `window.prompt('REFRESH')` +/// - Minimize the window: `window.prompt('MINIMIZE')` +/// - Maximize the window: `window.prompt('MAXIMIZE')` +/// - Navigate to a specific URL: `window.prompt('NAVIGATE_TO:${url}')` pub struct Panel { id: Option<WebViewId>, } diff --git a/docs/src/verso/window.rs.html b/docs/src/verso/window.rs.html index 890d3e8..8b621fe 100644 --- a/docs/src/verso/window.rs.html +++ b/docs/src/verso/window.rs.html @@ -541,6 +541,12 @@

Files

539 540 541 +542 +543 +544 +545 +546 +547
use std::{cell::Cell, ops::Deref, rc::Rc};
 
 use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle};
@@ -807,30 +813,36 @@ 

Files

) => { if let Some(webview) = &self.webview { let id = webview.id(); - match msg.as_str() { - "PREV" => { - events.push(EmbedderEvent::Navigation( - id, - TraversalDirection::Back(1), - )); - } - "FORWARD" => { - events.push(EmbedderEvent::Navigation( - id, - TraversalDirection::Forward(1), - )); - } - "REFRESH" => { - events.push(EmbedderEvent::Reload(id)); - } - "MINIMIZE" => { - self.window.set_minimized(true); - } - "MAXIMIZE" => { - let is_maximized = self.window.is_maximized(); - self.window.set_maximized(!is_maximized); + + if msg.starts_with("NAVIGATE_TO:") { + let url = ServoUrl::parse(msg.strip_prefix("NAVIGATE_TO:").unwrap()).unwrap(); + events.push(EmbedderEvent::LoadUrl(id, url)); + } else { + match msg.as_str() { + "PREV" => { + events.push(EmbedderEvent::Navigation( + id, + TraversalDirection::Back(1), + )); + } + "FORWARD" => { + events.push(EmbedderEvent::Navigation( + id, + TraversalDirection::Forward(1), + )); + } + "REFRESH" => { + events.push(EmbedderEvent::Reload(id)); + } + "MINIMIZE" => { + self.window.set_minimized(true); + } + "MAXIMIZE" => { + let is_maximized = self.window.is_maximized(); + self.window.set_maximized(!is_maximized); + } + e => log::warn!("Verso Panel isn't supporting this prompt message yet: {e}") } - e => log::warn!("Verso Panel isn't supporting this prompt message yet: {e}") } } let _ = sender.send(None); diff --git a/docs/verso/webview/index.html b/docs/verso/webview/index.html index d6645dd..2a03bfd 100644 --- a/docs/verso/webview/index.html +++ b/docs/verso/webview/index.html @@ -1,4 +1,4 @@ verso::webview - Rust -

Module verso::webview

source ·
Expand description

Web view types to handle web browsing contexts.

+

Module verso::webview

source ·
Expand description

Web view types to handle web browsing contexts.

Structs§

  • A panel is a special web view that focus on controlling states around window. It could be treated as the control panel or navigation bar of the window depending on usages.
  • A web view is an area to display web browsing context. It’s what user will treat as a “web page”.
\ No newline at end of file diff --git a/docs/verso/webview/struct.Panel.html b/docs/verso/webview/struct.Panel.html index f235973..3ea1a16 100644 --- a/docs/verso/webview/struct.Panel.html +++ b/docs/verso/webview/struct.Panel.html @@ -1,5 +1,5 @@ Panel in verso::webview - Rust -

Struct verso::webview::Panel

source ·
pub struct Panel { /* private fields */ }
Expand description

A panel is a special web view that focus on controlling states around window. +

Struct verso::webview::Panel

source ·
pub struct Panel { /* private fields */ }
Expand description

A panel is a special web view that focus on controlling states around window. It could be treated as the control panel or navigation bar of the window depending on usages.

At the moment, following Web API is supported:

    @@ -7,10 +7,13 @@
  • Navigate to previous page: window.prompt('PREV')
  • Navigate to next page: window.prompt('FORWARD')
  • Refresh the page: window.prompt('REFRESH')
  • +
  • Minimize the window: window.prompt('MINIMIZE')
  • +
  • Maximize the window: window.prompt('MAXIMIZE')
  • +
  • Navigate to a specific URL: window.prompt('NAVIGATE_TO:${url}')
-

Implementations§

source§

impl Panel

source

pub fn new() -> Self

Create a panel from Winit window.

-
source

pub fn set_id(&mut self, id: WebViewId)

Set web view ID of this panel.

-
source

pub fn id(&self) -> WebViewId

Get web view ID of this panel.

+

Implementations§

source§

impl Panel

source

pub fn new() -> Self

Create a panel from Winit window.

+
source

pub fn set_id(&mut self, id: WebViewId)

Set web view ID of this panel.

+
source

pub fn id(&self) -> WebViewId

Get web view ID of this panel.

We assume this is always called after set_id. Calling before it will cause panic.

Auto Trait Implementations§

§

impl Freeze for Panel

§

impl RefUnwindSafe for Panel

§

impl Send for Panel

§

impl Sync for Panel

§

impl Unpin for Panel

§

impl UnwindSafe for Panel

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 diff --git a/docs/verso/window/index.html b/docs/verso/window/index.html index 76f480b..33738c1 100644 --- a/docs/verso/window/index.html +++ b/docs/verso/window/index.html @@ -1,3 +1,3 @@ verso::window - Rust -

Module verso::window

source ·
Expand description

Verso’s window types to handle Winit’s window.

+

Module verso::window

source ·
Expand description

Verso’s window types to handle Winit’s window.

Structs§

  • A Winit window with webrender rendering context.
  • A Verso window is a Winit window containing several web views.
\ No newline at end of file diff --git a/docs/verso/window/struct.GLWindow.html b/docs/verso/window/struct.GLWindow.html index 9cb1098..04bd8ad 100644 --- a/docs/verso/window/struct.GLWindow.html +++ b/docs/verso/window/struct.GLWindow.html @@ -1,11 +1,11 @@ GLWindow in verso::window - Rust -

Struct verso::window::GLWindow

source ·
pub struct GLWindow { /* private fields */ }
Expand description

A Winit window with webrender rendering context.

-

Implementations§

source§

impl GLWindow

source

pub fn new(window: WinitWindow, rendering_context: RenderingContext) -> Self

Create a web view from Winit window.

-
source

pub fn is_animating(&self) -> bool

Check if WebView (GLWindow) is animating.

-

Trait Implementations§

source§

impl WindowMethods for GLWindow

source§

fn get_coordinates(&self) -> EmbedderCoordinates

Get the coordinates of the native window, the screen and the framebuffer.
source§

fn set_animation_state(&self, state: AnimationState)

Set whether the application is currently animating. +

Struct verso::window::GLWindow

source ·
pub struct GLWindow { /* private fields */ }
Expand description

A Winit window with webrender rendering context.

+

Implementations§

source§

impl GLWindow

source

pub fn new(window: WinitWindow, rendering_context: RenderingContext) -> Self

Create a web view from Winit window.

+
source

pub fn is_animating(&self) -> bool

Check if WebView (GLWindow) is animating.

+

Trait Implementations§

source§

impl WindowMethods for GLWindow

source§

fn get_coordinates(&self) -> EmbedderCoordinates

Get the coordinates of the native window, the screen and the framebuffer.
source§

fn set_animation_state(&self, state: AnimationState)

Set whether the application is currently animating. Typically, when animations are active, the window will want to avoid blocking on UI events, and just -run the event loop at the vsync interval.
source§

fn rendering_context(&self) -> RenderingContext

Get the [RenderingContext] of this Window.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where +run the event loop at the vsync interval.

source§

fn rendering_context(&self) -> RenderingContext

Get the [RenderingContext] of this Window.

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

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where diff --git a/docs/verso/window/struct.Window.html b/docs/verso/window/struct.Window.html index ba25934..5e052ea 100644 --- a/docs/verso/window/struct.Window.html +++ b/docs/verso/window/struct.Window.html @@ -1,6 +1,6 @@ Window in verso::window - Rust

Struct verso::window::Window

source ·
pub struct Window { /* private fields */ }
Expand description

A Verso window is a Winit window containing several web views.

-

Implementations§

source§

impl Window

source

pub fn new(window: WinitWindow) -> Self

Create a Verso window from Winit window.

+

Implementations§

source§

impl Window

source

pub fn new(window: WinitWindow) -> Self

Create a Verso window from Winit window.

source

pub fn set_webview_id(&mut self, id: WebViewId)

Set WebView ID of this window.

source

pub fn gl_window(&self) -> Rc<GLWindow>

Return the reference counted GLWindow.

source

pub fn handle_winit_window_event( @@ -9,23 +9,23 @@ events: &mut Vec<EmbedderEvent>, event: &WindowEvent )

Handle Winit window event.

-
source

pub fn handle_servo_messages( +

source

pub fn handle_servo_messages( &mut self, servo: &mut Servo<GLWindow>, events: &mut Vec<EmbedderEvent>, status: &mut Status ) -> bool

Handle servo messages and return a boolean to indicate servo needs to present or not.

-
source

pub fn paint(&self, servo: &mut Servo<GLWindow>)

Paint offscreen framebuffer to Winit window.

-
source

pub fn request_redraw(&self)

Queues a Winit WindowEvent::RedrawRequested event to be emitted that aligns with the windowing system drawing loop.

-
source

pub fn is_animating(&self) -> bool

Check if WebView (GLWindow) is animating.

-
source

pub fn resize( +

source

pub fn paint(&self, servo: &mut Servo<GLWindow>)

Paint offscreen framebuffer to Winit window.

+
source

pub fn request_redraw(&self)

Queues a Winit WindowEvent::RedrawRequested event to be emitted that aligns with the windowing system drawing loop.

+
source

pub fn is_animating(&self) -> bool

Check if WebView (GLWindow) is animating.

+
source

pub fn resize( &self, size: Size2D<i32, DevicePixel>, events: &mut Vec<EmbedderEvent> )

Resize the rendering context and all web views.

-
source

pub fn set_cursor_icon(&self, cursor: Cursor)

Set cursor icon of the window.

-

Methods from Deref<Target = GLWindow>§

source

pub fn is_animating(&self) -> bool

Check if WebView (GLWindow) is animating.

-

Trait Implementations§

source§

impl Deref for Window

§

type Target = GLWindow

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl !Freeze for Window

§

impl !RefUnwindSafe for Window

§

impl !Send for Window

§

impl !Sync for Window

§

impl Unpin for Window

§

impl !UnwindSafe for Window

Blanket Implementations§

source§

impl<T> Any for T
where +

source

pub fn set_cursor_icon(&self, cursor: Cursor)

Set cursor icon of the window.

+

Methods from Deref<Target = GLWindow>§

source

pub fn is_animating(&self) -> bool

Check if WebView (GLWindow) is animating.

+

Trait Implementations§

source§

impl Deref for Window

§

type Target = GLWindow

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl !Freeze for Window

§

impl !RefUnwindSafe for Window

§

impl !Send for Window

§

impl !Sync for Window

§

impl Unpin for Window

§

impl !UnwindSafe for Window

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

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where