Bug 1301384 - Part 2 - Unify Progressbar across different OSs for download panels. r=dao
MozReview-Commit-ID: 8Nyiil9LSUr
--- a/browser/components/downloads/DownloadsViewUI.jsm
+++ b/browser/components/downloads/DownloadsViewUI.jsm
@@ -150,16 +150,23 @@ this.DownloadsViewUI.DownloadElementShel
// The progress bar is only displayed for in-progress downloads.
if (this.download.hasProgress) {
this.element.setAttribute("progressmode", "normal");
this.element.setAttribute("progress", this.download.progress);
} else {
this.element.setAttribute("progressmode", "undetermined");
}
+ if (this.download.stopped && this.download.canceled &&
+ this.download.hasPartialData) {
+ this.element.setAttribute("progresspaused", "true");
+ } else {
+ this.element.removeAttribute("progresspaused");
+ }
+
// Dispatch the ValueChange event for accessibility, if possible.
if (this._progressElement) {
let event = this.element.ownerDocument.createEvent("Events");
event.initEvent("ValueChange", true, true);
this._progressElement.dispatchEvent(event);
}
let status = this.statusTextAndTip;
--- a/browser/components/downloads/content/download.xml
+++ b/browser/components/downloads/content/download.xml
@@ -40,17 +40,17 @@
<xul:description class="downloadTarget"
crop="center"
style="min-width: &downloadsSummary.minWidth2;"
xbl:inherits="value=displayName,tooltiptext=displayName"/>
<xul:progressmeter anonid="progressmeter"
class="downloadProgress"
min="0"
max="100"
- xbl:inherits="mode=progressmode,value=progress"/>
+ xbl:inherits="mode=progressmode,value=progress,paused=progresspaused"/>
<xul:description class="downloadDetails"
crop="end"
xbl:inherits="value=status,tooltiptext=statusTip"/>
</xul:vbox>
</xul:hbox>
<xul:toolbarseparator />
<xul:stack class="downloadButtonArea">
<xul:button class="downloadButton downloadCancel downloadIconCancel"
--- a/browser/themes/osx/downloads/allDownloadsViewOverlay.css
+++ b/browser/themes/osx/downloads/allDownloadsViewOverlay.css
@@ -4,8 +4,16 @@
%include ../../shared/downloads/allDownloadsViewOverlay.inc.css
/*** List items ***/
:root {
--downloads-item-height: 6em;
}
+
+.downloadProgress > .progress-bar {
+ background-color: #3c9af8;
+}
+
+.downloadProgress[paused="true"] > .progress-bar {
+ background-color: #a6a6a6;
+}
--- a/browser/themes/osx/downloads/downloads.css
+++ b/browser/themes/osx/downloads/downloads.css
@@ -30,14 +30,22 @@
outline: 2px -moz-mac-focusring solid;
outline-offset: -2px;
}
@item@[verdict="Malware"] {
color: #aa1b08;
}
+.downloadProgress > .progress-bar {
+ background-color: #3c9af8;
+}
+
+.downloadProgress[paused="true"] > .progress-bar {
+ background-color: #a6a6a6;
+}
+
/*** Highlighted list items ***/
@keyfocus@ @itemFocused@ {
outline: 2px -moz-mac-focusring solid;
outline-offset: -2px;
}
--- a/browser/themes/shared/downloads/allDownloadsViewOverlay.inc.css
+++ b/browser/themes/shared/downloads/allDownloadsViewOverlay.inc.css
@@ -139,8 +139,11 @@
%else
list-style-image: url("chrome://browser/skin/panel-icons.svg#folder");
%endif
}
.downloadIconRetry > .button-box > .button-icon {
list-style-image: url("chrome://browser/skin/panel-icons.svg#retry");
}
+
+/*** Progressmeter ***/
+%include progressmeter.inc.css
--- a/browser/themes/shared/downloads/downloads.inc.css
+++ b/browser/themes/shared/downloads/downloads.inc.css
@@ -381,8 +381,11 @@ richlistitem[type="download"] > .downloa
}
#downloadsPanel-blockedSubview-title,
#downloadsPanel-blockedSubview-details1,
#downloadsPanel-blockedSubview-details2 {
-moz-margin-start: 64px;
-moz-margin-end: 16px;
}
+
+/*** Progressmeter ***/
+%include progressmeter.inc.css
new file mode 100644
--- /dev/null
+++ b/browser/themes/shared/downloads/progressmeter.inc.css
@@ -0,0 +1,72 @@
+/*** Common-styled progressmeter ***/
+.downloadProgress {
+ height: 8px;
+ border-radius: 1px;
+ margin-top: 2px;
+ margin-bottom: 2px;
+ margin-inline-start: 6px;
+ margin-inline-end: 12px;
+
+ /* for overriding rules in progressmeter.css */
+ -moz-appearance: none;
+ border-style: none;
+ background-color: transparent;
+ min-width: initial;
+ min-height: initial;
+}
+
+.downloadProgress[mode="undetermined"] {
+ /* for overriding rules on global.css in Linux. */
+ -moz-binding: url("chrome://global/content/bindings/progressmeter.xml#progressmeter");
+}
+
+.downloadProgress > .progress-bar {
+ background-color: Highlight;
+
+ /* for overriding rules in progressmeter.css */
+ -moz-appearance: none;
+}
+
+.downloadProgress[paused="true"] > .progress-bar {
+ background-color: GrayText;
+}
+
+.downloadProgress[mode="undetermined"] > .progress-bar {
+ /* Make a white reflecting animation.
+ Create a gradient with 2 identical pattern, and enlarge the size to 200%.
+ This allows us to animate background-position with percentage. */
+ background-image: linear-gradient(90deg, transparent 0%,
+ rgba(255,255,255,0.5) 25%,
+ transparent 50%,
+ rgba(255,255,255,0.5) 75%,
+ transparent 100%);
+ background-blend-mode: lighten;
+ background-size: 200% 100%;
+ animation: downloadProgressSlideX 1.5s linear infinite;
+}
+
+.downloadProgress > .progress-remainder {
+ border: solid ButtonShadow;
+ border-block-start-width: 1px;
+ border-block-end-width: 1px;
+ border-inline-start-width: 0;
+ border-inline-end-width: 1px;
+ background-color: ButtonFace;
+}
+
+.downloadProgress[value="0"] > .progress-remainder {
+ border-width: 1px;
+}
+
+.downloadProgress > .progress-remainder[mode="undetermined"] {
+ border: none;
+}
+
+@keyframes downloadProgressSlideX {
+ 0% {
+ background-position: 0 0;
+ }
+ 100% {
+ background-position: -100% 0;
+ }
+}
--- a/browser/themes/windows/downloads/allDownloadsViewOverlay.css
+++ b/browser/themes/windows/downloads/allDownloadsViewOverlay.css
@@ -5,16 +5,22 @@
%include ../../shared/downloads/allDownloadsViewOverlay.inc.css
/*** List items ***/
:root {
--downloads-item-height: 6em;
}
+@media (-moz-windows-default-theme) {
+ .downloadProgress > .progress-bar {
+ background-color: #3c9af8;
+ }
+}
+
/*** Highlighted list items ***/
@media not all and (-moz-os-version: windows-xp) {
@media (-moz-windows-default-theme) {
/*
-moz-appearance: menuitem is almost right, but the hover effect is not
transparent and is lighter than desired.
--- a/browser/themes/windows/downloads/downloads.css
+++ b/browser/themes/windows/downloads/downloads.css
@@ -33,16 +33,26 @@
@keyfocus@ .downloadButton:focus > .button-box {
border: 1px dotted ThreeDDarkShadow;
}
@media (-moz-windows-default-theme) {
@item@[verdict="Malware"] {
color: #aa1b08;
}
+
+ /* Use unified color for the progressbar on default theme */
+ .downloadProgress > .progress-bar {
+ background-color: #3c9af8;
+ }
+
+ .downloadProgress[paused="true"] > .progress-bar {
+ background-color: #a6a6a6;
+ }
+
}
/*** Highlighted list items ***/
@keyfocus@ @itemFocused@ {
outline: 1px -moz-dialogtext dotted;
outline-offset: -1px;
}