Browse Source

implement progress fraction update

master
yggverse 2 months ago
parent
commit
2d160b5a49
  1. 12
      src/browser/main/tab/page.rs
  2. 4
      src/browser/main/tab/page/navigation.rs
  3. 3
      src/browser/main/tab/page/navigation/request.rs

12
src/browser/main/tab/page.rs

@ -388,8 +388,16 @@ impl Page {
pub fn update(&self) { pub fn update(&self) {
// Interpret status to progress fraction // Interpret status to progress fraction
// @TODO let progress_fraction = match self.meta.borrow().status {
self.navigation.update(); Some(Status::Prepare) => 0.25,
Some(Status::Connect) => 0.50,
Some(Status::Request) => 0.75,
Some(Status::Response) => 1.0,
_ => 0.0,
};
// Update components
self.navigation.update(progress_fraction);
// @TODO self.content.update(); // @TODO self.content.update();
} }

4
src/browser/main/tab/page/navigation.rs

@ -71,11 +71,11 @@ impl Navigation {
} }
// Actions // Actions
pub fn update(&self) { pub fn update(&self, progress_fraction: f64) {
self.base.update(self.request.uri()); self.base.update(self.request.uri());
self.history.update(); self.history.update();
self.reload.update(!self.request.is_empty()); self.reload.update(!self.request.is_empty());
self.request.update(); self.request.update(progress_fraction);
self.bookmark.update(); self.bookmark.update();
} }

3
src/browser/main/tab/page/navigation/request.rs

@ -41,7 +41,8 @@ impl Request {
} }
// Actions // Actions
pub fn update(&self) { pub fn update(&self, progress_fraction: f64) {
self.widget.set_progress_fraction(progress_fraction);
// @TODO animate progress fraction // @TODO animate progress fraction
} }

Loading…
Cancel
Save