Bug 493702. Paint subdocuments across iframe boundaries in print presentations when we don't have docshells. r=roc
--- 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());