Bug 845337. When we are looking for the parent prescontext we may not have a root frame so use the root view instead to get the parent prescontext. r=roc

This commit is contained in:
Timothy Nikkel 2013-02-27 14:52:06 -06:00
parent 50c84383be
commit 6a5cba3ab2

View File

@ -1152,11 +1152,21 @@ nsPresContext::GetParentPresContext()
{
nsIPresShell* shell = GetPresShell();
if (shell) {
nsIFrame* rootFrame = shell->FrameManager()->GetRootFrame();
if (rootFrame) {
nsIFrame* f = nsLayoutUtils::GetCrossDocParentFrame(rootFrame);
if (f)
return f->PresContext();
nsViewManager* viewManager = shell->GetViewManager();
if (viewManager) {
nsView* view = viewManager->GetRootView();
if (view) {
view = view->GetParent(); // anonymous inner view
if (view) {
view = view->GetParent(); // subdocumentframe's view
if (view) {
nsIFrame* f = view->GetFrame();
if (f) {
return f->PresContext();
}
}
}
}
}
}
return nullptr;