Implement a LOADING state, have a :-moz-loading selector to match on it, use it
for images. Bug 288064, r=biesi, sr=dbaron git-svn-id: svn://10.0.0.236/trunk@181371 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -98,6 +98,7 @@ nsImageLoadingContent::nsImageLoadingContent()
|
||||
mImageBlockingStatus(nsIContentPolicy::ACCEPT),
|
||||
mLoadingEnabled(PR_TRUE),
|
||||
mStartingLoad(PR_FALSE),
|
||||
mLoading(PR_FALSE),
|
||||
// mBroken starts out true, since an image without a URI is broken....
|
||||
mBroken(PR_TRUE),
|
||||
mUserDisabled(PR_FALSE),
|
||||
@@ -162,6 +163,10 @@ nsImageLoadingContent::OnStartContainer(imgIRequest* aRequest,
|
||||
imgIContainer* aContainer)
|
||||
{
|
||||
LOOP_OVER_OBSERVERS(OnStartContainer(aRequest, aContainer));
|
||||
|
||||
// Have to check for state changes here, since we might have been in
|
||||
// the LOADING state before.
|
||||
UpdateImageState(PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -540,7 +545,8 @@ nsImageLoadingContent::ImageState() const
|
||||
return
|
||||
(mBroken * NS_EVENT_STATE_BROKEN) |
|
||||
(mUserDisabled * NS_EVENT_STATE_USERDISABLED) |
|
||||
(mSuppressed * NS_EVENT_STATE_SUPPRESSED);
|
||||
(mSuppressed * NS_EVENT_STATE_SUPPRESSED) |
|
||||
(mLoading * NS_EVENT_STATE_LOADING);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -562,7 +568,7 @@ nsImageLoadingContent::UpdateImageState(PRBool aNotify)
|
||||
|
||||
PRInt32 oldState = ImageState();
|
||||
|
||||
mBroken = mUserDisabled = mSuppressed = PR_FALSE;
|
||||
mLoading = mBroken = mUserDisabled = mSuppressed = PR_FALSE;
|
||||
|
||||
// If we were blocked by server-based content policy, we claim to be
|
||||
// suppressed. If we were blocked by type-based content policy, we claim to
|
||||
@@ -579,6 +585,8 @@ nsImageLoadingContent::UpdateImageState(PRBool aNotify)
|
||||
nsresult rv = mCurrentRequest->GetImageStatus(¤tLoadStatus);
|
||||
if (NS_FAILED(rv) || (currentLoadStatus & imgIRequest::STATUS_ERROR)) {
|
||||
mBroken = PR_TRUE;
|
||||
} else if (!(currentLoadStatus & imgIRequest::STATUS_SIZE_AVAILABLE)) {
|
||||
mLoading = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user