Bug 1223751 - Assume all frames are visible in subdocuments of a top level content document that's assuming all frames are visible. r=tn
authorSeth Fowler <mark.seth.fowler@gmail.com>
Mon, 04 Apr 2016 15:11:43 -0700
changeset 291561 f1ee7dcaa1cb0002a4074ccab583a8e458257fe4
parent 291560 5209d6b9fe6e0e39f1b4c46b0642aae3ece65973
child 291562 85740a5fc12fb0264ab964a262fa8bf6a45d7c55
push id74617
push usermfowler@mozilla.com
push dateMon, 04 Apr 2016 22:48:03 +0000
treeherdermozilla-inbound@f1ee7dcaa1cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1223751
milestone48.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 1223751 - Assume all frames are visible in subdocuments of a top level content document that's assuming all frames are visible. r=tn
layout/base/nsPresShell.cpp
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -6007,16 +6007,34 @@ PresShell::AssumeAllFramesVisible()
   // resource docs and don't keep track of them.
   if (mPresContext->Type() == nsPresContext::eContext_PrintPreview ||
       mPresContext->Type() == nsPresContext::eContext_Print ||
       mPresContext->IsChrome() ||
       mDocument->IsResourceDoc()) {
     return true;
   }
 
+  // If we're assuming all frames are visible in the top level content
+  // document, we need to in subdocuments as well. Otherwise we can get in a
+  // situation where things like animations won't work in subdocuments because
+  // their frames appear not to be visible, since we won't schedule an image
+  // visibility update if the top level content document is assuming all
+  // frames are visible.
+  //
+  // Note that it's not safe to call IsRootContentDocument() if we're
+  // currently being destroyed, so we have to check that first.
+  if (!mHaveShutDown && !mIsDestroying &&
+      !mPresContext->IsRootContentDocument()) {
+    nsPresContext* presContext =
+      mPresContext->GetToplevelContentDocumentPresContext();
+    if (presContext && presContext->PresShell()->AssumeAllFramesVisible()) {
+      return true;
+    }
+  }
+
   return false;
 }
 
 void
 PresShell::ScheduleApproximateFrameVisibilityUpdateSoon()
 {
   if (AssumeAllFramesVisible()) {
     return;