mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 07:40:42 +00:00
Bug 640272 - Check load status for border images before trying to render them. r=bzbarsky
This commit is contained in:
parent
e910197c98
commit
fd82cd9682
0
layout/base/crashtests/640272-empty.html
Normal file
0
layout/base/crashtests/640272-empty.html
Normal file
14
layout/base/crashtests/640272-ref.html
Normal file
14
layout/base/crashtests/640272-ref.html
Normal 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>
|
15
layout/base/crashtests/640272.html
Normal file
15
layout/base/crashtests/640272.html
Normal 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>
|
@ -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
|
||||
|
@ -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))) {
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user