Bug 680518 - Progress element should invalidate itself when the bar size changes. r=roc
authorMounir Lamouri <mounir.lamouri@gmail.com>
Mon, 22 Aug 2011 15:00:24 +0200
changeset 75652 4b1410af17c7ff2bc900a5bd035256034eeda4bf
parent 75651 1933e939180e4a1900be87fd2105291305da46fd
child 75653 c11ae0f171a4044f4ae3190148dab38267c78013
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersroc
bugs680518
milestone9.0a1
Bug 680518 - Progress element should invalidate itself when the bar size changes. r=roc
layout/forms/nsProgressFrame.cpp
layout/reftests/forms/progress/block-invalidate-ref.html
layout/reftests/forms/progress/block-invalidate.html
layout/reftests/forms/progress/reftest.list
--- a/layout/forms/nsProgressFrame.cpp
+++ b/layout/forms/nsProgressFrame.cpp
@@ -244,16 +244,17 @@ nsProgressFrame::AttributeChanged(PRInt3
   NS_ASSERTION(mBarDiv, "Progress bar div must exist!");
 
   if (aNameSpaceID == kNameSpaceID_None &&
       (aAttribute == nsGkAtoms::value || aAttribute == nsGkAtoms::max)) {
     nsIFrame* barFrame = mBarDiv->GetPrimaryFrame();
     NS_ASSERTION(barFrame, "The progress frame should have a child with a frame!");
     PresContext()->PresShell()->FrameNeedsReflow(barFrame, nsIPresShell::eResize,
                                                  NS_FRAME_IS_DIRTY);
+    Invalidate(GetVisualOverflowRectRelativeToSelf());
   }
 
   return nsHTMLContainerFrame::AttributeChanged(aNameSpaceID, aAttribute,
                                                 aModType);
 }
 
 nsSize
 nsProgressFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
new file mode 100644
--- /dev/null
+++ b/layout/reftests/forms/progress/block-invalidate-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+  <link rel='stylesheet' type='text/css' href='style.css'>
+  <style>
+    progress { display: block; }
+  </style>
+  <body>
+    <progress value='0.5'></progress>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/forms/progress/block-invalidate.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+  <link rel='stylesheet' type='text/css' href='style.css'>
+  <style>
+    progress { display: block; }
+  </style>
+  <script>
+    function loadHandler() {
+      setTimeout(function() {
+        var p = document.getElementsByTagName('progress')[0];
+        p.value = '0.5';
+        document.documentElement.className = '';
+      }, 0);
+    }
+  </script>
+  <body onload="loadHandler();">
+    <progress value='0'></progress>
+  </body>
+</html>
--- a/layout/reftests/forms/progress/reftest.list
+++ b/layout/reftests/forms/progress/reftest.list
@@ -14,8 +14,11 @@
 == bar-pseudo-element-vertical.html bar-pseudo-element-vertical-ref.html
 == bar-pseudo-element-vertical-rtl.html bar-pseudo-element-vertical-rtl-ref.html
 == indeterminate-style-height.html indeterminate-style-height-ref.html
 
 # The following test is disabled but kept in the repository because the
 # transformations will not behave exactly the same for <progress> and two divs.
 # However, it would be possible to manually check those.
 # == transformations.html transformations-ref.html
+
+# Tests for bugs:
+== block-invalidate.html block-invalidate-ref.html