Bug 841547 - Only set the 'decoded' class on top-level image documents. r=jaws, r=Ms2ger

This commit is contained in:
Michael Harrison 2013-06-24 11:29:23 -04:00
parent a07141c566
commit ccfd1c8cb1

View File

@ -444,7 +444,7 @@ ImageDocument::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aDa
nsDOMTokenList* classList = mImageContent->AsElement()->GetClassList();
mozilla::ErrorResult rv;
if (aType == imgINotificationObserver::DECODE_COMPLETE) {
if (mImageContent) {
if (mImageContent && !nsContentUtils::IsChildOfSameType(this)) {
// Update the background-color of the image only after the
// image has been decoded to prevent flashes of just the
// background-color.
@ -455,7 +455,7 @@ ImageDocument::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aDa
if (aType == imgINotificationObserver::DISCARD) {
// mImageContent can be null if the document is already destroyed
if (mImageContent) {
if (mImageContent && !nsContentUtils::IsChildOfSameType(this)) {
// Remove any decoded-related styling when the image is unloaded.
classList->Remove(NS_LITERAL_STRING("decoded"), rv);
NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());