Bug 474336, updating max on progressmeter doesn't update display, r+sr=neil
authorNeil Deakin <neil@mozilla.com>
Tue, 20 Jan 2009 12:46:52 -0500
changeset 23974 f706be55329ee8b87af69793c3d75a4fe1fe322b
parent 23973 e416d62b69a5565f7f39f5b0f96c457b62fa6e15
child 23975 31d411bd26bc291d010e9e4a079b6c3e1de5156d
push id4820
push userneil@mozilla.com
push dateTue, 20 Jan 2009 17:47:59 +0000
treeherdermozilla-central@31d411bd26bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs474336
milestone1.9.2a1pre
Bug 474336, updating max on progressmeter doesn't update display, r+sr=neil
layout/reftests/bugs/474336-1-ref.xul
layout/reftests/bugs/474336-1.xul
layout/reftests/bugs/reftest.list
layout/xul/base/src/nsProgressMeterFrame.cpp
toolkit/content/tests/widgets/test_progressmeter.xul
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/474336-1-ref.xul
@@ -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>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/474336-1.xul
@@ -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>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1024,8 +1024,9 @@ fails == 461512-1.html 461512-1-ref.html
 == 466395-2.html 466395-2-ref.html
 == 467084-1.html 467084-1-ref.html
 == 467084-2.html 467084-2-ref.html
 == 467460-1.html 467460-1-ref.html
 == 468473-1.xul 468473-1-ref.xul
 == 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
--- a/layout/xul/base/src/nsProgressMeterFrame.cpp
+++ b/layout/xul/base/src/nsProgressMeterFrame.cpp
@@ -117,17 +117,17 @@ nsProgressMeterFrame::AttributeChanged(P
 {
   nsresult rv = nsBoxFrame::AttributeChanged(aNameSpaceID, aAttribute,
                                              aModType);
   if (NS_OK != rv) {
     return rv;
   }
 
   // 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();
     if (!remainderChild) return NS_OK;
     nsCOMPtr<nsIContent> remainderContent = remainderChild->GetContent();
     if (!remainderContent) return NS_OK;
 
     nsAutoString value, maxValue;
--- a/toolkit/content/tests/widgets/test_progressmeter.xul
+++ b/toolkit/content/tests/widgets/test_progressmeter.xul
@@ -44,16 +44,22 @@ function doTests() {
   ise(n1.value, "7", "determined value set 7");
   n1.value = "17";
   ise(n1.value, "17", "determined value set 17 string");
   n1.value = 18;
   ise(n1.value, "17", "determined value set 18");
   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;
   ise(n2.value, "0", "undetermined value set -1");
   n2.value = 125;
   ise(n2.value, "100", "undetermined value set 125");
   n2.value = 7;
   ise(n2.value, "7", "undetermined value set 7");