Skip to main content

WebBrowser

Struct WebBrowser 

Source
pub struct WebBrowser {
    pub engine: WebEngine,
    pub address_bar_focused: bool,
    pub address_box: TextBox,
    pub active_tab_idx: usize,
    tabs: Vec<TabSlot>,
    last_discard_check_ms: u64,
    pub omnibox: OmniboxEngine,
    pub omnibox_items: Vec<OmniboxItem>,
    pub selected_suggestion: Option<usize>,
}

Fields§

§engine: WebEngine

アクティブタブのライブエンジン。tabs[active_tab_idx].engine は None。

§address_bar_focused: bool§address_box: TextBox§active_tab_idx: usize§tabs: Vec<TabSlot>§last_discard_check_ms: u64

最後に memory_checkpoint で量を確かめた時刻(ms)。確かめは 250ms に 1 回に間引く。

§omnibox: OmniboxEngine§omnibox_items: Vec<OmniboxItem>§selected_suggestion: Option<usize>

Implementations§

Source§

impl WebBrowser

Source

pub fn execute_search_or_navigate(&mut self, text: &str)

Source

pub fn top_offset(&self) -> i32

コンテンツ描画の開始 Y 座標 (コントロールバーの直下)。 描画・クリック判定・レイアウトすべてがこの値を共通参照する。

Source

fn sync_active_title(&mut self)

アクティブエンジンのタイトルを現タブスロットに同期する(タブバー表示用)。

Source

fn activate(&mut self, idx: usize)

アクティブタブを idx へ切り替える。ライブエンジンを現タブスロットへ戻し、 切替先スロットのエンジンを mem::swap でライブへ取り出す(クローン・再取得なし)。

Source§

impl WebBrowser

Source

fn blank_engine(&self) -> WebEngine

空の新しいエンジン(今のウィンドウの大きさ)。

Source

fn reload_discarded(&mut self, idx: usize)

破棄済みのタブ idx へ切り替え、その URL を読み直す(2026-11-19)。 今のライブエンジンは元のスロットへ戻す。読み込みの前に、足りなければ別の裏のタブを先に破棄する。

Source

pub fn discard_if_needed(&mut self, before_load: bool)

メモリが足りなければ、一番長く使われていない裏のタブを 1 つ破棄する(2026-11-19。判定は kernel/tab_discard.rs)。

呼ぶ所は、アプリのスレッドの 1 周の頭・新しいタブを作る前・ページの読み込みを始める前(before_load)。 レイアウトや JS の途中では呼ばない(ライブのエンジンには触れず、スロットの engine だけを捨てる)。

Source§

impl WebBrowser

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl App for WebBrowser

Source§

fn draw( &mut self, screen: &Screen, win_x: u32, win_y: u32, win_w: u32, win_h: u32, )

【2026-08-01計測】再描画要求の内訳カウンタ。

Source§

fn memory_checkpoint(&mut self)

アプリのスレッドの 1 周の頭(錠もレイアウトも JS も動いていない所)で呼ばれる(2026-11-19)。 250ms に 1 回、ヒープの量を見て、足りなければ裏のタブを 1 つ破棄する。

Source§

fn open_url_in_new_tab(&mut self, url: &str)

2 度目の起動の URL を新しいタブで開く(2026-11-18)。タブが上限(16)なら、今のタブで開く。

Source§

fn name(&self) -> &str

Source§

fn instance_info(&self) -> String

インスタンス特有の情報(ファイル名やURLなど)を返す
Source§

fn live_title(&self) -> Option<String>

タブタイトル一覧。空を返すとタブなし扱い(非推奨: 全アプリは最低1タブ持つ) タイトルバーに出す文字(None なら作成時の Window.title)。ページで変わるアプリが使う。
Source§

fn on_resize(&mut self, width: u32, height: u32)

ウィンドウサイズ変更の通知
Source§

fn needs_timer_redraw(&self) -> bool

Source§

fn on_mouse( &mut self, local_x: i32, local_y: i32, btn_left: bool, btn_right: bool, wheel: i32, )

マウスイベント。ローカル座標とホイール移動量が渡される。
Source§

fn on_key(&mut self, keycode: u8, pressed: bool, ascii: Option<char>)

キーボードイベント
Source§

fn tabs(&self) -> Vec<String>

Source§

fn active_tab(&self) -> usize

Source§

fn close_tab(&mut self, idx: usize) -> bool

タブを閉じる。最後のタブが閉じられウィンドウも閉じる場合は true を返す。
Source§

fn switch_tab(&mut self, idx: usize)

Source§

fn add_tab(&mut self)

Source§

fn get_dom_value(&self, id: &str) -> Option<String>

Source§

fn set_dom_value(&mut self, id: &str, val: &str)

Source§

fn get_dom_content(&self, id: &str) -> Option<String>

Source§

fn set_dom_content(&mut self, id: &str, val: &str)

Source§

fn is_proxy(&self) -> bool

ProxyApp であるかどうか
Source§

fn get_shared_buffer(&self) -> Option<Arc<Mutex<Vec<u32>>>>

共有されるバックバッファを返す
Source§

fn open_file_dialog(&mut self)

Alt+O: ファイルオープンダイアログを開く(未実装アプリはno-op)
Source§

fn save_file(&mut self)

Alt+S: ファイルを保存する(未実装アプリはno-op)
Source§

fn tab_thread_fn(&self) -> Option<fn()>

このアプリの各タブ用バックグラウンドスレッド関数を返す。 Some(fn) を返したアプリはタブ追加時にスケジューラでスレッドを起動する。 スレッド関数は引数なしの fn() で、グローバル Mutex 経由でアプリ状態と通信する。
Source§

fn get_buffer_updated_flag(&self) -> Option<Arc<AtomicBool>>

ProxyApp の shared_buffer が更新されたことを通知する AtomicBool を返す。 ProxyApp でない通常のアプリは None を返す(デフォルト実装)。 Core 0 の dirty 判定がこのフラグを読んで矩形を登録する。
Source§

fn is_stopped(&self) -> bool

アプリのスレッドがもう居ない(panic・メモリの使いすぎで止めた)か。ウィンドウは最後の画面のまま残る。 同じアプリを開き直すとき、WindowManager::add_window はこのウィンドウを使い回さず置き換える。
Source§

fn unresponsive_ms(&self) -> Option<u64>

アプリが応答していない時間(ms)。応答しているなら None(TODO R2 (a))。 ProxyApp はアプリのスレッドの 1 周の始まりが UNRESPONSIVE_MS 以上前なら返す。 メインループで描くアプリは、ウォッチドッグの Not Responding(watchdog::is_not_responding)で見る(Window::unresponsive)。
Source§

fn kill_tab(&mut self, _idx: usize) -> bool

タブを 1 つだけ止める(TODO R2 (d)、2026-11-18)。受け付けたら true。 ProxyApp は合図を立てるだけで、アプリのスレッドが、そのタブの JS を打ち切ってから 1 周の頭でタブを閉じる。
Source§

fn running_tab(&self) -> usize

アプリのスレッドが今動かしているタブ(TODO R2 (d))。ProxyApp では、利用者が応答しない間に 別のタブを選んでも(App::active_tab は選んだ先を返す)、アプリが実際に動かしているタブを返す。
Source§

fn tab_kill_pending(&self) -> Option<usize>

タブを止める合図を立てたが、まだ閉じていないタブ(TODO R2 (d))。
Source§

fn os_tick(&mut self)

メインループが毎周 1 回呼ぶ(TODO R4 (b)、2026-11-17)。ProxyApp はここで、錠が取れずに控えた入力・ タブの切り替えをアプリへ渡し直し、題名・タブの写しを取り直す。錠は待たない(try_lock)。
Source§

impl Default for WebBrowser

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.