зеркало из https://github.com/mozilla/pjs.git
Try fixing bug 288064 again. r=biesi, sr=dbaron
This commit is contained in:
Родитель
d9bdd6a763
Коммит
85691c8301
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -250,6 +250,7 @@ private:
|
|||
* The state we had the last time we checked whether we needed to notify the
|
||||
* document of a state change. These are maintained by UpdateImageState.
|
||||
*/
|
||||
PRPackedBool mLoading : 1;
|
||||
PRPackedBool mBroken : 1;
|
||||
PRPackedBool mUserDisabled : 1;
|
||||
PRPackedBool mSuppressed : 1;
|
||||
|
|
|
@ -522,7 +522,7 @@ nsObjectLoadingContent::ObjectState() const
|
|||
{
|
||||
switch (mType) {
|
||||
case eType_Loading:
|
||||
return 0;
|
||||
return NS_EVENT_STATE_LOADING;
|
||||
case eType_Image:
|
||||
return ImageState();
|
||||
case eType_Plugin:
|
||||
|
|
|
@ -177,5 +177,8 @@ public:
|
|||
#define NS_EVENT_STATE_USERDISABLED 0x00010000
|
||||
// Content suppressed by the user (ad blocking, etc)
|
||||
#define NS_EVENT_STATE_SUPPRESSED 0x00020000
|
||||
// Content is still loading such that there is nothing to show the
|
||||
// user (eg an image which hasn't started coming in yet)
|
||||
#define NS_EVENT_STATE_LOADING 0x00040000
|
||||
|
||||
#endif // nsIEventStateManager_h__
|
||||
|
|
|
@ -10572,7 +10572,7 @@ nsCSSFrameConstructor::DoContentStateChanged(nsIContent* aContent,
|
|||
nsIFrame* primaryFrame = mPresShell->GetPrimaryFrameFor(aContent);
|
||||
if (primaryFrame) {
|
||||
if (aStateMask & (NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_USERDISABLED |
|
||||
NS_EVENT_STATE_SUPPRESSED)) {
|
||||
NS_EVENT_STATE_SUPPRESSED | NS_EVENT_STATE_LOADING)) {
|
||||
hint = nsChangeHint_ReconstructFrame;
|
||||
} else {
|
||||
PRUint8 app = primaryFrame->GetStyleDisplay()->mAppearance;
|
||||
|
|
|
@ -438,14 +438,15 @@ nsImageFrame::SourceRectToDest(const nsRect& aRect)
|
|||
}
|
||||
|
||||
static PRBool
|
||||
ImageOK(nsIContent* aContent)
|
||||
ImageOK(PRInt32 aContentState)
|
||||
{
|
||||
// Note that we treat NS_EVENT_STATE_SUPPRESSED images as "OK". This means
|
||||
// that we'll construct image frames for them as needed if their display is
|
||||
// toggled from "none" (though we won't paint them, unless their visibility
|
||||
// is changed too).
|
||||
return !(aContent->IntrinsicState() &
|
||||
(NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_USERDISABLED));
|
||||
return !(aContentState &
|
||||
(NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_USERDISABLED |
|
||||
NS_EVENT_STATE_LOADING));
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -453,10 +454,16 @@ PRBool
|
|||
nsImageFrame::ShouldCreateImageFrameFor(nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext)
|
||||
{
|
||||
if (ImageOK(aContent)) {
|
||||
PRInt32 state = aContent->IntrinsicState();
|
||||
if (ImageOK(state)) {
|
||||
// Image is fine; do the image frame thing
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
if ((state & NS_EVENT_STATE_LOADING) &&
|
||||
HaveFixedSize(aStyleContext->GetStylePosition())) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// Check if we want to use a placeholder box with an icon or just
|
||||
// let the the presShell make us into inline text. Decide as follows:
|
||||
|
@ -1273,7 +1280,7 @@ nsImageFrame::Paint(nsPresContext* aPresContext,
|
|||
getter_AddRefs(currentRequest));
|
||||
}
|
||||
|
||||
PRBool imageOK = ImageOK(mContent);
|
||||
PRBool imageOK = ImageOK(mContent->IntrinsicState());
|
||||
|
||||
nsCOMPtr<imgIContainer> imgCon;
|
||||
if (currentRequest) {
|
||||
|
|
|
@ -394,6 +394,7 @@ hr[size="1"] {
|
|||
|
||||
img:-moz-broken::before, input:-moz-broken::before,
|
||||
img:-moz-user-disabled::before, input:-moz-user-disabled::before,
|
||||
img:-moz-loading::before, input:-moz-loading::before,
|
||||
/* Nonempty applets should just show their kids.
|
||||
XXXbz do we need a selector that will ignore <param> elements? */
|
||||
applet:empty:-moz-broken::before,
|
||||
|
|
|
@ -81,6 +81,7 @@ CSS_PSEUDO_CLASS(onlyChild, ":only-child")
|
|||
CSS_PSEUDO_CLASS(mozBroken, ":-moz-broken")
|
||||
CSS_PSEUDO_CLASS(mozUserDisabled, ":-moz-user-disabled")
|
||||
CSS_PSEUDO_CLASS(mozSuppressed, ":-moz-suppressed")
|
||||
CSS_PSEUDO_CLASS(mozLoading, ":-moz-loading")
|
||||
|
||||
// CSS 3 UI
|
||||
// http://www.w3.org/TR/2004/CR-css3-ui-20040511/#pseudo-classes
|
||||
|
|
|
@ -3109,6 +3109,9 @@ static PRBool SelectorMatches(RuleProcessorData &data,
|
|||
else if (nsCSSPseudoClasses::mozSuppressed == pseudoClass->mAtom) {
|
||||
result = STATE_CHECK(NS_EVENT_STATE_SUPPRESSED);
|
||||
}
|
||||
else if (nsCSSPseudoClasses::mozLoading == pseudoClass->mAtom) {
|
||||
result = STATE_CHECK(NS_EVENT_STATE_LOADING);
|
||||
}
|
||||
else if (nsCSSPseudoClasses::required == pseudoClass->mAtom) {
|
||||
result = STATE_CHECK(NS_EVENT_STATE_REQUIRED);
|
||||
}
|
||||
|
@ -3648,6 +3651,7 @@ PRBool IsStateSelector(nsCSSSelector& aSelector)
|
|||
(pseudoClass->mAtom == nsCSSPseudoClasses::mozBroken) ||
|
||||
(pseudoClass->mAtom == nsCSSPseudoClasses::mozUserDisabled) ||
|
||||
(pseudoClass->mAtom == nsCSSPseudoClasses::mozSuppressed) ||
|
||||
(pseudoClass->mAtom == nsCSSPseudoClasses::mozLoading) ||
|
||||
(pseudoClass->mAtom == nsCSSPseudoClasses::required) ||
|
||||
(pseudoClass->mAtom == nsCSSPseudoClasses::optional) ||
|
||||
(pseudoClass->mAtom == nsCSSPseudoClasses::valid) ||
|
||||
|
|
Загрузка…
Ссылка в новой задаче