Bug 974412 - Cancel any pending InvalidatePresShellIfHidden() request for the shell when detaching the pres context. r=roc
authorMats Palmgren <matspal@gmail.com>
Fri, 21 Feb 2014 08:40:45 +0000
changeset 169863 7710a7b9f8409930aef6a06d875ec64313799236
parent 169862 e36575f8b202d030e542dda38afd2a2c54eed8fa
child 169864 c2f752b69b3accf8820e5e1bfb410b81687e37f1
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersroc
bugs974412
milestone30.0a1
Bug 974412 - Cancel any pending InvalidatePresShellIfHidden() request for the shell when detaching the pres context. r=roc
layout/base/nsIPresShell.h
layout/base/nsPresContext.cpp
layout/base/nsPresShell.cpp
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -1389,16 +1389,17 @@ public:
   void NotifyFontSizeInflationEnabledIsDirty()
   {
     mFontSizeInflationEnabledIsDirty = true;
   }
 
   virtual void AddInvalidateHiddenPresShellObserver(nsRefreshDriver *aDriver) = 0;
 
   void InvalidatePresShellIfHidden();
+  void CancelInvalidatePresShellIfHidden();
 
   // Schedule an update of the list of visible images.
   virtual void ScheduleImageVisibilityUpdate() = 0;
 
   // Clears the current list of visible images on this presshell and replaces it
   // with images that are in the display list aList.
   virtual void RebuildImageVisibility(const nsDisplayList& aList) = 0;
 
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1574,16 +1574,19 @@ nsPresContext::GetDocShell() const
   return mContainer;
 }
 
 /* virtual */ void
 nsPresContext::Detach()
 {
   SetContainer(nullptr);
   SetLinkHandler(nullptr);
+  if (mShell) {
+    mShell->CancelInvalidatePresShellIfHidden();
+  }
 }
 
 bool
 nsPresContext::ThrottledTransitionStyleIsUpToDate() const
 {
   return
     mLastUpdateThrottledTransitionStyle == mRefreshDriver->MostRecentRefresh();
 }
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -620,16 +620,25 @@ nsIPresShell::InvalidatePresShellIfHidde
 {
   if (!IsVisible() && mPresContext) {
     mPresContext->NotifyInvalidation(0);
   }
   mHiddenInvalidationObserverRefreshDriver = nullptr;
 }
 
 void
+nsIPresShell::CancelInvalidatePresShellIfHidden()
+{
+  if (mHiddenInvalidationObserverRefreshDriver) {
+    mHiddenInvalidationObserverRefreshDriver->RemovePresShellToInvalidateIfHidden(this);
+    mHiddenInvalidationObserverRefreshDriver = nullptr;
+  }
+}
+
+void
 nsIPresShell::SetVerifyReflowEnable(bool aEnabled)
 {
   gVerifyReflowEnabled = aEnabled;
 }
 
 /* virtual */ void
 nsIPresShell::AddWeakFrameExternal(nsWeakFrame* aWeakFrame)
 {