2007-10-14  Peter Kasting  <zerodpx@gmail.com>

        Reviewed by Maciej.

        http://bugs.webkit.org/show_bug.cgi?id=15210
        Draw the image outline even for broken images.

        * rendering/RenderImage.cpp:
        (WebCore::RenderImage::paint):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@26591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp
index 2fa7035..30b1cc8 100644
--- a/WebCore/rendering/RenderImage.cpp
+++ b/WebCore/rendering/RenderImage.cpp
@@ -223,18 +223,19 @@
             return;
 
         if (cWidth > 2 && cHeight > 2) {
-            if (!errorOccurred()) {
-                context->setStrokeStyle(SolidStroke);
-                context->setStrokeColor(Color::lightGray);
-                context->setFillColor(Color::transparent);
-                context->drawRect(IntRect(tx + leftBorder + leftPad, ty + topBorder + topPad, cWidth, cHeight));
-            }
+            // Draw an outline rect where the image should be.
+            context->setStrokeStyle(SolidStroke);
+            context->setStrokeColor(Color::lightGray);
+            context->setFillColor(Color::transparent);
+            context->drawRect(IntRect(tx + leftBorder + leftPad, ty + topBorder + topPad, cWidth, cHeight));
 
             bool errorPictureDrawn = false;
             int imageX = 0;
             int imageY = 0;
-            int usableWidth = cWidth;
-            int usableHeight = cHeight;
+            // When calculating the usable dimensions, exclude the pixels of
+            // the ouline rect so the error image/alt text doesn't draw on it.
+            int usableWidth = cWidth - 2;
+            int usableHeight = cHeight - 2;
 
             if (errorOccurred() && !image()->isNull() && (usableWidth >= image()->width()) && (usableHeight >= image()->height())) {
                 // Center the error image, accounting for border and padding.