diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/ephy-tab.c | 16 |
2 files changed, 20 insertions, 4 deletions
@@ -1,5 +1,13 @@ 2003-08-07 Marco Pesenti Gritti <marco@it.gnome.org> + * src/ephy-tab.c: (build_load_percent): + + Clamp the values to 0/100, mozilla sometimes report + more done requests than total requests, but their + progress widget clamp them. + +2003-08-07 Marco Pesenti Gritti <marco@it.gnome.org> + * embed/mozilla/mozilla-notifiers.cpp: Dont set font prefs in mozilla when they are unset in diff --git a/src/ephy-tab.c b/src/ephy-tab.c index a84c0ce4f..e9643c56f 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -597,16 +597,24 @@ ephy_tab_title_cb (EphyEmbed *embed, EphyTab *tab) } static int -build_load_percent (int bytes_loaded, int max_bytes_loaded) +build_load_percent (int requests_done, int requests_total) { - if (max_bytes_loaded > 0) + int percent; + + if (requests_total > 0) { - return (bytes_loaded * 100) / max_bytes_loaded; + percent = (requests_done * 100) / requests_total; + + /* Mozilla sometimes report more done requests than + total requests. Their progress widget clamp the value */ + percent = CLAMP (percent, 0, 100); } else { - return -1; + percent = -1; } + + return percent; } static char * |