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
authorTimothy Nikkel <tnikkel@gmail.com>
Wed, 27 Feb 2013 14:52:06 -0600
changeset 123210 3d20e0577cbf7d5bcdf7b29affb64b41d1dbab55
parent 123209 ae360bf4bc473dffe40da66400d9d8f9dcee0756
child 123211 8cb9d69819783558ec4fc67c43ad59208682987d
push id24373
push userryanvm@gmail.com
push dateThu, 28 Feb 2013 01:36:21 +0000
treeherdermozilla-central@8cb9d6981978 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs845337
milestone22.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 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
layout/base/nsPresContext.cpp
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1147,21 +1147,31 @@ nsPresContext::Observe(nsISupports* aSub
   return NS_ERROR_FAILURE;
 }
 
 nsPresContext*
 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;
 }
 
 nsPresContext*
 nsPresContext::GetToplevelContentDocumentPresContext()
 {