Bug 493702. Paint subdocuments across iframe boundaries in print presentations when we don't have docshells. r=roc
authorTimothy Nikkel <tnikkel@gmail.com>
Tue, 19 May 2009 21:57:31 +1200
changeset 28575 409416c625bcccc55d41a8e1e143657b1ae6e845
parent 28574 759009d95b4108c3d1626e2417000dc15e79ecbe
child 28576 8737a137215ce1a2053f6c6e44c78fdf1e364553
push id7118
push userrocallahan@mozilla.com
push dateTue, 19 May 2009 10:02:10 +0000
treeherdermozilla-central@409416c625bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs493702
milestone1.9.2a1pre
Bug 493702. Paint subdocuments across iframe boundaries in print presentations when we don't have docshells. r=roc
layout/generic/nsFrameFrame.cpp
--- a/layout/generic/nsFrameFrame.cpp
+++ b/layout/generic/nsFrameFrame.cpp
@@ -315,43 +315,44 @@ nsSubDocumentFrame::BuildDisplayList(nsD
   NS_ENSURE_SUCCESS(rv, rv);
   
   if (!mInnerView)
     return NS_OK;
   nsIView* subdocView = mInnerView->GetFirstChild();
   if (!subdocView)
     return NS_OK;
 
-  // Get the PresShell so we can check if painting is suppressed
-  // on the subdocument. We use this roundabout way in case we
-  // don't have a frame tree.
-  if (!mFrameLoader)
-    return NS_OK;
-  nsCOMPtr<nsIDocShell> docShell;
-  mFrameLoader->GetDocShell(getter_AddRefs(docShell));
-  if (!docShell)
-    return NS_OK;
   nsCOMPtr<nsIPresShell> presShell;
-  docShell->GetPresShell(getter_AddRefs(presShell));
-  if (!presShell)
-    return NS_OK;
+
+  nsIFrame* f = static_cast<nsIFrame*>(subdocView->GetClientData());
+
+  if (f) {
+    presShell = f->PresContext()->PresShell();
+  } else {
+    // If we don't have a frame we use this roundabout way to get the pres shell.
+    if (!mFrameLoader)
+      return NS_OK;
+    nsCOMPtr<nsIDocShell> docShell;
+    mFrameLoader->GetDocShell(getter_AddRefs(docShell));
+    if (!docShell)
+      return NS_OK;
+    docShell->GetPresShell(getter_AddRefs(presShell));
+    if (!presShell)
+      return NS_OK;
+  }
 
   PRBool suppressed = PR_TRUE;
   presShell->IsPaintingSuppressed(&suppressed);
 
-  nsIFrame* f = static_cast<nsIFrame*>(subdocView->GetClientData());
-
   nsDisplayList childItems;
 
   nsRect dirty;
   if (f) {
     dirty = aDirtyRect - f->GetOffsetTo(this);
     aBuilder->EnterPresShell(f, dirty);
-    NS_ASSERTION(presShell == f->PresContext()->PresShell(),
-                 "these presshells should be the same");
 
     rv = f->BuildDisplayListForStackingContext(aBuilder, dirty, &childItems);
   }
 
   // Get the bounds of subdocView relative to the reference frame.
   nsRect shellBounds = subdocView->GetBounds() +
                        mInnerView->GetPosition() +
                        GetOffsetTo(aBuilder->ReferenceFrame());