--- 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