Bug 334697 - Implement pie-chart throbber. r=vlad, ui-r=beltzner

This commit is contained in:
Dão Gottwald 2009-10-01 14:31:24 +02:00
parent d1b3e0e73d
commit ffb64b861a
13 changed files with 129 additions and 3 deletions

View File

@ -305,6 +305,10 @@
// count of open requests (should always be 0 or 1)
mRequestCount: 0,
destroy: function () {
this._cancelStalledTimer();
},
onProgressChange : function (aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress)
@ -314,6 +318,16 @@
if (this.mBlank)
return;
if (this.mTotalProgress) {
const STATES = 8;
let state = Math.ceil(STATES * this.mTotalProgress);
if (state != this.mTab.getAttribute("progress")) {
this.mTab.setAttribute("progress", state);
this.mTab.removeAttribute("stalled");
this._startStalledTimer();
}
}
if (this.mTabBrowser.mCurrentTab == this.mTab) {
for (let i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
let p = this.mTabBrowser.mProgressListeners[i];
@ -393,6 +407,7 @@
if (!this.mBlank) {
if (!(aStateFlags & nsIWebProgressListener.STATE_RESTORING)) {
this.mTab.setAttribute("busy", "true");
this._startStalledTimer();
this.mTabBrowser.updateIcon(this.mTab);
this.mTabBrowser.setTabTitleLoading(this.mTab);
}
@ -419,6 +434,9 @@
this.mBlank = false;
this.mTab.removeAttribute("busy");
this.mTab.removeAttribute("progress");
this.mTab.removeAttribute("stalled");
this._cancelStalledTimer();
this.mTabBrowser.updateIcon(this.mTab);
var location = aRequest.QueryInterface(nsIChannel).URI;
@ -613,6 +631,20 @@
aIID.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
},
_startStalledTimer: function () {
this._cancelStalledTimer();
this._stalledTimer = setTimeout(function (self) {
self.mTab.setAttribute("stalled", "true");
}, 700, this);
},
_cancelStalledTimer: function () {
if (this._stalledTimer) {
clearTimeout(this._stalledTimer);
this._stalledTimer = 0;
}
}
});
]]>
@ -1496,6 +1528,7 @@
const filter = this.mTabFilters[aTab._tPos];
browser.webProgress.removeProgressListener(filter);
filter.removeProgressListener(this.mTabListeners[aTab._tPos]);
this.mTabListeners[aTab._tPos].destroy();
// Remove our title change and blocking listeners
browser.removeEventListener("DOMTitleChanged", this.onTitleChanged, true);
@ -2736,6 +2769,7 @@
this.getBrowserAtIndex(i).webProgress.removeProgressListener(this.mTabFilters[i]);
this.mTabFilters[i].removeProgressListener(this.mTabListeners[i]);
this.mTabFilters[i] = null;
this.mTabListeners[i].destroy();
this.mTabListeners[i] = null;
this.getBrowserAtIndex(i).removeEventListener("DOMTitleChanged", this.onTitleChanged, true);
}

View File

@ -1127,7 +1127,35 @@ tabpanels {
}
.tabbrowser-tab[busy] > .tab-icon-image {
list-style-image: url("chrome://global/skin/icons/loading_16.png") !important;
list-style-image: url("chrome://browser/skin/tabbrowser/progress.png") !important;
-moz-image-region: rect(0, 16px, 16px, 0);
}
.tabbrowser-tab[busy][stalled] > .tab-icon-image {
list-style-image: url("chrome://browser/skin/tabbrowser/progress-pulsing.png") !important;
}
.tabbrowser-tab[busy][progress="1"] > .tab-icon-image {
-moz-image-region: rect(0, 32px, 16px, 16px);
}
.tabbrowser-tab[busy][progress="2"] > .tab-icon-image {
-moz-image-region: rect(0, 48px, 16px, 32px);
}
.tabbrowser-tab[busy][progress="3"] > .tab-icon-image {
-moz-image-region: rect(0, 64px, 16px, 48px);
}
.tabbrowser-tab[busy][progress="4"] > .tab-icon-image {
-moz-image-region: rect(0, 80px, 16px, 64px);
}
.tabbrowser-tab[busy][progress="5"] > .tab-icon-image {
-moz-image-region: rect(0, 96px, 16px, 80px);
}
.tabbrowser-tab[busy][progress="6"] > .tab-icon-image {
-moz-image-region: rect(0, 112px, 16px, 96px);
}
.tabbrowser-tab[busy][progress="7"] > .tab-icon-image {
-moz-image-region: rect(0, 128px, 16px, 112px);
}
.tabbrowser-tab[busy][progress="8"] > .tab-icon-image {
-moz-image-region: rect(0, 144px, 16px, 128px);
}
.tabs-bottom {

View File

@ -60,4 +60,6 @@ browser.jar:
* skin/classic/browser/preferences/preferences.css (preferences/preferences.css)
skin/classic/browser/preferences/applications.css (preferences/applications.css)
skin/classic/browser/tabbrowser/alltabs.png (tabbrowser/alltabs.png)
skin/classic/browser/tabbrowser/progress.png (tabbrowser/progress.png)
skin/classic/browser/tabbrowser/progress-pulsing.png (tabbrowser/progress-pulsing.png)
skin/classic/browser/tabbrowser/tabDragIndicator.png (tabbrowser/tabDragIndicator.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -1477,7 +1477,35 @@ tabbrowser > tabbox {
}
.tabbrowser-tab[busy] > .tab-icon-image {
list-style-image: url("chrome://global/skin/icons/loading_16.png") !important;
list-style-image: url("chrome://browser/skin/tabbrowser/progress.png") !important;
-moz-image-region: rect(0, 16px, 16px, 0);
}
.tabbrowser-tab[busy][stalled] > .tab-icon-image {
list-style-image: url("chrome://browser/skin/tabbrowser/progress-pulsing.png") !important;
}
.tabbrowser-tab[busy][progress="1"] > .tab-icon-image {
-moz-image-region: rect(0, 32px, 16px, 16px);
}
.tabbrowser-tab[busy][progress="2"] > .tab-icon-image {
-moz-image-region: rect(0, 48px, 16px, 32px);
}
.tabbrowser-tab[busy][progress="3"] > .tab-icon-image {
-moz-image-region: rect(0, 64px, 16px, 48px);
}
.tabbrowser-tab[busy][progress="4"] > .tab-icon-image {
-moz-image-region: rect(0, 80px, 16px, 64px);
}
.tabbrowser-tab[busy][progress="5"] > .tab-icon-image {
-moz-image-region: rect(0, 96px, 16px, 80px);
}
.tabbrowser-tab[busy][progress="6"] > .tab-icon-image {
-moz-image-region: rect(0, 112px, 16px, 96px);
}
.tabbrowser-tab[busy][progress="7"] > .tab-icon-image {
-moz-image-region: rect(0, 128px, 16px, 112px);
}
.tabbrowser-tab[busy][progress="8"] > .tab-icon-image {
-moz-image-region: rect(0, 144px, 16px, 128px);
}
.tabbrowser-tab:not(:hover):not([selected="true"]) > .tab-icon-image {

View File

@ -101,6 +101,8 @@ browser.jar:
skin/classic/browser/tabbrowser/alltabs-box-bkgnd-icon.png (tabbrowser/alltabs-box-bkgnd-icon.png)
skin/classic/browser/tabbrowser/alltabs-box-overflow-bkgnd-animate.png (tabbrowser/alltabs-box-overflow-bkgnd-animate.png)
skin/classic/browser/tabbrowser/newtab.png (tabbrowser/newtab.png)
skin/classic/browser/tabbrowser/progress.png (tabbrowser/progress.png)
skin/classic/browser/tabbrowser/progress-pulsing.png (tabbrowser/progress-pulsing.png)
skin/classic/browser/tabbrowser/tab-arrow-left.png (tabbrowser/tab-arrow-left.png)
skin/classic/browser/tabbrowser/tab-arrow-right.png (tabbrowser/tab-arrow-right.png)
skin/classic/browser/tabbrowser/tabbrowser-tabs-bkgnd.png (tabbrowser/tabbrowser-tabs-bkgnd.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -1201,7 +1201,35 @@ statusbarpanel#statusbar-display {
}
.tabbrowser-tab[busy] > .tab-icon-image {
list-style-image: url("chrome://global/skin/icons/loading_16.png") !important;
list-style-image: url("chrome://browser/skin/tabbrowser/progress.png") !important;
-moz-image-region: rect(0, 16px, 16px, 0);
}
.tabbrowser-tab[busy][stalled] > .tab-icon-image {
list-style-image: url("chrome://browser/skin/tabbrowser/progress-pulsing.png") !important;
}
.tabbrowser-tab[busy][progress="1"] > .tab-icon-image {
-moz-image-region: rect(0, 32px, 16px, 16px);
}
.tabbrowser-tab[busy][progress="2"] > .tab-icon-image {
-moz-image-region: rect(0, 48px, 16px, 32px);
}
.tabbrowser-tab[busy][progress="3"] > .tab-icon-image {
-moz-image-region: rect(0, 64px, 16px, 48px);
}
.tabbrowser-tab[busy][progress="4"] > .tab-icon-image {
-moz-image-region: rect(0, 80px, 16px, 64px);
}
.tabbrowser-tab[busy][progress="5"] > .tab-icon-image {
-moz-image-region: rect(0, 96px, 16px, 80px);
}
.tabbrowser-tab[busy][progress="6"] > .tab-icon-image {
-moz-image-region: rect(0, 112px, 16px, 96px);
}
.tabbrowser-tab[busy][progress="7"] > .tab-icon-image {
-moz-image-region: rect(0, 128px, 16px, 112px);
}
.tabbrowser-tab[busy][progress="8"] > .tab-icon-image {
-moz-image-region: rect(0, 144px, 16px, 128px);
}
.tab-icon-image {

View File

@ -83,6 +83,8 @@ browser.jar:
skin/classic/browser/tabbrowser/alltabs-box-overflow-end-bkgnd-animate.png (tabbrowser/alltabs-box-overflow-end-bkgnd-animate.png)
skin/classic/browser/tabbrowser/alltabs-box-overflow-start-bkgnd-animate.png (tabbrowser/alltabs-box-overflow-start-bkgnd-animate.png)
skin/classic/browser/tabbrowser/newtab.png (tabbrowser/newtab.png)
skin/classic/browser/tabbrowser/progress.png (tabbrowser/progress.png)
skin/classic/browser/tabbrowser/progress-pulsing.png (tabbrowser/progress-pulsing.png)
skin/classic/browser/tabbrowser/tab-arrow-left.png (tabbrowser/tab-arrow-left.png)
skin/classic/browser/tabbrowser/tab-arrow-right.png (tabbrowser/tab-arrow-right.png)
skin/classic/browser/tabbrowser/tabbrowser-tabs-bkgnd.png (tabbrowser/tabbrowser-tabs-bkgnd.png)
@ -177,6 +179,8 @@ browser.jar:
skin/classic/aero/browser/tabbrowser/alltabs-box-overflow-end-bkgnd-animate.png (tabbrowser/alltabs-box-overflow-end-bkgnd-animate.png)
skin/classic/aero/browser/tabbrowser/alltabs-box-overflow-start-bkgnd-animate.png (tabbrowser/alltabs-box-overflow-start-bkgnd-animate.png)
skin/classic/aero/browser/tabbrowser/newtab.png (tabbrowser/newtab-aero.png)
skin/classic/aero/browser/tabbrowser/progress.png (tabbrowser/progress.png)
skin/classic/aero/browser/tabbrowser/progress-pulsing.png (tabbrowser/progress-pulsing.png)
skin/classic/aero/browser/tabbrowser/tab-arrow-left.png (tabbrowser/tab-arrow-left-aero.png)
skin/classic/aero/browser/tabbrowser/tab-arrow-right.png (tabbrowser/tab-arrow-right-aero.png)
skin/classic/aero/browser/tabbrowser/tabbrowser-tabs-bkgnd.png (tabbrowser/tabbrowser-tabs-bkgnd.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB