Bug 1323606. Implement the pref layout.show_previous_page for e10s. r=gw280 r=mats
authorTimothy Nikkel <tnikkel@gmail.com>
Mon, 19 Dec 2016 17:34:00 -0600
changeset 326466 cf9d3767e4e8c0a2bd34af0f6f84c85c2df22d35
parent 326465 285af1bbbd7a2852cf9233e2dece8b245978a1e5
child 326467 1e631a95c4bc0e2c4d14dbae7ad2fa6ffc5cb166
push id84967
push usertnikkel@gmail.com
push dateMon, 19 Dec 2016 23:34:08 +0000
treeherdermozilla-inbound@cf9d3767e4e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgw280, mats
bugs1323606, 1157941
milestone53.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 1323606. Implement the pref layout.show_previous_page for e10s. r=gw280 r=mats The existing implementation only works for non-remote subdocuments. This essentially makes the changes from bug 1157941 conditional on this pref.
layout/generic/nsSubDocumentFrame.cpp
view/nsView.cpp
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -108,16 +108,18 @@ nsSubDocumentFrame::Init(nsIContent*    
                          nsIFrame*         aPrevInFlow)
 {
   // determine if we are a <frame> or <iframe>
   nsCOMPtr<nsIDOMHTMLFrameElement> frameElem = do_QueryInterface(aContent);
   mIsInline = frameElem ? false : true;
 
   static bool addedShowPreviousPage = false;
   if (!addedShowPreviousPage) {
+    // If layout.show_previous_page is true then during loading of a new page we
+    // will draw the previous page if the new page has painting suppressed.
     Preferences::AddBoolVarCache(&sShowPreviousPage, "layout.show_previous_page", true);
     addedShowPreviousPage = true;
   }
 
   nsAtomicContainerFrame::Init(aContent, aParent, aPrevInFlow);
 
   // We are going to create an inner view.  If we need a view for the
   // OuterFrame but we wait for the normal view creation path in
--- a/view/nsView.cpp
+++ b/view/nsView.cpp
@@ -18,29 +18,37 @@
 #include "nsXULPopupManager.h"
 #include "nsIWidgetListener.h"
 #include "nsContentUtils.h" // for nsAutoScriptBlocker
 #include "mozilla/TimelineConsumers.h"
 #include "mozilla/CompositeTimelineMarker.h"
 
 using namespace mozilla;
 
+static bool sShowPreviousPage = true;
+
 nsView::nsView(nsViewManager* aViewManager, nsViewVisibility aVisibility)
 {
   MOZ_COUNT_CTOR(nsView);
 
   mVis = aVisibility;
   // Views should be transparent by default. Not being transparent is
   // a promise that the view will paint all its pixels opaquely. Views
   // should make this promise explicitly by calling
   // SetViewContentTransparency.
   mVFlags = 0;
   mViewManager = aViewManager;
   mDirtyRegion = nullptr;
   mWidgetIsTopLevel = false;
+
+  static bool sShowPreviousPageInitialized = false;
+  if (!sShowPreviousPageInitialized) {
+    Preferences::AddBoolVarCache(&sShowPreviousPage, "layout.show_previous_page", true);
+    sShowPreviousPageInitialized = true;
+  }
 }
 
 void nsView::DropMouseGrabbing()
 {
   nsIPresShell* presShell = mViewManager->GetPresShell();
   if (presShell)
     presShell->ClearMouseCaptureOnView(this);
 }
@@ -1118,10 +1126,10 @@ nsView::HandleEvent(WidgetGUIEvent* aEve
   }
 
   return result;
 }
 
 bool
 nsView::IsPrimaryFramePaintSuppressed()
 {
-  return mFrame ? mFrame->PresContext()->PresShell()->IsPaintingSuppressed() : false;
+  return sShowPreviousPage && mFrame && mFrame->PresContext()->PresShell()->IsPaintingSuppressed();
 }