Bug 1297996 - Add preference to show background colour between pageloads for non-e10s. r?tnikkel
Adds a hidden layout.show_previous_page pref for non-e10s that, when set to false,
will blank out the content area in between page loads instead of showing the
previous page.
MozReview-Commit-ID: 1EyDk4IabeK
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -36,20 +36,23 @@
#include "nsIObjectLoadingContent.h"
#include "nsLayoutUtils.h"
#include "FrameLayerBuilder.h"
#include "nsPluginFrame.h"
#include "nsContentUtils.h"
#include "nsIPermissionManager.h"
#include "nsServiceManagerUtils.h"
#include "nsIDOMMutationEvent.h"
+#include "mozilla/Preferences.h"
using namespace mozilla;
using mozilla::layout::RenderFrameParent;
+static bool sShowPreviousPage = true;
+
static nsIDocument*
GetDocumentFromView(nsView* aView)
{
NS_PRECONDITION(aView, "");
nsViewManager* vm = aView->GetViewManager();
nsIPresShell* ps = vm ? vm->GetPresShell() : nullptr;
return ps ? ps->GetDocument() : nullptr;
@@ -102,16 +105,22 @@ void
nsSubDocumentFrame::Init(nsIContent* aContent,
nsContainerFrame* aParent,
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) {
+ 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
// nsCSSFrameConstructor, then we will lose because the inner view's
// parent will already have been set to some outer view (e.g., the
// canvas) when it really needs to have this frame's view as its
// parent. So, create this frame's view right away, whether we
@@ -222,17 +231,17 @@ nsSubDocumentFrame::GetSubdocumentPresSh
// being the old page that will probably have a frame.
nsView* nextView = subdocView->GetNextSibling();
nsIFrame* frame = nullptr;
if (nextView) {
frame = nextView->GetFrame();
}
if (frame) {
nsIPresShell* ps = frame->PresContext()->PresShell();
- if (!presShell || (ps && !ps->IsPaintingSuppressed())) {
+ if (!presShell || (ps && !ps->IsPaintingSuppressed() && sShowPreviousPage)) {
subdocView = nextView;
subdocRootFrame = frame;
presShell = ps;
}
}
if (!presShell) {
// If we don't have a frame we use this roundabout way to get the pres shell.
if (!mFrameLoader)