Bug 1050159. Apply correct dirty rect when AddCanvasBackgroundColorItem creates an nsDisplaySolidColor. r=mattwoodrow
authorRobert O'Callahan <robert@ocallahan.org>
Sat, 06 Sep 2014 16:16:33 +1200
changeset 204450 71efcfad349112b309be94d8f9803126106ce368
parent 204449 7a702947b27429daa2c90b72f35ce79ac4eda3e4
child 204451 46803bf61e5fd387fdc6e64ca95aa1d8c10d9cee
push id48909
push userrocallahan@mozilla.com
push dateWed, 10 Sep 2014 01:13:13 +0000
treeherdermozilla-inbound@a5678a961b1e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1050159
milestone35.0a1
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 1050159. Apply correct dirty rect when AddCanvasBackgroundColorItem creates an nsDisplaySolidColor. r=mattwoodrow
layout/generic/nsSubDocumentFrame.cpp
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -425,16 +425,18 @@ nsSubDocumentFrame::BuildDisplayList(nsD
           // circuited due to us ignoring the root scroll frame, so we do it here.
           nsIScrollableFrame* rootScrollableFrame = do_QueryFrame(rootScrollFrame);
           dirty = rootScrollableFrame->ExpandRectToNearlyVisible(dirty);
         }
       }
     }
 
     aBuilder->EnterPresShell(subdocRootFrame, dirty);
+  } else {
+    dirty = aDirtyRect;
   }
 
   DisplayListClipState::AutoSaveRestore clipState(aBuilder);
   if (ShouldClipSubdocument()) {
     clipState.ClipContainingBlockDescendantsToContentBox(aBuilder, this);
   }
 
   nsIScrollableFrame *sf = presShell->GetRootScrollFrameAsScrollable();
@@ -484,23 +486,28 @@ nsSubDocumentFrame::BuildDisplayList(nsD
       // If we are in print preview/page layout we want to paint the grey
       // background behind the page, not the canvas color. The canvas color gets
       // painted on the page itself.
       if (nsLayoutUtils::NeedsPrintPreviewBackground(presContext)) {
         presShell->AddPrintPreviewBackgroundItem(
           *aBuilder, childItems, subdocRootFrame ? subdocRootFrame : this,
           bounds);
       } else {
+        // Invoke AutoBuildingDisplayList to ensure that the correct dirty rect
+        // is used to compute the visible rect if AddCanvasBackgroundColorItem
+        // creates a display item.
+        nsIFrame* frame = subdocRootFrame ? subdocRootFrame : this;
+        nsDisplayListBuilder::AutoBuildingDisplayList
+          building(aBuilder, frame, dirty, true);
         // 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.
         uint32_t flags = nsIPresShell::FORCE_DRAW;
         presShell->AddCanvasBackgroundColorItem(
-          *aBuilder, childItems, subdocRootFrame ? subdocRootFrame : this,
-          bounds, NS_RGBA(0,0,0,0), flags);
+          *aBuilder, childItems, frame, bounds, NS_RGBA(0,0,0,0), flags);
       }
     }
   }
 
   if (subdocRootFrame) {
     aBuilder->LeavePresShell(subdocRootFrame, dirty);
 
     if (ignoreViewportScrolling) {