⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

BrowserWindow

Struct BrowserWindow 

Source
pub struct BrowserWindow {
    pub address_bar: String,
    pub current_url: String,
    pub document: Option<Document>,
    pub stylesheet: Option<Stylesheet>,
    pub layout_root: Option<LayoutBox>,
    pub display_list: Option<DisplayList>,
    pub scroll_y: i32,
    pub viewport_width: i32,
    pub viewport_height: i32,
    pub back_history: Vec<String>,
    pub forward_history: Vec<String>,
    /* private fields */
}
Expand description

Browser window state

Fields§

§address_bar: String

Text in the address bar

§current_url: String

Currently loaded URL

§document: Option<Document>

Parsed DOM document

§stylesheet: Option<Stylesheet>

Author stylesheet

§layout_root: Option<LayoutBox>

Layout tree root

§display_list: Option<DisplayList>

Current display list

§scroll_y: i32

Vertical scroll offset (pixels)

§viewport_width: i32

Viewport width (pixels)

§viewport_height: i32

Viewport height (pixels)

§back_history: Vec<String>

Back navigation history

§forward_history: Vec<String>

Forward navigation history

Implementations§

Source§

impl BrowserWindow

Source

pub fn new(width: i32, height: i32) -> Self

Create a new browser window with given viewport dimensions

Source

pub fn navigate(&mut self, url: &str)

Navigate to a URL string

Source

pub fn load_html(&mut self, html: &str)

Load raw HTML content directly

Source

pub fn load_html_with_css(&mut self, html: &str, css: &str)

Load HTML with a separate CSS string

Source

pub fn render(&mut self) -> &[u32]

Render the current page to a pixel buffer

Source

pub fn handle_scroll(&mut self, delta_y: i32)

Handle scrolling

Source

pub fn handle_resize(&mut self, width: i32, height: i32)

Handle viewport resize

Source

pub fn go_back(&mut self) -> bool

Go back in history

Source

pub fn go_forward(&mut self) -> bool

Go forward in history

Source

pub fn reload(&mut self)

Reload the current page

Source

pub fn set_url(&mut self, url: &str)

Set the address bar text

Source

pub fn get_url(&self) -> &str

Get the current URL

Source

pub fn get_address_bar(&self) -> &str

Get the address bar text

Source

pub fn address_bar_input(&mut self, ch: char)

Handle text input in address bar

Source

pub fn address_bar_backspace(&mut self)

Handle backspace in address bar

Source

pub fn address_bar_submit(&mut self)

Submit the address bar (navigate to typed URL)

Source

pub fn can_go_back(&self) -> bool

Check if we can go back

Source

pub fn can_go_forward(&self) -> bool

Check if we can go forward

Source

pub fn get_title(&self) -> String

Get the page title (from element)</p> </div></details><details class="toggle method-toggle" open><summary><section id="method.node_count" class="method"><a class="src rightside" href="../../../src/veridian_kernel/browser/window.rs.html#286-288">Source</a><h4 class="code-header">pub fn <a href="#method.node_count" class="fn">node_count</a>(&self) -> usize</h4></section></summary><div class="docblock"><p>Get the document node count</p> </div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-BrowserWindow" class="impl"><a class="src rightside" href="../../../src/veridian_kernel/browser/window.rs.html#53-57">Source</a><a href="#impl-Default-for-BrowserWindow" class="anchor">§</a><h3 class="code-header">impl Default for <a class="struct" href="struct.BrowserWindow.html" title="struct veridian_kernel::browser::window::BrowserWindow">BrowserWindow</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="src rightside" href="../../../src/veridian_kernel/browser/window.rs.html#54-56">Source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a class="fn">default</a>() -> Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a>Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-BrowserWindow" class="impl"><a href="#impl-Freeze-for-BrowserWindow" class="anchor">§</a><h3 class="code-header">impl Freeze for <a class="struct" href="struct.BrowserWindow.html" title="struct veridian_kernel::browser::window::BrowserWindow">BrowserWindow</a></h3></section><section id="impl-RefUnwindSafe-for-BrowserWindow" class="impl"><a href="#impl-RefUnwindSafe-for-BrowserWindow" class="anchor">§</a><h3 class="code-header">impl RefUnwindSafe for <a class="struct" href="struct.BrowserWindow.html" title="struct veridian_kernel::browser::window::BrowserWindow">BrowserWindow</a></h3></section><section id="impl-Send-for-BrowserWindow" class="impl"><a href="#impl-Send-for-BrowserWindow" class="anchor">§</a><h3 class="code-header">impl Send for <a class="struct" href="struct.BrowserWindow.html" title="struct veridian_kernel::browser::window::BrowserWindow">BrowserWindow</a></h3></section><section id="impl-Sync-for-BrowserWindow" class="impl"><a href="#impl-Sync-for-BrowserWindow" class="anchor">§</a><h3 class="code-header">impl Sync for <a class="struct" href="struct.BrowserWindow.html" title="struct veridian_kernel::browser::window::BrowserWindow">BrowserWindow</a></h3></section><section id="impl-Unpin-for-BrowserWindow" class="impl"><a href="#impl-Unpin-for-BrowserWindow" class="anchor">§</a><h3 class="code-header">impl Unpin for <a class="struct" href="struct.BrowserWindow.html" title="struct veridian_kernel::browser::window::BrowserWindow">BrowserWindow</a></h3></section><section id="impl-UnwindSafe-for-BrowserWindow" class="impl"><a href="#impl-UnwindSafe-for-BrowserWindow" class="anchor">§</a><h3 class="code-header">impl UnwindSafe for <a class="struct" href="struct.BrowserWindow.html" title="struct veridian_kernel::browser::window::BrowserWindow">BrowserWindow</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> Any for T<div class="where">where T: 'static + ?Sized,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a class="fn">type_id</a>(&self) -> TypeId</h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> Borrow<T> for T<div class="where">where T: ?Sized,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a class="fn">borrow</a>(&self) -> &T</h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> BorrowMut<T> for T<div class="where">where T: ?Sized,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a class="fn">borrow_mut</a>(&mut self) -> &mut T</h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> From<T> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a class="fn">from</a>(t: T) -> T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p> </div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> Into<U> for T<div class="where">where U: From<T>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a class="fn">into</a>(self) -> U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p> <p>That is, this conversion is whatever the implementation of <code>[From]<T> for U</code> chooses to do.</p> </div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> TryFrom<U> for T<div class="where">where U: Into<T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Error</a> = Infallible</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a class="fn">try_from</a>(value: U) -> Result<T, <T as TryFrom<U>>::Error></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> TryInto<U> for T<div class="where">where U: TryFrom<T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Error</a> = <U as TryFrom<T>>::Error</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a class="fn">try_into</a>(self) -> Result<U, <U as TryFrom<T>>::Error></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main><!-- Footer content for all documentation pages --> <footer class="veridian-footer"> <hr> <p> <strong>VeridianOS</strong> - A next-generation microkernel operating system<br> <a href="https://github.com/doublegate/VeridianOS">GitHub</a> | <a href="/docs/architecture/">Architecture Guide</a> | <a href="/docs/contributing/">Contributing</a> </p> </footer> </body></html>