Bug 640272 - Check load status for border images before trying to render them. r=bzbarsky

This commit is contained in:
Mats Palmgren 2011-04-04 13:41:02 +02:00
parent e910197c98
commit fd82cd9682
6 changed files with 36 additions and 12 deletions

View File

View File

@ -0,0 +1,14 @@
<!DOCTYPE HTML>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Testcase for bug 640272</title>
<style>
#waBackButton {
border: 1px solid blue;
}
</style>
</head>
<body>
<a href="index.html" id="waBackButton">Indietro</a>
</body>
</html>

View File

@ -0,0 +1,15 @@
<!DOCTYPE HTML>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Testcase for bug 640272</title>
<style>
#waBackButton {
border: 1px solid blue;
-moz-border-image: url(640272-empty.html) 0 10 0 15;
}
</style>
</head>
<body>
<a href="index.html" id="waBackButton">Indietro</a>
</body>
</html>

View File

@ -326,3 +326,4 @@ load 616495-single-side-composite-color-border.html
load 629035-1.html
load 629908-1.html
load 635329.html
== 640272.html 640272-ref.html

View File

@ -2739,6 +2739,9 @@ DrawBorderImage(nsPresContext* aPresContext,
const nsStyleBorder& aStyleBorder,
const nsRect& aDirtyRect)
{
NS_PRECONDITION(aStyleBorder.IsBorderImageLoaded(),
"drawing border image that isn't successfully loaded");
if (aDirtyRect.IsEmpty())
return;
@ -2752,23 +2755,13 @@ DrawBorderImage(nsPresContext* aPresContext,
imgIRequest *req = aStyleBorder.GetBorderImage();
#ifdef DEBUG
{
PRUint32 status = imgIRequest::STATUS_ERROR;
if (req)
req->GetImageStatus(&status);
NS_ASSERTION(req && (status & imgIRequest::STATUS_LOAD_COMPLETE),
"no image to draw");
}
#endif
// Get the actual image, and determine where the split points are.
// Note that mBorderImageSplit is in image pixels, not necessarily
// CSS pixels.
nsCOMPtr<imgIContainer> imgContainer;
req->GetImage(getter_AddRefs(imgContainer));
NS_ASSERTION(imgContainer, "no image to draw");
nsIntSize imageSize;
if (NS_FAILED(imgContainer->GetWidth(&imageSize.width))) {

View File

@ -68,7 +68,8 @@ inline PRBool nsStyleBorder::IsBorderImageLoaded() const
PRUint32 status;
return mBorderImage &&
NS_SUCCEEDED(mBorderImage->GetImageStatus(&status)) &&
(status & imgIRequest::STATUS_LOAD_COMPLETE);
(status & imgIRequest::STATUS_LOAD_COMPLETE) &&
!(status & imgIRequest::STATUS_ERROR);
}
inline void