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: StringText in the address bar
current_url: StringCurrently 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: i32Vertical scroll offset (pixels)
viewport_width: i32Viewport width (pixels)
viewport_height: i32Viewport height (pixels)
back_history: Vec<String>Back navigation history
forward_history: Vec<String>Forward navigation history
Implementations§
Source§impl BrowserWindow
impl BrowserWindow
Sourcepub fn new(width: i32, height: i32) -> Self
pub fn new(width: i32, height: i32) -> Self
Create a new browser window with given viewport dimensions
Navigate to a URL string
Sourcepub fn load_html_with_css(&mut self, html: &str, css: &str)
pub fn load_html_with_css(&mut self, html: &str, css: &str)
Load HTML with a separate CSS string
Sourcepub fn handle_scroll(&mut self, delta_y: i32)
pub fn handle_scroll(&mut self, delta_y: i32)
Handle scrolling
Sourcepub fn handle_resize(&mut self, width: i32, height: i32)
pub fn handle_resize(&mut self, width: i32, height: i32)
Handle viewport resize
Sourcepub fn go_forward(&mut self) -> bool
pub fn go_forward(&mut self) -> bool
Go forward in history
Sourcepub fn get_address_bar(&self) -> &str
pub fn get_address_bar(&self) -> &str
Get the address bar text
Sourcepub fn address_bar_input(&mut self, ch: char)
pub fn address_bar_input(&mut self, ch: char)
Handle text input in address bar
Sourcepub fn address_bar_backspace(&mut self)
pub fn address_bar_backspace(&mut self)
Handle backspace in address bar
Sourcepub fn address_bar_submit(&mut self)
pub fn address_bar_submit(&mut self)
Submit the address bar (navigate to typed URL)
Sourcepub fn can_go_back(&self) -> bool
pub fn can_go_back(&self) -> bool
Check if we can go back
Sourcepub fn can_go_forward(&self) -> bool
pub fn can_go_forward(&self) -> bool
Check if we can go forward
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Get the document node count