Bug 1234049 - Ensure we always invalidate new PresShells that are created for an inactive DocShell upon reactivating them. r=smaug

This commit is contained in:
George Wright 2016-01-13 17:00:15 -05:00
Родитель dd8913044a
Коммит a0dfe950db
2 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -745,6 +745,7 @@ PresShell::PresShell()
mSelectionFlags = nsISelectionDisplay::DISPLAY_TEXT | nsISelectionDisplay::DISPLAY_IMAGES;
mIsThemeSupportDisabled = false;
mIsActive = true;
mIsHidden = false;
// FIXME/bug 735029: find a better solution to this problem
#if defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_ANDROID_APZ)
// The java pan/zoom code uses this to mean approximately "request a
@ -10403,6 +10404,10 @@ void PresShell::QueryIsActive()
if (docshell) {
bool isActive;
nsresult rv = docshell->GetIsActive(&isActive);
// Even though in theory the docshell here could be "Inactive and
// Foreground", thus implying aIsHidden=false for SetIsActive(),
// this is a newly created PresShell so we'd like to invalidate anyway
// upon being made active to ensure that the contents get painted.
if (NS_SUCCEEDED(rv))
SetIsActive(isActive);
}
@ -10440,6 +10445,11 @@ PresShell::SetIsActive(bool aIsActive, bool aIsHidden)
NS_PRECONDITION(mDocument, "should only be called with a document");
mIsActive = aIsActive;
// Keep track of whether we've called TabChild::MakeHidden() or not.
// This can still be true even if aIsHidden is false.
mIsHidden |= aIsHidden;
nsPresContext* presContext = GetPresContext();
if (presContext &&
presContext->RefreshDriver()->PresContext() == presContext) {
@ -10479,10 +10489,14 @@ PresShell::SetIsActive(bool aIsActive, bool aIsHidden)
// and (ii) has easy access to the TabChild. So we use this
// notification to signal the TabChild to drop its layer tree and
// stop trying to repaint.
if (aIsHidden) {
if (mIsHidden) {
if (TabChild* tab = TabChild::GetFrom(this)) {
if (aIsActive) {
tab->MakeVisible();
// The only time we should set this to false is when
// TabChild::MakeVisible() is called.
mIsHidden = false;
if (!mIsZombie) {
if (nsIFrame* root = mFrameConstructor->GetRootFrame()) {
FrameLayerBuilder::InvalidateAllLayersForFrame(

Просмотреть файл

@ -494,6 +494,8 @@ protected:
friend class nsPresShellEventCB;
bool mCaretEnabled;
bool mIsHidden;
#ifdef DEBUG
nsStyleSet* CloneStyleSet(nsStyleSet* aSet);
bool VerifyIncrementalReflow();