Get the parent pres shell from the docshell instead of the document. b=587064 r=roc a=blocking2.0
authorMats Palmgren <matspal@gmail.com>
Sun, 15 Aug 2010 15:54:02 +0200
changeset 50632 2808afb9dd8279c651eca91372052f444717d04f
parent 50631 4d25cd8808e523a208ef4376ef24660f18ee650f
child 50633 14c1f2783543449c4a193a4109f73b6688a99693
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, blocking2.0
bugs587064
milestone2.0b4pre
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
Get the parent pres shell from the docshell instead of the document. b=587064 r=roc a=blocking2.0
layout/base/nsPresContext.cpp
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -893,30 +893,28 @@ nsPresContext::Init(nsIDeviceContext* aD
 
   if (mDocument->GetDisplayDocument()) {
     NS_ASSERTION(mDocument->GetDisplayDocument()->GetShell() &&
                  mDocument->GetDisplayDocument()->GetShell()->GetPresContext(),
                  "Why are we being initialized?");
     mRefreshDriver = mDocument->GetDisplayDocument()->GetShell()->
       GetPresContext()->RefreshDriver();
   } else {
-    nsIDocument* parent = mDocument->GetParentDocument();
-    if (parent) {
-      NS_ASSERTION(parent->GetShell() && parent->GetShell()->GetPresContext(),
-                   "How did we get a presshell?");
-
-      // We don't have our container set yet at this point
-      nsCOMPtr<nsISupports> ourContainer = mDocument->GetContainer();
-
-      nsCOMPtr<nsIDocShellTreeItem> ourItem = do_QueryInterface(ourContainer);
-      if (ourItem) {
-        nsCOMPtr<nsIDocShellTreeItem> parentItem;
-        ourItem->GetSameTypeParent(getter_AddRefs(parentItem));
-        if (parentItem) {
-          mRefreshDriver = parent->GetShell()->GetPresContext()->RefreshDriver();
+    // We don't have our container set yet at this point
+    nsCOMPtr<nsISupports> ourContainer = mDocument->GetContainer();
+    nsCOMPtr<nsIDocShellTreeItem> ourItem = do_QueryInterface(ourContainer);
+    if (ourItem) {
+      nsCOMPtr<nsIDocShellTreeItem> parentItem;
+      ourItem->GetSameTypeParent(getter_AddRefs(parentItem));
+      nsCOMPtr<nsIDocShell> parentDocShell = do_QueryInterface(parentItem);
+      if (parentDocShell) {
+        nsCOMPtr<nsIPresShell> parentPresShell;
+        parentDocShell->GetPresShell(getter_AddRefs(parentPresShell));
+        if (parentPresShell) {
+          mRefreshDriver = parentPresShell->GetPresContext()->RefreshDriver();
         }
       }
     }
 
     if (!mRefreshDriver) {
       mRefreshDriver = new nsRefreshDriver(this);
       if (!mRefreshDriver)
         return NS_ERROR_OUT_OF_MEMORY;