Bug 693930 - Fennec keeps viewport ThebesLayers alive for background tabs. r=roc
authorOleg Romashin <romaxa@gmail.com>
Tue, 18 Oct 2011 15:28:20 -0400
changeset 80260 d2dd7339bedbea31f998aec0075ffb78ab3874a8
parent 80259 26a69ff93c13d5d7189bf938dc37a11a50065f5f
child 80261 2fce0afe2141a4181a8e264ebcade8aaff0027e6
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs693930
milestone10.0a1
Bug 693930 - Fennec keeps viewport ThebesLayers alive for background tabs. r=roc
layout/base/nsLayoutUtils.cpp
layout/base/nsPresShell.cpp
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -1628,16 +1628,17 @@ nsLayoutUtils::PaintFrame(nsRenderingCon
     // creates a display list with a PageContent item. The PageContent item's
     // paint function calls this function on the nsPageFrame's child which is
     // an nsPageContentFrame. We only want to add the canvas background color
     // item once, for the nsPageContentFrame.
 
     // Add the canvas background color to the bottom of the list. This
     // happens after we've built the list so that AddCanvasBackgroundColorItem
     // can monkey with the contents if necessary.
+    canvasArea.IntersectRect(canvasArea, visibleRegion.GetBounds());
     rv = presShell->AddCanvasBackgroundColorItem(
            builder, list, aFrame, canvasArea, aBackstop);
 
     // If the passed in backstop color makes us draw something different from
     // normal, we need to flush layers.
     if ((aFlags & PAINT_WIDGET_LAYERS) && !willFlushRetainedLayers) {
       nsIView* view = aFrame->GetView();
       if (view) {
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -4999,16 +4999,19 @@ AddCanvasBackgroundColor(const nsDisplay
 
 nsresult PresShell::AddCanvasBackgroundColorItem(nsDisplayListBuilder& aBuilder,
                                                  nsDisplayList&        aList,
                                                  nsIFrame*             aFrame,
                                                  const nsRect&         aBounds,
                                                  nscolor               aBackstopColor,
                                                  PRUint32              aFlags)
 {
+  if (aBounds.IsEmpty()) {
+    return NS_OK;
+  }
   // We don't want to add an item for the canvas background color if the frame
   // (sub)tree we are painting doesn't include any canvas frames. There isn't
   // an easy way to check this directly, but if we check if the root of the
   // (sub)tree we are painting is a canvas frame that should cover us in all
   // cases (it will usually be a viewport frame when we have a canvas frame in
   // the (sub)tree).
   if (!(aFlags & nsIPresShell::FORCE_DRAW) &&
       !nsCSSRendering::IsCanvasFrame(aFrame)) {