Backed out changeset b7900afb72e5
authorRobert O'Callahan <robert@ocallahan.org>
Thu, 12 Aug 2010 11:31:29 +1200
changeset 49581 06b4065f00be168cb38ec3fd66e272f1a5bdaca8
parent 49572 b7900afb72e53a4ebeea30e03931999b2a531be4
child 49582 c53922a8b0894234acac1701a99ab6f4974b5a9c
push idunknown
push userunknown
push dateunknown
milestone2.0b4pre
backs outb7900afb72e53a4ebeea30e03931999b2a531be4
Backed out changeset b7900afb72e5
layout/base/nsPresContext.cpp
layout/base/nsPresShell.cpp
layout/base/nsRefreshDriver.h
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -259,17 +259,17 @@ nsPresContext::~nsPresContext()
   SetShell(nsnull);
 
   if (mTransitionManager) {
     mTransitionManager->Disconnect();
   }
 
   // Disconnect the refresh driver *after* the transition manager, which
   // needs it.
-  if (mRefreshDriver && mRefreshDriver->PresContext() == this) {
+  if (mRefreshDriver) {
     mRefreshDriver->Disconnect();
   }
 
   if (mEventManager) {
     // unclear if these are needed, but can't hurt
     mEventManager->NotifyDestroyPresContext(this);
     mEventManager->SetPresContext(nsnull);
 
@@ -886,47 +886,19 @@ nsPresContext::Init(nsIDeviceContext* aD
     return NS_ERROR_OUT_OF_MEMORY;
 
   NS_ADDREF(mEventManager);
 
   mTransitionManager = new nsTransitionManager(this);
   if (!mTransitionManager)
     return NS_ERROR_OUT_OF_MEMORY;
 
-  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();
-        }
-      }
-    }
-
-    if (!mRefreshDriver) {
-      mRefreshDriver = new nsRefreshDriver(this);
-      if (!mRefreshDriver)
-        return NS_ERROR_OUT_OF_MEMORY;
-    }
-  }
+  mRefreshDriver = new nsRefreshDriver(this);
+  if (!mRefreshDriver)
+    return NS_ERROR_OUT_OF_MEMORY;
 
   mLangService = do_GetService(NS_LANGUAGEATOMSERVICE_CONTRACTID);
 
   // Register callbacks so we're notified when the preferences change
   nsContentUtils::RegisterPrefCallback("font.",
                                        nsPresContext::PrefChangedCallback,
                                        this);
   nsContentUtils::RegisterPrefCallback("browser.display.",
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -7262,18 +7262,17 @@ PresShell::Freeze()
     mCaret->SetCaretVisible(PR_FALSE);
 
   mPaintingSuppressed = PR_TRUE;
 
   if (mDocument)
     mDocument->EnumerateSubDocuments(FreezeSubDocument, nsnull);
 
   nsPresContext* presContext = GetPresContext();
-  if (presContext &&
-      presContext->RefreshDriver()->PresContext() == presContext) {
+  if (presContext) {
     presContext->RefreshDriver()->Freeze();
   }
 }
 
 void
 PresShell::FireOrClearDelayedEvents(PRBool aFireEvents)
 {
   mNoDelayedMouseEvents = PR_FALSE;
@@ -7316,18 +7315,17 @@ ThawSubDocument(nsIDocument *aDocument, 
 
   return PR_TRUE;
 }
 
 void
 PresShell::Thaw()
 {
   nsPresContext* presContext = GetPresContext();
-  if (presContext &&
-      presContext->RefreshDriver()->PresContext() == presContext) {
+  if (presContext) {
     presContext->RefreshDriver()->Thaw();
   }
 
   mDocument->EnumerateFreezableElements(ThawElement, this);
 
   if (mDocument)
     mDocument->EnumerateSubDocuments(ThawSubDocument, nsnull);
 
--- a/layout/base/nsRefreshDriver.h
+++ b/layout/base/nsRefreshDriver.h
@@ -157,21 +157,16 @@ public:
   void Freeze();
 
   /**
    * Thaw the refresh driver.  If needed, it should start delivering
    * refreshes again.
    */
   void Thaw();
 
-  /**
-   * Return the prescontext we were initialized with
-   */
-  nsPresContext* PresContext() const { return mPresContext; }
-
 #ifdef DEBUG
   /**
    * Check whether the given observer is an observer for the given flush type
    */
   PRBool IsRefreshObserver(nsARefreshObserver *aObserver,
 			   mozFlushType aFlushType);
 #endif