Bug 689623. Part 9. Make images default to visible when they have a frame created for them. r=mats

This commit is contained in:
Timothy Nikkel 2013-02-24 18:59:23 -06:00
Родитель 45f8b4f1f9
Коммит 9e119b46eb
2 изменённых файлов: 14 добавлений и 7 удалений

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

@ -237,6 +237,11 @@ nsImageLoadingContent::OnStopRequest(imgIRequest* aRequest,
void
nsImageLoadingContent::OnUnlockedDraw()
{
if (mVisibleCount > 0) {
// We should already be marked as visible, there is nothing more we can do.
return;
}
nsPresContext* presContext = GetFramePresContext();
if (!presContext)
return;
@ -395,6 +400,11 @@ nsImageLoadingContent::FrameCreated(nsIFrame* aFrame)
{
NS_ASSERTION(aFrame, "aFrame is null");
nsPresContext* presContext = aFrame->PresContext();
if (mVisibleCount == 0) {
presContext->PresShell()->EnsureImageInVisibleList(this);
}
// We pass the SKIP_FRAME_CHECK flag to TrackImage here because our primary
// frame pointer hasn't been setup yet when this is caled.
TrackImage(mCurrentRequest, SKIP_FRAME_CHECK);
@ -402,8 +412,6 @@ nsImageLoadingContent::FrameCreated(nsIFrame* aFrame)
// We need to make sure that our image request is registered, if it should
// be registered.
nsPresContext* presContext = aFrame->PresContext();
if (mCurrentRequest) {
nsLayoutUtils::RegisterImageRequestIfAnimated(presContext, mCurrentRequest,
&mCurrentRequestRegistered);

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

@ -5427,11 +5427,10 @@ PresShell::EnsureImageInVisibleList(nsIImageLoadingContent* aImage)
}
#endif
// This check could be slow.
if (mVisibleImages.Contains(aImage)) {
return;
}
// nsImageLoadingContent doesn't call this function if it has a positive
// visible count so the image shouldn't be in mVisibleImages. Either way it
// doesn't hurt to put it in multiple times.
MOZ_ASSERT(!mVisibleImages.Contains(aImage), "image already in the array");
mVisibleImages.AppendElement(aImage);
aImage->IncrementVisibleCount();
}