Repository: servo/servo
File: ports/servoshell/desktop/minibrowser.rs (Rust)

Code before:
use winit::event_loop::ActiveEventLoop;
use winit::window::Window;

use super::app_state::RunningAppState;
use super::events_loop::EventLoopProxy;
use super::geometry::winit_position_to_euclid_point;
use super::headed_window::Window as ServoWindow;
use crate::desktop::headed_window::INITIAL_WINDOW_TITLE;
use crate::desktop::window_trait::WindowPortsMethods;
use crate::prefs::{EXPERIMENTAL_PREFS, ServoShellPreferences};
use crate::running_app_state::RunningAppStateTrait;

pub struct Minibrowser {
    rendering_context: Rc<OffscreenRenderingContext>,
    context: EguiGlow,
    event_queue: Vec<MinibrowserEvent>,
    toolbar_height: Length<f32, DeviceIndependentPixel>,

    last_update: Instant,
    last_mouse_position: Option<Point2D<f32, DeviceIndependentPixel>>,
    location: String,

    /// Whether the location has been edited by the user without clicking Go.
    location_dirty: bool,

    /// The [`LoadStatus`] of the active `WebView.
    load_status: LoadStatus,

    /// The text to display in the status bar on the bottom of the window.
    status_text: Option<String>,

    /// Whether or not the current `WebView` can navigate backward.
    can_go_back: bool,

    /// Whether or not the current `WebView` can navigate forward.
    can_go_forward: bool,

    /// Handle to the GPU texture of the favicon.
    ///
    /// These need to be cached across egui draw calls.
    favicon_textures: HashMap<WebViewId, (egui::TextureHandle, egui::load::SizedTexture)>,

    /// Whether the user has enabled experimental preferences.
    experimental_prefs_enabled: bool,
}

pub enum MinibrowserEvent {
    /// Go button clicked.
    Go(String),
    Back,
    Forward,

Review comment (suggestion):
```suggestion
    /// The [`LoadStatus`] of the active `WebView`.
```

Code after:
use winit::event_loop::ActiveEventLoop;
use winit::window::Window;

use super::app_state::RunningAppState;
use super::events_loop::EventLoopProxy;
use super::geometry::winit_position_to_euclid_point;
use super::headed_window::Window as ServoWindow;
use crate::desktop::headed_window::INITIAL_WINDOW_TITLE;
use crate::desktop::window_trait::WindowPortsMethods;
use crate::prefs::{EXPERIMENTAL_PREFS, ServoShellPreferences};
use crate::running_app_state::RunningAppStateTrait;

pub struct Minibrowser {
    rendering_context: Rc<OffscreenRenderingContext>,
    context: EguiGlow,
    event_queue: Vec<MinibrowserEvent>,
    toolbar_height: Length<f32, DeviceIndependentPixel>,

    last_update: Instant,
    last_mouse_position: Option<Point2D<f32, DeviceIndependentPixel>>,
    location: String,

    /// Whether the location has been edited by the user without clicking Go.
    location_dirty: bool,

    /// The [`LoadStatus`] of the active `WebView`.
    load_status: LoadStatus,

    /// The text to display in the status bar on the bottom of the window.
    status_text: Option<String>,

    /// Whether or not the current `WebView` can navigate backward.
    can_go_back: bool,

    /// Whether or not the current `WebView` can navigate forward.
    can_go_forward: bool,

    /// Handle to the GPU texture of the favicon.
    ///
    /// These need to be cached across egui draw calls.
    favicon_textures: HashMap<WebViewId, (egui::TextureHandle, egui::load::SizedTexture)>,

    /// Whether the user has enabled experimental preferences.
    experimental_prefs_enabled: bool,
}

pub enum MinibrowserEvent {
    /// Go button clicked.
    Go(String),
    Back,
    Forward,