Bug 1084136 (Part 5) - Don't reset STATUS_DECODE_STARTED when decoding finishes. r=tn

--HG--
extra : rebase_source : d60164094c0dc0d7fbc4f47980f8b2d9df0b9deb
This commit is contained in:
Seth Fowler 2014-11-06 17:33:58 -08:00
parent 07645410f4
commit f114d563da
4 changed files with 8 additions and 20 deletions

View File

@ -253,7 +253,6 @@ nsImageLoadingContent::OnStopRequest(imgIRequest* aRequest,
// XXXkhuey should this be GetOurCurrentDoc? Decoding if we're not in
// the document seems silly.
bool startedDecoding = false;
nsIDocument* doc = GetOurOwnerDoc();
nsIPresShell* shell = doc ? doc->GetShell() : nullptr;
if (shell && shell->IsVisible() &&
@ -274,9 +273,7 @@ nsImageLoadingContent::OnStopRequest(imgIRequest* aRequest,
// visible.
if (!mFrameCreateCalled || (f->GetStateBits() & NS_FRAME_FIRST_REFLOW) ||
mVisibleCount > 0 || shell->AssumeAllImagesVisible()) {
if (NS_SUCCEEDED(mCurrentRequest->StartDecoding())) {
startedDecoding = true;
}
mCurrentRequest->StartDecoding();
}
}
}
@ -288,8 +285,8 @@ nsImageLoadingContent::OnStopRequest(imgIRequest* aRequest,
uint32_t reqStatus;
aRequest->GetImageStatus(&reqStatus);
if (NS_SUCCEEDED(aStatus) && !(reqStatus & imgIRequest::STATUS_ERROR) &&
(reqStatus & imgIRequest::STATUS_DECODE_STARTED ||
(startedDecoding && !(reqStatus & imgIRequest::STATUS_DECODE_COMPLETE)))) {
(reqStatus & imgIRequest::STATUS_DECODE_STARTED) &&
!(reqStatus & imgIRequest::STATUS_DECODE_COMPLETE)) {
mFireEventsOnDecode = true;
} else {
// Fire the appropriate DOM event.

View File

@ -430,8 +430,6 @@ imgStatusTracker::Difference(imgStatusTracker* aOther) const
ImageStatusDiff diff;
diff.diffState = ~mState & aOther->mState & ~FLAG_REQUEST_STARTED;
diff.diffImageStatus = ~mImageStatus & aOther->mImageStatus;
diff.unsetDecodeStarted = mImageStatus & imgIRequest::STATUS_DECODE_STARTED
&& !(aOther->mImageStatus & imgIRequest::STATUS_DECODE_STARTED);
MOZ_ASSERT(!mIsMultipart || aOther->mIsMultipart, "mIsMultipart should be monotonic");
diff.foundIsMultipart = !mIsMultipart && aOther->mIsMultipart;
@ -486,10 +484,6 @@ imgStatusTracker::ApplyDifference(const ImageStatusDiff& aDiff)
// Update the image status. There are some subtle points which are handled below.
mImageStatus |= aDiff.diffImageStatus;
// Unset bits which can get unset as part of the decoding process.
if (aDiff.unsetDecodeStarted)
mImageStatus &= ~imgIRequest::STATUS_DECODE_STARTED;
}
void
@ -633,8 +627,9 @@ imgStatusTracker::RecordDecoded()
{
NS_ABORT_IF_FALSE(mImage, "RecordDecoded called before we have an Image");
mState |= FLAG_DECODE_STARTED | FLAG_DECODE_STOPPED | FLAG_FRAME_STOPPED;
mImageStatus |= imgIRequest::STATUS_FRAME_COMPLETE | imgIRequest::STATUS_DECODE_COMPLETE;
mImageStatus &= ~imgIRequest::STATUS_DECODE_STARTED;
mImageStatus |= imgIRequest::STATUS_DECODE_STARTED |
imgIRequest::STATUS_DECODE_COMPLETE |
imgIRequest::STATUS_FRAME_COMPLETE;
}
void
@ -703,7 +698,6 @@ imgStatusTracker::RecordStopDecode(nsresult aStatus)
mState |= FLAG_DECODE_STOPPED;
mImageStatus |= imgIRequest::STATUS_DECODE_COMPLETE;
mImageStatus &= ~imgIRequest::STATUS_DECODE_STARTED;
if (NS_SUCCEEDED(aStatus) && !(mImageStatus & imgIRequest::STATUS_ERROR)) {
mHasBeenDecoded = true;

View File

@ -46,7 +46,6 @@ struct ImageStatusDiff
: invalidRect()
, diffState(0)
, diffImageStatus(0)
, unsetDecodeStarted(false)
, foundIsMultipart(false)
, foundLastPart(false)
, gotDecoded(false)
@ -60,7 +59,6 @@ struct ImageStatusDiff
return aOther.invalidRect == invalidRect
&& aOther.diffState == diffState
&& aOther.diffImageStatus == diffImageStatus
&& aOther.unsetDecodeStarted == unsetDecodeStarted
&& aOther.foundIsMultipart == foundIsMultipart
&& aOther.foundLastPart == foundLastPart
&& aOther.gotDecoded == gotDecoded;
@ -70,7 +68,6 @@ struct ImageStatusDiff
invalidRect = invalidRect.Union(aOther.invalidRect);
diffState |= aOther.diffState;
diffImageStatus |= aOther.diffImageStatus;
unsetDecodeStarted = unsetDecodeStarted || aOther.unsetDecodeStarted;
foundIsMultipart = foundIsMultipart || aOther.foundIsMultipart;
foundLastPart = foundLastPart || aOther.foundLastPart;
gotDecoded = gotDecoded || aOther.gotDecoded;
@ -79,7 +76,6 @@ struct ImageStatusDiff
nsIntRect invalidRect;
uint32_t diffState;
uint32_t diffImageStatus;
bool unsetDecodeStarted : 1;
bool foundIsMultipart : 1;
bool foundLastPart : 1;
bool gotDecoded : 1;

View File

@ -692,7 +692,8 @@ nsresult nsImageBoxFrame::OnStopRequest(imgIRequest *request,
// an error yet and we've already started decoding, we must only fire these
// events after we finish decoding.
if (NS_SUCCEEDED(aStatus) && !(reqStatus & imgIRequest::STATUS_ERROR) &&
reqStatus & imgIRequest::STATUS_DECODE_STARTED) {
(reqStatus & imgIRequest::STATUS_DECODE_STARTED) &&
!(reqStatus & imgIRequest::STATUS_DECODE_COMPLETE)) {
mFireEventOnDecode = true;
} else {
if (NS_SUCCEEDED(aStatus)) {