aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-tab.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-08-08 05:53:39 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-08-08 05:53:39 +0800
commitd1e77fff25e5a65b15d975f76278db31c0af418f (patch)
tree44bbf77e964e0b1b0058ac67a5d082e57c5ada64 /src/ephy-tab.c
parent164d34f58d39f7b267b570ad3e467fff0bf49eb7 (diff)
downloadgsoc2013-epiphany-d1e77fff25e5a65b15d975f76278db31c0af418f.tar
gsoc2013-epiphany-d1e77fff25e5a65b15d975f76278db31c0af418f.tar.gz
gsoc2013-epiphany-d1e77fff25e5a65b15d975f76278db31c0af418f.tar.bz2
gsoc2013-epiphany-d1e77fff25e5a65b15d975f76278db31c0af418f.tar.lz
gsoc2013-epiphany-d1e77fff25e5a65b15d975f76278db31c0af418f.tar.xz
gsoc2013-epiphany-d1e77fff25e5a65b15d975f76278db31c0af418f.tar.zst
gsoc2013-epiphany-d1e77fff25e5a65b15d975f76278db31c0af418f.zip
Clamp the values to 0/100, mozilla sometimes report more done requests
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.
Diffstat (limited to 'src/ephy-tab.c')
-rw-r--r--src/ephy-tab.c16
1 files changed, 12 insertions, 4 deletions
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 *