Chromium Code Reviews| Index: Source/core/rendering/RenderImage.cpp |
| diff --git a/Source/core/rendering/RenderImage.cpp b/Source/core/rendering/RenderImage.cpp |
| index cf34503bd8cb5beafd4c648bb0f094d09291c2bb..e17e66b0e4873c5fd4f6b0c05b4924562bfd6c7c 100644 |
| --- a/Source/core/rendering/RenderImage.cpp |
| +++ b/Source/core/rendering/RenderImage.cpp |
| @@ -90,11 +90,6 @@ void RenderImage::setImageResource(PassOwnPtr<RenderImageResource> imageResource |
| static const unsigned short paddingWidth = 4; |
| static const unsigned short paddingHeight = 4; |
| -// Alt text is restricted to this maximum size, in pixels. These are |
| -// signed integers because they are compared with other signed values. |
| -static const float maxAltTextWidth = 1024; |
| -static const int maxAltTextHeight = 256; |
| - |
| IntSize RenderImage::imageSizeForError(ImageResource* newImage) const |
| { |
| ASSERT_ARG(newImage, newImage); |
| @@ -131,7 +126,7 @@ bool RenderImage::setImageSizeForAltText(ImageResource* newImage /* = 0 */) |
| FontCachePurgePreventer fontCachePurgePreventer; |
| const Font& font = style()->font(); |
| - IntSize paddedTextSize(paddingWidth + std::min(ceilf(font.width(constructTextRun(this, font, m_altText, style()))), maxAltTextWidth), paddingHeight + std::min(font.fontMetrics().height(), maxAltTextHeight)); |
| + IntSize paddedTextSize(paddingWidth + ceilf(font.width(constructTextRun(this, font, m_altText, style()))), paddingHeight + font.fontMetrics().height()); |
| imageSize = imageSize.expandedTo(paddedTextSize); |
| } |
| @@ -294,7 +289,6 @@ void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOf |
| context->setFillColor(Color::transparent); |
| context->drawRect(pixelSnappedIntRect(LayoutRect(paintOffset.x() + leftBorder + leftPad, paintOffset.y() + topBorder + topPad, cWidth, cHeight))); |
| - bool errorPictureDrawn = false; |
| LayoutSize imageOffset; |
| // When calculating the usable dimensions, exclude the pixels of |
| // the ouline rect so the error image/alt text doesn't draw on it. |
| @@ -303,7 +297,7 @@ void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOf |
| RefPtr<Image> image = m_imageResource->image(); |
| - if (m_imageResource->errorOccurred() && !image->isNull() && usableWidth >= image->width() && usableHeight >= image->height()) { |
| + if (m_imageResource->errorOccurred() && !image->isNull() && usableWidth >= image->width() && usableHeight >= image->height() && m_altText.isEmpty()) { |
| float deviceScaleFactor = blink::deviceScaleFactor(frame()); |
| // Call brokenImage() explicitly to ensure we get the broken image icon at the appropriate resolution. |
| pair<Image*, float> brokenImageAndImageScaleFactor = ImageResource::brokenImage(deviceScaleFactor); |
| @@ -319,7 +313,6 @@ void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOf |
| centerY = 0; |
| imageOffset = LayoutSize(leftBorder + leftPad + centerX + borderWidth, topBorder + topPad + centerY + borderWidth); |
| context->drawImage(image.get(), pixelSnappedIntRect(LayoutRect(paintOffset + imageOffset, imageSize)), CompositeSourceOver, shouldRespectImageOrientation()); |
| - errorPictureDrawn = true; |
| } |
| if (!m_altText.isEmpty()) { |
| @@ -341,12 +334,7 @@ void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOf |
| int availableWidth = cWidth - static_cast<int>(paddingWidth); |
| textOrigin.move(availableWidth - ceilf(textWidth), 0); |
| } |
| - if (errorPictureDrawn) { |
| - if (usableWidth >= textWidth && fontMetrics.height() <= imageOffset.height()) |
| - context->drawBidiText(font, textRunPaintInfo, textOrigin); |
| - } else if (usableWidth >= textWidth && usableHeight >= fontMetrics.height()) { |
| - context->drawBidiText(font, textRunPaintInfo, textOrigin); |
| - } |
| + context->drawBidiText(font, textRunPaintInfo, textOrigin); |
|
esprehn
2014/08/01 13:45:25
This won't wrap the text, so I think you're just g
|
| } |
| } |
| } else if (m_imageResource->hasImage() && cWidth > 0 && cHeight > 0) { |