Bug 693930 - Fennec keeps viewport ThebesLayers alive for background tabs. r=roc a=asa
authorOleg Romashin <romaxa@gmail.com>
Tue, 18 Oct 2011 15:28:20 -0400
changeset 78908 304ce011f8343bc6c015122ea04402acf3a53992
parent 78907 0ffb24f7c34a2d3697ea7f46b50450811e909c51
child 78909 f8b25775b12bb486130830785e0c75ac164ccfc8
push idunknown
push userunknown
push dateunknown
reviewersroc, asa
Bug 693930 - Fennec keeps viewport ThebesLayers alive for background tabs. r=roc a=asa
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -1626,16 +1626,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
@@ -4962,16 +4962,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)) {