зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1326738 - Check for user-disabled images as well as broken images to determine if the broken icon should be displayed. r=tnikkel
MozReview-Commit-ID: CseLBP8aI75 --HG-- extra : rebase_source : 0f34cc82b1089bf339417e0b7de77d2865c3cc8b
This commit is contained in:
Родитель
4309500934
Коммит
01c2dc7a45
|
@ -800,7 +800,7 @@ nsImageFrame::EnsureIntrinsicSizeAndRatio()
|
|||
// image request is null or image size not known, probably an
|
||||
// invalid image specified
|
||||
if (!(GetStateBits() & NS_FRAME_GENERATED_CONTENT)) {
|
||||
bool imageBroken = false;
|
||||
bool imageInvalid = false;
|
||||
// check for broken images. valid null images (eg. img src="") are
|
||||
// not considered broken because they have no image requests
|
||||
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
|
||||
|
@ -808,14 +808,21 @@ nsImageFrame::EnsureIntrinsicSizeAndRatio()
|
|||
nsCOMPtr<imgIRequest> currentRequest;
|
||||
imageLoader->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,
|
||||
getter_AddRefs(currentRequest));
|
||||
uint32_t imageStatus;
|
||||
imageBroken =
|
||||
currentRequest &&
|
||||
NS_SUCCEEDED(currentRequest->GetImageStatus(&imageStatus)) &&
|
||||
(imageStatus & imgIRequest::STATUS_ERROR);
|
||||
if (currentRequest) {
|
||||
uint32_t imageStatus;
|
||||
imageInvalid =
|
||||
NS_SUCCEEDED(currentRequest->GetImageStatus(&imageStatus)) &&
|
||||
(imageStatus & imgIRequest::STATUS_ERROR);
|
||||
} else {
|
||||
// check if images are user-disabled (or blocked for other
|
||||
// reasons)
|
||||
int16_t imageBlockingStatus;
|
||||
imageLoader->GetImageBlockingStatus(&imageBlockingStatus);
|
||||
imageInvalid = imageBlockingStatus != nsIContentPolicy::ACCEPT;
|
||||
}
|
||||
}
|
||||
// invalid image specified. make the image big enough for the "broken" icon
|
||||
if (imageBroken) {
|
||||
if (imageInvalid) {
|
||||
nscoord edgeLengthToUse =
|
||||
nsPresContext::CSSPixelsToAppUnits(
|
||||
ICON_SIZE + (2 * (ICON_PADDING + ALT_BORDER_WIDTH)));
|
||||
|
|
Загрузка…
Ссылка в новой задаче