Bug 689623. Part 7. Clear the list of visible images on presshells that we don't descend into while building the display list of visible images. r=mats

This commit is contained in:
Timothy Nikkel 2013-02-24 18:59:22 -06:00
parent 9660b7d867
commit c382d9d2b7
2 changed files with 25 additions and 0 deletions

View File

@ -5315,6 +5315,8 @@ PresShell::MarkImagesInListVisible(const nsDisplayList& aList)
void
PresShell::RebuildImageVisibility(const nsDisplayList& aList)
{
MOZ_ASSERT(!mImageVisibilityVisited, "already visited?");
mImageVisibilityVisited = true;
nsTArray< nsCOMPtr<nsIImageLoadingContent > > beforeimagelist;
beforeimagelist.SwapElements(mVisibleImages);
MarkImagesInListVisible(aList);
@ -5323,6 +5325,22 @@ PresShell::RebuildImageVisibility(const nsDisplayList& aList)
}
}
/* static */ void
PresShell::ClearImageVisibilityVisited(nsView* aView, bool aClear)
{
nsViewManager* vm = aView->GetViewManager();
if (aClear) {
PresShell* presShell = static_cast<PresShell*>(vm->GetPresShell());
if (!presShell->mImageVisibilityVisited) {
presShell->ClearVisibleImagesList();
}
presShell->mImageVisibilityVisited = false;
}
for (nsView* v = aView->GetFirstChild(); v; v = v->GetNextSibling()) {
ClearImageVisibilityVisited(v, v->GetViewManager() != vm);
}
}
void
PresShell::ClearVisibleImagesList()
{
@ -5363,6 +5381,8 @@ PresShell::UpdateImageVisibility()
RebuildImageVisibility(list);
ClearImageVisibilityVisited(rootFrame->GetView(), true);
list.DeleteAll();
}
@ -5421,6 +5441,8 @@ PresShell::Paint(nsView* aViewToPaint,
NS_ASSERTION(!mIsDestroying, "painting a destroyed PresShell");
NS_ASSERTION(aViewToPaint, "null view");
MOZ_ASSERT(!mImageVisibilityVisited, "should have been cleared");
if (!mIsActive || mIsZombie) {
return;
}

View File

@ -712,6 +712,7 @@ protected:
nsRevocableEventPtr<nsRunnableMethod<PresShell> > mUpdateImageVisibilityEvent;
void ClearVisibleImagesList();
static void ClearImageVisibilityVisited(nsView* aView, bool aClear);
static void MarkImagesInListVisible(const nsDisplayList& aList);
// A list of images that are visible or almost visible.
@ -806,6 +807,8 @@ protected:
bool mAsyncResizeTimerIsActive : 1;
bool mInResize : 1;
bool mImageVisibilityVisited : 1;
static bool sDisableNonTestMouseEvents;
};