Bug 579323. Part 2: Actually fix the bug by calling InvalidateThebesLayersInSubtree from nsIFrame::Redraw. r=dbaron,a=blocking
authorRobert O'Callahan <robert@ocallahan.org>
Tue, 31 Aug 2010 12:49:13 +1200
changeset 51758 c356fe3addab6ebf3709af8020459d0b1d380a35
parent 51757 24c941e03dac17a3ec238b930fa574d3f2bda28c
child 51759 a1e828d50d5a58b43f08e3c54632f507af16503e
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron, blocking
bugs579323
milestone2.0b5pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 579323. Part 2: Actually fix the bug by calling InvalidateThebesLayersInSubtree from nsIFrame::Redraw. r=dbaron,a=blocking
layout/generic/nsIFrame.h
layout/reftests/bugs/579323-1-ref.html
layout/reftests/bugs/579323-1.html
layout/reftests/bugs/reftest.list
layout/xul/base/src/nsBox.cpp
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -2411,17 +2411,17 @@ NS_PTR_TO_INT32(frame->Properties().Get(
 
   // For nsSprocketLayout
   virtual Valignment GetVAlign() const = 0;
   virtual Halignment GetHAlign() const = 0;
 
   PRBool IsHorizontal() const { return (mState & NS_STATE_IS_HORIZONTAL) != 0; }
   PRBool IsNormalDirection() const { return (mState & NS_STATE_IS_DIRECTION_NORMAL) != 0; }
 
-  NS_HIDDEN_(nsresult) Redraw(nsBoxLayoutState& aState, const nsRect* aRect = nsnull, PRBool aImmediate = PR_FALSE);
+  NS_HIDDEN_(nsresult) Redraw(nsBoxLayoutState& aState, const nsRect* aRect = nsnull);
   NS_IMETHOD RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild)=0;
   virtual PRBool GetMouseThrough() const = 0;
 
 #ifdef DEBUG_LAYOUT
   NS_IMETHOD SetDebug(nsBoxLayoutState& aState, PRBool aDebug)=0;
   NS_IMETHOD GetDebug(PRBool& aDebug)=0;
 
   NS_IMETHOD DumpBox(FILE* out)=0;
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/579323-1-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+body {
+  width: 500px;
+}
+div {
+  height: 100px;
+  opacity: 0.5;
+  border: 1px solid black;
+}
+</style>
+</head>
+<body>
+<div></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/579323-1.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+<style>
+body {
+  display: -moz-box;
+  -moz-box-orient: horizontal;
+  width: 400px;
+}
+canvas {
+  -moz-box-flex: 1;
+  height: 100px;
+  opacity: 0.5;
+  border: 1px solid black;
+}
+</style>
+<script>
+function doTest() {
+  document.body.style.width = "500px";
+  document.documentElement.removeAttribute("class");
+}
+window.addEventListener("MozReftestInvalidate", doTest, false);
+</script>
+</head>
+<body>
+<canvas></canvas>
+</body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1479,16 +1479,17 @@ random-if(d2d) == 555388-1.html 555388-1
 == 571347-2b.html 571347-2-ref.html
 == 571347-2c.html 571347-2-ref.html
 == 571347-2d.html 571347-2-ref.html
 == 571347-3.html 571347-3-ref.html
 == 572598-1.html 572598-ref.html
 == 574898-1.html 574898-ref.html
 == 577838-1.html 577838-1-ref.html
 == 577838-2.html 577838-2-ref.html
+== 579323-1.html 579323-1-ref.html
 == 579349-1.html 579349-1-ref.html
 == 580160-1.html 580160-1-ref.html
 == 581317-1.html 581317-1-ref.html
 == 581579-1.html 581579-1-ref.html
 == 582037-1a.html 582037-1-ref.html
 == 582037-1b.html 582037-1-ref.html
 == 582037-2a.html 582037-2-ref.html
 == 582037-2b.html 582037-2-ref.html
--- a/layout/xul/base/src/nsBox.cpp
+++ b/layout/xul/base/src/nsBox.cpp
@@ -51,16 +51,19 @@
 #include "nsIDOMNamedNodeMap.h"
 #include "nsIDOMAttr.h"
 #include "nsIRenderingContext.h"
 #include "nsIDocument.h"
 #include "nsIDeviceContext.h"
 #include "nsITheme.h"
 #include "nsIServiceManager.h"
 #include "nsIBoxLayout.h"
+#include "FrameLayerBuilder.h"
+
+using namespace mozilla;
 
 #ifdef DEBUG_LAYOUT
 PRInt32 gIndent = 0;
 #endif
 
 #ifdef DEBUG_LAYOUT
 void
 nsBoxAddIndents()
@@ -643,29 +646,31 @@ nsBox::SyncLayout(nsBoxLayoutState& aSta
                              flags);
   } 
 
   return NS_OK;
 }
 
 nsresult
 nsIFrame::Redraw(nsBoxLayoutState& aState,
-                 const nsRect*   aDamageRect,
-                 PRBool          aImmediate)
+                 const nsRect*   aDamageRect)
 {
   if (aState.PaintingDisabled())
     return NS_OK;
 
   nsRect damageRect(0,0,0,0);
   if (aDamageRect)
     damageRect = *aDamageRect;
   else
     damageRect = GetOverflowRect();
 
-  InvalidateWithFlags(damageRect, aImmediate ? INVALIDATE_IMMEDIATE : 0);
+  Invalidate(damageRect);
+  // nsStackLayout, at least, expects us to repaint descendants even
+  // if a damage rect is provided
+  FrameLayerBuilder::InvalidateThebesLayersInSubtree(this);
 
   return NS_OK;
 }
 
 PRBool
 nsIBox::AddCSSPrefSize(nsIBox* aBox, nsSize& aSize, PRBool &aWidthSet, PRBool &aHeightSet)
 {
     aWidthSet = PR_FALSE;