Bug 474336, updating max on progressmeter doesn't update display, r+sr=neil

This commit is contained in:
Neil Deakin 2009-01-20 12:46:52 -05:00
parent fb9e762696
commit f7f1f5e5ad
5 changed files with 62 additions and 1 deletions

View File

@ -0,0 +1,20 @@
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
>
<html:style>
#prog {
-moz-appearance: none;
background-color: blue;
}
#prog .progress-bar {
-moz-border-radius: 3px 3px;
background-color: red;
}
</html:style>
<progressmeter id="prog" value="50" max="200"/>
</window>

View File

@ -0,0 +1,34 @@
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
class="reftest-wait">
<html:style>
#prog {
-moz-appearance: none;
background-color: blue;
}
#prog .progress-bar {
-moz-border-radius: 3px 3px;
background-color: red;
}
</html:style>
<progressmeter id="prog" value="50"/>
<script>
<![CDATA[
function load(event) {
setTimeout(function() {
document.getElementById("prog").max = 200;
document.documentElement.removeAttribute("class");
}, 0);
}
window.addEventListener("load", load, false);
]]>
</script>
</window>

View File

@ -1029,3 +1029,4 @@ fails == 461512-1.html 461512-1-ref.html # Bug 461512
== 471356-1.html 471356-1-ref.html
== 471594-1.xhtml 471594-1-ref.html
== 472500-1.xul 472500-1-ref.xul
== 474336-1.xul 474336-1-ref.xul

View File

@ -122,7 +122,7 @@ nsProgressMeterFrame::AttributeChanged(PRInt32 aNameSpaceID,
}
// did the progress change?
if (nsGkAtoms::value == aAttribute) {
if (nsGkAtoms::value == aAttribute || nsGkAtoms::max == aAttribute) {
nsIFrame* barChild = GetFirstChild(nsnull);
if (!barChild) return NS_OK;
nsIFrame* remainderChild = barChild->GetNextSibling();

View File

@ -49,6 +49,12 @@ function doTests() {
n1.value = "Cat";
ise(n1.value, "17", "determined value set invalid");
n1.max = 200;
is(n1.max, 200, "max changed");
n1.value = 150;
n1.max = 120;
is(n1.value, 120, "max lowered below value");
n2.value = 2;
ise(n2.value, "0", "undetermined value set 2");
n2.value = -1;